[AUDIT] Run knip over twenty-server (#21159)

# Introduction
Run [knip](https://knip.dev/) over twenty-server
Used config:
```json
{
  "$schema": "https://unpkg.com/knip@5/schema.json",
  "workspaces": {
    "packages/twenty-server": {
      "entry": [
        "src/main.ts",
        "src/command/command.ts",
        "src/queue-worker/queue-worker.ts",
        "src/database/scripts/setup-db.ts",
        "src/database/scripts/truncate-db.ts",
        "src/database/clickHouse/migrations/run-migrations.ts",
        "src/database/clickHouse/seeds/run-seeds.ts",
        "src/instrument.ts",
        "lingui.config.ts",
        "test/integration/graphql/codegen/index.ts",
        "test/integration/utils/setup-test.ts",
        "test/integration/utils/teardown-test.ts",
        "scripts/**/*.ts",
        "**/*.spec.ts",
        "**/*.integration-spec.ts"
      ],
      "project": ["src/**/*.ts", "test/**/*.ts", "scripts/**/*.ts"],
      "ignore": [
        "src/database/typeorm/**/migrations/**",
        "src/database/typeorm/**/*.entity.ts",
        "**/*.workspace-entity.ts",
        "**/logic-function-resource/constants/seed-project/**"
      ],
      "ignoreDependencies": ["@types/psl", "@types/aws-lambda"],
      "ignoreBinaries": ["nest", "lingui", "typeorm"]
    }
  }
}
```
This commit is contained in:
Paul Rastoin
2026-06-04 12:05:22 +02:00
committed by GitHub
parent 4ad8d8e98e
commit 3d49642d12
140 changed files with 55 additions and 4643 deletions
@@ -1,44 +0,0 @@
import { type MessageDescriptor } from '@lingui/core';
import { msg } from '@lingui/core/macro';
import { assertUnreachable } from 'twenty-shared/utils';
import { STANDARD_ERROR_MESSAGE } from 'src/engine/api/common/common-query-runners/errors/standard-error-message.constant';
import {
appendCommonExceptionCode,
CustomException,
} from 'src/utils/custom-exception';
export const FlatViewExceptionCode = appendCommonExceptionCode({
VIEW_NOT_FOUND: 'VIEW_NOT_FOUND',
VIEW_ALREADY_EXISTS: 'VIEW_ALREADY_EXISTS',
} as const);
const getFlatViewExceptionUserFriendlyMessage = (
code: keyof typeof FlatViewExceptionCode,
) => {
switch (code) {
case FlatViewExceptionCode.VIEW_NOT_FOUND:
return msg`View not found.`;
case FlatViewExceptionCode.VIEW_ALREADY_EXISTS:
return msg`View already exists.`;
case FlatViewExceptionCode.INTERNAL_SERVER_ERROR:
return STANDARD_ERROR_MESSAGE;
default:
assertUnreachable(code);
}
};
export class FlatViewException extends CustomException<
keyof typeof FlatViewExceptionCode
> {
constructor(
message: string,
code: keyof typeof FlatViewExceptionCode,
{ userFriendlyMessage }: { userFriendlyMessage?: MessageDescriptor } = {},
) {
super(message, code, {
userFriendlyMessage:
userFriendlyMessage ?? getFlatViewExceptionUserFriendlyMessage(code),
});
}
}