[QRQC_2] No explicit any in twenty-server (#12068)
# Introduction Added a no-explicit-any rule to the twenty-server, not applicable to tests and integration tests folder Related to https://github.com/twentyhq/core-team-issues/issues/975 Discussed with Charles ## In case of conflicts Until this is approved I won't rebased and handle conflict, just need to drop two latest commits and re run the scripts etc ## Legacy We decided not to handle the existing lint error occurrences and programmatically ignored them through a disable next line rule comment ## Open question We might wanna activate the [no-explicit-any](https://typescript-eslint.io/rules/no-explicit-any/) `ignoreRestArgs` for our use case ? ``` ignoreRestArgs?: boolean; ``` --------- Co-authored-by: etiennejouan <jouan.etienne@gmail.com>
This commit is contained in:
@ -46,6 +46,7 @@ export class AdminPanelHealthService {
|
||||
: AdminPanelHealthServiceStatus.OUTAGE;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private transformServiceDetails(details: any) {
|
||||
if (!details) return details;
|
||||
|
||||
|
||||
@ -9,10 +9,13 @@ import { CreateAppTokenInput } from 'src/engine/core-modules/app-token/dtos/crea
|
||||
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
|
||||
export const appTokenAutoResolverOpts: AutoResolverOpts<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
unknown,
|
||||
unknown,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ReadResolverOpts<any>,
|
||||
PagingStrategies
|
||||
>[] = [
|
||||
|
||||
@ -11,6 +11,7 @@ export class BeforeCreateOneAppToken<T extends AppToken>
|
||||
{
|
||||
async run(
|
||||
instance: CreateOneInputType<T>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
context: any,
|
||||
): Promise<CreateOneInputType<T>> {
|
||||
const userId = context?.req?.user?.id;
|
||||
|
||||
@ -25,5 +25,6 @@ export class CreateObjectEventInput {
|
||||
@Field(() => GraphQLJSON, { nullable: true })
|
||||
@IsObject()
|
||||
@IsOptional()
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
properties?: Record<string, any>;
|
||||
}
|
||||
|
||||
@ -11,6 +11,7 @@ export const genericTrackSchema = baseEventSchema.extend({
|
||||
export type GenericTrackEvent<E extends string = string> = {
|
||||
type: 'track';
|
||||
event: E;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
properties: any;
|
||||
timestamp: string;
|
||||
version: string;
|
||||
@ -18,8 +19,10 @@ export type GenericTrackEvent<E extends string = string> = {
|
||||
workspaceId?: string;
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export const eventsRegistry = new Map<string, z.ZodSchema<any>>();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export function registerEvent<E extends string, S extends z.ZodObject<any>>(
|
||||
event: E,
|
||||
schema: S,
|
||||
|
||||
@ -57,6 +57,7 @@ export class SSOAuthController {
|
||||
@Get('saml/metadata/:identityProviderId')
|
||||
@UseGuards(EnterpriseFeaturesEnabledGuard)
|
||||
@UseFilters(AuthRestApiExceptionFilter)
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async generateMetadata(@Req() req: any): Promise<string | void> {
|
||||
return generateServiceProviderMetadata({
|
||||
wantAssertionsSigned: false,
|
||||
|
||||
@ -26,6 +26,7 @@ export class OIDCAuthGuard extends AuthGuard('openidconnect') {
|
||||
super();
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private getStateByRequest(request: any): {
|
||||
identityProviderId: string;
|
||||
} {
|
||||
|
||||
@ -20,6 +20,7 @@ export class GoogleAPIsOauthExchangeCodeForTokenStrategy extends GoogleAPIsOauth
|
||||
request: GoogleAPIsRequest,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
profile: any,
|
||||
done: VerifyCallback,
|
||||
): Promise<void> {
|
||||
|
||||
@ -14,6 +14,8 @@ export class GoogleAPIsOauthRequestCodeStrategy extends GoogleAPIsOauthCommonStr
|
||||
super(twentyConfigService);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authenticate(req: any, options: any) {
|
||||
options = {
|
||||
...options,
|
||||
|
||||
@ -36,6 +36,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authenticate(req: Request, options: any) {
|
||||
options = {
|
||||
...options,
|
||||
@ -54,6 +55,7 @@ export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
|
||||
request: GoogleRequest,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
profile: any,
|
||||
done: VerifyCallback,
|
||||
): Promise<void> {
|
||||
|
||||
@ -20,6 +20,7 @@ export class MicrosoftAPIsOauthExchangeCodeForTokenStrategy extends MicrosoftAPI
|
||||
request: MicrosoftAPIsRequest,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
profile: any,
|
||||
done: VerifyCallback,
|
||||
): Promise<void> {
|
||||
|
||||
@ -9,6 +9,8 @@ export class MicrosoftAPIsOauthRequestCodeStrategy extends MicrosoftAPIsOauthCom
|
||||
super(twentyConfigService);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authenticate(req: any, options: any) {
|
||||
options = {
|
||||
...options,
|
||||
|
||||
@ -40,6 +40,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
authenticate(req: Request, options: any) {
|
||||
options = {
|
||||
...options,
|
||||
@ -59,6 +60,7 @@ export class MicrosoftStrategy extends PassportStrategy(Strategy, 'microsoft') {
|
||||
request: MicrosoftRequest,
|
||||
accessToken: string,
|
||||
refreshToken: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
profile: any,
|
||||
done: VerifyCallback,
|
||||
): Promise<void> {
|
||||
|
||||
@ -45,6 +45,7 @@ export class OIDCAuthStrategy extends PassportStrategy(
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
async authenticate(req: Request, options: any) {
|
||||
return super.authenticate(req, {
|
||||
...options,
|
||||
@ -84,6 +85,7 @@ export class OIDCAuthStrategy extends PassportStrategy(
|
||||
async validate(
|
||||
req: Request,
|
||||
tokenset: TokenSet,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
done: (err: any, user?: OIDCRequest['user']) => void,
|
||||
) {
|
||||
try {
|
||||
|
||||
@ -34,7 +34,9 @@ export class CacheStorageModule implements OnModuleDestroy {
|
||||
constructor(@Inject(CACHE_MANAGER) private cacheManager: Cache) {}
|
||||
|
||||
async onModuleDestroy() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
if ((this.cacheManager.store as any)?.name === 'redis') {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
await (this.cacheManager.store as any).client.quit();
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ export class FlushCacheCommand extends CommandRunner {
|
||||
|
||||
async run(
|
||||
passedParams: string[],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
options?: Record<string, any>,
|
||||
): Promise<void> {
|
||||
const pattern = options?.pattern || '*';
|
||||
|
||||
@ -123,6 +123,7 @@ export class CacheStorageService {
|
||||
}
|
||||
|
||||
private isRedisCache() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return (this.cache.store as any)?.name === 'redis';
|
||||
}
|
||||
|
||||
|
||||
@ -14,6 +14,7 @@ export class CaptchaModule {
|
||||
static forRoot(options: CaptchaModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: CAPTCHA_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
const config = await options.useFactory(...args);
|
||||
|
||||
|
||||
@ -31,6 +31,7 @@ export type CaptchaModuleOptions =
|
||||
|
||||
export type CaptchaModuleAsyncOptions = {
|
||||
useFactory: (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...args: any[]
|
||||
) => CaptchaModuleOptions | Promise<CaptchaModuleOptions> | undefined;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
|
||||
@ -2,12 +2,14 @@ import * as Sentry from '@sentry/node';
|
||||
|
||||
export function SentryCronMonitor(monitorSlug: string, schedule: string) {
|
||||
return function (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
target: any,
|
||||
propertyKey: string,
|
||||
descriptor: PropertyDescriptor,
|
||||
) {
|
||||
const originalMethod = descriptor.value;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
descriptor.value = async function (...args: any[]) {
|
||||
if (!Sentry.isInitialized()) {
|
||||
return await originalMethod.apply(this, args);
|
||||
|
||||
@ -16,6 +16,7 @@ export class EmailModule {
|
||||
static forRoot(options: EmailModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: EMAIL_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => {
|
||||
const config = options.useFactory(...args);
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ export type EmailModuleOptions =
|
||||
};
|
||||
|
||||
export type EmailModuleAsyncOptions = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => EmailModuleOptions;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
Pick<FactoryProvider, 'inject'>;
|
||||
|
||||
@ -29,6 +29,8 @@ export const objectRecordChangedValues = (
|
||||
|
||||
return acc;
|
||||
},
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
{} as Record<string, { before: any; after: any }>,
|
||||
);
|
||||
};
|
||||
|
||||
@ -1,7 +1,11 @@
|
||||
export function objectRecordDiffMerge(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
oldRecord: Record<string, any>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
newRecord: Record<string, any>,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Record<string, any> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const result: Record<string, any> = { diff: {} };
|
||||
|
||||
// Iterate over the keys in the oldRecord diff
|
||||
|
||||
@ -7,6 +7,7 @@ export class ExceptionHandlerConsoleDriver
|
||||
implements ExceptionHandlerDriverInterface
|
||||
{
|
||||
captureExceptions(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exceptions: ReadonlyArray<any>,
|
||||
options?: ExceptionHandlerOptions,
|
||||
) {
|
||||
|
||||
@ -9,6 +9,7 @@ export class ExceptionHandlerSentryDriver
|
||||
implements ExceptionHandlerDriverInterface
|
||||
{
|
||||
captureExceptions(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exceptions: ReadonlyArray<any>,
|
||||
options?: ExceptionHandlerOptions,
|
||||
) {
|
||||
|
||||
@ -37,6 +37,7 @@ export class ExceptionHandlerModule extends ConfigurableModuleClass {
|
||||
static forRootAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule {
|
||||
const provider = {
|
||||
provide: EXCEPTION_HANDLER_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
const config = await options?.useFactory?.(...args);
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ export class ExceptionHandlerService {
|
||||
) {}
|
||||
|
||||
captureExceptions(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exceptions: ReadonlyArray<any>,
|
||||
options?: ExceptionHandlerOptions,
|
||||
): string[] {
|
||||
|
||||
@ -22,6 +22,7 @@ export const handleException = (
|
||||
|
||||
interface RequestAndParams {
|
||||
request: Request | null;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
params: any;
|
||||
}
|
||||
|
||||
@ -35,10 +36,14 @@ export class HttpExceptionHandlerService {
|
||||
|
||||
handleError = (
|
||||
exception: CustomException,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
response: Response<any, Record<string, any>>,
|
||||
errorCode?: number,
|
||||
user?: ExceptionHandlerUser,
|
||||
workspace?: ExceptionHandlerWorkspace,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Response<any, Record<string, any>> | undefined => {
|
||||
const params = this.request?.params;
|
||||
|
||||
|
||||
@ -2,6 +2,7 @@ import { ExceptionHandlerOptions } from 'src/engine/core-modules/exception-handl
|
||||
|
||||
export interface ExceptionHandlerDriverInterface {
|
||||
captureExceptions(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exceptions: ReadonlyArray<any>,
|
||||
options?: ExceptionHandlerOptions,
|
||||
): string[];
|
||||
|
||||
@ -9,6 +9,7 @@ export interface ExceptionHandlerOptions {
|
||||
name: string;
|
||||
};
|
||||
document?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
additionalData?: Record<string, any>;
|
||||
user?: ExceptionHandlerUser | null;
|
||||
workspace?: ExceptionHandlerWorkspace | null;
|
||||
|
||||
@ -9,6 +9,7 @@ export class ExceptionHandlerMockService
|
||||
implements ExceptionHandlerDriverInterface
|
||||
{
|
||||
captureExceptions(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
exceptions: readonly any[],
|
||||
_?: ExceptionHandlerOptions | undefined,
|
||||
): string[] {
|
||||
|
||||
@ -6,6 +6,7 @@ export class MockedUnhandledExceptionFilter
|
||||
extends BaseExceptionFilter
|
||||
implements ExceptionFilter
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
catch(exception: any, _host: ArgumentsHost) {
|
||||
throw exception;
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ export class FileStorageModule {
|
||||
static forRootAsync(options: FileStorageModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: STORAGE_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
const config = await options.useFactory(...args);
|
||||
|
||||
|
||||
@ -24,6 +24,7 @@ export type FileStorageModuleOptions =
|
||||
|
||||
export type FileStorageModuleAsyncOptions = {
|
||||
useFactory: (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...args: any[]
|
||||
) => FileStorageModuleOptions | Promise<FileStorageModuleOptions>;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
|
||||
@ -42,6 +42,7 @@ export class FileController {
|
||||
const folderPath = checkFilePath(params[0]);
|
||||
const filename = checkFilename(params['filename']);
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const workspaceId = (req as any)?.workspaceId;
|
||||
|
||||
if (!workspaceId) {
|
||||
|
||||
@ -27,6 +27,7 @@ export class FileService {
|
||||
});
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
encodeFileToken(payloadToEncode: Record<string, any>) {
|
||||
const fileTokenExpiresIn = this.twentyConfigService.get(
|
||||
'FILE_TOKEN_EXPIRES_IN',
|
||||
|
||||
@ -31,6 +31,7 @@ export enum ErrorCode {
|
||||
}
|
||||
|
||||
export class BaseGraphQLError extends GraphQLError {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
public extensions: Record<string, any>;
|
||||
override readonly name!: string;
|
||||
readonly locations: ReadonlyArray<SourceLocation> | undefined;
|
||||
@ -40,11 +41,13 @@ export class BaseGraphQLError extends GraphQLError {
|
||||
readonly nodes: ReadonlyArray<ASTNode> | undefined;
|
||||
public originalError: Error | undefined;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
|
||||
constructor(
|
||||
message: string,
|
||||
code?: string,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
extensions?: Record<string, any>,
|
||||
) {
|
||||
super(message);
|
||||
@ -106,6 +109,7 @@ export class ValidationError extends BaseGraphQLError {
|
||||
}
|
||||
|
||||
export class AuthenticationError extends BaseGraphQLError {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(message: string, extensions?: Record<string, any>) {
|
||||
super(message, ErrorCode.UNAUTHENTICATED, extensions);
|
||||
|
||||
@ -114,6 +118,7 @@ export class AuthenticationError extends BaseGraphQLError {
|
||||
}
|
||||
|
||||
export class ForbiddenError extends BaseGraphQLError {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
constructor(message: string, extensions?: Record<string, any>) {
|
||||
super(message, ErrorCode.FORBIDDEN, extensions);
|
||||
|
||||
|
||||
@ -1,9 +1,11 @@
|
||||
export class HealthStateManager {
|
||||
private lastKnownState: {
|
||||
timestamp: Date;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
details: Record<string, any>;
|
||||
} | null = null;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
updateState(details: Record<string, any>) {
|
||||
this.lastKnownState = {
|
||||
timestamp: new Date(),
|
||||
|
||||
@ -38,6 +38,7 @@ import { messages as zhHantMessages } from 'src/engine/core-modules/i18n/locales
|
||||
@Injectable()
|
||||
export class I18nService implements OnModuleInit {
|
||||
async loadTranslations() {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const messages: Record<keyof typeof APP_LOCALES, any> = {
|
||||
en: enMessages,
|
||||
'pseudo-en': pseudoEnMessages,
|
||||
@ -72,6 +73,7 @@ export class I18nService implements OnModuleInit {
|
||||
'zh-TW': zhHantMessages,
|
||||
};
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(Object.entries(messages) as [keyof typeof APP_LOCALES, any][]).forEach(
|
||||
([locale, message]) => {
|
||||
i18n.load(locale, message);
|
||||
|
||||
@ -39,10 +39,12 @@ export class JwtWrapperService {
|
||||
return this.jwtService.sign(payload, options);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
verify<T extends object = any>(token: string, options?: JwtVerifyOptions): T {
|
||||
return this.jwtService.verify(token, options);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
decode<T = any>(payload: string, options?: jwt.DecodeOptions): T {
|
||||
return this.jwtService.decode(payload, options);
|
||||
}
|
||||
|
||||
@ -8,6 +8,8 @@ import {
|
||||
} from 'src/engine/core-modules/key-value-pair/key-value-pair.entity';
|
||||
|
||||
export class KeyValuePairService<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
KeyValueTypesMap extends Record<string, any> = Record<string, any>,
|
||||
> {
|
||||
constructor(
|
||||
|
||||
@ -9,6 +9,7 @@ export interface LLMChatModelModuleOptions {
|
||||
}
|
||||
|
||||
export type LLMChatModelModuleAsyncOptions = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => LLMChatModelModuleOptions | undefined;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
Pick<FactoryProvider, 'inject'>;
|
||||
|
||||
@ -14,6 +14,7 @@ export class LLMChatModelModule {
|
||||
static forRoot(options: LLMChatModelModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: LLM_CHAT_MODEL_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => {
|
||||
const config = options.useFactory(...args);
|
||||
|
||||
|
||||
@ -21,6 +21,7 @@ export type LLMTracingModuleOptions =
|
||||
| ConsoleDriverFactoryOptions;
|
||||
|
||||
export type LLMTracingModuleAsyncOptions = {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => LLMTracingModuleOptions;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
Pick<FactoryProvider, 'inject'>;
|
||||
|
||||
@ -15,6 +15,7 @@ export class LLMTracingModule {
|
||||
static forRoot(options: LLMTracingModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: LLM_TRACING_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: (...args: any[]) => {
|
||||
const config = options.useFactory(...args);
|
||||
|
||||
|
||||
@ -34,6 +34,7 @@ export class LoggerModule extends ConfigurableModuleClass {
|
||||
static forRootAsync(options: typeof ASYNC_OPTIONS_TYPE): DynamicModule {
|
||||
const provider = {
|
||||
provide: LOGGER_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
const config = await options?.useFactory?.(...args);
|
||||
|
||||
|
||||
@ -11,10 +11,14 @@ import { LOGGER_DRIVER } from 'src/engine/core-modules/logger/logger.constants';
|
||||
export class LoggerService implements LoggerServiceInterface {
|
||||
constructor(@Inject(LOGGER_DRIVER) private driver: LoggerServiceInterface) {}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
log(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.log.apply(this.driver, [message, category, ...optionalParams]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
error(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.error.apply(this.driver, [
|
||||
message,
|
||||
@ -23,10 +27,14 @@ export class LoggerService implements LoggerServiceInterface {
|
||||
]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
warn(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.warn.apply(this.driver, [message, category, ...optionalParams]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
debug?(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.debug?.apply(this.driver, [
|
||||
message,
|
||||
@ -35,6 +43,8 @@ export class LoggerService implements LoggerServiceInterface {
|
||||
]);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
verbose?(message: any, category: string, ...optionalParams: any[]) {
|
||||
this.driver.verbose?.apply(this.driver, [
|
||||
message,
|
||||
|
||||
@ -38,6 +38,7 @@ export class SyncDriver implements MessageQueueDriver {
|
||||
id: '',
|
||||
name: jobName,
|
||||
// TODO: Fix this type issue
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
data: data as any,
|
||||
});
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
export interface MessageQueueJob<T = any> {
|
||||
id: string;
|
||||
name: string;
|
||||
@ -11,5 +12,6 @@ export interface MessageQueueCronJobData<
|
||||
}
|
||||
|
||||
export interface MessageQueueJobData {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[key: string]: any;
|
||||
}
|
||||
|
||||
@ -19,6 +19,7 @@ export interface BullMQDriverFactoryOptions {
|
||||
|
||||
export interface SyncDriverFactoryOptions {
|
||||
type: MessageQueueDriverType.Sync;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
options: Record<string, any>;
|
||||
}
|
||||
|
||||
|
||||
@ -62,6 +62,7 @@ export class MessageQueueCoreModule extends ConfigurableModuleClass {
|
||||
|
||||
const driverProvider: Provider = {
|
||||
provide: QUEUE_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
if (options.useFactory) {
|
||||
const config = await options.useFactory(...args);
|
||||
|
||||
@ -8,6 +8,7 @@ import { computeTableName } from 'src/engine/utils/compute-table-name.util';
|
||||
|
||||
type RecordPositionQuery = string;
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
type RecordPositionQueryParams = any[];
|
||||
|
||||
export const buildRecordPositionQuery = (
|
||||
|
||||
@ -21,8 +21,10 @@ export class RecordInputTransformerService {
|
||||
recordInput,
|
||||
objectMetadataMapItem,
|
||||
}: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
recordInput: Record<string, any>;
|
||||
objectMetadataMapItem: ObjectMetadataItemWithFieldMaps;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
}): Promise<Record<string, any>> {
|
||||
if (!recordInput) {
|
||||
return recordInput;
|
||||
@ -63,7 +65,9 @@ export class RecordInputTransformerService {
|
||||
|
||||
async transformFieldValue(
|
||||
fieldType: FieldMetadataType,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Promise<any> {
|
||||
if (!isDefined(value)) {
|
||||
return value;
|
||||
@ -90,6 +94,7 @@ export class RecordInputTransformerService {
|
||||
}
|
||||
|
||||
private async transformRichTextV2Value(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
richTextValue: any,
|
||||
): Promise<RichTextV2Metadata> {
|
||||
const parsedValue = richTextV2ValueSchema.parse(richTextValue);
|
||||
@ -124,6 +129,8 @@ export class RecordInputTransformerService {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private transformLinksValue(value: any): any {
|
||||
if (!value) {
|
||||
return value;
|
||||
@ -157,6 +164,8 @@ export class RecordInputTransformerService {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private transformEmailsValue(value: any): any {
|
||||
if (!value) {
|
||||
return value;
|
||||
@ -185,6 +194,7 @@ export class RecordInputTransformerService {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private stringifySubFields(fieldMetadataType: FieldMetadataType, value: any) {
|
||||
const compositeType = compositeTypeDefinitions.get(fieldMetadataType);
|
||||
|
||||
@ -213,6 +223,7 @@ export class RecordInputTransformerService {
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private parseSubFields(fieldMetadataType: FieldMetadataType, value: any) {
|
||||
const compositeType = compositeTypeDefinitions.get(fieldMetadataType);
|
||||
|
||||
@ -221,6 +232,7 @@ export class RecordInputTransformerService {
|
||||
}
|
||||
|
||||
return Object.entries(value).reduce(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
(acc, [subFieldName, subFieldValue]: [string, any]) => {
|
||||
const subFieldType = compositeType.properties.find(
|
||||
(property) => property.name === subFieldName,
|
||||
|
||||
@ -28,6 +28,7 @@ export class AddPackagesCommand extends CommandRunner {
|
||||
|
||||
async run(
|
||||
passedParams: string[],
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
options: Record<string, any>,
|
||||
): Promise<void> {
|
||||
this.logger.log('---------------------------------------');
|
||||
|
||||
@ -21,6 +21,7 @@ export const copyAndBuildDependencies = async (buildDirectory: string) => {
|
||||
|
||||
try {
|
||||
await execPromise('yarn', { cwd: buildDirectory });
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
throw new Error(error.stdout);
|
||||
}
|
||||
|
||||
@ -12,8 +12,10 @@ export class ConsoleListener {
|
||||
};
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
intercept(callback: (type: string, message: any[]) => void) {
|
||||
Object.keys(this.originalConsole).forEach((method) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
console[method] = (...args: any[]) => {
|
||||
callback(method, args);
|
||||
};
|
||||
@ -22,6 +24,7 @@ export class ConsoleListener {
|
||||
|
||||
release() {
|
||||
Object.keys(this.originalConsole).forEach((method) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
console[method] = (...args: any[]) => {
|
||||
this.originalConsole[method](...args);
|
||||
};
|
||||
|
||||
@ -24,6 +24,7 @@ export type ServerlessModuleOptions =
|
||||
|
||||
export type ServerlessModuleAsyncOptions = {
|
||||
useFactory: (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
...args: any[]
|
||||
) => ServerlessModuleOptions | Promise<ServerlessModuleOptions>;
|
||||
} & Pick<ModuleMetadata, 'imports'> &
|
||||
|
||||
@ -15,6 +15,7 @@ export class ServerlessModule {
|
||||
static forRootAsync(options: ServerlessModuleAsyncOptions): DynamicModule {
|
||||
const provider = {
|
||||
provide: SERVERLESS_DRIVER,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
useFactory: async (...args: any[]) => {
|
||||
const config = await options.useFactory(...args);
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ import {
|
||||
export class IsX509CertificateConstraint
|
||||
implements ValidatorConstraintInterface
|
||||
{
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
validate(value: any) {
|
||||
if (typeof value !== 'string') {
|
||||
return false;
|
||||
|
||||
@ -78,6 +78,7 @@ export class ConfigValueConverterService {
|
||||
return appValue;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return transformer.toStorage(appValue as any, options);
|
||||
} catch (error) {
|
||||
if (error instanceof ConfigVariableException) {
|
||||
|
||||
@ -5,9 +5,12 @@ import {
|
||||
} from 'class-validator';
|
||||
|
||||
export const AssertOrWarn = (
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
condition: (object: any, value: any) => boolean,
|
||||
validationOptions?: ValidationOptions,
|
||||
) => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
return function (object: any, propertyName: string) {
|
||||
registerDecorator({
|
||||
name: 'AssertOrWarn',
|
||||
@ -19,6 +22,7 @@ export const AssertOrWarn = (
|
||||
},
|
||||
constraints: [condition],
|
||||
validator: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
validate(value: any, args: ValidationArguments) {
|
||||
return condition(args.object, value);
|
||||
},
|
||||
|
||||
@ -3,6 +3,7 @@ import { Transform } from 'class-transformer';
|
||||
export const CastToLogLevelArray = () =>
|
||||
Transform(({ value }: { value: string }) => toLogLevelArray(value));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const toLogLevelArray = (value: any) => {
|
||||
if (typeof value === 'string') {
|
||||
const rawLogLevels = value.split(',').map((level) => level.trim());
|
||||
|
||||
@ -3,6 +3,7 @@ import { Transform } from 'class-transformer';
|
||||
export const CastToPositiveNumber = () =>
|
||||
Transform(({ value }: { value: string }) => toNumber(value));
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const toNumber = (value: any) => {
|
||||
if (typeof value === 'number') {
|
||||
return value >= 0 ? value : undefined;
|
||||
|
||||
@ -16,8 +16,10 @@ export const IsStrictlyLowerThan = (
|
||||
constraints: [property],
|
||||
options: validationOptions,
|
||||
validator: {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
validate(value: any, args: ValidationArguments) {
|
||||
const [relatedPropertyName] = args.constraints;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
const relatedValue = (args.object as any)[relatedPropertyName];
|
||||
|
||||
return (
|
||||
|
||||
@ -51,15 +51,18 @@ export class ConfigStorageService implements ConfigStorageInterface {
|
||||
];
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
private logAndRethrow(message: string, error: any): never {
|
||||
this.logger.error(message, error);
|
||||
throw error;
|
||||
}
|
||||
|
||||
private async convertAndSecureValue<T extends keyof ConfigVariables>(
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any,
|
||||
key: T,
|
||||
isDecrypt = false,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Promise<any> {
|
||||
try {
|
||||
const convertedValue = isDecrypt
|
||||
|
||||
@ -237,7 +237,9 @@ export class TwentyConfigService {
|
||||
|
||||
private maskSensitiveValue<T extends keyof ConfigVariables>(
|
||||
key: T,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
value: any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): any {
|
||||
if (!isString(value) || !(key in CONFIG_VARIABLES_MASKING_CONFIG)) {
|
||||
return value;
|
||||
|
||||
@ -27,6 +27,7 @@ export interface TypeTransformer<T> {
|
||||
|
||||
export const typeTransformers: Record<
|
||||
ConfigVariableType,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
TypeTransformer<any>
|
||||
> = {
|
||||
[ConfigVariableType.BOOLEAN]: {
|
||||
|
||||
@ -179,6 +179,7 @@ export class UserService extends TypeOrmQueryService<User> {
|
||||
userId,
|
||||
workspaceId: userWorkspace.workspaceId,
|
||||
});
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
} catch (error: any) {
|
||||
if (
|
||||
error instanceof PermissionsException &&
|
||||
|
||||
@ -6,6 +6,8 @@ import { mergeUserVars } from 'src/engine/core-modules/user/user-vars/utils/merg
|
||||
|
||||
@Injectable()
|
||||
export class UserVarsService<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
KeyValueTypesMap extends Record<string, any> = Record<string, any>,
|
||||
> {
|
||||
constructor(private readonly keyValuePairService: KeyValuePairService) {}
|
||||
@ -19,6 +21,7 @@ export class UserVarsService<
|
||||
workspaceId?: string;
|
||||
key: Extract<K, string>;
|
||||
}): Promise<KeyValueTypesMap[K]> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarWorkspaceLevel: any[] = [];
|
||||
|
||||
if (workspaceId) {
|
||||
@ -36,6 +39,7 @@ export class UserVarsService<
|
||||
);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarUserLevel: any[] = [];
|
||||
|
||||
if (userId) {
|
||||
@ -51,6 +55,7 @@ export class UserVarsService<
|
||||
throw new Error(`Multiple values found for key ${key} at user level`);
|
||||
}
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let userVarWorkspaceAndUserLevel: any[] = [];
|
||||
|
||||
if (userId && workspaceId) {
|
||||
@ -81,7 +86,9 @@ export class UserVarsService<
|
||||
}: {
|
||||
userId?: string;
|
||||
workspaceId?: string;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
}): Promise<Map<Extract<keyof KeyValueTypesMap, string>, any>> {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
let result: any[] = [];
|
||||
|
||||
if (userId) {
|
||||
|
||||
@ -8,10 +8,13 @@ import { User } from 'src/engine/core-modules/user/user.entity';
|
||||
import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
|
||||
export const userAutoResolverOpts: AutoResolverOpts<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
unknown,
|
||||
unknown,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ReadResolverOpts<any>,
|
||||
PagingStrategies
|
||||
>[] = [
|
||||
|
||||
@ -150,6 +150,7 @@ export class UserResolver {
|
||||
async userVars(
|
||||
@Parent() user: User,
|
||||
@AuthWorkspace() workspace: Workspace,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
): Promise<Record<string, any>> {
|
||||
const userVars = await this.userVarService.getAll({
|
||||
userId: user.id,
|
||||
|
||||
@ -10,10 +10,13 @@ import { WorkspaceAuthGuard } from 'src/engine/guards/workspace-auth.guard';
|
||||
import { Workspace } from './workspace.entity';
|
||||
|
||||
export const workspaceAutoResolverOpts: AutoResolverOpts<
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
any,
|
||||
unknown,
|
||||
unknown,
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
ReadResolverOpts<any>,
|
||||
PagingStrategies
|
||||
>[] = [
|
||||
|
||||
Reference in New Issue
Block a user