[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:
-8
@@ -1,8 +0,0 @@
|
||||
import { Field } from '@nestjs/graphql';
|
||||
|
||||
import { HealthIndicatorId } from 'src/engine/core-modules/admin-panel/enums/health-indicator-id.enum';
|
||||
|
||||
export class HealthIndicatorInput {
|
||||
@Field(() => HealthIndicatorId)
|
||||
indicatorId: HealthIndicatorId;
|
||||
}
|
||||
-16
@@ -1,16 +0,0 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
@ObjectType()
|
||||
export class AccountSyncJobByStatusCounter {
|
||||
@Field(() => Number, { nullable: true })
|
||||
NOT_SYNCED?: number;
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
ACTIVE?: number;
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
FAILED_INSUFFICIENT_PERMISSIONS?: number;
|
||||
|
||||
@Field(() => Number, { nullable: true })
|
||||
FAILED_UNKNOWN?: number;
|
||||
}
|
||||
-8
@@ -1,8 +0,0 @@
|
||||
// Refresh result returned by the app OAuth driver. Mirrors
|
||||
// `ConnectedAccountTokens` from the central refresh manager but redeclared
|
||||
// here so this engine-side driver has zero dependency on `modules/`.
|
||||
|
||||
export type AppOAuthTokens = {
|
||||
accessToken: string;
|
||||
refreshToken: string | null;
|
||||
};
|
||||
-25
@@ -1,25 +0,0 @@
|
||||
import { type AllMetadataName } from 'twenty-shared/metadata';
|
||||
|
||||
export const APPLICATION_MANIFEST_METADATA_NAMES = [
|
||||
'objectMetadata',
|
||||
'fieldMetadata',
|
||||
'logicFunction',
|
||||
'frontComponent',
|
||||
'role',
|
||||
'skill',
|
||||
'agent',
|
||||
'view',
|
||||
'viewField',
|
||||
'viewFieldGroup',
|
||||
'viewFilter',
|
||||
'viewFilterGroup',
|
||||
'viewGroup',
|
||||
'navigationMenuItem',
|
||||
'pageLayout',
|
||||
'pageLayoutTab',
|
||||
'pageLayoutWidget',
|
||||
'commandMenuItem',
|
||||
] as const satisfies AllMetadataName[];
|
||||
|
||||
export type ApplicationManifestMetadataName =
|
||||
(typeof APPLICATION_MANIFEST_METADATA_NAMES)[number];
|
||||
@@ -1,15 +0,0 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { AuthToken } from 'src/engine/core-modules/auth/dto/auth-token.dto';
|
||||
|
||||
@ObjectType('ExchangeAuthCode')
|
||||
export class ExchangeAuthCodeDTO {
|
||||
@Field(() => AuthToken)
|
||||
accessOrWorkspaceAgnosticToken: AuthToken;
|
||||
|
||||
@Field(() => AuthToken)
|
||||
refreshToken: AuthToken;
|
||||
|
||||
@Field(() => AuthToken)
|
||||
loginToken: AuthToken;
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
import { ArgsType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsOptional, IsString } from 'class-validator';
|
||||
|
||||
@ArgsType()
|
||||
export class ExchangeAuthCodeInput {
|
||||
@Field(() => String)
|
||||
@IsNotEmpty()
|
||||
@IsString()
|
||||
authorizationCode: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
codeVerifier?: string;
|
||||
|
||||
@Field(() => String, { nullable: true })
|
||||
@IsOptional()
|
||||
@IsString()
|
||||
clientSecret?: string;
|
||||
}
|
||||
-9
@@ -1,9 +0,0 @@
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { AuthToken } from 'src/engine/core-modules/auth/dto/auth-token.dto';
|
||||
|
||||
@ObjectType()
|
||||
export class WorkspaceAgnosticToken {
|
||||
@Field(() => AuthToken)
|
||||
token: AuthToken;
|
||||
}
|
||||
-10
@@ -1,10 +0,0 @@
|
||||
import {
|
||||
type PendingActivationUserWorkspaceAuthContext,
|
||||
type WorkspaceAuthContext,
|
||||
} from 'src/engine/core-modules/auth/types/workspace-auth-context.type';
|
||||
|
||||
export const isPendingActivationUserAuthContext = (
|
||||
context: WorkspaceAuthContext,
|
||||
): context is PendingActivationUserWorkspaceAuthContext => {
|
||||
return context.type === 'pendingActivationUser';
|
||||
};
|
||||
@@ -1,7 +0,0 @@
|
||||
import { type UserEntity } from 'src/engine/core-modules/user/user.entity';
|
||||
import { type AUTH_CONTEXT_USER_SELECT_FIELDS } from 'src/engine/core-modules/auth/constants/auth-context-user-select-fields.constants';
|
||||
|
||||
export type AuthContextUser = Pick<
|
||||
UserEntity,
|
||||
(typeof AUTH_CONTEXT_USER_SELECT_FIELDS)[number]
|
||||
>;
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
export const BILLING_WORKFLOW_EXECUTION_ERROR_MESSAGE =
|
||||
'No remaining credits to execute workflow. Please check your subscription.';
|
||||
@@ -1,20 +0,0 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { Field, ObjectType } from '@nestjs/graphql';
|
||||
|
||||
import { SubscriptionInterval } from 'src/engine/core-modules/billing/enums/billing-subscription-interval.enum';
|
||||
|
||||
@ObjectType('BillingPrice')
|
||||
export class BillingPriceDTO {
|
||||
@Field(() => Number)
|
||||
upTo: number;
|
||||
|
||||
@Field(() => Number)
|
||||
amount: number;
|
||||
|
||||
@Field(() => String)
|
||||
stripePriceId: string;
|
||||
|
||||
@Field(() => SubscriptionInterval)
|
||||
recurringInterval: SubscriptionInterval;
|
||||
}
|
||||
-15
@@ -1,15 +0,0 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { ArgsType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
|
||||
import { AvailableProduct } from 'src/engine/core-modules/billing/enums/billing-available-product.enum';
|
||||
|
||||
@ArgsType()
|
||||
export class BillingProductInput {
|
||||
@Field(() => String)
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
product: AvailableProduct;
|
||||
}
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
export enum AvailableProduct {
|
||||
BasePlan = 'base-plan',
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
import { SubscriptionInterval } from 'src/engine/core-modules/billing/enums/billing-subscription-interval.enum';
|
||||
import {
|
||||
BillingException,
|
||||
BillingExceptionCode,
|
||||
} from 'src/engine/core-modules/billing/billing.exception';
|
||||
|
||||
export const getOppositeInterval = (interval: SubscriptionInterval) => {
|
||||
if (interval === SubscriptionInterval.Month) return SubscriptionInterval.Year;
|
||||
if (interval === SubscriptionInterval.Year) return SubscriptionInterval.Month;
|
||||
throw new BillingException(
|
||||
`Interval invalid`,
|
||||
BillingExceptionCode.BILLING_SUBSCRIPTION_INTERVAL_INVALID,
|
||||
);
|
||||
};
|
||||
@@ -1,14 +0,0 @@
|
||||
import {
|
||||
BillingException,
|
||||
BillingExceptionCode,
|
||||
} from 'src/engine/core-modules/billing/billing.exception';
|
||||
import { BillingPlanKey } from 'src/engine/core-modules/billing/enums/billing-plan-key.enum';
|
||||
|
||||
export const getOppositePlan = (plan: BillingPlanKey) => {
|
||||
if (plan === BillingPlanKey.PRO) return BillingPlanKey.ENTERPRISE;
|
||||
if (plan === BillingPlanKey.ENTERPRISE) return BillingPlanKey.PRO;
|
||||
throw new BillingException(
|
||||
`Plan invalid`,
|
||||
BillingExceptionCode.BILLING_PLAN_NOT_FOUND,
|
||||
);
|
||||
};
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
export const isSubscriptionIncompleteOnboardingStatus = (
|
||||
hasAnySubscription: boolean,
|
||||
) => {
|
||||
return !hasAnySubscription;
|
||||
};
|
||||
-5
@@ -1,5 +0,0 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
const DAYS_TO_MS = (days: number) => days * 24 * 60 * 60 * 1000;
|
||||
|
||||
export const ENTERPRISE_VALIDITY_TOKEN_DEFAULT_EXPIRATION_MS = DAYS_TO_MS(30);
|
||||
-13
@@ -1,13 +0,0 @@
|
||||
/* @license Enterprise */
|
||||
|
||||
import { ArgsType, Field } from '@nestjs/graphql';
|
||||
|
||||
import { IsNotEmpty, IsString } from 'class-validator';
|
||||
|
||||
@ArgsType()
|
||||
export class SetEnterpriseKeyInput {
|
||||
@Field(() => String)
|
||||
@IsString()
|
||||
@IsNotEmpty()
|
||||
enterpriseKey: string;
|
||||
}
|
||||
-11
@@ -1,11 +0,0 @@
|
||||
import { type Readable } from 'stream';
|
||||
|
||||
export const readFileContent = async (stream: Readable): Promise<string> => {
|
||||
const chunks: Buffer[] = [];
|
||||
|
||||
for await (const chunk of stream) {
|
||||
chunks.push(Buffer.from(chunk));
|
||||
}
|
||||
|
||||
return Buffer.concat(chunks).toString('utf8');
|
||||
};
|
||||
-12
@@ -1,12 +0,0 @@
|
||||
import { dirname } from 'path';
|
||||
|
||||
export const getLogicFunctionBaseFolderPath = (handlerPath: string): string => {
|
||||
return dirname(dirname(handlerPath));
|
||||
};
|
||||
|
||||
export const getRelativePathFromBase = (
|
||||
handlerPath: string,
|
||||
baseFolderPath: string,
|
||||
): string => {
|
||||
return handlerPath.replace(`${baseFolderPath}/`, '');
|
||||
};
|
||||
-31
@@ -1,31 +0,0 @@
|
||||
export type FindByPositionQueryArgs = {
|
||||
positionValue: number | null;
|
||||
recordPositionQueryType: RecordPositionQueryType.FIND_BY_POSITION;
|
||||
};
|
||||
|
||||
export type FindMinPositionQueryArgs = {
|
||||
recordPositionQueryType: RecordPositionQueryType.FIND_MIN_POSITION;
|
||||
};
|
||||
|
||||
export type FindMaxPositionQueryArgs = {
|
||||
recordPositionQueryType: RecordPositionQueryType.FIND_MAX_POSITION;
|
||||
};
|
||||
|
||||
export type UpdatePositionQueryArgs = {
|
||||
recordId: string;
|
||||
positionValue: number;
|
||||
recordPositionQueryType: RecordPositionQueryType.UPDATE_POSITION;
|
||||
};
|
||||
|
||||
export enum RecordPositionQueryType {
|
||||
FIND_MIN_POSITION = 'FIND_MIN_POSITION',
|
||||
FIND_MAX_POSITION = 'FIND_MAX_POSITION',
|
||||
FIND_BY_POSITION = 'FIND_BY_POSITION',
|
||||
UPDATE_POSITION = 'UPDATE_POSITION',
|
||||
}
|
||||
|
||||
export type RecordPositionQueryArgs =
|
||||
| FindByPositionQueryArgs
|
||||
| FindMinPositionQueryArgs
|
||||
| FindMaxPositionQueryArgs
|
||||
| UpdatePositionQueryArgs;
|
||||
@@ -1,7 +0,0 @@
|
||||
export enum ToolType {
|
||||
HTTP_REQUEST = 'HTTP_REQUEST',
|
||||
SEND_EMAIL = 'SEND_EMAIL',
|
||||
SEARCH_HELP_CENTER = 'SEARCH_HELP_CENTER',
|
||||
CODE_INTERPRETER = 'CODE_INTERPRETER',
|
||||
NAVIGATE_APP = 'NAVIGATE_APP',
|
||||
}
|
||||
-1
@@ -1 +0,0 @@
|
||||
export { MAX_EMAIL_RECIPIENTS } from 'twenty-shared/constants';
|
||||
@@ -1,6 +0,0 @@
|
||||
export type ToolContext = {
|
||||
workspaceId: string;
|
||||
userId?: string;
|
||||
roleId?: string;
|
||||
[key: string]: unknown;
|
||||
};
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
export const CONFIG_VARIABLES_METADATA_DECORATOR_KEY =
|
||||
'config-variables-metadata' as const;
|
||||
-2
@@ -1,2 +0,0 @@
|
||||
export const CONFIG_VARIABLES_METADATA_DECORATOR_NAMES_KEY =
|
||||
'config-variable-names' as const;
|
||||
-14
@@ -1,14 +0,0 @@
|
||||
import {
|
||||
TWENTY_ALL_VERSIONS,
|
||||
TwentyAllVersion,
|
||||
} from 'src/engine/core-modules/upgrade/constants/twenty-all-versions.constant';
|
||||
import { TWENTY_CURRENT_VERSION } from 'src/engine/core-modules/upgrade/constants/twenty-current-version.constant';
|
||||
import { IndexOf, IsGreaterOrEqual } from 'twenty-shared/types';
|
||||
|
||||
export type RemovedSinceVersion<RemoveAtVersion extends TwentyAllVersion, T> =
|
||||
IsGreaterOrEqual<
|
||||
IndexOf<typeof TWENTY_CURRENT_VERSION, typeof TWENTY_ALL_VERSIONS>,
|
||||
IndexOf<RemoveAtVersion, typeof TWENTY_ALL_VERSIONS>
|
||||
> extends true
|
||||
? never
|
||||
: T;
|
||||
Reference in New Issue
Block a user