From 576f88b5c52304d1b27b66a1ec5247d867fdb498 Mon Sep 17 00:00:00 2001 From: martmull Date: Fri, 19 Jun 2026 13:42:15 +0200 Subject: [PATCH] Update ci internal applications (#21837) Fix `twenty-last-contact` ci - add tests - add tsgo - update package commands Review in cubic --- .github/workflows/ci-internal-apps.yaml | 2 +- .../twenty-last-contact/.oxlintrc.json | 64 +++++++---- .../internal/twenty-last-contact/package.json | 8 +- .../on-calendar-event-started.test.ts | 4 +- .../__tests__/on-calendar-interaction.test.ts | 4 +- .../__tests__/on-email-interaction.test.ts | 4 +- .../on-calendar-event-started.ts | 2 +- .../on-calendar-interaction.ts | 20 ++-- .../logic-functions/on-email-interaction.ts | 11 +- ...te-person-last-contact-at-from-calendar.ts | 2 +- .../utils/update-person-last-contact-at.ts | 2 +- .../twenty-last-contact/tsconfig.json | 2 +- .../internal/twenty-last-contact/yarn.lock | 104 ++++++++++++++++-- 13 files changed, 174 insertions(+), 55 deletions(-) diff --git a/.github/workflows/ci-internal-apps.yaml b/.github/workflows/ci-internal-apps.yaml index e32dbb4573..be5d476122 100644 --- a/.github/workflows/ci-internal-apps.yaml +++ b/.github/workflows/ci-internal-apps.yaml @@ -66,7 +66,7 @@ jobs: // keep this PR small while the remaining apps are made CI-ready. Remove an // app from this list once its checks pass, and delete the list entirely // once every application is covered. - const CI_EXCLUDED_APPLICATIONS = ['call-recording', 'exa', 'people-data-labs', 'self-hosting', 'twenty-discord', 'twenty-fireflies', 'twenty-for-twenty', 'twenty-last-contact', 'twenty-linear', 'twenty-meeting-bot', 'twenty-partners', 'twenty-slack']; + const CI_EXCLUDED_APPLICATIONS = ['call-recording', 'exa', 'people-data-labs', 'self-hosting', 'twenty-discord', 'twenty-fireflies', 'twenty-for-twenty', 'twenty-linear', 'twenty-meeting-bot', 'twenty-partners', 'twenty-slack']; const eventName = process.env.EVENT_NAME; const changedFiles = JSON.parse(process.env.CHANGED_FILES || '[]'); const changedApps = new Set(); diff --git a/packages/twenty-apps/internal/twenty-last-contact/.oxlintrc.json b/packages/twenty-apps/internal/twenty-last-contact/.oxlintrc.json index 369b9cfd76..a1d10264b4 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/.oxlintrc.json +++ b/packages/twenty-apps/internal/twenty-last-contact/.oxlintrc.json @@ -1,37 +1,57 @@ { "$schema": "./node_modules/oxlint/configuration_schema.json", - "plugins": ["typescript"], + "plugins": ["react", "typescript", "import", "unicorn"], "categories": { "correctness": "off" }, "ignorePatterns": ["node_modules", "dist"], "rules": { + "func-style": ["error", "declaration", { "allowArrowFunctions": true }], + "no-console": "off", + "no-control-regex": "off", + "no-debugger": "error", + "no-duplicate-imports": "error", + "no-undef": "off", "no-unused-vars": "off", - + "no-redeclare": "off", + "import/no-duplicates": "error", + "typescript/no-redeclare": "error", + "typescript/ban-ts-comment": "error", + "typescript/consistent-type-imports": [ + "error", + { + "prefer": "type-imports", + "fixStyle": "inline-type-imports" + } + ], + "typescript/explicit-function-return-type": "off", + "typescript/explicit-module-boundary-types": "off", + "typescript/no-empty-object-type": [ + "error", + { + "allowInterfaces": "with-single-extends" + } + ], + "typescript/no-empty-function": "off", + "typescript/no-explicit-any": "off", "typescript/no-unused-vars": [ "warn", { + "vars": "all", + "varsIgnorePattern": "^_", + "args": "after-used", "argsIgnorePattern": "^_" } ], - "typescript/no-explicit-any": "off" - }, - "overrides": [ - { - "files": ["**/*.logic-function.ts", "**/logic-functions/**/*.ts"], - "rules": { - "no-restricted-imports": [ - "error", - { - "patterns": [ - { - "group": ["twenty-shared", "twenty-shared/*"], - "message": "Logic functions must not import from twenty-shared directly. Import runtime types and helpers from `twenty-sdk/logic-function` instead so the logic-function bundle stays minimal." - } - ] - } - ] - } - } - ] + "react/no-unescaped-entities": "off", + "react/prop-types": "off", + "react/jsx-key": "off", + "react/display-name": "off", + "react/jsx-uses-react": "off", + "react/react-in-jsx-scope": "off", + "react/jsx-no-useless-fragment": "off", + "react/jsx-props-no-spreading": ["error", { "explicitSpread": "ignore" }], + "react-hooks/rules-of-hooks": "error", + "react-hooks/exhaustive-deps": "warn" + } } diff --git a/packages/twenty-apps/internal/twenty-last-contact/package.json b/packages/twenty-apps/internal/twenty-last-contact/package.json index 88f1cbb409..6e0f4f6062 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/package.json +++ b/packages/twenty-apps/internal/twenty-last-contact/package.json @@ -13,6 +13,7 @@ "twenty": "twenty", "lint": "oxlint -c .oxlintrc.json .", "lint:fix": "oxlint --fix -c .oxlintrc.json .", + "typecheck": "tsgo --noEmit -p tsconfig.spec.json", "test": "vitest run", "test:watch": "vitest", "test:unit": "vitest run --config vitest.unit.config.ts" @@ -20,15 +21,14 @@ "devDependencies": { "@types/node": "^24.7.2", "@types/react": "^19.0.0", + "@typescript/native-preview": "^7.0.0-dev.20260116.1", "oxlint": "^0.16.0", "react": "^19.0.0", "react-dom": "^19.0.0", - "twenty-sdk": "^2.13.0", + "twenty-client-sdk": "^2.14.0", + "twenty-sdk": "^2.14.0", "typescript": "^5.9.3", "vite-tsconfig-paths": "^4.2.1", "vitest": "^4.0.0" - }, - "dependencies": { - "twenty-client-sdk": "^2.13.0" } } diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-event-started.test.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-event-started.test.ts index 89acd6d73b..f81dd604ee 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-event-started.test.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-event-started.test.ts @@ -5,7 +5,9 @@ const { queryMock, mutationMock } = vi.hoisted(() => ({ mutationMock: vi.fn(), })); vi.mock('twenty-client-sdk/core', () => ({ - CoreApiClient: vi.fn(() => ({ query: queryMock, mutation: mutationMock })), + CoreApiClient: vi.fn(function () { + return { query: queryMock, mutation: mutationMock }; + }), })); import onCalendarEventStarted from '../on-calendar-event-started'; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-interaction.test.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-interaction.test.ts index 46dacd2011..f4d31745d9 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-interaction.test.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-calendar-interaction.test.ts @@ -5,7 +5,9 @@ const { queryMock, mutationMock } = vi.hoisted(() => ({ mutationMock: vi.fn(), })); vi.mock('twenty-client-sdk/core', () => ({ - CoreApiClient: vi.fn(() => ({ query: queryMock, mutation: mutationMock })), + CoreApiClient: vi.fn(function () { + return { query: queryMock, mutation: mutationMock }; + }), })); import onCalendarInteraction from '../on-calendar-interaction'; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-email-interaction.test.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-email-interaction.test.ts index ce19e6f654..2deb2b1b73 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-email-interaction.test.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/__tests__/on-email-interaction.test.ts @@ -5,7 +5,9 @@ const { queryMock, mutationMock } = vi.hoisted(() => ({ mutationMock: vi.fn(), })); vi.mock('twenty-client-sdk/core', () => ({ - CoreApiClient: vi.fn(() => ({ query: queryMock, mutation: mutationMock })), + CoreApiClient: vi.fn(function () { + return { query: queryMock, mutation: mutationMock }; + }), })); import onEmailInteraction from '../on-email-interaction'; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-event-started.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-event-started.ts index 78c0b72dd9..fa8c107669 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-event-started.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-event-started.ts @@ -53,7 +53,7 @@ const handler = async (): Promise => { }); calendarEventIds.push( - ...(calendarEvents?.edges.map((edge) => edge.node.id) ?? []), + ...(calendarEvents?.edges.map((edge: { node: { id: string } }) => edge.node.id) ?? []), ); calendarEventsHasNextPage = calendarEvents?.pageInfo.hasNextPage ?? false; calendarEventsCursor = calendarEvents?.pageInfo.endCursor ?? undefined; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-interaction.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-interaction.ts index 2c7eefa786..6688010dc0 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-interaction.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-calendar-interaction.ts @@ -1,13 +1,19 @@ -import { defineLogicFunction, ObjectRecordUpdateEvent } from 'twenty-sdk/define'; -import type { DatabaseEventPayload } from 'twenty-sdk/logic-function'; -import { CoreApiClient, CoreSchema } from 'twenty-client-sdk/core'; +import { defineLogicFunction, type ObjectRecordUpdateEvent } from 'twenty-sdk/define'; +import { type DatabaseEventPayload } from 'twenty-sdk/logic-function'; +import { CoreApiClient } from 'twenty-client-sdk/core'; import { CALENDAR_INTERACTION_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers'; import { updatePersonLastContactAtFromCalendar } from 'src/utils/update-person-last-contact-at-from-calendar'; -const handler = async (event: DatabaseEventPayload< - ObjectRecordUpdateEvent ->): Promise => { +type CalendarEventParticipantUpdate = { + personId?: string | null; +}; + +const handler = async ( + event: DatabaseEventPayload< + ObjectRecordUpdateEvent + >, +): Promise => { const personId = event.properties.after.personId; if (!personId) { @@ -23,7 +29,7 @@ export default defineLogicFunction({ universalIdentifier: CALENDAR_INTERACTION_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER, name: 'on-calendar-interaction', description: - 'Updates a person\'s last-contacted fields when a new calendar event participant is created (past events only).', + "Updates a person's last-contacted fields when a new calendar event participant is created (past events only).", timeoutSeconds: 60, databaseEventTriggerSettings: { eventName: 'calendarEventParticipant.updated', diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-email-interaction.ts b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-email-interaction.ts index e8349d047d..b872517357 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-email-interaction.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/logic-functions/on-email-interaction.ts @@ -1,11 +1,16 @@ -import { defineLogicFunction, ObjectRecordUpdateEvent } from 'twenty-sdk/define'; +import { defineLogicFunction, type ObjectRecordUpdateEvent } from 'twenty-sdk/define'; import type { DatabaseEventPayload } from 'twenty-sdk/logic-function'; -import { CoreApiClient, CoreSchema } from 'twenty-client-sdk/core'; +import { CoreApiClient } from 'twenty-client-sdk/core'; import { EMAIL_INTERACTION_LOGIC_FUNCTION_UNIVERSAL_IDENTIFIER } from 'src/constants/universal-identifiers'; import { updatePersonLastContactAtIfNewer } from 'src/utils/update-person-last-contact-at'; -const handler = async (event: DatabaseEventPayload>): Promise => { +type MessageParticipantUpdate = { + personId?: string | null; + messageId?: string | null; +}; + +const handler = async (event: DatabaseEventPayload>): Promise => { const personId = event.properties.after.personId; const messageId = event.properties.after.messageId; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at-from-calendar.ts b/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at-from-calendar.ts index 69f8ec0c95..e85b18c6c3 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at-from-calendar.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at-from-calendar.ts @@ -1,4 +1,4 @@ -import { CoreApiClient } from 'twenty-client-sdk/core'; +import { type CoreApiClient } from 'twenty-client-sdk/core'; import { updatePersonLastContactAtIfNewer } from 'src/utils/update-person-last-contact-at'; diff --git a/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at.ts b/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at.ts index ffbb55deb0..952b60b23d 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at.ts +++ b/packages/twenty-apps/internal/twenty-last-contact/src/utils/update-person-last-contact-at.ts @@ -1,4 +1,4 @@ -import { CoreApiClient } from 'twenty-client-sdk/core'; +import { type CoreApiClient } from 'twenty-client-sdk/core'; export const updatePersonLastContactAtIfNewer = async ( client: CoreApiClient, diff --git a/packages/twenty-apps/internal/twenty-last-contact/tsconfig.json b/packages/twenty-apps/internal/twenty-last-contact/tsconfig.json index d574c8c810..f71645f97a 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/tsconfig.json +++ b/packages/twenty-apps/internal/twenty-last-contact/tsconfig.json @@ -6,7 +6,7 @@ "outDir": "./dist", "rootDir": ".", "jsx": "react-jsx", - "moduleResolution": "node", + "moduleResolution": "bundler", "allowSyntheticDefaultImports": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, diff --git a/packages/twenty-apps/internal/twenty-last-contact/yarn.lock b/packages/twenty-apps/internal/twenty-last-contact/yarn.lock index c6dd0629eb..fa18a16f9c 100644 --- a/packages/twenty-apps/internal/twenty-last-contact/yarn.lock +++ b/packages/twenty-apps/internal/twenty-last-contact/yarn.lock @@ -783,6 +783,87 @@ __metadata: languageName: node linkType: hard +"@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-darwin-arm64@npm:7.0.0-dev.20260616.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-darwin-x64@npm:7.0.0-dev.20260616.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-linux-arm64@npm:7.0.0-dev.20260616.1" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-linux-arm@npm:7.0.0-dev.20260616.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-linux-x64@npm:7.0.0-dev.20260616.1" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-win32-arm64@npm:7.0.0-dev.20260616.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260616.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview-win32-x64@npm:7.0.0-dev.20260616.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + +"@typescript/native-preview@npm:^7.0.0-dev.20260116.1": + version: 7.0.0-dev.20260616.1 + resolution: "@typescript/native-preview@npm:7.0.0-dev.20260616.1" + dependencies: + "@typescript/native-preview-darwin-arm64": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-darwin-x64": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-linux-arm": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-linux-arm64": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-linux-x64": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-win32-arm64": "npm:7.0.0-dev.20260616.1" + "@typescript/native-preview-win32-x64": "npm:7.0.0-dev.20260616.1" + dependenciesMeta: + "@typescript/native-preview-darwin-arm64": + optional: true + "@typescript/native-preview-darwin-x64": + optional: true + "@typescript/native-preview-linux-arm": + optional: true + "@typescript/native-preview-linux-arm64": + optional: true + "@typescript/native-preview-linux-x64": + optional: true + "@typescript/native-preview-win32-arm64": + optional: true + "@typescript/native-preview-win32-x64": + optional: true + bin: + tsgo: bin/tsgo.js + checksum: 10c0/e858f6a5bc41e615d3a87381ac33c938cbaa3553c47f4f1c3e06682fd96303f624ecd457542b7980a7eb29f73b54da19e8a52650246cc98a145c4a46aa743b40 + languageName: node + linkType: hard + "@vitest/expect@npm:4.1.8": version: 4.1.8 resolution: "@vitest/expect@npm:4.1.8" @@ -1673,11 +1754,12 @@ __metadata: dependencies: "@types/node": "npm:^24.7.2" "@types/react": "npm:^19.0.0" + "@typescript/native-preview": "npm:^7.0.0-dev.20260116.1" oxlint: "npm:^0.16.0" react: "npm:^19.0.0" react-dom: "npm:^19.0.0" - twenty-client-sdk: "npm:^2.13.0" - twenty-sdk: "npm:^2.13.0" + twenty-client-sdk: "npm:^2.14.0" + twenty-sdk: "npm:^2.14.0" typescript: "npm:^5.9.3" vite-tsconfig-paths: "npm:^4.2.1" vitest: "npm:^4.0.0" @@ -2413,22 +2495,22 @@ __metadata: languageName: node linkType: hard -"twenty-client-sdk@npm:2.13.0, twenty-client-sdk@npm:^2.13.0": - version: 2.13.0 - resolution: "twenty-client-sdk@npm:2.13.0" +"twenty-client-sdk@npm:2.14.0, twenty-client-sdk@npm:^2.14.0": + version: 2.14.0 + resolution: "twenty-client-sdk@npm:2.14.0" dependencies: "@genql/runtime": "npm:^2.10.0" esbuild: "npm:^0.28.1" graphql: "npm:^16.8.1" lodash: "npm:^4.17.21" prettier: "npm:^3.8.3" - checksum: 10c0/740464acec94c1d4cc5fa50ed6b190a7f1d1681963f61437a6c704835c05ffe0f5a13e254e57601a99b07bbe0f68483dee19211731853aafbcc15ec79f8039ce + checksum: 10c0/eb222a726e21fc98f3a624f9acac7d47f0c769b989911889036665dac7c7c88698ec99beb844bf51a42e1696ea0a067bae8cf47fd751965af52a3720835242f0 languageName: node linkType: hard -"twenty-sdk@npm:^2.13.0": - version: 2.13.0 - resolution: "twenty-sdk@npm:2.13.0" +"twenty-sdk@npm:^2.14.0": + version: 2.14.0 + resolution: "twenty-sdk@npm:2.14.0" dependencies: "@sniptt/guards": "npm:^0.2.0" axios: "npm:^1.16.0" @@ -2445,12 +2527,12 @@ __metadata: react: "npm:^19.2.0" react-dom: "npm:^19.2.0" tinyglobby: "npm:^0.2.15" - twenty-client-sdk: "npm:2.13.0" + twenty-client-sdk: "npm:2.14.0" typescript: "npm:^5.9.3" uuid: "npm:^13.0.2" bin: twenty: dist/cli.cjs - checksum: 10c0/51c350abe5d344fcad3c961a77632fd3cb2d91e357d0562b3eb02f05f66dbc41221c5463d0f91c022316a16af03a05ad43f038d9534c0ae31c060008d0e48672 + checksum: 10c0/c4211772f8dd2ba81074a74be5f616c4c264d6bf8a174c5724be6d1c9a8cb3ca68a2674653bb58c059dae4bf1b0f43f91991e73d6a01395807206f0ac44afb08 languageName: node linkType: hard