Change type import rule (#13751)
Forcing "type" to be explicit, works best will rollup on the frontend to exclude depdendencies
This commit is contained in:
@@ -1,4 +1,8 @@
|
||||
import { CanActivate, ExecutionContext, Injectable } from '@nestjs/common';
|
||||
import {
|
||||
type CanActivate,
|
||||
type ExecutionContext,
|
||||
Injectable,
|
||||
} from '@nestjs/common';
|
||||
import { GqlExecutionContext } from '@nestjs/graphql';
|
||||
|
||||
import { t } from '@lingui/core/macro';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import {
|
||||
CaptchaDriverOptions,
|
||||
CaptchaModuleOptions,
|
||||
type CaptchaDriverOptions,
|
||||
type CaptchaModuleOptions,
|
||||
} from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
import { type TwentyConfigService } from 'src/engine/core-modules/twenty-config/twenty-config.service';
|
||||
|
||||
export const captchaModuleFactory = (
|
||||
twentyConfigService: TwentyConfigService,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { DynamicModule, Global } from '@nestjs/common';
|
||||
import { type DynamicModule, Global } from '@nestjs/common';
|
||||
|
||||
import { CaptchaService } from 'src/engine/core-modules/captcha/captcha.service';
|
||||
import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/constants/captcha-driver.constants';
|
||||
@@ -6,7 +6,7 @@ import { GoogleRecaptchaDriver } from 'src/engine/core-modules/captcha/drivers/g
|
||||
import { TurnstileDriver } from 'src/engine/core-modules/captcha/drivers/turnstile.driver';
|
||||
import {
|
||||
CaptchaDriverType,
|
||||
CaptchaModuleAsyncOptions,
|
||||
type CaptchaModuleAsyncOptions,
|
||||
} from 'src/engine/core-modules/captcha/interfaces';
|
||||
|
||||
@Global()
|
||||
|
||||
@@ -3,7 +3,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||
import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface';
|
||||
|
||||
import { CAPTCHA_DRIVER } from 'src/engine/core-modules/captcha/constants/captcha-driver.constants';
|
||||
import { CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { type CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces';
|
||||
|
||||
@Injectable()
|
||||
export class CaptchaService implements CaptchaDriver {
|
||||
|
||||
+5
-5
@@ -1,11 +1,11 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import axios, { type AxiosInstance } from 'axios';
|
||||
|
||||
import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface';
|
||||
import { CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response';
|
||||
import { type CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface';
|
||||
import { type CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response';
|
||||
|
||||
import {
|
||||
CaptchaDriverOptions,
|
||||
CaptchaValidateResult,
|
||||
type CaptchaDriverOptions,
|
||||
type CaptchaValidateResult,
|
||||
} from 'src/engine/core-modules/captcha/interfaces';
|
||||
|
||||
export class GoogleRecaptchaDriver implements CaptchaDriver {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces';
|
||||
import { type CaptchaValidateResult } from 'src/engine/core-modules/captcha/interfaces';
|
||||
|
||||
export interface CaptchaDriver {
|
||||
validate(token: string): Promise<CaptchaValidateResult>;
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import axios, { AxiosInstance } from 'axios';
|
||||
import axios, { type AxiosInstance } from 'axios';
|
||||
|
||||
import { CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface';
|
||||
import { CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response';
|
||||
import { type CaptchaDriver } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-driver.interface';
|
||||
import { type CaptchaServerResponse } from 'src/engine/core-modules/captcha/drivers/interfaces/captcha-server-response';
|
||||
|
||||
import {
|
||||
CaptchaDriverOptions,
|
||||
CaptchaValidateResult,
|
||||
type CaptchaDriverOptions,
|
||||
type CaptchaValidateResult,
|
||||
} from 'src/engine/core-modules/captcha/interfaces';
|
||||
|
||||
export class TurnstileDriver implements CaptchaDriver {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { Catch, ExceptionFilter } from '@nestjs/common';
|
||||
import { Catch, type ExceptionFilter } from '@nestjs/common';
|
||||
|
||||
import { CaptchaException } from 'src/engine/core-modules/captcha/captcha.exception';
|
||||
import { captchaGraphqlApiExceptionHandler } from 'src/engine/core-modules/captcha/utils/captcha-graphql-api-exception-handler.util';
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
import { FactoryProvider, ModuleMetadata } from '@nestjs/common';
|
||||
import { type FactoryProvider, type ModuleMetadata } from '@nestjs/common';
|
||||
import { registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
export enum CaptchaDriverType {
|
||||
|
||||
+4
-4
@@ -1,5 +1,7 @@
|
||||
import { assertUnreachable } from 'twenty-shared/utils';
|
||||
|
||||
import {
|
||||
CaptchaException,
|
||||
type CaptchaException,
|
||||
CaptchaExceptionCode,
|
||||
} from 'src/engine/core-modules/captcha/captcha.exception';
|
||||
import { UserInputError } from 'src/engine/core-modules/graphql/utils/graphql-errors.util';
|
||||
@@ -12,9 +14,7 @@ export const captchaGraphqlApiExceptionHandler = (
|
||||
throw new UserInputError(exception);
|
||||
|
||||
default: {
|
||||
const _exhaustiveCheck: never = exception.code;
|
||||
|
||||
throw exception;
|
||||
assertUnreachable(exception.code);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user