Skip to content

The open alternative to Salesforce, designed for AI.

Desktop Recorder: align merged integration and UI naming conventions (#25977)

Thomas des Francs8bc36528d5ac
diff --git a/packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts b/packages/twenty-apps/public/companion/src/__tests__/applicationConfig.test.ts
similarity index 58%
rename from packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts
rename to packages/twenty-apps/public/companion/src/__tests__/applicationConfig.test.ts
index fdc1c6235c9..c87b6c91ba5 100644
--- a/packages/twenty-apps/public/companion/src/__tests__/application-config.test.ts
+++ b/packages/twenty-apps/public/companion/src/__tests__/applicationConfig.test.ts
@@ -1,8 +1,6 @@
-import {
- APP_DESCRIPTION,
- APP_DISPLAY_NAME,
- APPLICATION_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
+import { APP_DESCRIPTION } from 'src/constants/APP_DESCRIPTION';
+import { APP_DISPLAY_NAME } from 'src/constants/APP_DISPLAY_NAME';
+import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/APPLICATION_UNIVERSAL_IDENTIFIER';
import { describe, expect, it } from 'vitest';
describe('application identifiers', () => {
diff --git a/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts b/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts
index fe1351b70f4..f8d4795eac4 100644
--- a/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts
+++ b/packages/twenty-apps/public/companion/src/__tests__/schema.integration-test.ts
@@ -1,6 +1,6 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
import { MetadataApiClient } from 'twenty-client-sdk/metadata';
-import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/APPLICATION_UNIVERSAL_IDENTIFIER';
import { describe, expect, it } from 'vitest';
describe('App installation', () => {
diff --git a/packages/twenty-apps/public/companion/src/__tests__/global-setup.ts b/packages/twenty-apps/public/companion/src/__tests__/setup.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/__tests__/global-setup.ts
rename to packages/twenty-apps/public/companion/src/__tests__/setup.ts
index 81057cf5a87..cb2c28eba7a 100644
--- a/packages/twenty-apps/public/companion/src/__tests__/global-setup.ts
+++ b/packages/twenty-apps/public/companion/src/__tests__/setup.ts
@@ -52,11 +52,3 @@ export const setup = async () => {
);
}
};
-
-export const teardown = async () => {
- try {
- await appUninstall({ appPath: APP_PATH });
- } finally {
- fs.rmSync(CONFIG_PATH, { force: true });
- }
-};
diff --git a/packages/twenty-apps/public/companion/src/__tests__/teardown.ts b/packages/twenty-apps/public/companion/src/__tests__/teardown.ts
new file mode 100644
index 00000000000..44457a6c170
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/__tests__/teardown.ts
@@ -0,0 +1,17 @@
+import * as fs from 'fs';
+import * as os from 'os';
+import * as path from 'path';
+
+import { appUninstall } from 'twenty-sdk/cli';
+
+const APP_PATH = process.cwd();
+const CONFIG_DIR = path.join(os.homedir(), '.twenty');
+const CONFIG_PATH = path.join(CONFIG_DIR, 'config.test.json');
+
+export const teardown = async () => {
+ try {
+ await appUninstall({ appPath: APP_PATH });
+ } finally {
+ fs.rmSync(CONFIG_PATH, { force: true });
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts b/packages/twenty-apps/public/companion/src/agents/callRecordingSummarizer.agent.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts
rename to packages/twenty-apps/public/companion/src/agents/callRecordingSummarizer.agent.ts
index 51f7b6ad651..f6a7076e510 100644
--- a/packages/twenty-apps/public/companion/src/agents/call-recording-summarizer.agent.ts
+++ b/packages/twenty-apps/public/companion/src/agents/callRecordingSummarizer.agent.ts
@@ -1,7 +1,6 @@
import { defineAgent } from 'twenty-sdk/define';
-
-import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { DEFAULT_CALL_RECORDING_SUMMARY_PROMPT } from 'src/constants/default-call-recording-summary-prompt';
+import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER';
+import { DEFAULT_CALL_RECORDING_SUMMARY_PROMPT } from 'src/constants/DEFAULT_CALL_RECORDING_SUMMARY_PROMPT';
export default defineAgent({
universalIdentifier: CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-apps/public/companion/src/application-config.ts b/packages/twenty-apps/public/companion/src/application-config.ts
index e1cbf229c08..d709fd45ac8 100644
--- a/packages/twenty-apps/public/companion/src/application-config.ts
+++ b/packages/twenty-apps/public/companion/src/application-config.ts
@@ -1,13 +1,10 @@
import { defineApplication, FieldType } from 'twenty-sdk/define';
-
-import {
- APP_DESCRIPTION,
- APP_DISPLAY_NAME,
- APPLICATION_UNIVERSAL_IDENTIFIER,
- COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
- COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
- COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
+import { APP_DESCRIPTION } from 'src/constants/APP_DESCRIPTION';
+import { APP_DISPLAY_NAME } from 'src/constants/APP_DISPLAY_NAME';
+import { APPLICATION_UNIVERSAL_IDENTIFIER } from 'src/constants/APPLICATION_UNIVERSAL_IDENTIFIER';
+import { COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER } from 'src/constants/COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER';
+import { COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER } from 'src/constants/COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER';
+import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER } from 'src/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER';
export default defineApplication({
universalIdentifier: APPLICATION_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-apps/public/companion/src/front-components/components/DesktopSettings.tsx b/packages/twenty-apps/public/companion/src/components/DesktopSettings.tsx
similarity index 100%
rename from packages/twenty-apps/public/companion/src/front-components/components/DesktopSettings.tsx
rename to packages/twenty-apps/public/companion/src/components/DesktopSettings.tsx
diff --git a/packages/twenty-apps/public/companion/src/constants/APPLICATION_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/APPLICATION_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..5d961f4e9e6
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/APPLICATION_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const APPLICATION_UNIVERSAL_IDENTIFIER =
+ '8bdaaa9f-dc53-4247-a89b-aa386c9b3244';
diff --git a/packages/twenty-apps/public/companion/src/constants/APP_DESCRIPTION.ts b/packages/twenty-apps/public/companion/src/constants/APP_DESCRIPTION.ts
new file mode 100644
index 00000000000..765d1290b7d
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/APP_DESCRIPTION.ts
@@ -0,0 +1,2 @@
+export const APP_DESCRIPTION =
+ 'Record meetings from the Twenty desktop app, with transcripts and summaries. No meeting bot.';
diff --git a/packages/twenty-apps/public/companion/src/constants/app-display-name.ts b/packages/twenty-apps/public/companion/src/constants/APP_DISPLAY_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/constants/app-display-name.ts
rename to packages/twenty-apps/public/companion/src/constants/APP_DISPLAY_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..6d17dc45d95
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER =
+ '2eafc2d0-8fec-430c-a939-65ca5fbc0f08';
diff --git a/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..af578b3db34
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER =
+ 'ebc46dc0-bbb4-45c3-b820-59e56ac899e7';
diff --git a/packages/twenty-apps/public/companion/src/constants/call-recording-summary-unavailable-prefix.ts b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/constants/call-recording-summary-unavailable-prefix.ts
rename to packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX.ts
diff --git a/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..ff4ebcf5fa3
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER =
+ 'bb9523d3-457e-4f4b-8c79-27a77afb87da';
diff --git a/packages/twenty-apps/public/companion/src/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..a97c8babd4e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ '61051403-6bd8-442f-ada0-d1c573e27eac';
diff --git a/packages/twenty-apps/public/companion/src/constants/COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..ee308b751db
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ 'ba3e76cf-2220-47d8-8b10-1c697ffaae1a';
diff --git a/packages/twenty-apps/public/companion/src/constants/COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..906e7f8d365
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
+ '51741213-33bb-44ae-9d96-3614f452affa';
diff --git a/packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts b/packages/twenty-apps/public/companion/src/constants/DEFAULT_CALL_RECORDING_SUMMARY_PROMPT.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts
rename to packages/twenty-apps/public/companion/src/constants/DEFAULT_CALL_RECORDING_SUMMARY_PROMPT.ts
index 90c7760f638..fab83f00710 100644
--- a/packages/twenty-apps/public/companion/src/constants/default-call-recording-summary-prompt.ts
+++ b/packages/twenty-apps/public/companion/src/constants/DEFAULT_CALL_RECORDING_SUMMARY_PROMPT.ts
@@ -1,4 +1,4 @@
-import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/call-recording-summary-unavailable-prefix';
+import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX';
export const DEFAULT_CALL_RECORDING_SUMMARY_PROMPT = [
'You are an AI meeting note-taker for a CRM. You receive the diarized,',
diff --git a/packages/twenty-apps/public/companion/src/constants/DEFAULT_ROLE_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/DEFAULT_ROLE_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..81f82fe5ec9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/DEFAULT_ROLE_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
+ 'd6e7b7da-f386-45aa-b0b5-57aeeb274860';
diff --git a/packages/twenty-apps/public/companion/src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..9ee521ad96b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ '51fd47c8-6a11-444a-84e5-37339aaabb20';
diff --git a/packages/twenty-apps/public/companion/src/constants/PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..9f657b9deb9
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ 'b7e80bff-0cf2-45a3-b50c-3c6575cba95d';
diff --git a/packages/twenty-apps/public/companion/src/constants/RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..b7db2800cfa
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ '2f955a7f-9d03-44c6-bb12-fbc8f6e33b07';
diff --git a/packages/twenty-apps/public/companion/src/constants/SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts b/packages/twenty-apps/public/companion/src/constants/SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
new file mode 100644
index 00000000000..8bc207d1d72
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/constants/SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER.ts
@@ -0,0 +1,2 @@
+export const SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
+ 'cc895d00-ae04-4fdb-b9a5-2b62bb607de5';
diff --git a/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts b/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts
deleted file mode 100644
index dcee522a3f0..00000000000
--- a/packages/twenty-apps/public/companion/src/constants/universal-identifiers.ts
+++ /dev/null
@@ -1,27 +0,0 @@
-export const APP_DISPLAY_NAME = 'Desktop Recorder';
-export const APP_DESCRIPTION =
- 'Record meetings from the Twenty desktop app, with transcripts and summaries. No meeting bot.';
-export const APPLICATION_UNIVERSAL_IDENTIFIER =
- '8bdaaa9f-dc53-4247-a89b-aa386c9b3244';
-export const DEFAULT_ROLE_UNIVERSAL_IDENTIFIER =
- 'd6e7b7da-f386-45aa-b0b5-57aeeb274860';
-export const RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
- '2f955a7f-9d03-44c6-bb12-fbc8f6e33b07';
-export const PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
- 'b7e80bff-0cf2-45a3-b50c-3c6575cba95d';
-export const IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
- '51fd47c8-6a11-444a-84e5-37339aaabb20';
-export const SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER =
- 'cc895d00-ae04-4fdb-b9a5-2b62bb607de5';
-export const CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER =
- 'ebc46dc0-bbb4-45c3-b820-59e56ac899e7';
-export const COMPANION_ADDITIONAL_SUMMARY_PROMPT_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
- '61051403-6bd8-442f-ada0-d1c573e27eac';
-export const COMPANION_SUMMARY_ENABLED_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
- 'ba3e76cf-2220-47d8-8b10-1c697ffaae1a';
-export const COMPANION_TRANSCRIPT_PROVIDER_APP_VARIABLE_UNIVERSAL_IDENTIFIER =
- '51741213-33bb-44ae-9d96-3614f452affa';
-export const CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER =
- '2eafc2d0-8fec-430c-a939-65ca5fbc0f08';
-export const CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER =
- 'bb9523d3-457e-4f4b-8c79-27a77afb87da';
diff --git a/packages/twenty-apps/public/companion/src/default-role.ts b/packages/twenty-apps/public/companion/src/defaultRole.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/default-role.ts
rename to packages/twenty-apps/public/companion/src/defaultRole.ts
index bd47c9cbecf..b84d15eef16 100644
--- a/packages/twenty-apps/public/companion/src/default-role.ts
+++ b/packages/twenty-apps/public/companion/src/defaultRole.ts
@@ -3,9 +3,8 @@ import {
SystemPermissionFlag,
defineApplicationRole,
} from 'twenty-sdk/define';
-
-import { APP_DISPLAY_NAME } from 'src/constants/app-display-name';
-import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
+import { APP_DISPLAY_NAME } from 'src/constants/APP_DISPLAY_NAME';
+import { DEFAULT_ROLE_UNIVERSAL_IDENTIFIER } from 'src/constants/DEFAULT_ROLE_UNIVERSAL_IDENTIFIER';
export default defineApplicationRole({
universalIdentifier: DEFAULT_ROLE_UNIVERSAL_IDENTIFIER,
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-failure-reason.ts b/packages/twenty-apps/public/companion/src/fields/companionFailureReason.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/fields/companion-failure-reason.ts
rename to packages/twenty-apps/public/companion/src/fields/companionFailureReason.ts
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-import-claimed-at.ts b/packages/twenty-apps/public/companion/src/fields/companionImportClaimedAt.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/fields/companion-import-claimed-at.ts
rename to packages/twenty-apps/public/companion/src/fields/companionImportClaimedAt.ts
diff --git a/packages/twenty-apps/public/companion/src/fields/companion-session.ts b/packages/twenty-apps/public/companion/src/fields/companionSession.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/fields/companion-session.ts
rename to packages/twenty-apps/public/companion/src/fields/companionSession.ts
diff --git a/packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx b/packages/twenty-apps/public/companion/src/front-components/settings.frontComponent.tsx
similarity index 82%
rename from packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx
rename to packages/twenty-apps/public/companion/src/front-components/settings.frontComponent.tsx
index 91d7ede2c8b..32427e02f0d 100644
--- a/packages/twenty-apps/public/companion/src/front-components/settings.front-component.tsx
+++ b/packages/twenty-apps/public/companion/src/front-components/settings.frontComponent.tsx
@@ -1,5 +1,5 @@
import { defineSettingsFrontComponent } from 'twenty-sdk/define';
-import { DesktopSettings } from './components/DesktopSettings';
+import { DesktopSettings } from 'src/components/DesktopSettings';
export default defineSettingsFrontComponent({
universalIdentifier: 'c7f85fb5-a198-4e80-9ee1-53d80cc68761',
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/AUDIO_FILE_TOO_LARGE_FAILURE_REASON.ts
similarity index 50%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/AUDIO_FILE_TOO_LARGE_FAILURE_REASON.ts
index 7d59195a29a..adeb04230b9 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/constants/media-file-too-large-failure-reasons.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/AUDIO_FILE_TOO_LARGE_FAILURE_REASON.ts
@@ -1,2 +1 @@
-export const VIDEO_FILE_TOO_LARGE_FAILURE_REASON = 'video_file_too_large';
export const AUDIO_FILE_TOO_LARGE_FAILURE_REASON = 'audio_file_too_large';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-micro-credits-per-hour.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/CALL_RECORDING_MICRO_CREDITS_PER_HOUR.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-micro-credits-per-hour.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/CALL_RECORDING_MICRO_CREDITS_PER_HOUR.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-additional-summary-prompt-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/companion-additional-summary-prompt-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-max-media-file-size-bytes.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_MAX_MEDIA_FILE_SIZE_BYTES.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/companion-max-media-file-size-bytes.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_MAX_MEDIA_FILE_SIZE_BYTES.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-recording-retention-hours-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/companion-recording-retention-hours-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-summary-enabled-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/companion-summary-enabled-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/companion-transcript-provider-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/companion-transcript-provider-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-request-status.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/CallRecordingRequestStatus.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-request-status.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/CallRecordingRequestStatus.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-status.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/CallRecordingStatus.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/call-recording-status.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/CallRecordingStatus.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-recording-retention-hours.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_RECORDING_RETENTION_HOURS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-recording-retention-hours.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_RECORDING_RETENTION_HOURS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-summary-enabled.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_SUMMARY_ENABLED.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-summary-enabled.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_SUMMARY_ENABLED.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_TRANSCRIPT_PROVIDER.ts
similarity index 75%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_TRANSCRIPT_PROVIDER.ts
index 82e1c47e5b7..43bcc0ce595 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-companion-transcript-provider.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_COMPANION_TRANSCRIPT_PROVIDER.ts
@@ -1,4 +1,4 @@
-import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/recall-async-transcript-provider.type';
+import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/RecallAsyncTranscriptProvider';
export const DEFAULT_COMPANION_TRANSCRIPT_PROVIDER: RecallAsyncTranscriptProvider =
'recallai_async';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/default-recall-region.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_RECALL_REGION.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/default-recall-region.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/DEFAULT_RECALL_REGION.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/enqueued-job-retry-limit.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/ENQUEUED_JOB_RETRY_LIMIT.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/enqueued-job-retry-limit.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/ENQUEUED_JOB_RETRY_LIMIT.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/max-payloads-per-enqueue-jobs-call.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/max-payloads-per-enqueue-jobs-call.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/milliseconds-per-minute.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/MILLISECONDS_PER_MINUTE.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/milliseconds-per-minute.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/MILLISECONDS_PER_MINUTE.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/NON_TERMINAL_CALL_RECORDING_STATUSES.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/NON_TERMINAL_CALL_RECORDING_STATUSES.ts
index dd604c7e858..5c28b91e48c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/constants/non-terminal-call-recording-statuses.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/NON_TERMINAL_CALL_RECORDING_STATUSES.ts
@@ -1,4 +1,4 @@
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
export const NON_TERMINAL_CALL_RECORDING_STATUSES = [
CallRecordingStatus.SCHEDULED,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/not-recorded-recall-sub-codes.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/NOT_RECORDED_RECALL_SUB_CODES.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/not-recorded-recall-sub-codes.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/NOT_RECORDED_RECALL_SUB_CODES.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-adhoc-pool-retry-delay-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_ADHOC_POOL_RETRY_DELAY_MS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-adhoc-pool-retry-delay-ms.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_ADHOC_POOL_RETRY_DELAY_MS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-key-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_KEY_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-key-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_KEY_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-attempts.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_ATTEMPTS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-attempts.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_ATTEMPTS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-in-process-retry-wait-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-in-process-retry-wait-ms.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-retry-after-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_RETRY_AFTER_MS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-max-retry-after-ms.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_MAX_RETRY_AFTER_MS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-retry-delay-ms.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_RETRY_DELAY_MS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-api-retry-delay-ms.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_API_RETRY_DELAY_MS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-async-transcript-providers.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_ASYNC_TRANSCRIPT_PROVIDERS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-async-transcript-providers.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_ASYNC_TRANSCRIPT_PROVIDERS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-region-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_REGION_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-region-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_REGION_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-webhook-secret-env-var-name.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_WEBHOOK_SECRET_ENV_VAR_NAME.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-webhook-secret-env-var-name.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RECALL_WEBHOOK_SECRET_ENV_VAR_NAME.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/restricted-field-placeholder.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/RESTRICTED_FIELD_PLACEHOLDER.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/restricted-field-placeholder.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/RESTRICTED_FIELD_PLACEHOLDER.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/supported-meeting-platform-url-patterns.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/SUPPORTED_MEETING_PLATFORM_URL_PATTERNS.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/supported-meeting-platform-url-patterns.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/SUPPORTED_MEETING_PLATFORM_URL_PATTERNS.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/twenty-page-size.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/TWENTY_PAGE_SIZE.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/twenty-page-size.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/TWENTY_PAGE_SIZE.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/UNAVAILABLE_CALL_RECORDING_STATUSES.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/UNAVAILABLE_CALL_RECORDING_STATUSES.ts
index 1bee6e85211..10e6906386e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/constants/unavailable-call-recording-statuses.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/UNAVAILABLE_CALL_RECORDING_STATUSES.ts
@@ -1,4 +1,4 @@
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
export const UNAVAILABLE_CALL_RECORDING_STATUSES: readonly string[] = [
CallRecordingStatus.FAILED,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/VIDEO_FILE_TOO_LARGE_FAILURE_REASON.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/VIDEO_FILE_TOO_LARGE_FAILURE_REASON.ts
new file mode 100644
index 00000000000..958298c3b49
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/VIDEO_FILE_TOO_LARGE_FAILURE_REASON.ts
@@ -0,0 +1 @@
+export const VIDEO_FILE_TOO_LARGE_FAILURE_REASON = 'video_file_too_large';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts b/packages/twenty-apps/public/companion/src/logic-functions/constants/utils/getRecallBotRecordingConfig.ts
similarity index 80%
rename from packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/constants/utils/getRecallBotRecordingConfig.ts
index d6a12887694..e6cabd40be5 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/constants/recall-bot-recording-config.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/constants/utils/getRecallBotRecordingConfig.ts
@@ -1,7 +1,7 @@
-import { COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-recording-retention-hours-env-var-name';
-import { DEFAULT_COMPANION_RECORDING_RETENTION_HOURS } from 'src/logic-functions/constants/default-companion-recording-retention-hours';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_RECORDING_RETENTION_HOURS_ENV_VAR_NAME';
+import { DEFAULT_COMPANION_RECORDING_RETENTION_HOURS } from 'src/logic-functions/constants/DEFAULT_COMPANION_RECORDING_RETENTION_HOURS';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
type RecallBotRecordingConfig = {
video_mixed_mp4: Record<string, never>;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/claimCallRecordingArtifactsImport.test.ts
similarity index 93%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/claimCallRecordingArtifactsImport.test.ts
index 7615b8d2c80..951f7ad99c9 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/claim-call-recording-artifacts-import.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/claimCallRecordingArtifactsImport.test.ts
@@ -1,9 +1,7 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import {
- claimCallRecordingArtifactsImport,
- releaseCallRecordingArtifactsImportClaim,
-} from 'src/logic-functions/data/claim-call-recording-artifacts-import.util';
+import { claimCallRecordingArtifactsImport } from 'src/logic-functions/data/utils/claimCallRecordingArtifactsImport';
+import { releaseCallRecordingArtifactsImportClaim } from 'src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim';
const mutationMock = vi.fn();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/completeCallRecordingImport.test.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/completeCallRecordingImport.test.ts
index 11a5ab8a8d1..b714e630e37 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/complete-call-recording-import.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/completeCallRecordingImport.test.ts
@@ -1,14 +1,12 @@
import { describe, expect, it, vi } from 'vitest';
-import { completeCallRecordingImport } from 'src/logic-functions/data/complete-call-recording-import.util';
+import { completeCallRecordingImport } from 'src/logic-functions/data/utils/completeCallRecordingImport';
describe('completeCallRecordingImport', () => {
it('guards the flip with non-terminal statuses and returns true when the row is claimed', async () => {
- const mutation = vi
- .fn()
- .mockResolvedValue({
- updateCallRecordings: [{ id: 'call-recording-1' }],
- });
+ const mutation = vi.fn().mockResolvedValue({
+ updateCallRecordings: [{ id: 'call-recording-1' }],
+ });
const claimed = await completeCallRecordingImport(
{ mutation },
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueCallRecordingArtifactsImport.test.ts
similarity index 87%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueCallRecordingArtifactsImport.test.ts
index 89dbacd1fc6..4a30544f724 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-call-recording-artifacts-import.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueCallRecordingArtifactsImport.test.ts
@@ -1,8 +1,8 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
-import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/ENQUEUED_JOB_RETRY_LIMIT';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport';
const enqueueJobsMock = vi.hoisted(() => vi.fn());
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueLogicFunctionJobs.test.ts
similarity index 95%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueLogicFunctionJobs.test.ts
index bcc7451acd5..e437fff3a69 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/enqueue-logic-function-jobs.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/enqueueLogicFunctionJobs.test.ts
@@ -1,8 +1,8 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
-import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/max-payloads-per-enqueue-jobs-call';
-import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/enqueue-logic-function-jobs.util';
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/ENQUEUED_JOB_RETRY_LIMIT';
+import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL';
+import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/utils/enqueueLogicFunctionJobs';
const enqueueJobsMock = vi.hoisted(() => vi.fn());
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/findCallRecordingForSummary.test.ts
similarity index 94%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/findCallRecordingForSummary.test.ts
index a436386df95..c6ecb9e4b38 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/find-call-recording-for-summary.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/findCallRecordingForSummary.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest';
-import { findCallRecordingForSummary } from 'src/logic-functions/data/find-call-recording-for-summary.util';
+import { findCallRecordingForSummary } from 'src/logic-functions/data/utils/findCallRecordingForSummary';
describe('findCallRecordingForSummary', () => {
it('treats blank summary markdown as missing', async () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/getCurrentWorkspaceId.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/getCurrentWorkspaceId.test.ts
index b27e3a76579..263917197e2 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/get-current-workspace-id.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/getCurrentWorkspaceId.test.ts
@@ -1,6 +1,6 @@
import { afterEach, describe, expect, it } from 'vitest';
-import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/utils/getCurrentWorkspaceId';
const APP_ACCESS_TOKEN_ENV_VAR_NAME = 'TWENTY_APP_ACCESS_TOKEN';
const ORIGINAL_APP_ACCESS_TOKEN = process.env[APP_ACCESS_TOKEN_ENV_VAR_NAME];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/stripRestrictedFieldValue.test.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/stripRestrictedFieldValue.test.ts
index 27bc08f2f9a..90303de98ad 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/strip-restricted-field-value.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/__tests__/stripRestrictedFieldValue.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
-import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/restricted-field-placeholder';
-import { stripRestrictedFieldValue } from 'src/logic-functions/data/strip-restricted-field-value.util';
+import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/RESTRICTED_FIELD_PLACEHOLDER';
+import { stripRestrictedFieldValue } from 'src/logic-functions/data/utils/stripRestrictedFieldValue';
describe('stripRestrictedFieldValue', () => {
it('drops the calendar visibility restriction placeholder', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/claimCallRecordingArtifactsImport.ts
similarity index 71%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/claimCallRecordingArtifactsImport.ts
index dfb6240aa0b..11cefbf31ab 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/claim-call-recording-artifacts-import.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/claimCallRecordingArtifactsImport.ts
@@ -39,21 +39,3 @@ export const claimCallRecordingArtifactsImport = async (
return (result.updateCallRecordings ?? []).length > 0;
};
-
-export const releaseCallRecordingArtifactsImportClaim = async (
- client: Pick<CoreApiClient, 'mutation'>,
- { callRecordingId, claimedAt }: { callRecordingId: string; claimedAt: Date },
-): Promise<void> => {
- await client.mutation({
- updateCallRecordings: {
- __args: {
- filter: {
- id: { eq: callRecordingId },
- companionImportClaimedAt: { eq: claimedAt.toISOString() },
- },
- data: { companionImportClaimedAt: null },
- },
- id: true,
- },
- });
-};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/completeCallRecordingImport.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/completeCallRecordingImport.ts
index 00e584957ad..c665d1725e1 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/complete-call-recording-import.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/completeCallRecordingImport.ts
@@ -1,7 +1,6 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/non-terminal-call-recording-statuses';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/NON_TERMINAL_CALL_RECORDING_STATUSES';
export const completeCallRecordingImport = async (
client: Pick<CoreApiClient, 'mutation'>,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport.ts
similarity index 77%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport.ts
index 972fb284f35..bcf43885987 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-call-recording-artifacts-import.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport.ts
@@ -1,5 +1,5 @@
-import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/enqueue-logic-function-jobs.util';
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { enqueueLogicFunctionJobs } from 'src/logic-functions/data/utils/enqueueLogicFunctionJobs';
export const enqueueCallRecordingArtifactsImport = async ({
callRecordingId,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueLogicFunctionJobs.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueLogicFunctionJobs.ts
index a2ad6d98c70..c28aa413f43 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/enqueue-logic-function-jobs.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/enqueueLogicFunctionJobs.ts
@@ -1,8 +1,7 @@
import { enqueueJobs } from 'twenty-sdk/logic-function';
-
-import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/enqueued-job-retry-limit';
-import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/max-payloads-per-enqueue-jobs-call';
-import { getBatches } from 'src/logic-functions/utils/get-batches.util';
+import { ENQUEUED_JOB_RETRY_LIMIT } from 'src/logic-functions/constants/ENQUEUED_JOB_RETRY_LIMIT';
+import { MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL } from 'src/logic-functions/constants/MAX_PAYLOADS_PER_ENQUEUE_JOBS_CALL';
+import { getBatches } from 'src/logic-functions/utils/getBatches';
const MAX_ENQUEUE_PAYLOADS = 1_000;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchAllNodes.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchAllNodes.ts
index 26499daec9d..fbdb669e4fc 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-all-nodes.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchAllNodes.ts
@@ -1,15 +1,8 @@
import { isString, isUndefined } from '@sniptt/guards';
+import { type ConnectionPage } from 'src/logic-functions/types/ConnectionPage';
const MAX_PAGINATION_PAGES = 20;
-export type ConnectionPage<TNode> = {
- pageInfo?: {
- hasNextPage?: boolean | null;
- endCursor?: string | null;
- } | null;
- edges?: Array<{ node: TNode }> | null;
-};
-
export const fetchAllNodes = async <TNode>(
fetchPage: (
afterCursor: string | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchCalendarEventsByFilter.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchCalendarEventsByFilter.ts
index 47a13d00180..2edf994f8ea 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/fetch-calendar-events-by-filter.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/fetchCalendarEventsByFilter.ts
@@ -1,14 +1,11 @@
import { isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/twenty-page-size';
-import { type CalendarEventRecord } from 'src/logic-functions/types/calendar-event-record.type';
-import {
- fetchAllNodes,
- type ConnectionPage,
-} from 'src/logic-functions/data/fetch-all-nodes.util';
-import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/resolve-conference-link-url.util';
-import { stripRestrictedFieldValue } from 'src/logic-functions/data/strip-restricted-field-value.util';
+import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/TWENTY_PAGE_SIZE';
+import { type CalendarEventRecord } from 'src/logic-functions/types/CalendarEventRecord';
+import { fetchAllNodes } from 'src/logic-functions/data/utils/fetchAllNodes';
+import { type ConnectionPage } from 'src/logic-functions/types/ConnectionPage';
+import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/utils/resolveConferenceLinkUrl';
+import { stripRestrictedFieldValue } from 'src/logic-functions/data/utils/stripRestrictedFieldValue';
type CalendarEventNode = {
id: string;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingForSummary.ts
similarity index 95%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingForSummary.ts
index 56fb1d90b7b..fbd9ece151e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recording-for-summary.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingForSummary.ts
@@ -1,7 +1,6 @@
import { isNull, isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { getString } from 'src/logic-functions/utils/getString';
type CallRecordingForSummary = {
id: string;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingsByFilter.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingsByFilter.ts
index b5850af57f3..5b5c57d6843 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/find-call-recordings-by-filter.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/findCallRecordingsByFilter.ts
@@ -1,15 +1,12 @@
import { isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
-import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/twenty-page-size';
-import { type CallRecordingRecord } from 'src/logic-functions/types/call-recording-record.type';
-import {
- fetchAllNodes,
- type ConnectionPage,
-} from 'src/logic-functions/data/fetch-all-nodes.util';
-import { normalizeOptionalString } from 'src/logic-functions/utils/normalize-optional-string.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
+import { CallRecordingRequestStatus } from 'src/logic-functions/constants/CallRecordingRequestStatus';
+import { TWENTY_PAGE_SIZE } from 'src/logic-functions/constants/TWENTY_PAGE_SIZE';
+import { type CallRecordingRecord } from 'src/logic-functions/types/CallRecordingRecord';
+import { fetchAllNodes } from 'src/logic-functions/data/utils/fetchAllNodes';
+import { type ConnectionPage } from 'src/logic-functions/types/ConnectionPage';
+import { normalizeOptionalString } from 'src/logic-functions/utils/normalizeOptionalString';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
type CallRecordingNode = {
id: string;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/getCurrentWorkspaceId.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/getCurrentWorkspaceId.ts
index 4f0c8922006..d94d13fe15f 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/get-current-workspace-id.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/getCurrentWorkspaceId.ts
@@ -1,7 +1,6 @@
import { isUndefined } from '@sniptt/guards';
-
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getString } from 'src/logic-functions/utils/getString';
const APP_ACCESS_TOKEN_ENV_VAR_NAME = 'TWENTY_APP_ACCESS_TOKEN';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim.ts
new file mode 100644
index 00000000000..67edb968ca2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim.ts
@@ -0,0 +1,19 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+
+export const releaseCallRecordingArtifactsImportClaim = async (
+ client: Pick<CoreApiClient, 'mutation'>,
+ { callRecordingId, claimedAt }: { callRecordingId: string; claimedAt: Date },
+): Promise<void> => {
+ await client.mutation({
+ updateCallRecordings: {
+ __args: {
+ filter: {
+ id: { eq: callRecordingId },
+ companionImportClaimedAt: { eq: claimedAt.toISOString() },
+ },
+ data: { companionImportClaimedAt: null },
+ },
+ id: true,
+ },
+ });
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/stripRestrictedFieldValue.ts
similarity index 83%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/stripRestrictedFieldValue.ts
index 06b4a79a479..2637ea0f443 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/strip-restricted-field-value.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/stripRestrictedFieldValue.ts
@@ -1,4 +1,4 @@
-import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/restricted-field-placeholder';
+import { RESTRICTED_FIELD_PLACEHOLDER } from 'src/logic-functions/constants/RESTRICTED_FIELD_PLACEHOLDER';
export const stripRestrictedFieldValue = (
value: string | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/updateCallRecording.ts
similarity index 95%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/data/utils/updateCallRecording.ts
index 72f823e31cc..19d5383a48c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/update-call-recording.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/data/utils/updateCallRecording.ts
@@ -1,8 +1,7 @@
import { isUndefined } from '@sniptt/guards';
-import { type CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { type CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
export const updateCallRecording = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/desktopCompanion.ts b/packages/twenty-apps/public/companion/src/logic-functions/desktopCompanion.ts
new file mode 100644
index 00000000000..cb95a3d64b2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/desktopCompanion.ts
@@ -0,0 +1,16 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { desktopCompanionHandler } from 'src/logic-functions/utils/desktopCompanionHandler';
+
+export default defineLogicFunction({
+ universalIdentifier: '4ca4fc91-70f8-4bee-84f2-558053b1224a',
+ name: 'desktop-companion',
+ description:
+ 'Authenticated personal agenda and Recall desktop upload provisioning for Desktop Recorder.',
+ timeoutSeconds: 60,
+ handler: desktopCompanionHandler,
+ httpRouteTriggerSettings: {
+ path: '/companion/desktop',
+ httpMethod: 'POST',
+ isAuthRequired: true,
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktopRecordingImport.test.ts
similarity index 93%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktopRecordingImport.test.ts
index 598bb8b4380..ea7efa7e7b5 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktop-recording-import.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/desktopRecordingImport.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
-import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
-import { parseRecallWebhookEvent } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
-import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/is-recall-recording-done-signal.util';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/utils/shouldCompleteCallRecordingImport';
+import { parseRecallWebhookEvent } from 'src/logic-functions/recall-api/utils/parseRecallWebhookEvent';
+import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/utils/isRecallRecordingDoneSignal';
const recording = {
status: 'PROCESSING',
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/buildCallRecordingSummaryPrompt.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/buildCallRecordingSummaryPrompt.test.ts
index 91dbe63dc0d..94e4fd15366 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/build-call-recording-summary-prompt.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/buildCallRecordingSummaryPrompt.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/build-call-recording-summary-prompt.util';
+import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/utils/buildCallRecordingSummaryPrompt';
const TRANSCRIPT = [
{
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/computeRealMeetingKey.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/computeRealMeetingKey.test.ts
index 940316139e5..2d16731f29c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-real-meeting-key.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/computeRealMeetingKey.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { computeRealMeetingKey } from 'src/logic-functions/domain/compute-real-meeting-key.util';
+import { computeRealMeetingKey } from 'src/logic-functions/domain/utils/computeRealMeetingKey';
const STARTS_AT = '2026-01-01T13:00:00.000Z';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/extractConferenceLinkUrlFromText.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/extractConferenceLinkUrlFromText.test.ts
index bbf87db52ac..92c0beb9369 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/extract-conference-link-url-from-text.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/extractConferenceLinkUrlFromText.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/extract-conference-link-url-from-text.util';
+import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/utils/extractConferenceLinkUrlFromText';
describe('extractConferenceLinkUrlFromText', () => {
it.each([
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingMediaImportComplete.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingMediaImportComplete.test.ts
index 452a10425d5..fcf4c0d6582 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-import-complete.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingMediaImportComplete.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { isCallRecordingImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
+import { isCallRecordingImportComplete } from 'src/logic-functions/domain/utils/isCallRecordingImportComplete';
const AUDIO_VALUE = [{ fileId: 'file-audio-1', label: 'audio.mp3' }];
const VIDEO_VALUE = [{ fileId: 'file-video-1', label: 'video.mp4' }];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingStatusDowngrade.test.ts
similarity index 95%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingStatusDowngrade.test.ts
index d2cb7c099f1..5985714278c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-call-recording-status-downgrade.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isCallRecordingStatusDowngrade.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { isCallRecordingStatusDowngrade } from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
+import { isCallRecordingStatusDowngrade } from 'src/logic-functions/domain/utils/isCallRecordingStatusDowngrade';
describe('isCallRecordingStatusDowngrade', () => {
it.each([
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isRealTranscript.test.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isRealTranscript.test.ts
index 542792448e1..5e5c4c17b24 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/is-real-transcript.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/isRealTranscript.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { isRealTranscript } from 'src/logic-functions/domain/is-real-transcript.util';
+import { isRealTranscript } from 'src/logic-functions/domain/utils/isRealTranscript';
describe('isRealTranscript', () => {
it('is true for a non-empty diarized array', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/parseCallRecordingSummaryAgentResponse.test.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/parseCallRecordingSummaryAgentResponse.test.ts
index e8b30cba13d..fc09875454c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-call-recording-summary-agent-response.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/parseCallRecordingSummaryAgentResponse.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/parse-call-recording-summary-agent-response.util';
+import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/utils/parseCallRecordingSummaryAgentResponse';
describe('parseCallRecordingSummaryAgentResponse', () => {
it('returns the trimmed response markdown on success', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/resolveConferenceLinkUrl.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/resolveConferenceLinkUrl.test.ts
index 228912a1228..f20ab0fbaa5 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/resolve-conference-link-url.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/resolveConferenceLinkUrl.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/resolve-conference-link-url.util';
+import { resolveConferenceLinkUrl } from 'src/logic-functions/domain/utils/resolveConferenceLinkUrl';
describe('resolveConferenceLinkUrl', () => {
it('returns the structured conference link when present', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/shouldCompleteCallRecordingImport.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/shouldCompleteCallRecordingImport.test.ts
index 350a7f2ae73..e28b4677b3c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/should-complete-call-recording-import.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/__tests__/shouldCompleteCallRecordingImport.test.ts
@@ -1,7 +1,7 @@
import { describe, expect, it } from 'vitest';
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/utils/shouldCompleteCallRecordingImport';
const filledTranscript = [{ participant: { id: 1 }, words: [] }];
const filledAudio = [{ fileId: 'file-audio-1', label: 'audio.mp3' }];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildCallRecordingSummaryPrompt.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildCallRecordingSummaryPrompt.ts
index ea2fbd4e48c..9f60e04d3be 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-call-recording-summary-prompt.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildCallRecordingSummaryPrompt.ts
@@ -1,8 +1,7 @@
import { isArray, isNumber } from '@sniptt/guards';
-
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/format-seconds-as-clock-timestamp.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/formatSecondsAsClockTimestamp';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
const UNKNOWN_SPEAKER = 'Unknown speaker';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildFailedTranscriptMarker.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildFailedTranscriptMarker.ts
index c7719537f67..b863ed7710f 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-failed-transcript-marker.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildFailedTranscriptMarker.ts
@@ -1,4 +1,4 @@
-import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
+import { type TranscriptMarker } from 'src/logic-functions/types/TranscriptMarker';
export const buildFailedTranscriptMarker = ({
recallTranscriptId,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildPendingTranscriptMarker.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildPendingTranscriptMarker.ts
index 4471e050f01..48f27f3d653 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-pending-transcript-marker.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildPendingTranscriptMarker.ts
@@ -1,4 +1,4 @@
-import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
+import { type TranscriptMarker } from 'src/logic-functions/types/TranscriptMarker';
export const buildPendingTranscriptMarker = ({
recallTranscriptId,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/build-transcript-failure-reason.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildTranscriptFailureReason.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/build-transcript-failure-reason.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/buildTranscriptFailureReason.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeCallRecordingCharge.ts
similarity index 83%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeCallRecordingCharge.ts
index b7d58291bb5..22c79855c8e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-call-recording-charge.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeCallRecordingCharge.ts
@@ -1,15 +1,10 @@
import { isUndefined } from '@sniptt/guards';
-
-import { CALL_RECORDING_MICRO_CREDITS_PER_HOUR } from 'src/logic-functions/constants/call-recording-micro-credits-per-hour';
-import { MILLISECONDS_PER_MINUTE } from 'src/logic-functions/constants/milliseconds-per-minute';
+import { CALL_RECORDING_MICRO_CREDITS_PER_HOUR } from 'src/logic-functions/constants/CALL_RECORDING_MICRO_CREDITS_PER_HOUR';
+import { MILLISECONDS_PER_MINUTE } from 'src/logic-functions/constants/MILLISECONDS_PER_MINUTE';
+import { type CallRecordingCharge } from 'src/logic-functions/types/CallRecordingCharge';
const MILLISECONDS_PER_HOUR = 3_600_000;
-export type CallRecordingCharge = {
- creditsUsedMicro: number;
- quantityMinutes: number;
-};
-
export const computeCallRecordingCharge = ({
startedAt,
endedAt,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeRealMeetingKey.ts
similarity index 93%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeRealMeetingKey.ts
index 60508181d6f..10b7e40c54d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/compute-real-meeting-key.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/computeRealMeetingKey.ts
@@ -1,6 +1,5 @@
import { isUndefined } from '@sniptt/guards';
-
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
type ComputeRealMeetingKeyInput = {
calendarEventId: string;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/extractConferenceLinkUrlFromText.ts
similarity index 81%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/extractConferenceLinkUrlFromText.ts
index 4b50826ed53..7630e5df7fe 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/extract-conference-link-url-from-text.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/extractConferenceLinkUrlFromText.ts
@@ -1,5 +1,5 @@
-import { SUPPORTED_MEETING_PLATFORM_URL_PATTERNS } from 'src/logic-functions/constants/supported-meeting-platform-url-patterns';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { SUPPORTED_MEETING_PLATFORM_URL_PATTERNS } from 'src/logic-functions/constants/SUPPORTED_MEETING_PLATFORM_URL_PATTERNS';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
// Outlook HTML bodies encode ampersands; plain-text links can end mid-sentence.
const cleanExtractedConferenceLinkUrl = (url: string): string =>
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/getAllowedPreviousCallRecordingStatuses.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/getAllowedPreviousCallRecordingStatuses.ts
new file mode 100644
index 00000000000..eb9b8157d9c
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/getAllowedPreviousCallRecordingStatuses.ts
@@ -0,0 +1,9 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { isCallRecordingStatusDowngrade } from 'src/logic-functions/domain/utils/isCallRecordingStatusDowngrade';
+
+export const getAllowedPreviousCallRecordingStatuses = (
+ toStatus: CallRecordingStatus,
+): CallRecordingStatus[] =>
+ Object.values(CallRecordingStatus).filter(
+ (fromStatus) => !isCallRecordingStatusDowngrade({ fromStatus, toStatus }),
+ );
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingImportComplete.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingImportComplete.ts
new file mode 100644
index 00000000000..235916362a5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingImportComplete.ts
@@ -0,0 +1,9 @@
+import { isCallRecordingMediaImportComplete } from 'src/logic-functions/domain/utils/isCallRecordingMediaImportComplete';
+
+export const isCallRecordingImportComplete = ({
+ transcript,
+ ...media
+}: Parameters<typeof isCallRecordingMediaImportComplete>[0] & {
+ transcript: unknown;
+}): boolean =>
+ Array.isArray(transcript) && isCallRecordingMediaImportComplete(media);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingMediaImportComplete.ts
similarity index 68%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingMediaImportComplete.ts
index 9c1e417e733..c814d55d924 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-import-complete.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingMediaImportComplete.ts
@@ -1,7 +1,6 @@
import { isNonEmptyArray } from '@sniptt/guards';
-
-import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
-import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/parse-media-file-too-large-markers.util';
+import { type FilesFieldValue } from 'src/logic-functions/types/FilesFieldValue';
+import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/utils/parseMediaFileTooLargeMarkers';
export const isCallRecordingMediaImportComplete = ({
audio,
@@ -22,11 +21,3 @@ export const isCallRecordingMediaImportComplete = ({
(!requiresVideo || isNonEmptyArray(video) || videoFileTooLarge)
);
};
-
-export const isCallRecordingImportComplete = ({
- transcript,
- ...media
-}: Parameters<typeof isCallRecordingMediaImportComplete>[0] & {
- transcript: unknown;
-}): boolean =>
- Array.isArray(transcript) && isCallRecordingMediaImportComplete(media);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingStatusDowngrade.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingStatusDowngrade.ts
index d23e901ac0e..daa0e6198b1 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-call-recording-status-downgrade.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isCallRecordingStatusDowngrade.ts
@@ -1,6 +1,5 @@
import { isUndefined } from '@sniptt/guards';
-
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
// Deliveries are unordered; a late event must never move status backwards.
// FAILED and NOT_RECORDED share a rank so a late event cannot flip one into the other.
@@ -43,10 +42,3 @@ export const isCallRecordingStatusDowngrade = ({
return toRank < fromRank || (toRank === fromRank && toStatus !== fromStatus);
};
-
-export const getAllowedPreviousCallRecordingStatuses = (
- toStatus: CallRecordingStatus,
-): CallRecordingStatus[] =>
- Object.values(CallRecordingStatus).filter(
- (fromStatus) => !isCallRecordingStatusDowngrade({ fromStatus, toStatus }),
- );
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isDesktopAudioRecording.ts
similarity index 72%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isDesktopAudioRecording.ts
index fb558b1e7d5..90fb0d30e8c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-desktop-audio-recording.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isDesktopAudioRecording.ts
@@ -1,4 +1,4 @@
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
export const isDesktopAudioRecording = (session: unknown): boolean => {
const record = asRecord(session);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isNotRecordedRecallSubCode.ts
similarity index 85%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isNotRecordedRecallSubCode.ts
index 0e89a0fe0f7..38831652b8e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-not-recorded-recall-sub-code.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isNotRecordedRecallSubCode.ts
@@ -1,6 +1,5 @@
import { isUndefined } from '@sniptt/guards';
-
-import { NOT_RECORDED_RECALL_SUB_CODES } from 'src/logic-functions/constants/not-recorded-recall-sub-codes';
+import { NOT_RECORDED_RECALL_SUB_CODES } from 'src/logic-functions/constants/NOT_RECORDED_RECALL_SUB_CODES';
export const isNotRecordedRecallSubCode = (
subCode: string | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-real-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isRealTranscript.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-real-transcript.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isRealTranscript.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-recall-recording-done-signal.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isRecallRecordingDoneSignal.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-recall-recording-done-signal.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isRecallRecordingDoneSignal.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isUnavailableCallRecordingStatus.ts
similarity index 83%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isUnavailableCallRecordingStatus.ts
index abb3e89ef7e..affb8968a27 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/is-unavailable-call-recording-status.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/isUnavailableCallRecordingStatus.ts
@@ -1,6 +1,5 @@
import { isUndefined } from '@sniptt/guards';
-
-import { UNAVAILABLE_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/unavailable-call-recording-statuses';
+import { UNAVAILABLE_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/UNAVAILABLE_CALL_RECORDING_STATUSES';
export const isUnavailableCallRecordingStatus = (
status: string | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/mapRecallStatusCodeToCallRecordingStatus.ts
similarity index 94%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/mapRecallStatusCodeToCallRecordingStatus.ts
index 05296b8d036..0014c8e1216 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/mapRecallStatusCodeToCallRecordingStatus.ts
@@ -1,5 +1,5 @@
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { isNotRecordedRecallSubCode } from 'src/logic-functions/domain/is-not-recorded-recall-sub-code.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { isNotRecordedRecallSubCode } from 'src/logic-functions/domain/utils/isNotRecordedRecallSubCode';
export const mapRecallStatusCodeToCallRecordingStatus = ({
statusCode,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseCallRecordingSummaryAgentResponse.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseCallRecordingSummaryAgentResponse.ts
index aa9da12c935..4b47b5d973b 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-call-recording-summary-agent-response.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseCallRecordingSummaryAgentResponse.ts
@@ -1,8 +1,7 @@
import { type RunAgentResult } from 'twenty-sdk/logic-function';
-
-import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/call-recording-summary-unavailable-prefix';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX } from 'src/constants/CALL_RECORDING_SUMMARY_UNAVAILABLE_PREFIX';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
type ParsedCallRecordingSummaryAgentResponse =
| { outcome: 'summarized'; markdown: string }
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseMediaFileTooLargeMarkers.ts
similarity index 54%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseMediaFileTooLargeMarkers.ts
index 286e64d82c4..8d37f5e6a5e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-media-file-too-large-markers.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseMediaFileTooLargeMarkers.ts
@@ -1,13 +1,7 @@
-import {
- AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
- VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
-} from 'src/logic-functions/constants/media-file-too-large-failure-reasons';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
-
-export type MediaFileTooLargeMarkers = {
- audioFileTooLarge: boolean;
- videoFileTooLarge: boolean;
-};
+import { AUDIO_FILE_TOO_LARGE_FAILURE_REASON } from 'src/logic-functions/constants/AUDIO_FILE_TOO_LARGE_FAILURE_REASON';
+import { VIDEO_FILE_TOO_LARGE_FAILURE_REASON } from 'src/logic-functions/constants/VIDEO_FILE_TOO_LARGE_FAILURE_REASON';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
+import { type MediaFileTooLargeMarkers } from 'src/logic-functions/types/MediaFileTooLargeMarkers';
export const parseMediaFileTooLargeMarkers = (
companionFailureReason: string | null | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseTranscriptMarker.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseTranscriptMarker.ts
index 36a6cbce5d3..22e56abd469 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/parse-transcript-marker.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/parseTranscriptMarker.ts
@@ -1,7 +1,6 @@
import { isString, isUndefined } from '@sniptt/guards';
-
-import { type TranscriptMarker } from 'src/logic-functions/types/transcript-marker.type';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { type TranscriptMarker } from 'src/logic-functions/types/TranscriptMarker';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
export const parseTranscriptMarker = (
transcript: unknown,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/resolveConferenceLinkUrl.ts
similarity index 83%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/resolveConferenceLinkUrl.ts
index 84626c346cb..3f3c4415dbb 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/resolve-conference-link-url.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/resolveConferenceLinkUrl.ts
@@ -1,5 +1,5 @@
-import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/extract-conference-link-url-from-text.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { extractConferenceLinkUrlFromText } from 'src/logic-functions/domain/utils/extractConferenceLinkUrlFromText';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
type ResolveConferenceLinkUrlInput = {
conferenceLinkUrl: string | null | undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/shouldCompleteCallRecordingImport.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/domain/utils/shouldCompleteCallRecordingImport.ts
index f0907adee8b..0054ef4d6c8 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/should-complete-call-recording-import.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/domain/utils/shouldCompleteCallRecordingImport.ts
@@ -1,10 +1,10 @@
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
-import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
-import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/is-unavailable-call-recording-status.util';
-import { isCallRecordingImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { type FilesFieldValue } from 'src/logic-functions/types/FilesFieldValue';
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/utils/computeCallRecordingCharge';
+import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/utils/isUnavailableCallRecordingStatus';
+import { isCallRecordingImportComplete } from 'src/logic-functions/domain/utils/isCallRecordingImportComplete';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
export const shouldCompleteCallRecordingImport = ({
current,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failedTranscriptAudioRecovery.test.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failedTranscriptAudioRecovery.test.ts
index 9d65c9ce6ef..547bfd01a89 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failed-transcript-audio-recovery.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/failedTranscriptAudioRecovery.test.ts
@@ -1,20 +1,18 @@
import { beforeEach, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import {
- syncCallRecording,
- type SyncableCallRecording,
-} from 'src/logic-functions/flows/sync-call-recording.util';
+import { syncCallRecording } from 'src/logic-functions/flows/utils/syncCallRecording';
+import { type SyncableCallRecording } from 'src/logic-functions/types/SyncableCallRecording';
const { listTranscripts, importMedia, charge } = vi.hoisted(() => ({
listTranscripts: vi.fn(),
importMedia: vi.fn(),
charge: vi.fn(),
}));
-vi.mock('src/logic-functions/recall-api/list-recall-transcripts.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/listRecallTranscripts', () => ({
listRecallTranscripts: listTranscripts,
}));
-vi.mock('src/logic-functions/flows/import-call-recording-media.util', () => ({
+vi.mock('src/logic-functions/flows/utils/importCallRecordingMedia', () => ({
importCallRecordingMedia: importMedia,
}));
vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/importTranscriptRecovery.test.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/importTranscriptRecovery.test.ts
index 6dda7ecf477..fe3389b3bf5 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-transcript-recovery.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/importTranscriptRecovery.test.ts
@@ -1,19 +1,19 @@
import { beforeEach, expect, it, vi } from 'vitest';
-import { importCallRecordingTranscript } from 'src/logic-functions/flows/import-call-recording-transcript.util';
+import { importCallRecordingTranscript } from 'src/logic-functions/flows/utils/importCallRecordingTranscript';
const { list, create, download } = vi.hoisted(() => ({
list: vi.fn(),
create: vi.fn(),
download: vi.fn(),
}));
-vi.mock('src/logic-functions/recall-api/list-recall-transcripts.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/listRecallTranscripts', () => ({
listRecallTranscripts: list,
}));
vi.mock(
- 'src/logic-functions/recall-api/create-async-recall-transcript.util',
+ 'src/logic-functions/recall-api/utils/createAsyncRecallTranscript',
() => ({ createAsyncRecallTranscript: create }),
);
-vi.mock('src/logic-functions/flows/download-transcript.util', () => ({
+vi.mock('src/logic-functions/flows/utils/downloadTranscript', () => ({
downloadTranscript: download,
}));
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/completeAndChargeCallRecording.test.ts
similarity index 94%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/completeAndChargeCallRecording.test.ts
index 142a1049771..5902cfac24e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/complete-and-charge-call-recording.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/completeAndChargeCallRecording.test.ts
@@ -1,13 +1,13 @@
import { beforeEach, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { completeAndChargeCallRecording } from 'src/logic-functions/flows/complete-and-charge-call-recording.util';
+import { completeAndChargeCallRecording } from 'src/logic-functions/flows/utils/completeAndChargeCallRecording';
const { charge, prepare } = vi.hoisted(() => ({
charge: vi.fn(),
prepare: vi.fn(),
}));
vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
-vi.mock('src/logic-functions/flows/get-call-recording-charge.util', () => ({
+vi.mock('src/logic-functions/flows/utils/getCallRecordingCharge', () => ({
getCallRecordingCharge: prepare,
}));
const chargeInput = {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/createDesktopRecordingUpload.test.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/createDesktopRecordingUpload.test.ts
index 17e3ef6fcbd..899f7bab83e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/create-desktop-recording-upload.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/createDesktopRecordingUpload.test.ts
@@ -1,16 +1,14 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
-import {
- createDesktopRecordingUpload,
- failDesktopRecordingCapture,
-} from 'src/logic-functions/flows/create-desktop-recording-upload.util';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook';
+import { createDesktopRecordingUpload } from 'src/logic-functions/flows/utils/createDesktopRecordingUpload';
+import { failDesktopRecordingCapture } from 'src/logic-functions/flows/utils/failDesktopRecordingCapture';
const { request, agenda } = vi.hoisted(() => ({
request: vi.fn(),
agenda: vi.fn(),
}));
-vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getRecallApiConfig', () => ({
getRecallApiConfig: () => ({
success: true,
config: {
@@ -19,13 +17,13 @@ vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
},
}),
}));
-vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+vi.mock('src/logic-functions/data/utils/getCurrentWorkspaceId', () => ({
getCurrentWorkspaceId: () => 'workspace-1',
}));
-vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/recallBotApiRequest', () => ({
recallBotApiRequest: request,
}));
-vi.mock('src/logic-functions/flows/get-desktop-companion-agenda.util', () => ({
+vi.mock('src/logic-functions/flows/utils/getDesktopCompanionAgenda', () => ({
getDesktopCompanionAgenda: agenda,
}));
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/generateCallRecordingSummary.test.ts
similarity index 99%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/generateCallRecordingSummary.test.ts
index 46675dfab63..e7e945c492f 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/generate-call-recording-summary.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/generateCallRecordingSummary.test.ts
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { generateCallRecordingSummary } from 'src/logic-functions/flows/generate-call-recording-summary.util';
+import { generateCallRecordingSummary } from 'src/logic-functions/flows/utils/generateCallRecordingSummary';
const runAgentMock = vi.hoisted(() => vi.fn());
const stored = vi.hoisted(() => new Map<string, unknown>());
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getCallRecordingCharge.test.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getCallRecordingCharge.test.ts
index 68373b14afb..69e6b7e8f88 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-call-recording-charge.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getCallRecordingCharge.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { getCallRecordingCharge } from 'src/logic-functions/flows/get-call-recording-charge.util';
+import { getCallRecordingCharge } from 'src/logic-functions/flows/utils/getCallRecordingCharge';
const { charge, ownedUpload, provider } = vi.hoisted(() => ({
charge: vi.fn(),
@@ -8,10 +8,10 @@ const { charge, ownedUpload, provider } = vi.hoisted(() => ({
provider: vi.fn(),
}));
vi.mock('twenty-sdk/billing', () => ({ chargeCredits: charge }));
-vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getOwnedDesktopUpload', () => ({
getOwnedDesktopUpload: ownedUpload,
}));
-vi.mock('src/logic-functions/recall-api/get-recall-recording.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getRecallRecording', () => ({
getRecallRecording: provider,
}));
const query = vi.fn();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getDesktopCompanionAgenda.test.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getDesktopCompanionAgenda.test.ts
index b2362686a50..5cc382a3cac 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-desktop-companion-agenda.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/getDesktopCompanionAgenda.test.ts
@@ -1,7 +1,7 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { afterEach, beforeEach, expect, it, vi } from 'vitest';
-import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/utils/getDesktopCompanionAgenda';
const { post } = vi.hoisted(() => ({ post: vi.fn() }));
vi.mock('twenty-client-sdk/rest', () => ({
@@ -9,7 +9,7 @@ vi.mock('twenty-client-sdk/rest', () => ({
post = post;
},
}));
-vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+vi.mock('src/logic-functions/data/utils/getCurrentWorkspaceId', () => ({
getCurrentWorkspaceId: () => 'workspace-1',
}));
const query = vi.fn();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/handleRecallWebhook.test.ts
similarity index 94%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/handleRecallWebhook.test.ts
index a0fc6d3d672..877742e48ae 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/handle-recall-webhook.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/handleRecallWebhook.test.ts
@@ -1,16 +1,16 @@
import { beforeEach, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { handleRecallWebhook } from '../handle-recall-webhook.util';
+import { handleRecallWebhook } from 'src/logic-functions/flows/utils/handleRecallWebhook';
const { enqueue, ownedUpload } = vi.hoisted(() => ({
enqueue: vi.fn(),
ownedUpload: vi.fn(),
}));
-vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getOwnedDesktopUpload', () => ({
getOwnedDesktopUpload: ownedUpload,
}));
vi.mock(
- 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport',
() => ({ enqueueCallRecordingArtifactsImport: enqueue }),
);
const query = vi.fn();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/hydrateDesktopRecordingTimestamps.test.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/hydrateDesktopRecordingTimestamps.test.ts
index 54854caff25..7ad192d816c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-desktop-recordings.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/hydrateDesktopRecordingTimestamps.test.ts
@@ -1,10 +1,8 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { beforeEach, expect, it, vi } from 'vitest';
-import {
- hydrateDesktopRecordingTimestamps,
- recoverDesktopRecordings,
-} from 'src/logic-functions/flows/recover-desktop-recordings.util';
-import { type SyncableCallRecording } from 'src/logic-functions/flows/sync-call-recording.util';
+import { hydrateDesktopRecordingTimestamps } from 'src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps';
+import { recoverDesktopRecordings } from 'src/logic-functions/flows/utils/recoverDesktopRecordings';
+import { type SyncableCallRecording } from 'src/logic-functions/types/SyncableCallRecording';
const { request, update, enqueue, retrieve } = vi.hoisted(() => ({
request: vi.fn(),
@@ -12,23 +10,23 @@ const { request, update, enqueue, retrieve } = vi.hoisted(() => ({
enqueue: vi.fn(),
retrieve: vi.fn(),
}));
-vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getRecallApiConfig', () => ({
getRecallApiConfig: () => ({ success: true, config: {} }),
}));
-vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/recallBotApiRequest', () => ({
recallBotApiRequest: request,
}));
-vi.mock('src/logic-functions/recall-api/get-recall-recording.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getRecallRecording', () => ({
getRecallRecording: retrieve,
}));
-vi.mock('src/logic-functions/data/update-call-recording.util', () => ({
+vi.mock('src/logic-functions/data/utils/updateCallRecording', () => ({
updateCallRecording: update,
}));
vi.mock(
- 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport',
() => ({ enqueueCallRecordingArtifactsImport: enqueue }),
);
-vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getOwnedDesktopUpload', () => ({
getOwnedDesktopUpload: async () => {
const response = await request();
return response?.ok ? response.data : undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/importCallRecordingMedia.test.ts
similarity index 99%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/importCallRecordingMedia.test.ts
index 09d6eb48272..6aa866d0356 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-media.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/importCallRecordingMedia.test.ts
@@ -3,8 +3,8 @@ import { PassThrough, Readable } from 'node:stream';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { importCallRecordingMedia } from 'src/logic-functions/flows/import-call-recording-media.util';
+import { CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER';
+import { importCallRecordingMedia } from 'src/logic-functions/flows/utils/importCallRecordingMedia';
const mutationMock = vi.hoisted(() => vi.fn());
const requestOverHttpsMock = vi.hoisted(() => vi.fn());
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/putMediaDownloadBodyToUploadTarget.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/putMediaDownloadBodyToUploadTarget.test.ts
index 9de5102fa5f..09af2508ac2 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/put-media-download-body-to-upload-target.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/putMediaDownloadBodyToUploadTarget.test.ts
@@ -20,7 +20,7 @@ vi.mock('node:https', async () => {
return { ...actualHttps, request: requestOverHttpsMock };
});
-import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/put-media-download-body-to-upload-target.util';
+import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/utils/putMediaDownloadBodyToUploadTarget';
const HTTPS_UPLOAD_URL = 'https://storage.example.com/video.mp4';
const HTTP_UPLOAD_URL = 'http://storage.example.com/video.mp4';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/recoverRecordingSummaries.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/recoverRecordingSummaries.test.ts
index 843547082c9..76e5d981639 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/recover-recording-summaries.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/__tests__/recoverRecordingSummaries.test.ts
@@ -2,7 +2,7 @@ import { type CoreApiClient } from 'twenty-client-sdk/core';
import { beforeEach, expect, it, vi } from 'vitest';
import { kv } from 'twenty-sdk/logic-function';
-import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/utils/recoverRecordingSummaries';
vi.mock('twenty-sdk/logic-function', () => ({
kv: { get: vi.fn(), set: vi.fn(), delete: vi.fn() },
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/completeAndChargeCallRecording.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/completeAndChargeCallRecording.ts
index dd36b459430..4d44d5fb876 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/complete-and-charge-call-recording.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/completeAndChargeCallRecording.ts
@@ -1,8 +1,7 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { completeCallRecordingImport } from 'src/logic-functions/data/complete-call-recording-import.util';
+import { completeCallRecordingImport } from 'src/logic-functions/data/utils/completeCallRecordingImport';
import { chargeCredits } from 'twenty-sdk/billing';
-import { getCallRecordingCharge } from 'src/logic-functions/flows/get-call-recording-charge.util';
+import { getCallRecordingCharge } from 'src/logic-functions/flows/utils/getCallRecordingCharge';
export const completeAndChargeCallRecording = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/createDesktopRecordingUpload.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/createDesktopRecordingUpload.ts
index edf8f3967bd..90bf964662e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/create-desktop-recording-upload.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/createDesktopRecordingUpload.ts
@@ -1,29 +1,31 @@
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
-import { computeRealMeetingKey } from 'src/logic-functions/domain/compute-real-meeting-key.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { computeRealMeetingKey } from 'src/logic-functions/domain/utils/computeRealMeetingKey';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
-import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
-import { getRecallBotRecordingConfig } from 'src/logic-functions/constants/recall-bot-recording-config';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { type DesktopRecordingSession } from 'src/logic-functions/types/desktop-recording-session.type';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/utils/getCurrentWorkspaceId';
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/utils/getDesktopCompanionAgenda';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
+import { getRecallBotRecordingConfig } from 'src/logic-functions/constants/utils/getRecallBotRecordingConfig';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { type DesktopRecordingSession } from 'src/logic-functions/types/DesktopRecordingSession';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
const UUID_PATTERN =
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+
const getSessionId = (body: Record<string, unknown>): string => {
if (typeof body.sessionId !== 'string' || !UUID_PATTERN.test(body.sessionId))
throw new Error('Invalid recording session.');
return body.sessionId;
};
+
type DesktopRecord = {
id: string;
status: string;
companionSession: DesktopRecordingSession | null;
};
+
const getSession = async (
client: CoreApiClient,
id: string,
@@ -190,27 +192,3 @@ export const createDesktopRecordingUpload = async (
apiUrl: new URL(config.baseUrl).origin,
};
};
-
-export const failDesktopRecordingCapture = async (
- client: CoreApiClient,
- userWorkspaceId: string,
- body: Record<string, unknown>,
-) => {
- const id = getSessionId(body);
- const recording = await getSession(client, id);
- if (
- !recording ||
- asRecord(recording.companionSession)?.userWorkspaceId !== userWorkspaceId
- )
- throw new Error('Recording is unavailable.');
- if (recording.status === 'JOINING')
- await updateCallRecording(client, {
- id,
- expectedStatuses: [CallRecordingStatus.JOINING],
- data: {
- status: CallRecordingStatus.FAILED,
- companionFailureReason: 'desktop_capture_did_not_start',
- },
- });
- return { callRecordingId: id };
-};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/downloadTranscript.ts
similarity index 85%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/downloadTranscript.ts
index 196dc68e242..37d892f25a3 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/download-transcript.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/downloadTranscript.ts
@@ -1,17 +1,10 @@
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
import { isUndefined } from '@sniptt/guards';
-
-import { retrieveRecallTranscript } from 'src/logic-functions/recall-api/retrieve-recall-transcript.util';
+import { retrieveRecallTranscript } from 'src/logic-functions/recall-api/utils/retrieveRecallTranscript';
+import { type DownloadTranscriptResult } from 'src/logic-functions/types/DownloadTranscriptResult';
const TRANSCRIPT_DOWNLOAD_TIMEOUT_MS = 20_000;
-export type DownloadTranscriptResult =
- | { outcome: 'filled'; content: unknown }
- | { outcome: 'failed'; subCode: string | null }
- | { outcome: 'pending' }
- | { outcome: 'deleted' }
- | { outcome: 'error'; errorMessage: string };
-
export const downloadTranscript = async ({
transcriptId,
}: {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/failDesktopRecordingCapture.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/failDesktopRecordingCapture.ts
new file mode 100644
index 00000000000..fbd5158003c
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/failDesktopRecordingCapture.ts
@@ -0,0 +1,59 @@
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { type DesktopRecordingSession } from 'src/logic-functions/types/DesktopRecordingSession';
+
+const UUID_PATTERN =
+ /^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;
+
+const getSessionId = (body: Record<string, unknown>): string => {
+ if (typeof body.sessionId !== 'string' || !UUID_PATTERN.test(body.sessionId))
+ throw new Error('Invalid recording session.');
+ return body.sessionId;
+};
+
+type DesktopRecord = {
+ id: string;
+ status: string;
+ companionSession: DesktopRecordingSession | null;
+};
+
+const getSession = async (
+ client: CoreApiClient,
+ id: string,
+): Promise<DesktopRecord | undefined> => {
+ const result = await client.query({
+ callRecordings: {
+ __args: { first: 1, filter: { id: { eq: id } } },
+ edges: {
+ node: { id: true, status: true, companionSession: true },
+ },
+ },
+ });
+ return result.callRecordings?.edges?.[0]?.node as DesktopRecord | undefined;
+};
+
+export const failDesktopRecordingCapture = async (
+ client: CoreApiClient,
+ userWorkspaceId: string,
+ body: Record<string, unknown>,
+) => {
+ const id = getSessionId(body);
+ const recording = await getSession(client, id);
+ if (
+ !recording ||
+ asRecord(recording.companionSession)?.userWorkspaceId !== userWorkspaceId
+ )
+ throw new Error('Recording is unavailable.');
+ if (recording.status === 'JOINING')
+ await updateCallRecording(client, {
+ id,
+ expectedStatuses: [CallRecordingStatus.JOINING],
+ data: {
+ status: CallRecordingStatus.FAILED,
+ companionFailureReason: 'desktop_capture_did_not_start',
+ },
+ });
+ return { callRecordingId: id };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/generateCallRecordingSummary.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/generateCallRecordingSummary.ts
index 4fc10a6c12b..482aa160c8d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/generateCallRecordingSummary.ts
@@ -1,15 +1,14 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { createHash } from 'crypto';
-
-import { findCallRecordingForSummary } from 'src/logic-functions/data/find-call-recording-for-summary.util';
-import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
-import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/build-call-recording-summary-prompt.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { isRealTranscript } from 'src/logic-functions/domain/is-real-transcript.util';
-import { getOrGenerateSummary } from 'src/logic-functions/flows/get-or-generate-summary.util';
-import { type GenerateCallRecordingSummaryResult } from 'src/logic-functions/flows/generate-call-recording-summary-result.type';
-import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/get-companion-additional-summary-prompt.util';
-import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/is-call-recording-summary-enabled.util';
+import { findCallRecordingForSummary } from 'src/logic-functions/data/utils/findCallRecordingForSummary';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { buildCallRecordingSummaryPrompt } from 'src/logic-functions/domain/utils/buildCallRecordingSummaryPrompt';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { isRealTranscript } from 'src/logic-functions/domain/utils/isRealTranscript';
+import { getOrGenerateSummary } from 'src/logic-functions/flows/utils/getOrGenerateSummary';
+import { type GenerateCallRecordingSummaryResult } from 'src/logic-functions/types/GenerateCallRecordingSummaryResult';
+import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/getCompanionAdditionalSummaryPrompt';
+import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/isCallRecordingSummaryEnabled';
export const generateCallRecordingSummary = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getCallRecordingCharge.ts
similarity index 90%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getCallRecordingCharge.ts
index bce412e2c32..af6655fb88d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-call-recording-charge.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getCallRecordingCharge.ts
@@ -1,10 +1,9 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
-import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
-import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/utils/computeCallRecordingCharge';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
+import { getRecallRecording } from 'src/logic-functions/recall-api/utils/getRecallRecording';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/utils/normalizeRecallTimestamp';
+import { getString } from 'src/logic-functions/utils/getString';
export const getCallRecordingCharge = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getDesktopCompanionAgenda.ts
similarity index 95%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getDesktopCompanionAgenda.ts
index 1965ce036ba..c3e0c60edc8 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-desktop-companion-agenda.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getDesktopCompanionAgenda.ts
@@ -1,14 +1,12 @@
import { isNonEmptyString } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { RestApiClient } from 'twenty-client-sdk/rest';
-import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
-import {
- fetchAllNodes,
- type ConnectionPage,
-} from 'src/logic-functions/data/fetch-all-nodes.util';
-import { fetchCalendarEventsByFilter } from 'src/logic-functions/data/fetch-calendar-events-by-filter.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getRecordingParticipants } from 'src/logic-functions/flows/get-recording-participants.util';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/utils/getCurrentWorkspaceId';
+import { fetchAllNodes } from 'src/logic-functions/data/utils/fetchAllNodes';
+import { type ConnectionPage } from 'src/logic-functions/types/ConnectionPage';
+import { fetchCalendarEventsByFilter } from 'src/logic-functions/data/utils/fetchCalendarEventsByFilter';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getRecordingParticipants } from 'src/logic-functions/flows/utils/getRecordingParticipants';
export const getDesktopCompanionAgenda = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getOrGenerateSummary.ts
similarity index 57%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getOrGenerateSummary.ts
index d2492d3b5aa..92d5e676c2d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-or-generate-summary.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getOrGenerateSummary.ts
@@ -1,48 +1,8 @@
import { kv, runAgent } from 'twenty-sdk/logic-function';
-
-import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/parse-call-recording-summary-agent-response.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-
-export type CachedSummary =
- | {
- status: 'READY';
- markdown: string;
- outcome: 'generated' | 'not-summarizable';
- }
- | { status: 'EMPTY' }
- | { status: 'RUNNING' }
- | { status: 'INTERRUPTED' };
-
-export const readCachedSummary = async (
- key: string,
-): Promise<CachedSummary | null> => {
- const value = asRecord(await kv.get(key));
- if (!value) return null;
- if (value.status === 'RUNNING') {
- const startedAt =
- typeof value.startedAt === 'string' ? Date.parse(value.startedAt) : NaN;
- return {
- status:
- Number.isFinite(startedAt) && Date.now() - startedAt < 15 * 60_000
- ? 'RUNNING'
- : 'INTERRUPTED',
- };
- }
- if (value.status === 'EMPTY') return { status: 'EMPTY' };
- if (
- value.status === 'READY' &&
- typeof value.markdown === 'string' &&
- (value.outcome === 'generated' || value.outcome === 'not-summarizable')
- ) {
- return {
- status: 'READY',
- markdown: value.markdown,
- outcome: value.outcome,
- };
- }
- throw new Error('Stored summary result is invalid.');
-};
+import { CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER } from 'src/constants/CALL_RECORDING_SUMMARIZER_AGENT_UNIVERSAL_IDENTIFIER';
+import { parseCallRecordingSummaryAgentResponse } from 'src/logic-functions/domain/utils/parseCallRecordingSummaryAgentResponse';
+import { type CachedSummary } from 'src/logic-functions/types/CachedSummary';
+import { readCachedSummary } from 'src/logic-functions/flows/utils/readCachedSummary';
export const getOrGenerateSummary = async (
key: string,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getRecordingParticipants.ts
similarity index 94%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getRecordingParticipants.ts
index 095943f4e7c..9c402356f84 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/get-recording-participants.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/getRecordingParticipants.ts
@@ -1,11 +1,11 @@
import { isNonEmptyString } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import {
- fetchAllNodes,
- type ConnectionPage,
-} from 'src/logic-functions/data/fetch-all-nodes.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { fetchAllNodes } from 'src/logic-functions/data/utils/fetchAllNodes';
+import { type ConnectionPage } from 'src/logic-functions/types/ConnectionPage';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { type RecordingParticipant } from 'src/logic-functions/types/RecordingParticipant';
+import { type RecordingWithParticipants } from 'src/logic-functions/types/RecordingWithParticipants';
+import { type RecordingViewer } from 'src/logic-functions/types/RecordingViewer';
type Person = {
id: string;
@@ -39,28 +39,13 @@ type ParticipantCandidate = {
workspaceMember?: CalendarParticipant['workspaceMember'];
};
-export type RecordingParticipant = {
- id: string;
- name: string;
- avatarUrl: string | null;
-};
-
-export type RecordingWithParticipants = {
- id: string;
- calendarEventId?: string | null;
- transcript?: unknown;
-};
-
-export type RecordingViewer = {
- emails: string[];
- name: string;
- workspaceMemberId?: string;
-};
-
const escapeLike = (value: string) => value.replace(/[\\%_]/g, '\\$&');
+
const normalize = (value: string) => value.trim().toLowerCase();
+
const fullName = (name: Person['name']) =>
[name?.firstName, name?.lastName].filter(Boolean).join(' ').trim();
+
const personEmails = (person: Person) =>
[person.emails?.primaryEmail, ...(person.emails?.additionalEmails ?? [])]
.filter((email): email is string => isNonEmptyString(email))
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/handleRecallWebhook.ts
similarity index 90%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/handleRecallWebhook.ts
index cbd38b99951..c94b378edc8 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/handle-recall-webhook.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/handleRecallWebhook.ts
@@ -1,25 +1,20 @@
import { isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
-
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
-import { findCallRecordingsByFilter } from 'src/logic-functions/data/find-call-recordings-by-filter.util';
-import {
- isCallRecordingStatusDowngrade,
- getAllowedPreviousCallRecordingStatuses,
-} from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
-import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/is-recall-recording-done-signal.util';
-import { mapRecallStatusCodeToCallRecordingStatus } from 'src/logic-functions/domain/map-recall-status-code-to-call-recording-status.util';
-import {
- parseRecallWebhookEvent,
- type RecallWebhookBody,
- type RecallWebhookEvent,
-} from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
-import { type CallRecordingRecord } from 'src/logic-functions/types/call-recording-record.type';
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
-import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
-import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport';
+import { findCallRecordingsByFilter } from 'src/logic-functions/data/utils/findCallRecordingsByFilter';
+import { isCallRecordingStatusDowngrade } from 'src/logic-functions/domain/utils/isCallRecordingStatusDowngrade';
+import { getAllowedPreviousCallRecordingStatuses } from 'src/logic-functions/domain/utils/getAllowedPreviousCallRecordingStatuses';
+import { isRecallRecordingDoneSignal } from 'src/logic-functions/domain/utils/isRecallRecordingDoneSignal';
+import { mapRecallStatusCodeToCallRecordingStatus } from 'src/logic-functions/domain/utils/mapRecallStatusCodeToCallRecordingStatus';
+import { parseRecallWebhookEvent } from 'src/logic-functions/recall-api/utils/parseRecallWebhookEvent';
+import { type RecallWebhookBody } from 'src/logic-functions/types/RecallWebhookBody';
+import { type RecallWebhookEvent } from 'src/logic-functions/types/RecallWebhookEvent';
+import { type CallRecordingRecord } from 'src/logic-functions/types/CallRecordingRecord';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata';
type RecallWebhookHandlerResult =
| {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps.ts
new file mode 100644
index 00000000000..5ea8068c2bd
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps.ts
@@ -0,0 +1,38 @@
+import { type CoreApiClient } from 'twenty-client-sdk/core';
+import { getRecallRecording } from 'src/logic-functions/recall-api/utils/getRecallRecording';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/utils/normalizeRecallTimestamp';
+import { getString } from 'src/logic-functions/utils/getString';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { type SyncableCallRecording } from 'src/logic-functions/types/SyncableCallRecording';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+
+export const hydrateDesktopRecordingTimestamps = async (
+ client: CoreApiClient,
+ recording: SyncableCallRecording,
+): Promise<void> => {
+ if (
+ !isDesktopAudioRecording(recording.companionSession) ||
+ !recording.externalRecordingId ||
+ (recording.startedAt && recording.endedAt)
+ )
+ return;
+ const result = await getRecallRecording({
+ externalRecordingId: recording.externalRecordingId,
+ });
+ if (!result.ok) throw new Error('Recall recording is not available yet.');
+ const startedAt =
+ recording.startedAt ??
+ normalizeRecallTimestamp(getString(result.recording.started_at));
+ const endedAt =
+ recording.endedAt ??
+ normalizeRecallTimestamp(getString(result.recording.completed_at));
+ await updateCallRecording(client, {
+ id: recording.id,
+ data: {
+ ...(startedAt ? { startedAt } : {}),
+ ...(endedAt ? { endedAt } : {}),
+ },
+ });
+ recording.startedAt = startedAt;
+ recording.endedAt = endedAt;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingArtifacts.ts
similarity index 86%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingArtifacts.ts
index d5984b3fb0f..c6073b2bbd1 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-artifacts.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingArtifacts.ts
@@ -1,20 +1,16 @@
-import { hydrateDesktopRecordingTimestamps } from 'src/logic-functions/flows/recover-desktop-recordings.util';
+import { hydrateDesktopRecordingTimestamps } from 'src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps';
import { isNull, isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import {
- claimCallRecordingArtifactsImport,
- releaseCallRecordingArtifactsImportClaim,
-} from 'src/logic-functions/data/claim-call-recording-artifacts-import.util';
-import {
- syncCallRecording,
- type SyncableCallRecording,
-} from 'src/logic-functions/flows/sync-call-recording.util';
-import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
-import { type CallRecordingArtifactsImportRequest } from 'src/logic-functions/types/call-recording-artifacts-import-request.type';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+import { claimCallRecordingArtifactsImport } from 'src/logic-functions/data/utils/claimCallRecordingArtifactsImport';
+import { releaseCallRecordingArtifactsImportClaim } from 'src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim';
+import { syncCallRecording } from 'src/logic-functions/flows/utils/syncCallRecording';
+import { type SyncableCallRecording } from 'src/logic-functions/types/SyncableCallRecording';
+import { type FilesFieldValue } from 'src/logic-functions/types/FilesFieldValue';
+import { type CallRecordingArtifactsImportRequest } from 'src/logic-functions/types/CallRecordingArtifactsImportRequest';
+import { getString } from 'src/logic-functions/utils/getString';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
+import { type ImportCallRecordingArtifactsResult } from 'src/logic-functions/types/ImportCallRecordingArtifactsResult';
type CallRecordingForArtifactsImport = SyncableCallRecording & {
externalBotId: string | undefined;
@@ -34,18 +30,6 @@ type CallRecordingForArtifactsImportNode = {
video?: FilesFieldValue | null;
};
-export type ImportCallRecordingArtifactsResult =
- | {
- status: 'imported';
- callRecordingId: string;
- outcome: 'call-recording-artifacts-imported';
- }
- | {
- status: 'skipped';
- callRecordingId: string;
- reason: string;
- };
-
// Job payloads can carry forged provider ids, so imports resolve only from the
// CallRecording's upload after verifying its ownership with Recall.
export const importCallRecordingArtifacts = async ({
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingMedia.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingMedia.ts
index dd9d24f31c0..e677799d529 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-media.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingMedia.ts
@@ -1,21 +1,16 @@
import { isNull, isUndefined } from '@sniptt/guards';
import { MetadataApiClient } from 'twenty-client-sdk/metadata';
-
-import {
- CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER,
- CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-import { COMPANION_MAX_MEDIA_FILE_SIZE_BYTES } from 'src/logic-functions/constants/companion-max-media-file-size-bytes';
-import {
- AUDIO_FILE_TOO_LARGE_FAILURE_REASON,
- VIDEO_FILE_TOO_LARGE_FAILURE_REASON,
-} from 'src/logic-functions/constants/media-file-too-large-failure-reasons';
-import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/put-media-download-body-to-upload-target.util';
-import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/extract-recall-media-urls.util';
-import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
-import { type CallRecordingMediaFile } from 'src/logic-functions/types/call-recording-media-file.type';
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/CALL_RECORDING_AUDIO_FIELD_UNIVERSAL_IDENTIFIER';
+import { CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER } from 'src/constants/CALL_RECORDING_VIDEO_FIELD_UNIVERSAL_IDENTIFIER';
+import { COMPANION_MAX_MEDIA_FILE_SIZE_BYTES } from 'src/logic-functions/constants/COMPANION_MAX_MEDIA_FILE_SIZE_BYTES';
+import { AUDIO_FILE_TOO_LARGE_FAILURE_REASON } from 'src/logic-functions/constants/AUDIO_FILE_TOO_LARGE_FAILURE_REASON';
+import { VIDEO_FILE_TOO_LARGE_FAILURE_REASON } from 'src/logic-functions/constants/VIDEO_FILE_TOO_LARGE_FAILURE_REASON';
+import { putMediaDownloadBodyToUploadTarget } from 'src/logic-functions/flows/utils/putMediaDownloadBodyToUploadTarget';
+import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/utils/extractRecallMediaUrls';
+import { getRecallRecording } from 'src/logic-functions/recall-api/utils/getRecallRecording';
+import { type CallRecordingMediaFile } from 'src/logic-functions/types/CallRecordingMediaFile';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
type CallRecordingMediaUpdateFields = Pick<
CallRecordingUpdateFields,
@@ -38,6 +33,7 @@ type MediaUploadTarget = {
};
const MEDIA_DOWNLOAD_TIMEOUT_MS = 120_000;
+
const MEDIA_FILE_FOLDER = 'FilesField';
const MEDIA_ARTIFACT_DESCRIPTORS = [
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingTranscript.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingTranscript.ts
index 98638738746..1ab91462f07 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/importCallRecordingTranscript.ts
@@ -1,14 +1,13 @@
import { isUndefined } from '@sniptt/guards';
-
-import { buildFailedTranscriptMarker } from 'src/logic-functions/domain/build-failed-transcript-marker.util';
-import { buildPendingTranscriptMarker } from 'src/logic-functions/domain/build-pending-transcript-marker.util';
-import { buildTranscriptFailureReason } from 'src/logic-functions/domain/build-transcript-failure-reason.util';
-import { parseTranscriptMarker } from 'src/logic-functions/domain/parse-transcript-marker.util';
-import { createAsyncRecallTranscript } from 'src/logic-functions/recall-api/create-async-recall-transcript.util';
-import { listRecallTranscripts } from 'src/logic-functions/recall-api/list-recall-transcripts.util';
-import { type RecallTranscriptSummary } from 'src/logic-functions/recall-api/recall-transcript-summary.type';
-import { downloadTranscript } from 'src/logic-functions/flows/download-transcript.util';
-import { type ImportCallRecordingTranscriptResult } from 'src/logic-functions/flows/import-call-recording-transcript-result.type';
+import { buildFailedTranscriptMarker } from 'src/logic-functions/domain/utils/buildFailedTranscriptMarker';
+import { buildPendingTranscriptMarker } from 'src/logic-functions/domain/utils/buildPendingTranscriptMarker';
+import { buildTranscriptFailureReason } from 'src/logic-functions/domain/utils/buildTranscriptFailureReason';
+import { parseTranscriptMarker } from 'src/logic-functions/domain/utils/parseTranscriptMarker';
+import { createAsyncRecallTranscript } from 'src/logic-functions/recall-api/utils/createAsyncRecallTranscript';
+import { listRecallTranscripts } from 'src/logic-functions/recall-api/utils/listRecallTranscripts';
+import { type RecallTranscriptSummary } from 'src/logic-functions/types/RecallTranscriptSummary';
+import { downloadTranscript } from 'src/logic-functions/flows/utils/downloadTranscript';
+import { type ImportCallRecordingTranscriptResult } from 'src/logic-functions/types/ImportCallRecordingTranscriptResult';
type CallRecordingTranscriptArtifactUpdateFields =
ImportCallRecordingTranscriptResult['updateData'];
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/persistCallRecordingProgress.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/persistCallRecordingProgress.ts
index 428d25f8b54..67cbec9d546 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/persist-call-recording-progress.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/persistCallRecordingProgress.ts
@@ -1,11 +1,9 @@
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-
-import { getAllowedPreviousCallRecordingStatuses } from 'src/logic-functions/domain/is-call-recording-status-downgrade.util';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { getAllowedPreviousCallRecordingStatuses } from 'src/logic-functions/domain/utils/getAllowedPreviousCallRecordingStatuses';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { completeAndChargeCallRecording } from 'src/logic-functions/flows/complete-and-charge-call-recording.util';
-import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { completeAndChargeCallRecording } from 'src/logic-functions/flows/utils/completeAndChargeCallRecording';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
export const persistCallRecordingProgress = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/putMediaDownloadBodyToUploadTarget.ts
similarity index 99%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/putMediaDownloadBodyToUploadTarget.ts
index f0e6619fbce..029be73ac6a 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/put-media-download-body-to-upload-target.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/putMediaDownloadBodyToUploadTarget.ts
@@ -14,7 +14,9 @@ type MediaUploadTarget = {
};
const MEDIA_UPLOAD_TIMEOUT_MS = 60 * 1000;
+
const HTTP_STATUS_OK_LOWER_BOUND = 200;
+
const HTTP_STATUS_OK_UPPER_BOUND = 300;
export const putMediaDownloadBodyToUploadTarget = async ({
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/readCachedSummary.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/readCachedSummary.ts
new file mode 100644
index 00000000000..8b76d6ea13e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/readCachedSummary.ts
@@ -0,0 +1,33 @@
+import { kv } from 'twenty-sdk/logic-function';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { type CachedSummary } from 'src/logic-functions/types/CachedSummary';
+
+export const readCachedSummary = async (
+ key: string,
+): Promise<CachedSummary | null> => {
+ const value = asRecord(await kv.get(key));
+ if (!value) return null;
+ if (value.status === 'RUNNING') {
+ const startedAt =
+ typeof value.startedAt === 'string' ? Date.parse(value.startedAt) : NaN;
+ return {
+ status:
+ Number.isFinite(startedAt) && Date.now() - startedAt < 15 * 60_000
+ ? 'RUNNING'
+ : 'INTERRUPTED',
+ };
+ }
+ if (value.status === 'EMPTY') return { status: 'EMPTY' };
+ if (
+ value.status === 'READY' &&
+ typeof value.markdown === 'string' &&
+ (value.outcome === 'generated' || value.outcome === 'not-summarizable')
+ ) {
+ return {
+ status: 'READY',
+ markdown: value.markdown,
+ outcome: value.outcome,
+ };
+ }
+ throw new Error('Stored summary result is invalid.');
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverDesktopRecordings.ts
similarity index 70%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverDesktopRecordings.ts
index 98cff2fcd1a..11a81fc6575 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-desktop-recordings.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverDesktopRecordings.ts
@@ -1,47 +1,13 @@
-import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/non-terminal-call-recording-statuses';
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { NON_TERMINAL_CALL_RECORDING_STATUSES } from 'src/logic-functions/constants/NON_TERMINAL_CALL_RECORDING_STATUSES';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
-import { getRecallRecording } from 'src/logic-functions/recall-api/get-recall-recording.util';
-import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { type SyncableCallRecording } from 'src/logic-functions/flows/sync-call-recording.util';
-import { updateCallRecording } from 'src/logic-functions/data/update-call-recording.util';
-import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util';
-
-export const hydrateDesktopRecordingTimestamps = async (
- client: CoreApiClient,
- recording: SyncableCallRecording,
-): Promise<void> => {
- if (
- !isDesktopAudioRecording(recording.companionSession) ||
- !recording.externalRecordingId ||
- (recording.startedAt && recording.endedAt)
- )
- return;
- const result = await getRecallRecording({
- externalRecordingId: recording.externalRecordingId,
- });
- if (!result.ok) throw new Error('Recall recording is not available yet.');
- const startedAt =
- recording.startedAt ??
- normalizeRecallTimestamp(getString(result.recording.started_at));
- const endedAt =
- recording.endedAt ??
- normalizeRecallTimestamp(getString(result.recording.completed_at));
- await updateCallRecording(client, {
- id: recording.id,
- data: {
- ...(startedAt ? { startedAt } : {}),
- ...(endedAt ? { endedAt } : {}),
- },
- });
- recording.startedAt = startedAt;
- recording.endedAt = endedAt;
-};
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
+import { getString } from 'src/logic-functions/utils/getString';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { updateCallRecording } from 'src/logic-functions/data/utils/updateCallRecording';
+import { enqueueCallRecordingArtifactsImport } from 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport';
export const recoverDesktopRecordings = async (
client: CoreApiClient,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverRecordingSummaries.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverRecordingSummaries.ts
index b4a6a81cbdf..5800a4e5c7d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/recover-recording-summaries.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/recoverRecordingSummaries.ts
@@ -1,7 +1,6 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { kv } from 'twenty-sdk/logic-function';
-
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
const SUMMARY_RECOVERY_CURSOR_KEY = 'companion-summary-recovery-cursor';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/syncCallRecording.ts
similarity index 80%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/flows/utils/syncCallRecording.ts
index 82a973be9aa..a1027a28896 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/sync-call-recording.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/flows/utils/syncCallRecording.ts
@@ -1,35 +1,17 @@
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { parseTranscriptMarker } from 'src/logic-functions/domain/parse-transcript-marker.util';
-import { isCallRecordingMediaImportComplete } from 'src/logic-functions/domain/is-call-recording-import-complete.util';
-import { CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { parseTranscriptMarker } from 'src/logic-functions/domain/utils/parseTranscriptMarker';
+import { isCallRecordingMediaImportComplete } from 'src/logic-functions/domain/utils/isCallRecordingMediaImportComplete';
+import { CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
import { isNonEmptyArray, isUndefined } from '@sniptt/guards';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-
-import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/is-unavailable-call-recording-status.util';
-import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/should-complete-call-recording-import.util';
-import { importCallRecordingMedia } from 'src/logic-functions/flows/import-call-recording-media.util';
-import { persistCallRecordingProgress } from 'src/logic-functions/flows/persist-call-recording-progress.util';
-import { importCallRecordingTranscript } from 'src/logic-functions/flows/import-call-recording-transcript.util';
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
-import { type FilesFieldValue } from 'src/logic-functions/types/files-field-value.type';
-
-export type SyncableCallRecording = {
- companionSession?: unknown;
- id: string;
- status: string | undefined;
- startedAt: string | undefined;
- endedAt: string | undefined;
- externalRecordingId: string | undefined;
- companionFailureReason: string | undefined;
- transcript: unknown;
- audio: FilesFieldValue | undefined;
- video: FilesFieldValue | undefined;
-};
-
-export type SyncCallRecordingResult = {
- updated: boolean;
- requestedTranscript: boolean;
-};
+import { isUnavailableCallRecordingStatus } from 'src/logic-functions/domain/utils/isUnavailableCallRecordingStatus';
+import { shouldCompleteCallRecordingImport } from 'src/logic-functions/domain/utils/shouldCompleteCallRecordingImport';
+import { importCallRecordingMedia } from 'src/logic-functions/flows/utils/importCallRecordingMedia';
+import { persistCallRecordingProgress } from 'src/logic-functions/flows/utils/persistCallRecordingProgress';
+import { importCallRecordingTranscript } from 'src/logic-functions/flows/utils/importCallRecordingTranscript';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
+import { type SyncableCallRecording } from 'src/logic-functions/types/SyncableCallRecording';
+import { type SyncCallRecordingResult } from 'src/logic-functions/types/SyncCallRecordingResult';
export const syncCallRecording = async ({
client,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts b/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts
deleted file mode 100644
index 9eca90dc793..00000000000
--- a/packages/twenty-apps/public/companion/src/logic-functions/import-call-recording-artifacts.ts
+++ /dev/null
@@ -1,50 +0,0 @@
-import { isUndefined } from '@sniptt/guards';
-import { CoreApiClient } from 'twenty-client-sdk/core';
-import { defineLogicFunction } from 'twenty-sdk/define';
-
-import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import {
- importCallRecordingArtifacts,
- type ImportCallRecordingArtifactsResult,
-} from 'src/logic-functions/flows/import-call-recording-artifacts.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-
-export const importCallRecordingArtifactsHandler = async (
- payload: unknown,
-): Promise<ImportCallRecordingArtifactsResult> => {
- const body = asRecord(payload);
- const callRecordingId = getString(body?.callRecordingId);
- const requestedAt = getString(body?.requestedAt);
-
- if (isUndefined(callRecordingId) || isUndefined(requestedAt)) {
- return {
- status: 'skipped',
- callRecordingId: callRecordingId ?? 'unknown',
- reason: 'invalid call recording artifacts import request',
- };
- }
-
- try {
- return await importCallRecordingArtifacts({
- client: new CoreApiClient(),
- request: { callRecordingId, requestedAt },
- });
- } catch (error) {
- throw buildStepError(
- `artifact import for call recording ${callRecordingId}`,
- error,
- );
- }
-};
-
-export default defineLogicFunction({
- universalIdentifier:
- IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
- name: 'import-call-recording-artifacts',
- description:
- 'Imports recording media and transcript artifacts as an enqueued job after a verified Recall webhook resolves the owning CallRecording.',
- timeoutSeconds: 250,
- handler: importCallRecordingArtifactsHandler,
-});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/importCallRecordingArtifacts.ts b/packages/twenty-apps/public/companion/src/logic-functions/importCallRecordingArtifacts.ts
new file mode 100644
index 00000000000..494c558b7b2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/importCallRecordingArtifacts.ts
@@ -0,0 +1,13 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { importCallRecordingArtifactsHandler } from 'src/logic-functions/utils/importCallRecordingArtifactsHandler';
+
+export default defineLogicFunction({
+ universalIdentifier:
+ IMPORT_CALL_RECORDING_ARTIFACTS_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'import-call-recording-artifacts',
+ description:
+ 'Imports recording media and transcript artifacts as an enqueued job after a verified Recall webhook resolves the owning CallRecording.',
+ timeoutSeconds: 250,
+ handler: importCallRecordingArtifactsHandler,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/processRecallWebhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/processRecallWebhook.ts
new file mode 100644
index 00000000000..04e08856bb2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/processRecallWebhook.ts
@@ -0,0 +1,13 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { processRecallWebhookHandler } from 'src/logic-functions/utils/processRecallWebhookHandler';
+
+export default defineLogicFunction({
+ universalIdentifier:
+ PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'process-recall-webhook',
+ description:
+ 'Updates the matching CallRecording lifecycle status from a verified Recall.ai webhook event.',
+ timeoutSeconds: 30,
+ handler: processRecallWebhookHandler,
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/getOwnedDesktopUpload.test.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/getOwnedDesktopUpload.test.ts
index 046da1c401e..557e957a183 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/get-owned-desktop-upload.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/getOwnedDesktopUpload.test.ts
@@ -1,18 +1,18 @@
import { beforeEach, expect, it, vi } from 'vitest';
-import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/get-owned-desktop-upload.util';
+import { getOwnedDesktopUpload } from 'src/logic-functions/recall-api/utils/getOwnedDesktopUpload';
const { request, workspaceId } = vi.hoisted(() => ({
request: vi.fn(),
workspaceId: vi.fn(),
}));
-vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+vi.mock('src/logic-functions/data/utils/getCurrentWorkspaceId', () => ({
getCurrentWorkspaceId: workspaceId,
}));
-vi.mock('src/logic-functions/recall-api/get-recall-api-config.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getRecallApiConfig', () => ({
getRecallApiConfig: () => ({ success: true, config: {} }),
}));
-vi.mock('src/logic-functions/recall-api/recall-bot-api-request.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/recallBotApiRequest', () => ({
recallBotApiRequest: request,
}));
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/parseRecallRetryAfterMs.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/parseRecallRetryAfterMs.test.ts
index f1979dd2f56..b176bedbcbd 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/parse-recall-retry-after.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/parseRecallRetryAfterMs.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { parseRecallRetryAfterMs } from 'src/logic-functions/recall-api/parse-recall-retry-after.util';
+import { parseRecallRetryAfterMs } from 'src/logic-functions/recall-api/utils/parseRecallRetryAfterMs';
const NOW_MS = Date.parse('2026-01-01T13:00:00.000Z');
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/verifyRecallWebhookSignature.test.ts
similarity index 98%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/verifyRecallWebhookSignature.test.ts
index 45a420c9a4e..fd24a4e738a 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/verify-recall-webhook-signature.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/__tests__/verifyRecallWebhookSignature.test.ts
@@ -2,7 +2,7 @@ import { createHmac } from 'crypto';
import { describe, expect, it } from 'vitest';
-import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/utils/verifyRecallWebhookSignature';
const SECRET_BYTES = Buffer.from('test-secret-abc123');
const SECRET = `whsec_${SECRET_BYTES.toString('base64')}`;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/createAsyncRecallTranscript.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/createAsyncRecallTranscript.ts
index 50144b12713..a69390f6ab9 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/create-async-recall-transcript.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/createAsyncRecallTranscript.ts
@@ -1,9 +1,8 @@
import { isString } from '@sniptt/guards';
-
-import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
-import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/get-recall-async-transcript-provider.util';
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
+import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/getRecallAsyncTranscriptProvider';
type CreateAsyncRecallTranscriptResult =
| { ok: true; transcriptId: string }
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractRecallMediaUrls.ts
similarity index 74%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractRecallMediaUrls.ts
index 4e0e89f3016..a6837a8f46f 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-recall-media-urls.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractRecallMediaUrls.ts
@@ -1,11 +1,7 @@
-import { asRecord } from '../utils/as-record.util';
-import { getRecordAtPath } from '../utils/get-record-at-path.util';
-import { getString } from '../utils/get-string.util';
-
-export type RecallMediaUrls = {
- videoUrl: string | undefined;
- audioUrl: string | undefined;
-};
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getRecordAtPath } from 'src/logic-functions/utils/getRecordAtPath';
+import { getString } from 'src/logic-functions/utils/getString';
+import { type RecallMediaUrls } from 'src/logic-functions/types/RecallMediaUrls';
// Pre-signed URLs expire within hours; always re-extract from a fresh GET /recording.
export const extractRecallMediaUrls = (
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook.ts
similarity index 51%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook.ts
index de17f979ea2..77f0e1faa54 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook.ts
@@ -1,6 +1,6 @@
-import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
-import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata';
+import { type RecallWebhookBody } from 'src/logic-functions/types/RecallWebhookBody';
+import { getString } from 'src/logic-functions/utils/getString';
export const extractTwentyWorkspaceIdFromRecallWebhook = (
body: RecallWebhookBody,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/fetchRecallListPages.ts
similarity index 87%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/fetchRecallListPages.ts
index b88aa2770ec..bdc85813079 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/fetch-recall-list-pages.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/fetchRecallListPages.ts
@@ -1,13 +1,8 @@
import { isString, isUndefined } from '@sniptt/guards';
-
-import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
-import { type RecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
-
-export type RecallListResponse = {
- next?: unknown;
- results?: unknown;
-};
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+import { type RecallApiConfig } from 'src/logic-functions/types/RecallApiConfig';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
+import { type RecallListResponse } from 'src/logic-functions/types/RecallListResponse';
export const fetchRecallListPages = async <TItem>({
config,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getOwnedDesktopUpload.ts
similarity index 86%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getOwnedDesktopUpload.ts
index ab621eeb42d..c370e553c1c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-owned-desktop-upload.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getOwnedDesktopUpload.ts
@@ -1,9 +1,9 @@
-import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
-import { isDesktopAudioRecording } from 'src/logic-functions/domain/is-desktop-audio-recording.util';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/utils/getCurrentWorkspaceId';
+import { isDesktopAudioRecording } from 'src/logic-functions/domain/utils/isDesktopAudioRecording';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getString } from 'src/logic-functions/utils/getString';
type OwnedDesktopUpload = {
id: string;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallApiConfig.ts
similarity index 83%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallApiConfig.ts
index ce3161fd3d0..90d796b6c21 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-api-config.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallApiConfig.ts
@@ -1,15 +1,10 @@
import { isUndefined } from '@sniptt/guards';
-
-import { DEFAULT_RECALL_REGION } from 'src/logic-functions/constants/default-recall-region';
-import { RECALL_API_KEY_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-api-key-env-var-name';
-import { RECALL_REGION_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-region-env-var-name';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { normalizeOptionalString } from 'src/logic-functions/utils/normalize-optional-string.util';
-
-export type RecallApiConfig = {
- apiKey: string;
- baseUrl: string;
-};
+import { DEFAULT_RECALL_REGION } from 'src/logic-functions/constants/DEFAULT_RECALL_REGION';
+import { RECALL_API_KEY_ENV_VAR_NAME } from 'src/logic-functions/constants/RECALL_API_KEY_ENV_VAR_NAME';
+import { RECALL_REGION_ENV_VAR_NAME } from 'src/logic-functions/constants/RECALL_REGION_ENV_VAR_NAME';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { normalizeOptionalString } from 'src/logic-functions/utils/normalizeOptionalString';
+import { type RecallApiConfig } from 'src/logic-functions/types/RecallApiConfig';
export const getRecallApiConfig = ():
| {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallRecording.ts
similarity index 90%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallRecording.ts
index 27d86e801cc..deb656624b4 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-recording.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallRecording.ts
@@ -1,6 +1,6 @@
-import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
type GetRecallRecordingResult =
| { ok: true; recording: Record<string, unknown> }
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata.ts
similarity index 69%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata.ts
index 8b35ea4f3c3..27739165c62 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata.ts
@@ -1,6 +1,6 @@
-import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getRecordAtPath } from 'src/logic-functions/utils/get-record-at-path.util';
+import { type RecallWebhookBody } from 'src/logic-functions/types/RecallWebhookBody';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getRecordAtPath } from 'src/logic-functions/utils/getRecordAtPath';
// Recall delivers bot metadata under several body shapes per event family; this is the single reader of all of them.
export const getRecallWebhookBotMetadata = (
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/isRetryableRecallApiStatus.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/isRetryableRecallApiStatus.ts
new file mode 100644
index 00000000000..996ebdd1aa1
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/isRetryableRecallApiStatus.ts
@@ -0,0 +1,10 @@
+const RECALL_STATUS_RATE_LIMITED = 429;
+
+const RECALL_STATUS_CONFLICT = 409;
+
+const isRecallServerError = (status: number): boolean => status >= 500;
+
+export const isRetryableRecallApiStatus = (status: number): boolean =>
+ status === RECALL_STATUS_RATE_LIMITED ||
+ status === RECALL_STATUS_CONFLICT ||
+ isRecallServerError(status);
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/listRecallTranscripts.ts
similarity index 85%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/listRecallTranscripts.ts
index a613ea4f5e6..281db1bac35 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/list-recall-transcripts.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/listRecallTranscripts.ts
@@ -1,14 +1,11 @@
import { isArray, isUndefined } from '@sniptt/guards';
-
-import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-import {
- fetchRecallListPages,
- type RecallListResponse,
-} from 'src/logic-functions/recall-api/fetch-recall-list-pages.util';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { type RecallTranscriptSummary } from 'src/logic-functions/recall-api/recall-transcript-summary.type';
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getString } from 'src/logic-functions/utils/getString';
+import { fetchRecallListPages } from 'src/logic-functions/recall-api/utils/fetchRecallListPages';
+import { type RecallListResponse } from 'src/logic-functions/types/RecallListResponse';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { type RecallTranscriptSummary } from 'src/logic-functions/types/RecallTranscriptSummary';
type ListRecallTranscriptsResult =
| { ok: true; transcripts: RecallTranscriptSummary[] }
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/normalize-recall-timestamp.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/normalizeRecallTimestamp.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/normalize-recall-timestamp.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/normalizeRecallTimestamp.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallRetryAfterMs.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallRetryAfterMs.ts
index 8a92822e70a..0ed385756f4 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-retry-after.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallRetryAfterMs.ts
@@ -1,4 +1,4 @@
-import { RECALL_API_MAX_RETRY_AFTER_MS } from '../constants/recall-api-max-retry-after-ms';
+import { RECALL_API_MAX_RETRY_AFTER_MS } from 'src/logic-functions/constants/RECALL_API_MAX_RETRY_AFTER_MS';
export const parseRecallRetryAfterMs = (
retryAfterHeader: string | null,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallWebhookEvent.ts
similarity index 74%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallWebhookEvent.ts
index 5d7c664d544..074ad87e894 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/parse-recall-webhook-event.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/parseRecallWebhookEvent.ts
@@ -1,31 +1,11 @@
import { isUndefined } from '@sniptt/guards';
-
-import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/get-recall-webhook-bot-metadata.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getRecordAtPath } from 'src/logic-functions/utils/get-record-at-path.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/normalize-recall-timestamp.util';
-
-export type RecallWebhookBody = {
- event?: unknown;
- type?: unknown;
- data?: unknown;
- bot?: unknown;
-};
-
-export type RecallWebhookEvent = {
- event: string;
- statusCode: string | undefined;
- statusSubCode: string | undefined;
- statusTimestamp: string | undefined;
- externalBotId: string | undefined;
- externalSdkUploadId?: string;
- externalRecordingId: string | undefined;
- callRecordingIdFromMetadata: string | undefined;
- recordingStartedAt: string | undefined;
- recordingEndedAt: string | undefined;
- transcriptId: string | undefined;
-};
+import { getRecallWebhookBotMetadata } from 'src/logic-functions/recall-api/utils/getRecallWebhookBotMetadata';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getRecordAtPath } from 'src/logic-functions/utils/getRecordAtPath';
+import { getString } from 'src/logic-functions/utils/getString';
+import { normalizeRecallTimestamp } from 'src/logic-functions/recall-api/utils/normalizeRecallTimestamp';
+import { type RecallWebhookBody } from 'src/logic-functions/types/RecallWebhookBody';
+import { type RecallWebhookEvent } from 'src/logic-functions/types/RecallWebhookEvent';
// The only reader of raw webhook payloads; Recall delivers several body shapes per event family.
export const parseRecallWebhookEvent = (
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/recallBotApiRequest.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/recallBotApiRequest.ts
index bd2cbf7e3cb..ad0ace872c6 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-bot-api-request.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/recallBotApiRequest.ts
@@ -1,11 +1,10 @@
-import { RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS } from '../constants/recall-api-max-in-process-retry-wait-ms';
-import { RECALL_API_MAX_ATTEMPTS } from '../constants/recall-api-max-attempts';
+import { RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS } from 'src/logic-functions/constants/RECALL_API_MAX_IN_PROCESS_RETRY_WAIT_MS';
+import { RECALL_API_MAX_ATTEMPTS } from 'src/logic-functions/constants/RECALL_API_MAX_ATTEMPTS';
+import { parseRecallRetryAfterMs } from 'src/logic-functions/recall-api/utils/parseRecallRetryAfterMs';
+import { isRetryableRecallApiStatus } from 'src/logic-functions/recall-api/utils/isRetryableRecallApiStatus';
+import { resolveRecallApiRetryDelayMs } from 'src/logic-functions/recall-api/utils/resolveRecallApiRetryDelayMs';
+
type RecallApiConfig = { apiKey: string; baseUrl: string };
-import { parseRecallRetryAfterMs } from './parse-recall-retry-after.util';
-import {
- isRetryableRecallApiStatus,
- resolveRecallApiRetryDelayMs,
-} from './recall-api-retry-policy.util';
type RecallBotApiRequestArgs = {
config: RecallApiConfig;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/resolveRecallApiRetryDelayMs.ts
similarity index 56%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/resolveRecallApiRetryDelayMs.ts
index d8bdc419e9a..41c3ccadc86 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-api-retry-policy.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/resolveRecallApiRetryDelayMs.ts
@@ -1,17 +1,8 @@
-import { RECALL_API_ADHOC_POOL_RETRY_DELAY_MS } from '../constants/recall-api-adhoc-pool-retry-delay-ms';
-import { RECALL_API_RETRY_DELAY_MS } from '../constants/recall-api-retry-delay-ms';
+import { RECALL_API_ADHOC_POOL_RETRY_DELAY_MS } from 'src/logic-functions/constants/RECALL_API_ADHOC_POOL_RETRY_DELAY_MS';
+import { RECALL_API_RETRY_DELAY_MS } from 'src/logic-functions/constants/RECALL_API_RETRY_DELAY_MS';
-const RECALL_STATUS_RATE_LIMITED = 429;
-const RECALL_STATUS_CONFLICT = 409;
const RECALL_STATUS_ADHOC_POOL_EXHAUSTED = 507;
-const isRecallServerError = (status: number): boolean => status >= 500;
-
-export const isRetryableRecallApiStatus = (status: number): boolean =>
- status === RECALL_STATUS_RATE_LIMITED ||
- status === RECALL_STATUS_CONFLICT ||
- isRecallServerError(status);
-
export const resolveRecallApiRetryDelayMs = ({
retryAfterMs,
status,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/retrieveRecallTranscript.ts
similarity index 81%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/retrieveRecallTranscript.ts
index a096da7c62b..6c576791c0a 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/retrieve-recall-transcript.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/retrieveRecallTranscript.ts
@@ -1,16 +1,10 @@
import { isUndefined } from '@sniptt/guards';
-
-import { type RecallBotOperationFailure } from 'src/logic-functions/types/recall-bot-operation-result.type';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
-import { recallBotApiRequest } from 'src/logic-functions/recall-api/recall-bot-api-request.util';
-
-export type RecallTranscriptDetails = {
- downloadUrl: string | undefined;
- statusCode: string | undefined;
- statusSubCode: string | undefined;
-};
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { getString } from 'src/logic-functions/utils/getString';
+import { recallBotApiRequest } from 'src/logic-functions/recall-api/utils/recallBotApiRequest';
+import { type RecallTranscriptDetails } from 'src/logic-functions/types/RecallTranscriptDetails';
type RetrieveRecallTranscriptResult =
| { ok: true; transcript: RecallTranscriptDetails }
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/verifyRecallWebhookSignature.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/verifyRecallWebhookSignature.ts
index 2ff96cde799..eaad8912444 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/verify-recall-webhook-signature.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recall-api/utils/verifyRecallWebhookSignature.ts
@@ -1,8 +1,8 @@
import { createHmac, timingSafeEqual } from 'crypto';
-
import { isNonEmptyString } from '@sniptt/guards';
const RECALL_WEBHOOK_SECRET_PREFIX = 'whsec_';
+
const RECALL_WEBHOOK_TIMESTAMP_TOLERANCE_SECONDS = 5 * 60;
export const verifyRecallWebhookSignature = ({
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recallWebhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/recallWebhook.ts
new file mode 100644
index 00000000000..e40c0eb1b7a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/recallWebhook.ts
@@ -0,0 +1,22 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { recallWebhookRouteHandler } from 'src/logic-functions/utils/recallWebhookRouteHandler';
+
+export default defineLogicFunction({
+ universalIdentifier: RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'recall-webhook',
+ description:
+ 'Verifies Recall.ai webhook signatures and resolves the target workspace for the matching CallRecording update.',
+ timeoutSeconds: 30,
+ handler: recallWebhookRouteHandler,
+ serverRouteTriggerSettings: {
+ forwardedRequestHeaders: [
+ 'webhook-id',
+ 'webhook-timestamp',
+ 'webhook-signature',
+ 'svix-id',
+ 'svix-timestamp',
+ 'svix-signature',
+ ],
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/reconcileDesktopRecordings.ts b/packages/twenty-apps/public/companion/src/logic-functions/reconcileDesktopRecordings.ts
new file mode 100644
index 00000000000..4dac5cf2e94
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/reconcileDesktopRecordings.ts
@@ -0,0 +1,15 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { reconcileDesktopRecordingsHandler } from 'src/logic-functions/utils/reconcileDesktopRecordingsHandler';
+
+const RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER =
+ '2b1f250a-1409-4f7e-8e9b-66ad67e6b38c';
+
+export default defineLogicFunction({
+ universalIdentifier: RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER,
+ name: 'reconcile-desktop-recordings',
+ description:
+ 'Recovers desktop uploads and artifact imports after missed Recall webhooks.',
+ timeoutSeconds: 250,
+ handler: reconcileDesktopRecordingsHandler,
+ cronTriggerSettings: { pattern: '*/5 * * * *' },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/summarizeCallRecording.ts b/packages/twenty-apps/public/companion/src/logic-functions/summarizeCallRecording.ts
new file mode 100644
index 00000000000..4c83117e13f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/summarizeCallRecording.ts
@@ -0,0 +1,18 @@
+import { defineLogicFunction } from 'twenty-sdk/define';
+import { SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { summarizeCallRecordingHandler } from 'src/logic-functions/utils/summarizeCallRecordingHandler';
+
+const CALL_RECORDING_OBJECT_NAME = 'callRecording';
+
+export default defineLogicFunction({
+ universalIdentifier:
+ SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
+ name: 'summarize-call-recording',
+ description:
+ 'Generates an AI recap of a recording transcript and stores it on the Call Recording summary field when the transcript is filled.',
+ timeoutSeconds: 60 * 4,
+ handler: summarizeCallRecordingHandler,
+ databaseEventTriggerSettings: {
+ eventName: `${CALL_RECORDING_OBJECT_NAME}.updated`,
+ },
+});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/CachedSummary.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CachedSummary.ts
new file mode 100644
index 00000000000..ed860dc2ac5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/CachedSummary.ts
@@ -0,0 +1,9 @@
+export type CachedSummary =
+ | {
+ status: 'READY';
+ markdown: string;
+ outcome: 'generated' | 'not-summarizable';
+ }
+ | { status: 'EMPTY' }
+ | { status: 'RUNNING' }
+ | { status: 'INTERRUPTED' };
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CalendarEventRecord.ts
similarity index 72%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CalendarEventRecord.ts
index 1a4614958c5..18fde5c44af 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/types/calendar-event-record.type.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/CalendarEventRecord.ts
@@ -1,4 +1,4 @@
-import { type CompanionPolicyCalendarEventInput } from 'src/logic-functions/types/companion-policy-calendar-event-input.type';
+import { type CompanionPolicyCalendarEventInput } from 'src/logic-functions/types/CompanionPolicyCalendarEventInput';
export type CalendarEventRecord = CompanionPolicyCalendarEventInput & {
title: string | undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-artifacts-import-request.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingArtifactsImportRequest.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-artifacts-import-request.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingArtifactsImportRequest.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingCharge.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingCharge.ts
new file mode 100644
index 00000000000..76eaf7e51c1
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingCharge.ts
@@ -0,0 +1,4 @@
+export type CallRecordingCharge = {
+ creditsUsedMicro: number;
+ quantityMinutes: number;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-media-file.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingMediaFile.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-media-file.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingMediaFile.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingRecord.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingRecord.ts
index c80585f5483..b12ace87d26 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-record.type.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingRecord.ts
@@ -1,4 +1,4 @@
-import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
+import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/CallRecordingRequestStatus';
// Domain read shape: absence is always undefined; null lives only on wire types.
export type CallRecordingRecord = {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-summary.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingSummary.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-summary.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingSummary.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingUpdateFields.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingUpdateFields.ts
index ac2c0a4633d..1a8d6b95d07 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/types/call-recording-update-fields.type.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/CallRecordingUpdateFields.ts
@@ -1,8 +1,8 @@
-import { type DesktopRecordingSession } from 'src/logic-functions/types/desktop-recording-session.type';
-import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/call-recording-request-status';
-import { type CallRecordingStatus } from 'src/logic-functions/constants/call-recording-status';
-import { type CallRecordingMediaFile } from 'src/logic-functions/types/call-recording-media-file.type';
-import { type CallRecordingSummary } from 'src/logic-functions/types/call-recording-summary.type';
+import { type DesktopRecordingSession } from 'src/logic-functions/types/DesktopRecordingSession';
+import { type CallRecordingRequestStatus } from 'src/logic-functions/constants/CallRecordingRequestStatus';
+import { type CallRecordingStatus } from 'src/logic-functions/constants/CallRecordingStatus';
+import { type CallRecordingMediaFile } from 'src/logic-functions/types/CallRecordingMediaFile';
+import { type CallRecordingSummary } from 'src/logic-functions/types/CallRecordingSummary';
export type CallRecordingUpdateFields = Partial<{
// null clears a previously synced title when the calendar title disappears.
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/companion-policy-calendar-event-input.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/CompanionPolicyCalendarEventInput.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/companion-policy-calendar-event-input.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/CompanionPolicyCalendarEventInput.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/ConnectionPage.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/ConnectionPage.ts
new file mode 100644
index 00000000000..99d34c6cdfa
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/ConnectionPage.ts
@@ -0,0 +1,7 @@
+export type ConnectionPage<TNode> = {
+ pageInfo?: {
+ hasNextPage?: boolean | null;
+ endCursor?: string | null;
+ } | null;
+ edges?: Array<{ node: TNode }> | null;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/desktop-recording-session.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/DesktopRecordingSession.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/desktop-recording-session.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/DesktopRecordingSession.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/DownloadTranscriptResult.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/DownloadTranscriptResult.ts
new file mode 100644
index 00000000000..74b22f91608
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/DownloadTranscriptResult.ts
@@ -0,0 +1,6 @@
+export type DownloadTranscriptResult =
+ | { outcome: 'filled'; content: unknown }
+ | { outcome: 'failed'; subCode: string | null }
+ | { outcome: 'pending' }
+ | { outcome: 'deleted' }
+ | { outcome: 'error'; errorMessage: string };
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/files-field-value.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/FilesFieldValue.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/files-field-value.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/FilesFieldValue.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/GenerateCallRecordingSummaryResult.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/generate-call-recording-summary-result.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/GenerateCallRecordingSummaryResult.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingArtifactsResult.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingArtifactsResult.ts
new file mode 100644
index 00000000000..b73c7be96b0
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingArtifactsResult.ts
@@ -0,0 +1,11 @@
+export type ImportCallRecordingArtifactsResult =
+ | {
+ status: 'imported';
+ callRecordingId: string;
+ outcome: 'call-recording-artifacts-imported';
+ }
+ | {
+ status: 'skipped';
+ callRecordingId: string;
+ reason: string;
+ };
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingTranscriptResult.ts
similarity index 88%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingTranscriptResult.ts
index 256ee5734ba..065bd0641d6 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/import-call-recording-transcript-result.type.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/ImportCallRecordingTranscriptResult.ts
@@ -1,4 +1,4 @@
-import { type CallRecordingUpdateFields } from 'src/logic-functions/types/call-recording-update-fields.type';
+import { type CallRecordingUpdateFields } from 'src/logic-functions/types/CallRecordingUpdateFields';
type CallRecordingTranscriptArtifactUpdateFields = Pick<
CallRecordingUpdateFields,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/MediaFileTooLargeMarkers.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/MediaFileTooLargeMarkers.ts
new file mode 100644
index 00000000000..2063f70c62f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/MediaFileTooLargeMarkers.ts
@@ -0,0 +1,4 @@
+export type MediaFileTooLargeMarkers = {
+ audioFileTooLarge: boolean;
+ videoFileTooLarge: boolean;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallApiConfig.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallApiConfig.ts
new file mode 100644
index 00000000000..2a866a4f1d5
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallApiConfig.ts
@@ -0,0 +1,4 @@
+export type RecallApiConfig = {
+ apiKey: string;
+ baseUrl: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallAsyncTranscriptProvider.ts
similarity index 73%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/RecallAsyncTranscriptProvider.ts
index 1d98e6661b2..13f620a520e 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-async-transcript-provider.type.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallAsyncTranscriptProvider.ts
@@ -1,4 +1,4 @@
-import { type RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/recall-async-transcript-providers';
+import { type RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/RECALL_ASYNC_TRANSCRIPT_PROVIDERS';
export type RecallAsyncTranscriptProvider =
keyof typeof RECALL_ASYNC_TRANSCRIPT_PROVIDERS;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotOperationFailure.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotOperationFailure.ts
new file mode 100644
index 00000000000..57a7f6bb277
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotOperationFailure.ts
@@ -0,0 +1,6 @@
+export type RecallBotOperationFailure = {
+ ok: false;
+ // null = no HTTP response (network failure), distinct from any status code.
+ status: number | null;
+ errorMessage: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotRemovalResult.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotRemovalResult.ts
new file mode 100644
index 00000000000..8db1b7b2a3f
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotRemovalResult.ts
@@ -0,0 +1,7 @@
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+
+export type RecallBotRemovalResult =
+ | {
+ ok: true;
+ }
+ | RecallBotOperationFailure;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotScheduleResult.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotScheduleResult.ts
new file mode 100644
index 00000000000..3d9d6d80841
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallBotScheduleResult.ts
@@ -0,0 +1,8 @@
+import { type RecallBotOperationFailure } from 'src/logic-functions/types/RecallBotOperationFailure';
+
+export type RecallBotScheduleResult =
+ | {
+ ok: true;
+ externalBotId: string;
+ }
+ | RecallBotOperationFailure;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallListResponse.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallListResponse.ts
new file mode 100644
index 00000000000..8d44b180008
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallListResponse.ts
@@ -0,0 +1,4 @@
+export type RecallListResponse = {
+ next?: unknown;
+ results?: unknown;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallMediaUrls.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallMediaUrls.ts
new file mode 100644
index 00000000000..1aa59323b25
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallMediaUrls.ts
@@ -0,0 +1,4 @@
+export type RecallMediaUrls = {
+ videoUrl: string | undefined;
+ audioUrl: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallTranscriptDetails.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallTranscriptDetails.ts
new file mode 100644
index 00000000000..f63144b8a93
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallTranscriptDetails.ts
@@ -0,0 +1,5 @@
+export type RecallTranscriptDetails = {
+ downloadUrl: string | undefined;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-transcript-summary.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallTranscriptSummary.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/recall-transcript-summary.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/RecallTranscriptSummary.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookBody.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookBody.ts
new file mode 100644
index 00000000000..f5d5ec7f4a2
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookBody.ts
@@ -0,0 +1,6 @@
+export type RecallWebhookBody = {
+ event?: unknown;
+ type?: unknown;
+ data?: unknown;
+ bot?: unknown;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookEvent.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookEvent.ts
new file mode 100644
index 00000000000..cd27d89fe34
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecallWebhookEvent.ts
@@ -0,0 +1,13 @@
+export type RecallWebhookEvent = {
+ event: string;
+ statusCode: string | undefined;
+ statusSubCode: string | undefined;
+ statusTimestamp: string | undefined;
+ externalBotId: string | undefined;
+ externalSdkUploadId?: string;
+ externalRecordingId: string | undefined;
+ callRecordingIdFromMetadata: string | undefined;
+ recordingStartedAt: string | undefined;
+ recordingEndedAt: string | undefined;
+ transcriptId: string | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingParticipant.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingParticipant.ts
new file mode 100644
index 00000000000..945dc39a046
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingParticipant.ts
@@ -0,0 +1,5 @@
+export type RecordingParticipant = {
+ id: string;
+ name: string;
+ avatarUrl: string | null;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingViewer.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingViewer.ts
new file mode 100644
index 00000000000..0117114b977
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingViewer.ts
@@ -0,0 +1,5 @@
+export type RecordingViewer = {
+ emails: string[];
+ name: string;
+ workspaceMemberId?: string;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingWithParticipants.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingWithParticipants.ts
new file mode 100644
index 00000000000..9f930108e02
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/RecordingWithParticipants.ts
@@ -0,0 +1,5 @@
+export type RecordingWithParticipants = {
+ id: string;
+ calendarEventId?: string | null;
+ transcript?: unknown;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/StepFailure.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/StepFailure.ts
new file mode 100644
index 00000000000..237d1f5892b
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/StepFailure.ts
@@ -0,0 +1 @@
+export type StepFailure = { error: string };
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/SyncCallRecordingResult.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/SyncCallRecordingResult.ts
new file mode 100644
index 00000000000..7d3a93fa5b4
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/SyncCallRecordingResult.ts
@@ -0,0 +1,4 @@
+export type SyncCallRecordingResult = {
+ updated: boolean;
+ requestedTranscript: boolean;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/SyncableCallRecording.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/SyncableCallRecording.ts
new file mode 100644
index 00000000000..78c9d52a91e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/SyncableCallRecording.ts
@@ -0,0 +1,14 @@
+import { type FilesFieldValue } from 'src/logic-functions/types/FilesFieldValue';
+
+export type SyncableCallRecording = {
+ companionSession?: unknown;
+ id: string;
+ status: string | undefined;
+ startedAt: string | undefined;
+ endedAt: string | undefined;
+ externalRecordingId: string | undefined;
+ companionFailureReason: string | undefined;
+ transcript: unknown;
+ audio: FilesFieldValue | undefined;
+ video: FilesFieldValue | undefined;
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/transcript-marker.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/TranscriptMarker.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/types/transcript-marker.type.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/TranscriptMarker.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/CallRecordingCharge.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/CallRecordingCharge.test.ts
index 7abf925f9e5..a9f6fd47a33 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/compute-call-recording-charge.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/CallRecordingCharge.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { computeCallRecordingCharge } from 'src/logic-functions/domain/compute-call-recording-charge.util';
+import { computeCallRecordingCharge } from 'src/logic-functions/domain/utils/computeCallRecordingCharge';
describe('computeCallRecordingCharge', () => {
it('charges one credit for a one-hour recording', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ConnectionPage.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ConnectionPage.test.ts
index ea33f725c18..1d24973528b 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/data/__tests__/fetch-all-nodes.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ConnectionPage.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from 'vitest';
-import { fetchAllNodes } from 'src/logic-functions/data/fetch-all-nodes.util';
+import { fetchAllNodes } from 'src/logic-functions/data/utils/fetchAllNodes';
describe('fetchAllNodes', () => {
it('collects nodes across pages until hasNextPage is false', async () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/DownloadTranscriptResult.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/DownloadTranscriptResult.test.ts
index d77602018cb..906fe106f96 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/download-transcript.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/DownloadTranscriptResult.test.ts
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import { downloadTranscript } from 'src/logic-functions/flows/download-transcript.util';
+import { downloadTranscript } from 'src/logic-functions/flows/utils/downloadTranscript';
const TRANSCRIPT_DOWNLOAD_URL =
'https://recall-transcripts.example.com/transcript-1';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ImportCallRecordingArtifactsResult.test.ts
similarity index 86%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ImportCallRecordingArtifactsResult.test.ts
index fec2e5dbb76..88d3b78049d 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/import-call-recording-artifacts.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/ImportCallRecordingArtifactsResult.test.ts
@@ -1,6 +1,6 @@
import { beforeEach, expect, it, vi } from 'vitest';
import { type CoreApiClient } from 'twenty-client-sdk/core';
-import { importCallRecordingArtifacts } from '../import-call-recording-artifacts.util';
+import { importCallRecordingArtifacts } from 'src/logic-functions/flows/utils/importCallRecordingArtifacts';
const { claim, release, hydrate, sync, ownedUpload } = vi.hoisted(() => ({
ownedUpload: vi.fn(),
@@ -10,19 +10,29 @@ const { claim, release, hydrate, sync, ownedUpload } = vi.hoisted(() => ({
sync: vi.fn(),
}));
vi.mock(
- 'src/logic-functions/data/claim-call-recording-artifacts-import.util',
+ 'src/logic-functions/data/utils/claimCallRecordingArtifactsImport',
() => ({
claimCallRecordingArtifactsImport: claim,
releaseCallRecordingArtifactsImportClaim: release,
}),
);
-vi.mock('src/logic-functions/flows/recover-desktop-recordings.util', () => ({
- hydrateDesktopRecordingTimestamps: hydrate,
-}));
-vi.mock('src/logic-functions/flows/sync-call-recording.util', () => ({
+vi.mock(
+ 'src/logic-functions/data/utils/releaseCallRecordingArtifactsImportClaim',
+ () => ({
+ claimCallRecordingArtifactsImport: claim,
+ releaseCallRecordingArtifactsImportClaim: release,
+ }),
+);
+vi.mock(
+ 'src/logic-functions/flows/utils/hydrateDesktopRecordingTimestamps',
+ () => ({
+ hydrateDesktopRecordingTimestamps: hydrate,
+ }),
+);
+vi.mock('src/logic-functions/flows/utils/syncCallRecording', () => ({
syncCallRecording: sync,
}));
-vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getOwnedDesktopUpload', () => ({
getOwnedDesktopUpload: ownedUpload,
}));
const query = vi.fn();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/MediaFileTooLargeMarkers.test.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/MediaFileTooLargeMarkers.test.ts
index 3b86d03283d..5812d9a46fb 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/domain/__tests__/parse-media-file-too-large-markers.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/MediaFileTooLargeMarkers.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/parse-media-file-too-large-markers.util';
+import { parseMediaFileTooLargeMarkers } from 'src/logic-functions/domain/utils/parseMediaFileTooLargeMarkers';
describe('parseMediaFileTooLargeMarkers', () => {
it('parses single-artifact markers', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecallMediaUrls.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecallMediaUrls.test.ts
index 1f254c3cc9d..a7e30e8df35 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-api/__tests__/extract-recall-media-urls.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecallMediaUrls.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/extract-recall-media-urls.util';
+import { extractRecallMediaUrls } from 'src/logic-functions/recall-api/utils/extractRecallMediaUrls';
describe('extractRecallMediaUrls', () => {
it('reads both download urls flat from the v1.11 media shortcuts', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecordingParticipant.test.ts
similarity index 99%
rename from packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecordingParticipant.test.ts
index 2a42d0064de..4a350c085f5 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/flows/__tests__/get-recording-participants.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/types/__tests__/RecordingParticipant.test.ts
@@ -1,7 +1,7 @@
import { type CoreApiClient } from 'twenty-client-sdk/core';
import { beforeEach, expect, it, vi } from 'vitest';
-import { getRecordingParticipants } from 'src/logic-functions/flows/get-recording-participants.util';
+import { getRecordingParticipants } from 'src/logic-functions/flows/utils/getRecordingParticipants';
const query = vi.fn();
const client = { query } as unknown as CoreApiClient;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts b/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts
deleted file mode 100644
index 3279288413f..00000000000
--- a/packages/twenty-apps/public/companion/src/logic-functions/types/recall-bot-operation-result.type.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-export type RecallBotOperationFailure = {
- ok: false;
- // null = no HTTP response (network failure), distinct from any status code.
- status: number | null;
- errorMessage: string;
-};
-
-export type RecallBotScheduleResult =
- | {
- ok: true;
- externalBotId: string;
- }
- | RecallBotOperationFailure;
-
-export type RecallBotRemovalResult =
- | {
- ok: true;
- }
- | RecallBotOperationFailure;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/desktopCompanionHandler.test.ts
similarity index 87%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/desktopCompanionHandler.test.ts
index a2d3d7cec66..f3e772f81f4 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/desktop-companion.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/desktopCompanionHandler.test.ts
@@ -1,6 +1,6 @@
import { type RoutePayload } from 'twenty-sdk/define';
import { beforeEach, expect, it, vi } from 'vitest';
-import { desktopCompanionHandler } from 'src/logic-functions/desktop-companion';
+import { desktopCompanionHandler } from 'src/logic-functions/utils/desktopCompanionHandler';
const { clients, agenda } = vi.hoisted(() => ({
clients: vi.fn(),
@@ -13,7 +13,7 @@ vi.mock('twenty-client-sdk/core', () => ({
}
},
}));
-vi.mock('src/logic-functions/flows/get-desktop-companion-agenda.util', () => ({
+vi.mock('src/logic-functions/flows/utils/getDesktopCompanionAgenda', () => ({
getDesktopCompanionAgenda: agenda,
}));
beforeEach(() => vi.clearAllMocks());
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/formatSecondsAsClockTimestamp.test.ts
similarity index 96%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/formatSecondsAsClockTimestamp.test.ts
index 47510ea9258..85b55a04fb4 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/format-seconds-as-clock-timestamp.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/formatSecondsAsClockTimestamp.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/format-seconds-as-clock-timestamp.util';
+import { formatSecondsAsClockTimestamp } from 'src/logic-functions/utils/formatSecondsAsClockTimestamp';
describe('formatSecondsAsClockTimestamp', () => {
it('formats sub-hour durations as minutes and padded seconds', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBatches.test.ts
similarity index 87%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBatches.test.ts
index 2e06c615b87..131f6ecdf26 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-batches.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBatches.test.ts
@@ -1,6 +1,6 @@
import { describe, expect, it } from 'vitest';
-import { getBatches } from 'src/logic-functions/utils/get-batches.util';
+import { getBatches } from 'src/logic-functions/utils/getBatches';
describe('getBatches', () => {
it('returns no batches for an empty list', () => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBooleanApplicationVariableValue.test.ts
similarity index 97%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBooleanApplicationVariableValue.test.ts
index 8125dabb71f..c8c0d2ec696 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-boolean-application-variable-value.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getBooleanApplicationVariableValue.test.ts
@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/get-boolean-application-variable-value.util';
+import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/getBooleanApplicationVariableValue';
const BOOLEAN_APPLICATION_VARIABLE_NAME = 'TEST_BOOLEAN_APPLICATION_VARIABLE';
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getCompanionAdditionalSummaryPrompt.test.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getCompanionAdditionalSummaryPrompt.test.ts
index 15fb4cb1503..fb079ded702 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-companion-additional-summary-prompt.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getCompanionAdditionalSummaryPrompt.test.ts
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-additional-summary-prompt-env-var-name';
-import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/get-companion-additional-summary-prompt.util';
+import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME';
+import { getCompanionAdditionalSummaryPrompt } from 'src/logic-functions/utils/getCompanionAdditionalSummaryPrompt';
describe('getCompanionAdditionalSummaryPrompt', () => {
beforeEach(() => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getRecallAsyncTranscriptProvider.test.ts
similarity index 87%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getRecallAsyncTranscriptProvider.test.ts
index 43f06c5d350..6ae9daf4e14 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/get-recall-async-transcript-provider.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/getRecallAsyncTranscriptProvider.test.ts
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-transcript-provider-env-var-name';
-import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/get-recall-async-transcript-provider.util';
+import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME';
+import { getRecallAsyncTranscriptProvider } from 'src/logic-functions/utils/getRecallAsyncTranscriptProvider';
describe('getRecallAsyncTranscriptProvider', () => {
beforeEach(() => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/importCallRecordingArtifactsHandler.test.ts
similarity index 90%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/importCallRecordingArtifactsHandler.test.ts
index 33ecc671c5d..a4d0b7fbb29 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/import-call-recording-artifacts.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/importCallRecordingArtifactsHandler.test.ts
@@ -1,18 +1,14 @@
+import { importCallRecordingArtifactsHandler } from 'src/logic-functions/utils/importCallRecordingArtifactsHandler';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import importCallRecordingArtifactsLogicFunction, {
- importCallRecordingArtifactsHandler,
-} from 'src/logic-functions/import-call-recording-artifacts';
+import importCallRecordingArtifactsLogicFunction from 'src/logic-functions/importCallRecordingArtifacts';
const importCallRecordingArtifactsMock = vi.hoisted(() => vi.fn());
const coreApiClientMock = vi.hoisted(() => vi.fn());
-vi.mock(
- 'src/logic-functions/flows/import-call-recording-artifacts.util',
- () => ({
- importCallRecordingArtifacts: importCallRecordingArtifactsMock,
- }),
-);
+vi.mock('src/logic-functions/flows/utils/importCallRecordingArtifacts', () => ({
+ importCallRecordingArtifacts: importCallRecordingArtifactsMock,
+}));
vi.mock('twenty-client-sdk/core', () => ({
CoreApiClient: coreApiClientMock,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/isCallRecordingSummaryEnabled.test.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/isCallRecordingSummaryEnabled.test.ts
index 716ff404fb6..a6d71475622 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/is-call-recording-summary-enabled.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/isCallRecordingSummaryEnabled.test.ts
@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it } from 'vitest';
-import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-summary-enabled-env-var-name';
-import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/is-call-recording-summary-enabled.util';
+import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME';
+import { isCallRecordingSummaryEnabled } from 'src/logic-functions/utils/isCallRecordingSummaryEnabled';
describe('isCallRecordingSummaryEnabled', () => {
beforeEach(() => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/processRecallWebhookHandler.test.ts
similarity index 92%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/processRecallWebhookHandler.test.ts
index e49fcc170d8..39fa0f210a2 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/process-recall-webhook.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/processRecallWebhookHandler.test.ts
@@ -1,9 +1,8 @@
+import { processRecallWebhookHandler } from 'src/logic-functions/utils/processRecallWebhookHandler';
import { createHmac } from 'crypto';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
-import processRecallWebhookLogicFunction, {
- processRecallWebhookHandler,
-} from 'src/logic-functions/process-recall-webhook';
+import processRecallWebhookLogicFunction from 'src/logic-functions/processRecallWebhook';
const queryMock = vi.hoisted(() => vi.fn());
const mutationMock = vi.hoisted(() => vi.fn());
@@ -17,24 +16,21 @@ vi.mock('twenty-client-sdk/core', () => ({
}));
vi.mock(
- 'src/logic-functions/data/enqueue-call-recording-artifacts-import.util',
+ 'src/logic-functions/data/utils/enqueueCallRecordingArtifactsImport',
() => ({
enqueueCallRecordingArtifactsImport: enqueueArtifactImportMock,
}),
);
const SECRET = 'whsec_' + Buffer.from('test-secret').toString('base64');
-vi.mock(
- 'src/logic-functions/utils/get-application-variable-value.util',
- () => ({
- getApplicationVariableValue: () =>
- 'whsec_' + Buffer.from('test-secret').toString('base64'),
- }),
-);
-vi.mock('src/logic-functions/data/get-current-workspace-id.util', () => ({
+vi.mock('src/logic-functions/utils/getApplicationVariableValue', () => ({
+ getApplicationVariableValue: () =>
+ 'whsec_' + Buffer.from('test-secret').toString('base64'),
+}));
+vi.mock('src/logic-functions/data/utils/getCurrentWorkspaceId', () => ({
getCurrentWorkspaceId: () => '123e4567-e89b-12d3-a456-426614174000',
}));
-vi.mock('src/logic-functions/recall-api/get-owned-desktop-upload.util', () => ({
+vi.mock('src/logic-functions/recall-api/utils/getOwnedDesktopUpload', () => ({
getOwnedDesktopUpload: async () => ({
id: 'upload-1',
recording_id: 'recall-recording-1',
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/recallWebhookRouteHandler.test.ts
similarity index 82%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/recallWebhookRouteHandler.test.ts
index 9ed4f10451e..692f7f6f467 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/recall-webhook.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/recallWebhookRouteHandler.test.ts
@@ -1,14 +1,11 @@
import { createHmac } from 'crypto';
import { expect, it, vi } from 'vitest';
-import { recallWebhookRouteHandler } from 'src/logic-functions/recall-webhook';
+import { recallWebhookRouteHandler } from 'src/logic-functions/utils/recallWebhookRouteHandler';
-vi.mock(
- 'src/logic-functions/utils/get-application-variable-value.util',
- () => ({
- getApplicationVariableValue: () =>
- `whsec_${Buffer.from('test-secret').toString('base64')}`,
- }),
-);
+vi.mock('src/logic-functions/utils/getApplicationVariableValue', () => ({
+ getApplicationVariableValue: () =>
+ `whsec_${Buffer.from('test-secret').toString('base64')}`,
+}));
it('routes and dispatches only the signed bytes even when the parsed body is forged', () => {
const signedBody = {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/reconcileDesktopRecordingsHandler.test.ts
similarity index 89%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/reconcileDesktopRecordingsHandler.test.ts
index 31b7a6e6486..4c307d1fe6c 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/reconcile-desktop-recordings.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/reconcileDesktopRecordingsHandler.test.ts
@@ -4,15 +4,15 @@ import {
} from 'twenty-sdk/logic-function';
import { beforeEach, expect, it, vi } from 'vitest';
-import { reconcileDesktopRecordingsHandler } from 'src/logic-functions/reconcile-desktop-recordings';
-import { recoverDesktopRecordings } from 'src/logic-functions/flows/recover-desktop-recordings.util';
-import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+import { reconcileDesktopRecordingsHandler } from 'src/logic-functions/utils/reconcileDesktopRecordingsHandler';
+import { recoverDesktopRecordings } from 'src/logic-functions/flows/utils/recoverDesktopRecordings';
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/utils/recoverRecordingSummaries';
vi.mock('twenty-client-sdk/core', () => ({ CoreApiClient: class {} }));
vi.mock('twenty-sdk/define', () => ({
defineLogicFunction: (value: unknown) => value,
}));
-vi.mock('src/logic-functions/flows/recover-desktop-recordings.util', () => ({
+vi.mock('src/logic-functions/flows/utils/recoverDesktopRecordings', () => ({
recoverDesktopRecordings: vi.fn(),
}));
beforeEach(() => vi.resetAllMocks());
@@ -41,7 +41,7 @@ it('reports a summary recovery failure after media recovery has also run', async
expect(recoverDesktopRecordings).toHaveBeenCalledOnce();
});
-vi.mock('src/logic-functions/flows/recover-recording-summaries.util', () => ({
+vi.mock('src/logic-functions/flows/utils/recoverRecordingSummaries', () => ({
recoverRecordingSummaries: vi.fn(),
}));
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/summarizeCallRecordingHandler.test.ts
similarity index 91%
rename from packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/summarizeCallRecordingHandler.test.ts
index 229e84fa4aa..0e6852fbdde 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/__tests__/summarize-call-recording.test.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/__tests__/summarizeCallRecordingHandler.test.ts
@@ -1,17 +1,14 @@
import { beforeEach, expect, it, vi } from 'vitest';
-import { summarizeCallRecordingHandler } from 'src/logic-functions/summarize-call-recording';
+import { summarizeCallRecordingHandler } from 'src/logic-functions/utils/summarizeCallRecordingHandler';
const enqueueJobsMock = vi.hoisted(() => vi.fn());
const generateMock = vi.hoisted(() => vi.fn());
vi.mock('twenty-sdk/logic-function', () => ({ enqueueJobs: enqueueJobsMock }));
vi.mock('twenty-client-sdk/core', () => ({ CoreApiClient: class {} }));
-vi.mock(
- 'src/logic-functions/flows/generate-call-recording-summary.util',
- () => ({
- generateCallRecordingSummary: generateMock,
- }),
-);
+vi.mock('src/logic-functions/flows/utils/generateCallRecordingSummary', () => ({
+ generateCallRecordingSummary: generateMock,
+}));
beforeEach(() => {
vi.clearAllMocks();
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/as-record.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/asRecord.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/as-record.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/asRecord.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepError.ts
similarity index 66%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepError.ts
index 269acb6b598..65d6076c713 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/build-step-failure.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepError.ts
@@ -1,23 +1,10 @@
import { RetryableLogicFunctionError } from 'twenty-sdk/logic-function';
-export type StepFailure = { error: string };
-
const formatStepFailureMessage = (stepLabel: string, error: unknown): string =>
`[companion] ${stepLabel} failed: ${
error instanceof Error ? error.message : String(error)
}`;
-export const buildStepFailure = (
- stepLabel: string,
- error: unknown,
-): StepFailure => {
- if (process.env.NODE_ENV !== 'test') {
- console.error(formatStepFailureMessage(stepLabel, error));
- }
-
- return { error: `${stepLabel} failed` };
-};
-
// Preserve explicit retry decisions; permanent errors must not become retryable.
export const buildStepError = (stepLabel: string, error: unknown): Error => {
if (error instanceof RetryableLogicFunctionError) return error;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepFailure.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepFailure.ts
new file mode 100644
index 00000000000..7441f15541e
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/buildStepFailure.ts
@@ -0,0 +1,17 @@
+import { type StepFailure } from 'src/logic-functions/types/StepFailure';
+
+const formatStepFailureMessage = (stepLabel: string, error: unknown): string =>
+ `[companion] ${stepLabel} failed: ${
+ error instanceof Error ? error.message : String(error)
+ }`;
+
+export const buildStepFailure = (
+ stepLabel: string,
+ error: unknown,
+): StepFailure => {
+ if (process.env.NODE_ENV !== 'test') {
+ console.error(formatStepFailureMessage(stepLabel, error));
+ }
+
+ return { error: `${stepLabel} failed` };
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/desktopCompanionHandler.ts
similarity index 63%
rename from packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/desktopCompanionHandler.ts
index 17b7563a920..8617ef1b256 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/desktop-companion.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/desktopCompanionHandler.ts
@@ -1,12 +1,10 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
-import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
-import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/get-desktop-companion-agenda.util';
-import {
- createDesktopRecordingUpload,
- failDesktopRecordingCapture,
-} from 'src/logic-functions/flows/create-desktop-recording-upload.util';
-import { getRecallApiConfig } from 'src/logic-functions/recall-api/get-recall-api-config.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { type RoutePayload } from 'twenty-sdk/define';
+import { getDesktopCompanionAgenda } from 'src/logic-functions/flows/utils/getDesktopCompanionAgenda';
+import { createDesktopRecordingUpload } from 'src/logic-functions/flows/utils/createDesktopRecordingUpload';
+import { failDesktopRecordingCapture } from 'src/logic-functions/flows/utils/failDesktopRecordingCapture';
+import { getRecallApiConfig } from 'src/logic-functions/recall-api/utils/getRecallApiConfig';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
export const desktopCompanionHandler = async (
payload: RoutePayload<unknown>,
@@ -43,17 +41,3 @@ export const desktopCompanionHandler = async (
throw new Error('Unknown companion request.');
}
};
-
-export default defineLogicFunction({
- universalIdentifier: '4ca4fc91-70f8-4bee-84f2-558053b1224a',
- name: 'desktop-companion',
- description:
- 'Authenticated personal agenda and Recall desktop upload provisioning for Desktop Recorder.',
- timeoutSeconds: 60,
- handler: desktopCompanionHandler,
- httpRouteTriggerSettings: {
- path: '/companion/desktop',
- httpMethod: 'POST',
- isAuthRequired: true,
- },
-});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/extractRichTextMarkdown.ts
similarity index 73%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/extractRichTextMarkdown.ts
index d245d5e31e0..1cd8dd0e5be 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/extract-rich-text-markdown.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/extractRichTextMarkdown.ts
@@ -1,7 +1,6 @@
import { isUndefined } from '@sniptt/guards';
-
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getString } from 'src/logic-functions/utils/getString';
export const extractRichTextMarkdown = (
rawValue: string,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/formatSecondsAsClockTimestamp.ts
similarity index 99%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/formatSecondsAsClockTimestamp.ts
index c92cae504c0..e39c65da3de 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/format-seconds-as-clock-timestamp.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/formatSecondsAsClockTimestamp.ts
@@ -1,4 +1,5 @@
const SECONDS_PER_MINUTE = 60;
+
const SECONDS_PER_HOUR = 3600;
export const formatSecondsAsClockTimestamp = (totalSeconds: number): string => {
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-application-variable-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getApplicationVariableValue.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-application-variable-value.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getApplicationVariableValue.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-batches.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getBatches.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-batches.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getBatches.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getBooleanApplicationVariableValue.ts
similarity index 84%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getBooleanApplicationVariableValue.ts
index e7480a97d0f..df0b2c8d874 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-boolean-application-variable-value.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/getBooleanApplicationVariableValue.ts
@@ -1,7 +1,8 @@
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
const TRUTHY_VALUES = new Set(['true', '1', 'yes', 'on']);
+
const FALSY_VALUES = new Set(['false', '0', 'no', 'off']);
export const getBooleanApplicationVariableValue = ({
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getCompanionAdditionalSummaryPrompt.ts
similarity index 70%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getCompanionAdditionalSummaryPrompt.ts
index ce83e09bf14..a50d279f783 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-companion-additional-summary-prompt.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/getCompanionAdditionalSummaryPrompt.ts
@@ -1,9 +1,8 @@
import { isUndefined } from '@sniptt/guards';
-
-import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-additional-summary-prompt-env-var-name';
-import { extractRichTextMarkdown } from 'src/logic-functions/utils/extract-rich-text-markdown.util';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { getString } from 'src/logic-functions/utils/get-string.util';
+import { COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_ADDITIONAL_SUMMARY_PROMPT_ENV_VAR_NAME';
+import { extractRichTextMarkdown } from 'src/logic-functions/utils/extractRichTextMarkdown';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { getString } from 'src/logic-functions/utils/getString';
export const getCompanionAdditionalSummaryPrompt = (): string | undefined => {
const rawValue = getString(
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getRecallAsyncTranscriptProvider.ts
similarity index 70%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getRecallAsyncTranscriptProvider.ts
index 006c8888645..11bfcf32b3f 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-recall-async-transcript-provider.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/getRecallAsyncTranscriptProvider.ts
@@ -1,9 +1,9 @@
-import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-transcript-provider-env-var-name';
-import { DEFAULT_COMPANION_TRANSCRIPT_PROVIDER } from 'src/logic-functions/constants/default-companion-transcript-provider';
-import { RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/recall-async-transcript-providers';
-import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/recall-async-transcript-provider.type';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_TRANSCRIPT_PROVIDER_ENV_VAR_NAME';
+import { DEFAULT_COMPANION_TRANSCRIPT_PROVIDER } from 'src/logic-functions/constants/DEFAULT_COMPANION_TRANSCRIPT_PROVIDER';
+import { RECALL_ASYNC_TRANSCRIPT_PROVIDERS } from 'src/logic-functions/constants/RECALL_ASYNC_TRANSCRIPT_PROVIDERS';
+import { type RecallAsyncTranscriptProvider } from 'src/logic-functions/types/RecallAsyncTranscriptProvider';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
const isRecallAsyncTranscriptProvider = (
value: unknown,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getRecordAtPath.ts
similarity index 77%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getRecordAtPath.ts
index fc41f0363df..83bba7995c8 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-record-at-path.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/getRecordAtPath.ts
@@ -1,4 +1,4 @@
-import { asRecord } from './as-record.util';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
export const getRecordAtPath = (
record: Record<string, unknown> | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/getString.ts
similarity index 58%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/getString.ts
index ea1e7cdd74b..80cdd392762 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/get-string.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/getString.ts
@@ -1,4 +1,4 @@
-import { isNonEmptyString } from './is-non-empty-string.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
export const getString = (value: unknown): string | undefined =>
isNonEmptyString(value) ? value : undefined;
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/importCallRecordingArtifactsHandler.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/importCallRecordingArtifactsHandler.ts
new file mode 100644
index 00000000000..835e80a651a
--- /dev/null
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/importCallRecordingArtifactsHandler.ts
@@ -0,0 +1,35 @@
+import { isUndefined } from '@sniptt/guards';
+import { CoreApiClient } from 'twenty-client-sdk/core';
+import { importCallRecordingArtifacts } from 'src/logic-functions/flows/utils/importCallRecordingArtifacts';
+import { type ImportCallRecordingArtifactsResult } from 'src/logic-functions/types/ImportCallRecordingArtifactsResult';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { buildStepError } from 'src/logic-functions/utils/buildStepError';
+import { getString } from 'src/logic-functions/utils/getString';
+
+export const importCallRecordingArtifactsHandler = async (
+ payload: unknown,
+): Promise<ImportCallRecordingArtifactsResult> => {
+ const body = asRecord(payload);
+ const callRecordingId = getString(body?.callRecordingId);
+ const requestedAt = getString(body?.requestedAt);
+
+ if (isUndefined(callRecordingId) || isUndefined(requestedAt)) {
+ return {
+ status: 'skipped',
+ callRecordingId: callRecordingId ?? 'unknown',
+ reason: 'invalid call recording artifacts import request',
+ };
+ }
+
+ try {
+ return await importCallRecordingArtifacts({
+ client: new CoreApiClient(),
+ request: { callRecordingId, requestedAt },
+ });
+ } catch (error) {
+ throw buildStepError(
+ `artifact import for call recording ${callRecordingId}`,
+ error,
+ );
+ }
+};
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/isCallRecordingSummaryEnabled.ts
similarity index 70%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/isCallRecordingSummaryEnabled.ts
index 4fe5f7fe8f8..c6469b95d34 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/is-call-recording-summary-enabled.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/isCallRecordingSummaryEnabled.ts
@@ -1,6 +1,6 @@
-import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/companion-summary-enabled-env-var-name';
-import { DEFAULT_COMPANION_SUMMARY_ENABLED } from 'src/logic-functions/constants/default-companion-summary-enabled';
-import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/get-boolean-application-variable-value.util';
+import { COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME } from 'src/logic-functions/constants/COMPANION_SUMMARY_ENABLED_ENV_VAR_NAME';
+import { DEFAULT_COMPANION_SUMMARY_ENABLED } from 'src/logic-functions/constants/DEFAULT_COMPANION_SUMMARY_ENABLED';
+import { getBooleanApplicationVariableValue } from 'src/logic-functions/utils/getBooleanApplicationVariableValue';
export const isCallRecordingSummaryEnabled = (): boolean =>
getBooleanApplicationVariableValue({
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/is-non-empty-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/isNonEmptyString.ts
similarity index 100%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/is-non-empty-string.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/isNonEmptyString.ts
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/normalizeOptionalString.ts
similarity index 63%
rename from packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/normalizeOptionalString.ts
index 1698ea51259..9b8fcdcb1c9 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/utils/normalize-optional-string.util.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/normalizeOptionalString.ts
@@ -1,4 +1,4 @@
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
export const normalizeOptionalString = (
value: string | null | undefined,
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/processRecallWebhookHandler.ts
similarity index 63%
rename from packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/processRecallWebhookHandler.ts
index d2fc2412e2b..01bb303f6f6 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/process-recall-webhook.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/processRecallWebhookHandler.ts
@@ -1,14 +1,11 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
-import { defineLogicFunction } from 'twenty-sdk/define';
-
-import { PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { handleRecallWebhook } from 'src/logic-functions/flows/handle-recall-webhook.util';
-import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
-import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
-import { getCurrentWorkspaceId } from 'src/logic-functions/data/get-current-workspace-id.util';
+import { handleRecallWebhook } from 'src/logic-functions/flows/utils/handleRecallWebhook';
+import { buildStepError } from 'src/logic-functions/utils/buildStepError';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/utils/verifyRecallWebhookSignature';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook';
+import { getCurrentWorkspaceId } from 'src/logic-functions/data/utils/getCurrentWorkspaceId';
export const processRecallWebhookHandler = async (payload: unknown) => {
const envelope = asRecord(payload);
@@ -52,13 +49,3 @@ export const processRecallWebhookHandler = async (payload: unknown) => {
throw buildStepError('Recall webhook processing', error);
}
};
-
-export default defineLogicFunction({
- universalIdentifier:
- PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
- name: 'process-recall-webhook',
- description:
- 'Updates the matching CallRecording lifecycle status from a verified Recall.ai webhook event.',
- timeoutSeconds: 30,
- handler: processRecallWebhookHandler,
-});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/recallWebhookRouteHandler.ts
similarity index 63%
rename from packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/recallWebhookRouteHandler.ts
index 2466c5b671d..97c4095eed2 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/recall-webhook.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/recallWebhookRouteHandler.ts
@@ -1,17 +1,13 @@
import { isNull, isUndefined } from '@sniptt/guards';
-import { defineLogicFunction, type RoutePayload } from 'twenty-sdk/define';
-
-import {
- PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
- RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
-} from 'src/constants/universal-identifiers';
-import { RECALL_WEBHOOK_SECRET_ENV_VAR_NAME } from 'src/logic-functions/constants/recall-webhook-secret-env-var-name';
-import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/extract-twenty-workspace-id-from-recall-webhook.util';
-import { type RecallWebhookBody } from 'src/logic-functions/recall-api/parse-recall-webhook-event.util';
-import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/verify-recall-webhook-signature.util';
-import { getApplicationVariableValue } from 'src/logic-functions/utils/get-application-variable-value.util';
-import { isNonEmptyString } from 'src/logic-functions/utils/is-non-empty-string.util';
-import { asRecord } from 'src/logic-functions/utils/as-record.util';
+import { type RoutePayload } from 'twenty-sdk/define';
+import { PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/PROCESS_RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { RECALL_WEBHOOK_SECRET_ENV_VAR_NAME } from 'src/logic-functions/constants/RECALL_WEBHOOK_SECRET_ENV_VAR_NAME';
+import { extractTwentyWorkspaceIdFromRecallWebhook } from 'src/logic-functions/recall-api/utils/extractTwentyWorkspaceIdFromRecallWebhook';
+import { type RecallWebhookBody } from 'src/logic-functions/types/RecallWebhookBody';
+import { verifyRecallWebhookSignature } from 'src/logic-functions/recall-api/utils/verifyRecallWebhookSignature';
+import { getApplicationVariableValue } from 'src/logic-functions/utils/getApplicationVariableValue';
+import { isNonEmptyString } from 'src/logic-functions/utils/isNonEmptyString';
+import { asRecord } from 'src/logic-functions/utils/asRecord';
type RecallWebhookResolverResult = {
workspaceId: string;
@@ -73,22 +69,3 @@ export const recallWebhookRouteHandler = (
payload: { rawBody, headers: routePayload.headers },
};
};
-
-export default defineLogicFunction({
- universalIdentifier: RECALL_WEBHOOK_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
- name: 'recall-webhook',
- description:
- 'Verifies Recall.ai webhook signatures and resolves the target workspace for the matching CallRecording update.',
- timeoutSeconds: 30,
- handler: recallWebhookRouteHandler,
- serverRouteTriggerSettings: {
- forwardedRequestHeaders: [
- 'webhook-id',
- 'webhook-timestamp',
- 'webhook-signature',
- 'svix-id',
- 'svix-timestamp',
- 'svix-signature',
- ],
- },
-});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/reconcileDesktopRecordingsHandler.ts
similarity index 72%
rename from packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/reconcileDesktopRecordingsHandler.ts
index 395bd7ec370..8bfa8666387 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/reconcile-desktop-recordings.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/reconcileDesktopRecordingsHandler.ts
@@ -4,9 +4,8 @@ import {
enqueueJobs,
type LogicFunctionExecutionContext,
} from 'twenty-sdk/logic-function';
-import { defineLogicFunction } from 'twenty-sdk/define';
-import { recoverDesktopRecordings } from 'src/logic-functions/flows/recover-desktop-recordings.util';
-import { recoverRecordingSummaries } from 'src/logic-functions/flows/recover-recording-summaries.util';
+import { recoverDesktopRecordings } from 'src/logic-functions/flows/utils/recoverDesktopRecordings';
+import { recoverRecordingSummaries } from 'src/logic-functions/flows/utils/recoverRecordingSummaries';
const RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER =
'2b1f250a-1409-4f7e-8e9b-66ad67e6b38c';
@@ -39,13 +38,3 @@ export const reconcileDesktopRecordingsHandler = async (
if (summaries.status === 'rejected') throw summaries.reason;
return media.value;
};
-
-export default defineLogicFunction({
- universalIdentifier: RECONCILE_DESKTOP_RECORDINGS_IDENTIFIER,
- name: 'reconcile-desktop-recordings',
- description:
- 'Recovers desktop uploads and artifact imports after missed Recall webhooks.',
- timeoutSeconds: 250,
- handler: reconcileDesktopRecordingsHandler,
- cronTriggerSettings: { pattern: '*/5 * * * *' },
-});
diff --git a/packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts b/packages/twenty-apps/public/companion/src/logic-functions/utils/summarizeCallRecordingHandler.ts
similarity index 72%
rename from packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts
rename to packages/twenty-apps/public/companion/src/logic-functions/utils/summarizeCallRecordingHandler.ts
index 2939d7bbff6..82e375f5ceb 100644
--- a/packages/twenty-apps/public/companion/src/logic-functions/summarize-call-recording.ts
+++ b/packages/twenty-apps/public/companion/src/logic-functions/utils/summarizeCallRecordingHandler.ts
@@ -1,16 +1,15 @@
import { CoreApiClient } from 'twenty-client-sdk/core';
import { enqueueJobs } from 'twenty-sdk/logic-function';
import {
- defineLogicFunction,
type DatabaseEventPayload,
type ObjectRecordBaseEvent,
} from 'twenty-sdk/define';
-
-import { SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers';
-import { generateCallRecordingSummary } from 'src/logic-functions/flows/generate-call-recording-summary.util';
-import { buildStepError } from 'src/logic-functions/utils/build-step-failure.util';
+import { SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER';
+import { generateCallRecordingSummary } from 'src/logic-functions/flows/utils/generateCallRecordingSummary';
+import { buildStepError } from 'src/logic-functions/utils/buildStepError';
const CALL_RECORDING_OBJECT_NAME = 'callRecording';
+
const TRANSCRIPT_FIELD_NAME = 'transcript';
type CallRecordingForDatabaseEvent = {
@@ -58,16 +57,3 @@ export const summarizeCallRecordingHandler = async (
});
return { callRecordingId: event.recordId, enqueued: true };
};
-
-export default defineLogicFunction({
- universalIdentifier:
- SUMMARIZE_CALL_RECORDING_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER,
- name: 'summarize-call-recording',
- description:
- 'Generates an AI recap of a recording transcript and stores it on the Call Recording summary field when the transcript is filled.',
- timeoutSeconds: 60 * 4,
- handler: summarizeCallRecordingHandler,
- databaseEventTriggerSettings: {
- eventName: `${CALL_RECORDING_OBJECT_NAME}.updated`,
- },
-});
diff --git a/packages/twenty-apps/public/companion/vitest.config.ts b/packages/twenty-apps/public/companion/vitest.config.ts
index c00da60b5cb..dd37768c6a7 100644
--- a/packages/twenty-apps/public/companion/vitest.config.ts
+++ b/packages/twenty-apps/public/companion/vitest.config.ts
@@ -11,6 +11,6 @@ export default defineConfig({
test: {
testTimeout: 60_000,
include: ['src/**/*.integration-test.ts'],
- globalSetup: ['src/__tests__/global-setup.ts'],
+ globalSetup: ['src/__tests__/setup.ts', 'src/__tests__/teardown.ts'],
},
});
diff --git a/packages/twenty-companion/src/renderer/components/Empty.tsx b/packages/twenty-companion/src/renderer/components/Empty.tsx
index 22a1f3b9cbe..3e2ebccfa0e 100644
--- a/packages/twenty-companion/src/renderer/components/Empty.tsx
+++ b/packages/twenty-companion/src/renderer/components/Empty.tsx
@@ -1,7 +1,5 @@
-import {
- AnimatedPlaceholder,
- type AnimatedPlaceholderType,
-} from '@ui/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder';
+import { AnimatedPlaceholder } from '@ui/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder';
+import type { AnimatedPlaceholderType } from '@ui/primitives/feedback/AnimatedPlaceholder/types/AnimatedPlaceholderType';
import { type ReactNode } from 'react';
export const Empty = ({
diff --git a/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx b/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
index 594e778c3a2..9c88eeabbb1 100644
--- a/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
+++ b/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/AnimatedPlaceholder.tsx
@@ -1,3 +1,4 @@
+import { type AnimatedPlaceholderType } from './types/AnimatedPlaceholderType';
import { clsx } from 'clsx';
import { useEffect, useRef } from 'react';
@@ -11,10 +12,6 @@ import styles from './AnimatedPlaceholder.module.scss';
const PARALLAX_OFFSET_IN_PX = 2;
-export type AnimatedPlaceholderType =
- | keyof typeof BACKGROUND
- | keyof typeof MOVING_IMAGE;
-
type AnimatedPlaceholderProps = {
type: AnimatedPlaceholderType;
assetBasePath?: string;
diff --git a/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/types/AnimatedPlaceholderType.ts b/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/types/AnimatedPlaceholderType.ts
new file mode 100644
index 00000000000..f9ae8d476da
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/feedback/AnimatedPlaceholder/types/AnimatedPlaceholderType.ts
@@ -0,0 +1,6 @@
+import { type BACKGROUND } from '@ui/primitives/feedback/AnimatedPlaceholder/constants/Background';
+import { type MOVING_IMAGE } from '@ui/primitives/feedback/AnimatedPlaceholder/constants/MovingImage';
+
+export type AnimatedPlaceholderType =
+ | keyof typeof BACKGROUND
+ | keyof typeof MOVING_IMAGE;
diff --git a/packages/twenty-ui/src/primitives/feedback/index.ts b/packages/twenty-ui/src/primitives/feedback/index.ts
index 0b9dae403f6..36999478943 100644
--- a/packages/twenty-ui/src/primitives/feedback/index.ts
+++ b/packages/twenty-ui/src/primitives/feedback/index.ts
@@ -7,7 +7,7 @@
* |___/
*/
-export type { AnimatedPlaceholderType } from './AnimatedPlaceholder/AnimatedPlaceholder';
+export type { AnimatedPlaceholderType } from './AnimatedPlaceholder/types/AnimatedPlaceholderType';
export { AnimatedPlaceholder } from './AnimatedPlaceholder/AnimatedPlaceholder';
export { BACKGROUND } from './AnimatedPlaceholder/constants/Background';
export { DARK_BACKGROUND } from './AnimatedPlaceholder/constants/DarkBackground';
diff --git a/packages/twenty-ui/src/primitives/input/AnimatedButton/AnimatedButton.tsx b/packages/twenty-ui/src/primitives/input/AnimatedButton/AnimatedButton.tsx
index 85c4bb3235f..73ccf452c5b 100644
--- a/packages/twenty-ui/src/primitives/input/AnimatedButton/AnimatedButton.tsx
+++ b/packages/twenty-ui/src/primitives/input/AnimatedButton/AnimatedButton.tsx
@@ -7,12 +7,10 @@ import { themeCssVariables, useTheme } from '@ui/theme-constants';
import { GRAY_SCALE_LIGHT } from '@ui/theme/constants/GrayScaleLight';
import { useIsMobile } from '@ui/utilities';
import { getOsShortcutSeparator } from '@ui/utilities/device/getOsShortcutSeparator';
-import {
- type ButtonAccent,
- type ButtonPosition,
- type ButtonProps,
- type ButtonVariant,
-} from '@ui/primitives/input/Button/Button';
+import type { ButtonAccent } from '@ui/primitives/input/Button/types/ButtonAccent';
+import type { ButtonPosition } from '@ui/primitives/input/Button/types/ButtonPosition';
+import type { ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';
+import type { ButtonVariant } from '@ui/primitives/input/Button/types/ButtonVariant';
import styles from './AnimatedButton.module.scss';
diff --git a/packages/twenty-ui/src/primitives/input/Button/Button.tsx b/packages/twenty-ui/src/primitives/input/Button/Button.tsx
index 2eb58d152a1..047447b06f0 100644
--- a/packages/twenty-ui/src/primitives/input/Button/Button.tsx
+++ b/packages/twenty-ui/src/primitives/input/Button/Button.tsx
@@ -1,73 +1,19 @@
+import { type ButtonProps } from './types/ButtonProps';
+
import { clsx } from 'clsx';
import React, { useState } from 'react';
import { Link } from 'react-router-dom';
import { isDefined } from '@ui/utilities/utils/isDefined';
-import { type IconComponent } from '@ui/icon/types/IconComponent';
import { ButtonHotkeys } from '@ui/primitives/input/Button/internal/ButtonHotKeys';
import { ButtonIcon } from '@ui/primitives/input/Button/internal/ButtonIcon';
import { ButtonSoon } from '@ui/primitives/input/Button/internal/ButtonSoon';
import { useIsMobile } from '@ui/utilities';
-import { type ClickOutsideAttributes } from '@ui/utilities/types/ClickOutsideAttributes';
+
import { ButtonText } from '@ui/primitives/input/Button/internal/ButtonText';
import styles from './Button.module.scss';
-export type ButtonSize = 'medium' | 'small';
-export type ButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
-export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
-export type ButtonAccent = 'default' | 'blue' | 'danger' | 'green';
-
-export type ButtonProps = {
- id?: string;
- className?: string;
- Icon?: IconComponent;
- title?: string;
- fullWidth?: boolean;
- variant?: ButtonVariant;
- inverted?: boolean;
- size?: ButtonSize;
- position?: ButtonPosition;
- accent?: ButtonAccent;
- soon?: boolean;
- justify?: 'center' | 'flex-start' | 'flex-end';
- disabled?: boolean;
- focus?: boolean;
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
- to?: string;
- target?: string;
- dataTestId?: string;
- hotkeys?: string[];
- ariaLabel?: string;
- ariaExpanded?: boolean;
- isLoading?: boolean;
- 'data-base-ui-click-trigger'?: string;
- 'data-popup-open'?: string;
- 'data-pressed'?: string;
-} & Pick<
- React.ComponentPropsWithRef<'button'>,
- | 'ref'
- | 'type'
- | 'role'
- | 'tabIndex'
- | 'style'
- | 'aria-label'
- | 'aria-expanded'
- | 'aria-controls'
- | 'aria-haspopup'
- | 'aria-disabled'
- | 'onFocus'
- | 'onBlur'
- | 'onKeyDown'
- | 'onKeyUp'
- | 'onMouseDown'
- | 'onMouseMove'
- | 'onMouseLeave'
- | 'onPointerDown'
- | 'onPointerEnter'
-> &
- ClickOutsideAttributes;
-
export const Button = ({
className,
Icon,
diff --git a/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx b/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
index 960ac83d071..af609a8c63a 100644
--- a/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
+++ b/packages/twenty-ui/src/primitives/input/Button/__stories__/Button.stories.tsx
@@ -6,13 +6,11 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import {
- Button,
- type ButtonAccent,
- type ButtonPosition,
- type ButtonSize,
- type ButtonVariant,
-} from '@ui/primitives/input/Button/Button';
+import { Button } from '@ui/primitives/input/Button/Button';
+import type { ButtonAccent } from '@ui/primitives/input/Button/types/ButtonAccent';
+import type { ButtonPosition } from '@ui/primitives/input/Button/types/ButtonPosition';
+import type { ButtonSize } from '@ui/primitives/input/Button/types/ButtonSize';
+import type { ButtonVariant } from '@ui/primitives/input/Button/types/ButtonVariant';
const meta: Meta<typeof Button> = {
title: 'UI/Input/Button/Button',
diff --git a/packages/twenty-ui/src/primitives/input/Button/internal/ButtonHotKeys.tsx b/packages/twenty-ui/src/primitives/input/Button/internal/ButtonHotKeys.tsx
index 9d5e7be53bf..9e59a65b870 100644
--- a/packages/twenty-ui/src/primitives/input/Button/internal/ButtonHotKeys.tsx
+++ b/packages/twenty-ui/src/primitives/input/Button/internal/ButtonHotKeys.tsx
@@ -1,8 +1,6 @@
-import {
- type ButtonAccent,
- type ButtonSize,
- type ButtonVariant,
-} from '@ui/primitives/input/Button/Button';
+import type { ButtonAccent } from '@ui/primitives/input/Button/types/ButtonAccent';
+import type { ButtonSize } from '@ui/primitives/input/Button/types/ButtonSize';
+import type { ButtonVariant } from '@ui/primitives/input/Button/types/ButtonVariant';
import { getOsShortcutSeparator } from '@ui/utilities';
import styles from './ButtonHotKeys.module.scss';
diff --git a/packages/twenty-ui/src/primitives/input/Button/types/ButtonAccent.ts b/packages/twenty-ui/src/primitives/input/Button/types/ButtonAccent.ts
new file mode 100644
index 00000000000..2e108a982e8
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/Button/types/ButtonAccent.ts
@@ -0,0 +1 @@
+export type ButtonAccent = 'default' | 'blue' | 'danger' | 'green';
diff --git a/packages/twenty-ui/src/primitives/input/Button/types/ButtonPosition.ts b/packages/twenty-ui/src/primitives/input/Button/types/ButtonPosition.ts
new file mode 100644
index 00000000000..9200a8f72b1
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/Button/types/ButtonPosition.ts
@@ -0,0 +1 @@
+export type ButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
diff --git a/packages/twenty-ui/src/primitives/input/Button/types/ButtonProps.ts b/packages/twenty-ui/src/primitives/input/Button/types/ButtonProps.ts
new file mode 100644
index 00000000000..7b598d446d4
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/Button/types/ButtonProps.ts
@@ -0,0 +1,57 @@
+import React from 'react';
+import { type IconComponent } from '@ui/icon/types/IconComponent';
+import { type ClickOutsideAttributes } from '@ui/utilities/types/ClickOutsideAttributes';
+import { type ButtonSize } from './ButtonSize';
+import { type ButtonPosition } from './ButtonPosition';
+import { type ButtonVariant } from './ButtonVariant';
+import { type ButtonAccent } from './ButtonAccent';
+
+export type ButtonProps = {
+ id?: string;
+ className?: string;
+ Icon?: IconComponent;
+ title?: string;
+ fullWidth?: boolean;
+ variant?: ButtonVariant;
+ inverted?: boolean;
+ size?: ButtonSize;
+ position?: ButtonPosition;
+ accent?: ButtonAccent;
+ soon?: boolean;
+ justify?: 'center' | 'flex-start' | 'flex-end';
+ disabled?: boolean;
+ focus?: boolean;
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ to?: string;
+ target?: string;
+ dataTestId?: string;
+ hotkeys?: string[];
+ ariaLabel?: string;
+ ariaExpanded?: boolean;
+ isLoading?: boolean;
+ 'data-base-ui-click-trigger'?: string;
+ 'data-popup-open'?: string;
+ 'data-pressed'?: string;
+} & Pick<
+ React.ComponentPropsWithRef<'button'>,
+ | 'ref'
+ | 'type'
+ | 'role'
+ | 'tabIndex'
+ | 'style'
+ | 'aria-label'
+ | 'aria-expanded'
+ | 'aria-controls'
+ | 'aria-haspopup'
+ | 'aria-disabled'
+ | 'onFocus'
+ | 'onBlur'
+ | 'onKeyDown'
+ | 'onKeyUp'
+ | 'onMouseDown'
+ | 'onMouseMove'
+ | 'onMouseLeave'
+ | 'onPointerDown'
+ | 'onPointerEnter'
+> &
+ ClickOutsideAttributes;
diff --git a/packages/twenty-ui/src/primitives/input/Button/types/ButtonSize.ts b/packages/twenty-ui/src/primitives/input/Button/types/ButtonSize.ts
new file mode 100644
index 00000000000..8984bde68ed
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/Button/types/ButtonSize.ts
@@ -0,0 +1 @@
+export type ButtonSize = 'medium' | 'small';
diff --git a/packages/twenty-ui/src/primitives/input/Button/types/ButtonVariant.ts b/packages/twenty-ui/src/primitives/input/Button/types/ButtonVariant.ts
new file mode 100644
index 00000000000..28eac9f82e2
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/Button/types/ButtonVariant.ts
@@ -0,0 +1 @@
+export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
diff --git a/packages/twenty-ui/src/primitives/input/ButtonGroup/ButtonGroup.tsx b/packages/twenty-ui/src/primitives/input/ButtonGroup/ButtonGroup.tsx
index 1d1fc88e7d2..8a266769988 100644
--- a/packages/twenty-ui/src/primitives/input/ButtonGroup/ButtonGroup.tsx
+++ b/packages/twenty-ui/src/primitives/input/ButtonGroup/ButtonGroup.tsx
@@ -2,10 +2,8 @@ import { clsx } from 'clsx';
import React, { type ReactNode } from 'react';
import { isDefined } from '@ui/utilities/utils/isDefined';
-import {
- type ButtonPosition,
- type ButtonProps,
-} from '@ui/primitives/input/Button/Button';
+import type { ButtonPosition } from '@ui/primitives/input/Button/types/ButtonPosition';
+import type { ButtonProps } from '@ui/primitives/input/Button/types/ButtonProps';
import styles from './ButtonGroup.module.scss';
diff --git a/packages/twenty-ui/src/primitives/input/ButtonGroup/__stories__/ButtonGroup.stories.tsx b/packages/twenty-ui/src/primitives/input/ButtonGroup/__stories__/ButtonGroup.stories.tsx
index 1b1f21a0246..272a9b95196 100644
--- a/packages/twenty-ui/src/primitives/input/ButtonGroup/__stories__/ButtonGroup.stories.tsx
+++ b/packages/twenty-ui/src/primitives/input/ButtonGroup/__stories__/ButtonGroup.stories.tsx
@@ -6,12 +6,10 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import {
- Button,
- type ButtonAccent,
- type ButtonSize,
- type ButtonVariant,
-} from '@ui/primitives/input/Button/Button';
+import { Button } from '@ui/primitives/input/Button/Button';
+import type { ButtonAccent } from '@ui/primitives/input/Button/types/ButtonAccent';
+import type { ButtonSize } from '@ui/primitives/input/Button/types/ButtonSize';
+import type { ButtonVariant } from '@ui/primitives/input/Button/types/ButtonVariant';
import { ButtonGroup } from '@ui/primitives/input/ButtonGroup/ButtonGroup';
const meta: Meta<typeof ButtonGroup> = {
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/IconButton.tsx b/packages/twenty-ui/src/primitives/input/IconButton/IconButton.tsx
index 9056a319bdd..31230ff7d16 100644
--- a/packages/twenty-ui/src/primitives/input/IconButton/IconButton.tsx
+++ b/packages/twenty-ui/src/primitives/input/IconButton/IconButton.tsx
@@ -1,32 +1,12 @@
+import { type IconButtonProps } from './types/IconButtonProps';
+
import { clsx } from 'clsx';
import React from 'react';
-import { type IconComponent } from '@ui/icon';
import { useTheme } from '@ui/theme-constants';
import styles from './IconButton.module.scss';
-export type IconButtonSize = 'medium' | 'small';
-export type IconButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
-export type IconButtonVariant = 'primary' | 'secondary' | 'tertiary';
-export type IconButtonAccent = 'default' | 'blue' | 'danger';
-
-export type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
- className?: string;
- Icon?: IconComponent;
- variant?: IconButtonVariant;
- size?: IconButtonSize;
- position?: IconButtonPosition;
- accent?: IconButtonAccent;
- disabled?: boolean;
- focus?: boolean;
- dataTestId?: string;
- ariaLabel?: string;
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
- to?: string;
- children?: React.ReactNode;
-};
-
export const IconButton = React.forwardRef<HTMLButtonElement, IconButtonProps>(
(
{
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/__stories__/IconButton.stories.tsx b/packages/twenty-ui/src/primitives/input/IconButton/__stories__/IconButton.stories.tsx
index 23522476a9d..d54a677111d 100644
--- a/packages/twenty-ui/src/primitives/input/IconButton/__stories__/IconButton.stories.tsx
+++ b/packages/twenty-ui/src/primitives/input/IconButton/__stories__/IconButton.stories.tsx
@@ -7,13 +7,11 @@ import {
type CatalogStory,
ComponentDecorator,
} from '@ui/testing';
-import {
- IconButton,
- type IconButtonAccent,
- type IconButtonPosition,
- type IconButtonSize,
- type IconButtonVariant,
-} from '@ui/primitives/input/IconButton/IconButton';
+import { IconButton } from '@ui/primitives/input/IconButton/IconButton';
+import type { IconButtonAccent } from '@ui/primitives/input/IconButton/types/IconButtonAccent';
+import type { IconButtonPosition } from '@ui/primitives/input/IconButton/types/IconButtonPosition';
+import type { IconButtonSize } from '@ui/primitives/input/IconButton/types/IconButtonSize';
+import type { IconButtonVariant } from '@ui/primitives/input/IconButton/types/IconButtonVariant';
const meta: Meta<typeof IconButton> = {
title: 'UI/Input/Button/IconButton',
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonAccent.ts b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonAccent.ts
new file mode 100644
index 00000000000..3f889977dc4
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonAccent.ts
@@ -0,0 +1 @@
+export type IconButtonAccent = 'default' | 'blue' | 'danger';
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonPosition.ts b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonPosition.ts
new file mode 100644
index 00000000000..71c6639765a
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonPosition.ts
@@ -0,0 +1 @@
+export type IconButtonPosition = 'standalone' | 'left' | 'middle' | 'right';
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonProps.ts b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonProps.ts
new file mode 100644
index 00000000000..d8082dd302e
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonProps.ts
@@ -0,0 +1,22 @@
+import React from 'react';
+import { type IconComponent } from '@ui/icon';
+import { type IconButtonSize } from './IconButtonSize';
+import { type IconButtonPosition } from './IconButtonPosition';
+import { type IconButtonVariant } from './IconButtonVariant';
+import { type IconButtonAccent } from './IconButtonAccent';
+
+export type IconButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
+ className?: string;
+ Icon?: IconComponent;
+ variant?: IconButtonVariant;
+ size?: IconButtonSize;
+ position?: IconButtonPosition;
+ accent?: IconButtonAccent;
+ disabled?: boolean;
+ focus?: boolean;
+ dataTestId?: string;
+ ariaLabel?: string;
+ onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
+ to?: string;
+ children?: React.ReactNode;
+};
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonSize.ts b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonSize.ts
new file mode 100644
index 00000000000..9b2609b4e8c
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonSize.ts
@@ -0,0 +1 @@
+export type IconButtonSize = 'medium' | 'small';
diff --git a/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonVariant.ts b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonVariant.ts
new file mode 100644
index 00000000000..9037b7534cc
--- /dev/null
+++ b/packages/twenty-ui/src/primitives/input/IconButton/types/IconButtonVariant.ts
@@ -0,0 +1 @@
+export type IconButtonVariant = 'primary' | 'secondary' | 'tertiary';
diff --git a/packages/twenty-ui/src/primitives/input/IconButtonWithTooltip/IconButtonWithTooltip.tsx b/packages/twenty-ui/src/primitives/input/IconButtonWithTooltip/IconButtonWithTooltip.tsx
index c0f79556768..eb8f7dde003 100644
--- a/packages/twenty-ui/src/primitives/input/IconButtonWithTooltip/IconButtonWithTooltip.tsx
+++ b/packages/twenty-ui/src/primitives/input/IconButtonWithTooltip/IconButtonWithTooltip.tsx
@@ -1,7 +1,5 @@
-import {
- IconButton,
- type IconButtonProps,
-} from '@ui/primitives/input/IconButton/IconButton';
+import { IconButton } from '@ui/primitives/input/IconButton/IconButton';
+import type { IconButtonProps } from '@ui/primitives/input/IconButton/types/IconButtonProps';
import {
AppTooltip,
TooltipDelay,
diff --git a/packages/twenty-ui/src/primitives/input/index.ts b/packages/twenty-ui/src/primitives/input/index.ts
index fdf4c4518b8..3ed3d2e12f5 100644
--- a/packages/twenty-ui/src/primitives/input/index.ts
+++ b/packages/twenty-ui/src/primitives/input/index.ts
@@ -11,13 +11,11 @@ export type { AnimatedButtonProps } from './AnimatedButton/AnimatedButton';
export { AnimatedButton } from './AnimatedButton/AnimatedButton';
export type { AnimatedLightIconButtonProps } from './AnimatedLightIconButton/AnimatedLightIconButton';
export { AnimatedLightIconButton } from './AnimatedLightIconButton/AnimatedLightIconButton';
-export type {
- ButtonSize,
- ButtonPosition,
- ButtonVariant,
- ButtonAccent,
- ButtonProps,
-} from './Button/Button';
+export type { ButtonSize } from './Button/types/ButtonSize';
+export type { ButtonPosition } from './Button/types/ButtonPosition';
+export type { ButtonVariant } from './Button/types/ButtonVariant';
+export type { ButtonAccent } from './Button/types/ButtonAccent';
+export type { ButtonProps } from './Button/types/ButtonProps';
export { Button } from './Button/Button';
export { baseTransitionTiming } from './Button/constant';
export type { ButtonGroupProps } from './ButtonGroup/ButtonGroup';
@@ -60,13 +58,11 @@ export type {
export { FloatingIconButton } from './FloatingIconButton/FloatingIconButton';
export type { FloatingIconButtonGroupProps } from './FloatingIconButtonGroup/FloatingIconButtonGroup';
export { FloatingIconButtonGroup } from './FloatingIconButtonGroup/FloatingIconButtonGroup';
-export type {
- IconButtonSize,
- IconButtonPosition,
- IconButtonVariant,
- IconButtonAccent,
- IconButtonProps,
-} from './IconButton/IconButton';
+export type { IconButtonSize } from './IconButton/types/IconButtonSize';
+export type { IconButtonPosition } from './IconButton/types/IconButtonPosition';
+export type { IconButtonVariant } from './IconButton/types/IconButtonVariant';
+export type { IconButtonAccent } from './IconButton/types/IconButtonAccent';
+export type { IconButtonProps } from './IconButton/types/IconButtonProps';
export { IconButton } from './IconButton/IconButton';
export type { IconButtonGroupProps } from './IconButtonGroup/IconButtonGroup';
export { IconButtonGroup } from './IconButtonGroup/IconButtonGroup';