diff --git a/backend/knip.json b/backend/knip.json new file mode 100644 index 00000000..b605ec3c --- /dev/null +++ b/backend/knip.json @@ -0,0 +1,9 @@ +{ + "$schema": "https://unpkg.com/knip@5/schema.json", + "ignoreExportsUsedInFile": { + "interface": true, + "type": true + }, + "ignore": ["src/migrations/**", "src/shared/config/datasource.config.ts", "src/enums/widget-type.enum.ts"], + "tags": ["-lintignore"] +} diff --git a/backend/package.json b/backend/package.json index af3b7062..b3486017 100644 --- a/backend/package.json +++ b/backend/package.json @@ -29,7 +29,8 @@ "migration:generate": "yarn run typeorm migration:generate -d dist/shared/config/datasource.config.js", "migration:create": "yarn run typeorm migration:create -d dist/shared/config/datasource.config.js", "migration:run": "yarn run typeorm migration:run -d dist/shared/config/datasource.config.js", - "migration:revert": "npm run typeorm -- migration:revert -d dist/shared/config/datasource.config.js" + "migration:revert": "npm run typeorm -- migration:revert -d dist/shared/config/datasource.config.js", + "knip": "knip" }, "dependencies": { "@amplitude/node": "1.10.2", @@ -39,7 +40,6 @@ "@nestjs/common": "11.1.8", "@nestjs/config": "4.0.2", "@nestjs/core": "11.1.8", - "@nestjs/microservices": "^11.1.8", "@nestjs/platform-express": "11.1.8", "@nestjs/schedule": "^6.0.1", "@nestjs/swagger": "^11.2.1", @@ -71,7 +71,6 @@ "dotenv": "17.2.3", "eslint-plugin-security": "3.0.1", "express": "5.1.0", - "express-rate-limit": "8.1.0", "fetch-blob": "^4.0.0", "helmet": "8.1.0", "i18n-iso-countries": "^7.14.0", @@ -116,7 +115,7 @@ "@types/express": "^5.0.5", "@types/ibm_db": "^3.2.0", "@types/json2csv": "^5.0.7", - "@types/node": "^24.9.1", + "@types/node": "^24.10.1", "@types/safe-regex": "^1.1.6", "@types/supertest": "^6.0.3", "@types/uuid": "^11.0.0", @@ -127,12 +126,13 @@ "eslint": "^9.38.0", "eslint-config-prettier": "^10.1.8", "eslint-plugin-import": "^2.32.0", + "knip": "^5.70.2", "nock": "^14.0.10", "prettier": "^3.6.2", "supertest": "^7.1.4", "ts-loader": "^9.5.4", "ts-node": "^10.9.2", "tsconfig-paths": "^4.2.0", - "typescript": "5.9.3" + "typescript": "^5.9.3" } } diff --git a/backend/src/authorization/index.ts b/backend/src/authorization/index.ts index 0b241cf5..8483d7b3 100644 --- a/backend/src/authorization/index.ts +++ b/backend/src/authorization/index.ts @@ -1,3 +1,3 @@ export { AuthMiddleware } from './auth.middleware.js'; export { BasicAuthMiddleware } from './basic-auth.middleware.js'; -export { IRequestWithCognitoInfo, ICognitoDecodedData } from './cognito-decoded.interface.js'; +export { IRequestWithCognitoInfo } from './cognito-decoded.interface.js'; diff --git a/backend/src/common/data-injection.tokens.ts b/backend/src/common/data-injection.tokens.ts index 848df8d3..353e8466 100644 --- a/backend/src/common/data-injection.tokens.ts +++ b/backend/src/common/data-injection.tokens.ts @@ -153,15 +153,8 @@ export enum UseCaseType { GET_API_KEY = 'GET_API_KEY', DELETE_API_KEY = 'DELETE_API_KEY', - REQUEST_INFO_FROM_TABLE_WITH_AI = 'REQUEST_INFO_FROM_TABLE_WITH_AI', REQUEST_INFO_FROM_TABLE_WITH_AI_V2 = 'REQUEST_INFO_FROM_TABLE_WITH_AI_V2', - CREATE_THREAD_WITH_AI_ASSISTANT = 'CREATE_THREAD_WITH_AI_ASSISTANT', - ADD_MESSAGE_TO_THREAD_WITH_AI_ASSISTANT = 'ADD_MESSAGE_TO_THREAD_WITH_AI_ASSISTANT', - GET_ALL_USER_THREADS_WITH_AI_ASSISTANT = 'GET_ALL_USER_THREADS_WITH_AI_ASSISTANT', - GET_ALL_THREAD_MESSAGES = 'GET_ALL_THREAD_MESSAGES', - DELETE_THREAD_WITH_AI_ASSISTANT = 'DELETE_THREAD_WITH_AI_ASSISTANT', - CREATE_TABLE_FILTERS = 'CREATE_TABLE_FILTERS', FIND_TABLE_FILTERS = 'FIND_TABLE_FILTERS', DELETE_TABLE_FILTERS = 'DELETE_TABLE_FILTERS', diff --git a/backend/src/entities/ai/application/data-structures/request-info-from-table.ds.ts b/backend/src/entities/ai/application/data-structures/request-info-from-table.ds.ts index 24ff6c10..9bdb203d 100644 --- a/backend/src/entities/ai/application/data-structures/request-info-from-table.ds.ts +++ b/backend/src/entities/ai/application/data-structures/request-info-from-table.ds.ts @@ -1,5 +1,5 @@ import { Response } from 'express'; -export class RequestInfoFromTableDS { +class RequestInfoFromTableDS { connectionId: string; tableName: string; user_message: string; diff --git a/backend/src/entities/ai/application/data-structures/response-info.ds.ts b/backend/src/entities/ai/application/data-structures/response-info.ds.ts deleted file mode 100644 index b0163ef3..00000000 --- a/backend/src/entities/ai/application/data-structures/response-info.ds.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; - -export class ResponseInfoDS { - @ApiProperty() - response_message: string; -} diff --git a/backend/src/entities/ai/application/enums/message-roles.enum.ts b/backend/src/entities/ai/application/enums/message-roles.enum.ts deleted file mode 100644 index 9735c651..00000000 --- a/backend/src/entities/ai/application/enums/message-roles.enum.ts +++ /dev/null @@ -1,4 +0,0 @@ -export enum MessageRolesEnum { - user = 'user', - assistant = 'assistant', -} \ No newline at end of file diff --git a/backend/src/entities/ai/utils/command-validity-check.util.ts b/backend/src/entities/ai/utils/command-validity-check.util.ts deleted file mode 100644 index 9cc414f8..00000000 --- a/backend/src/entities/ai/utils/command-validity-check.util.ts +++ /dev/null @@ -1,44 +0,0 @@ -export function isValidSQLQuery(query: string): boolean { - const upperCaseQuery = query.toUpperCase(); - const forbiddenKeywords = ['DROP', 'DELETE', 'ALTER', 'TRUNCATE', 'INSERT', 'UPDATE']; - - if (forbiddenKeywords.some((keyword) => upperCaseQuery.includes(keyword))) { - return false; - } - - const cleanedQuery = query.trim().replace(/;$/, ''); - - const sqlInjectionPatterns = [/--/, /\/\*/, /\*\//]; - - if (sqlInjectionPatterns.some((pattern) => pattern.test(cleanedQuery))) { - return false; - } - - if (cleanedQuery.split(';').length > 1) { - return false; - } - - const selectPattern = /^\s*SELECT\s+[\s\S]+\s+FROM\s+/i; - if (!selectPattern.test(cleanedQuery)) { - return false; - } - - return true; -} - -export function isValidMongoDbCommand(command: string): boolean { - const upperCaseCommand = command.toUpperCase(); - const forbiddenKeywords = ['DROP', 'REMOVE', 'UPDATE', 'INSERT']; - - if (forbiddenKeywords.some((keyword) => upperCaseCommand.includes(keyword))) { - return false; - } - - const injectionPatterns = [/\/\*/, /\*\//]; - - if (injectionPatterns.some((pattern) => pattern.test(command))) { - return false; - } - - return true; -} diff --git a/backend/src/entities/ai/utils/prompt-generating.util.ts b/backend/src/entities/ai/utils/prompt-generating.util.ts deleted file mode 100644 index 7f14a33f..00000000 --- a/backend/src/entities/ai/utils/prompt-generating.util.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { ConnectionTypesEnum } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/enums/connection-types-enum.js'; - -export function convertDdTypeEnumToReadableString(dataType: ConnectionTypesEnum): string { - switch (dataType) { - case ConnectionTypesEnum.postgres: - case ConnectionTypesEnum.agent_postgres: - return 'PostgreSQL'; - case ConnectionTypesEnum.mysql: - case ConnectionTypesEnum.agent_mysql: - return 'MySQL'; - case ConnectionTypesEnum.mongodb: - case ConnectionTypesEnum.agent_mongodb: - return 'MongoDB'; - case ConnectionTypesEnum.mssql: - case ConnectionTypesEnum.agent_mssql: - return 'Microsoft SQL Server'; - case ConnectionTypesEnum.oracledb: - case ConnectionTypesEnum.agent_oracledb: - return 'Oracle DB'; - case ConnectionTypesEnum.ibmdb2: - case ConnectionTypesEnum.agent_ibmdb2: - return 'IBM DB2'; - default: - throw new Error('Unknown database type'); - } -} diff --git a/backend/src/entities/ai/utils/wrap-query-with-limit.util.ts b/backend/src/entities/ai/utils/wrap-query-with-limit.util.ts deleted file mode 100644 index b7e52d67..00000000 --- a/backend/src/entities/ai/utils/wrap-query-with-limit.util.ts +++ /dev/null @@ -1,22 +0,0 @@ -import { ConnectionTypesEnum } from "@rocketadmin/shared-code/dist/src/data-access-layer/shared/enums/connection-types-enum.js"; - -export function wrapQueryWithLimit(query: string, databaseType: ConnectionTypesEnum): string { - const queryWithoutSemicolon = query.replace(/;$/, ''); - switch (databaseType) { - case ConnectionTypesEnum.postgres: - case ConnectionTypesEnum.agent_postgres: - case ConnectionTypesEnum.mysql: - case ConnectionTypesEnum.agent_mysql: - case ConnectionTypesEnum.mssql: - case ConnectionTypesEnum.agent_mssql: - return `SELECT * FROM (${queryWithoutSemicolon}) AS ai_query LIMIT 1000`; - case ConnectionTypesEnum.ibmdb2: - case ConnectionTypesEnum.agent_ibmdb2: - return `SELECT * FROM (${queryWithoutSemicolon}) AS ai_query FETCH FIRST 1000 ROWS ONLY`; - case ConnectionTypesEnum.oracledb: - case ConnectionTypesEnum.agent_oracledb: - return `SELECT * FROM (${queryWithoutSemicolon}) WHERE ROWNUM <= 1000`; - default: - throw new Error('Unsupported database type'); - } -} diff --git a/backend/src/entities/connection-properties/dto/index.ts b/backend/src/entities/connection-properties/dto/index.ts index 92c889ee..35f561fd 100644 --- a/backend/src/entities/connection-properties/dto/index.ts +++ b/backend/src/entities/connection-properties/dto/index.ts @@ -1,2 +1 @@ export { CreateConnectionPropertiesDto } from './create-connection-properties.dto.js'; -export { UpdateConnectionPropertiesDto } from './update-connection-properties.dto.js'; diff --git a/backend/src/entities/connection-properties/dto/update-connection-properties.dto.ts b/backend/src/entities/connection-properties/dto/update-connection-properties.dto.ts deleted file mode 100644 index 8f3fba3e..00000000 --- a/backend/src/entities/connection-properties/dto/update-connection-properties.dto.ts +++ /dev/null @@ -1,3 +0,0 @@ -export class UpdateConnectionPropertiesDto { - hidden_tables: Array; -} diff --git a/backend/src/entities/connection/application/dto/index.ts b/backend/src/entities/connection/application/dto/index.ts deleted file mode 100644 index 7f772b0a..00000000 --- a/backend/src/entities/connection/application/dto/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { CreateConnectionDto } from './create-connection.dto.js'; -export { CreateGroupInConnectionDTO } from './create-group-in-connection.dto.js'; diff --git a/backend/src/entities/connection/connection.controller.ts b/backend/src/entities/connection/connection.controller.ts index d646cbeb..c8077951 100644 --- a/backend/src/entities/connection/connection.controller.ts +++ b/backend/src/entities/connection/connection.controller.ts @@ -55,7 +55,6 @@ import { CreateGroupInConnectionDTO } from './application/dto/create-group-in-co import { DeleteConnectionReasonDto } from './application/dto/delete-connection.dto.js'; import { DeleteGroupFromConnectionDTO } from './application/dto/delete-group-from-connection-request.dto.js'; import { FoundUserGroupsInConnectionDTO } from './application/dto/found-user-groups-in-connection.dto.js'; -import { CreateConnectionDto } from './application/dto/index.js'; import { ConnectionTokenResponseDTO } from './application/dto/new-connection-token-response.dto.js'; import { TestConnectionResponseDTO } from './application/dto/test-connection-response.dto.js'; import { UpdateMasterPasswordRequestBodyDto } from './application/dto/update-master-password-request-body.dto.js'; @@ -84,6 +83,7 @@ import { TokenValidationResult } from './use-cases/validate-connection-token.use import { isTestConnectionUtil } from './utils/is-test-connection-util.js'; import { SkipThrottle } from '@nestjs/throttler'; import { isRedisConnectionUrl } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/create-data-access-object.js'; +import { CreateConnectionDto } from './application/dto/create-connection.dto.js'; @UseInterceptors(SentryInterceptor) @Controller() diff --git a/backend/src/entities/connection/connection.interface.ts b/backend/src/entities/connection/connection.interface.ts deleted file mode 100644 index 9e8b3051..00000000 --- a/backend/src/entities/connection/connection.interface.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { AccessLevelEnum } from '../../enums/index.js'; -import { IUserData } from '../user/user.interface.js'; - -export interface IConnectionData { - id: string; - title?: string; - masterEncryption: boolean; - type?: string; - host?: string; - port?: number; - username?: string; - database?: string; - schema?: string; - sid?: string; - createdAt?: Date; - updatedAt?: Date; - ssh?: boolean; - sshHost?: string; - sshPort?: number; - ssl?: boolean; - cert?: string; - author?: IUserData; - token?: string; - azure_encryption?: boolean; -} - -export interface IConnectionAccessRO { - connection: IConnectionData; - accessLevel: AccessLevelEnum; -} - diff --git a/backend/src/entities/email/email-verification.module.ts b/backend/src/entities/email/email-verification.module.ts deleted file mode 100644 index 725b5899..00000000 --- a/backend/src/entities/email/email-verification.module.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { MiddlewareConsumer, Module, NestModule } from '@nestjs/common'; -import { TypeOrmModule } from '@nestjs/typeorm'; -import { EmailVerificationEntity } from './email-verification.entity.js'; - -@Module({ - imports: [TypeOrmModule.forFeature([EmailVerificationEntity])], - providers: [], - controllers: [], -}) -export class EmailVerificationModule implements NestModule { - public configure(consumer: MiddlewareConsumer): any { - consumer.apply().forRoutes(); - } -} diff --git a/backend/src/entities/group/application/data-sctructures/created-group.ds.ts b/backend/src/entities/group/application/data-sctructures/created-group.ds.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/entities/group/dto/create-group.dto.ts b/backend/src/entities/group/dto/create-group.dto.ts deleted file mode 100644 index 96ef2279..00000000 --- a/backend/src/entities/group/dto/create-group.dto.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; -import { PermissionEntity } from '../../permission/permission.entity.js'; -import { UserEntity } from '../../user/user.entity.js'; - -export class CreateGroupDto { - @IsNotEmpty() - title: string; - - permissions?: Array; - - isMain?: boolean; - - users?: Array; -} diff --git a/backend/src/entities/group/dto/index.ts b/backend/src/entities/group/dto/index.ts deleted file mode 100644 index 3c0ce404..00000000 --- a/backend/src/entities/group/dto/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { CreateGroupDto } from './create-group.dto.js'; -export { UpdateGroupDto } from './update-group.dto.js'; diff --git a/backend/src/entities/group/dto/update-group.dto.ts b/backend/src/entities/group/dto/update-group.dto.ts deleted file mode 100644 index 781fff53..00000000 --- a/backend/src/entities/group/dto/update-group.dto.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { PermissionEntity } from '../../permission/permission.entity.js'; -import { UserEntity } from '../../user/user.entity.js'; - -export class UpdateGroupDto { - title?: string; - - permissions?: Array; - - users?: Array; -} diff --git a/backend/src/entities/group/group.interface.ts b/backend/src/entities/group/group.interface.ts deleted file mode 100644 index 65d2fd9d..00000000 --- a/backend/src/entities/group/group.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -export interface IGroupAccessRO { - group: IGroupInfo; - accessLevel: string; -} - -export interface IGroupInfo { - id: string; - title: string; - isMain: boolean; -} diff --git a/backend/src/entities/permission/dto/create-permission.dto.ts b/backend/src/entities/permission/dto/create-permission.dto.ts deleted file mode 100644 index a1968c20..00000000 --- a/backend/src/entities/permission/dto/create-permission.dto.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class CreatePermissionDto { - @IsNotEmpty() - type: string; - - @IsNotEmpty() - accessLevel: string; - - tableName?: string; - - @IsNotEmpty() - groupId: string; -} diff --git a/backend/src/entities/permission/dto/create-permissions.dto.ts b/backend/src/entities/permission/dto/create-permissions.dto.ts deleted file mode 100644 index c43e55fa..00000000 --- a/backend/src/entities/permission/dto/create-permissions.dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class CreatePermissionsDto { - @IsNotEmpty() - connection: Record; - - @IsNotEmpty() - group: Record; - - tables: Record; -} diff --git a/backend/src/entities/permission/dto/index.ts b/backend/src/entities/permission/dto/index.ts deleted file mode 100644 index 705feba3..00000000 --- a/backend/src/entities/permission/dto/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { CreatePermissionDto } from './create-permission.dto.js'; -export { UpdatePermissionDto } from './update-permission.dto.js'; -export { CreatePermissionsDto } from './create-permissions.dto.js'; diff --git a/backend/src/entities/permission/dto/update-permission.dto.ts b/backend/src/entities/permission/dto/update-permission.dto.ts deleted file mode 100644 index 6762cca3..00000000 --- a/backend/src/entities/permission/dto/update-permission.dto.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class UpdatePermissionDto { - @IsNotEmpty() - type: string; - - @IsNotEmpty() - accessLevel: string; - - tableName?: string; - - @IsNotEmpty() - groupId: string; - - @IsNotEmpty() - permissionId: string; -} diff --git a/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts b/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts index f08b2718..8d03494f 100644 --- a/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts +++ b/backend/src/entities/table-actions/table-action-rules-module/application/dto/create-action-rules-with-actions-and-events-body.dto.ts @@ -19,7 +19,7 @@ import { TableActionEventEnum } from '../../../../../enums/table-action-event-en import { applyDecorators } from '@nestjs/common'; import { IsURLOptions } from 'validator'; -export function IsUrlIfNotTest(validationOptions?: IsURLOptions) { +function IsUrlIfNotTest(validationOptions?: IsURLOptions) { return function (object: NonNullable, propertyName: string) { const decorators = [IsString()]; if (process.env.NODE_ENV !== 'test') { diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-action.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-action.ds.ts deleted file mode 100644 index c87c00d6..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-action.ds.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class ActivateTableActionDS { - connectionId: string; - userId: string; - masterPwd: string; - tableName: string; - actionId: string; - confirmed: boolean; - request_body: Record; -} \ No newline at end of file diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-actions.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-actions.ds.ts deleted file mode 100644 index 8f285d83..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activate-table-actions.ds.ts +++ /dev/null @@ -1,9 +0,0 @@ -export class ActivateTableActionsDS { - connectionId: string; - userId: string; - masterPwd: string; - tableName: string; - actionId: string; - confirmed: boolean; - request_body: Array>; -} \ No newline at end of file diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activated-table-action.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activated-table-action.ds.ts deleted file mode 100644 index 29070538..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/activated-table-action.ds.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { OperationResultStatusEnum } from '../../../../../enums/index.js'; - -export type ActivatedTableActionDS = void | { location: string }; -export type ActivatedTableActionsDS = - | OperationResultStatusEnum - | { location: string } - | void - | { success: OperationResultStatusEnum }; diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/find-table-actions.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/find-table-actions.ds.ts deleted file mode 100644 index 6305536f..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/find-table-actions.ds.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class FindTableActionsDS { - connectionId: string; - tableName: string; - masterPwd: string; - userId: string; -} diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/found-table-actions.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/found-table-actions.ds.ts deleted file mode 100644 index 480826d0..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/found-table-actions.ds.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { ApiProperty } from '@nestjs/swagger'; -import { FoundTableActionDTO } from '../../../table-action-rules-module/application/dto/found-action-rules-with-actions-and-events.dto.js'; - -export class FoundTableActionsDS { - @ApiProperty() - table_name: string; - - @ApiProperty() - display_name: string; - - @ApiProperty({ isArray: true, type: FoundTableActionDTO }) - table_actions: Array; -} diff --git a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/update-table-action.ds.ts b/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/update-table-action.ds.ts deleted file mode 100644 index ebdc874d..00000000 --- a/backend/src/entities/table-actions/table-actions-module/application/data-sctructures/update-table-action.ds.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { TableActionTypeEnum } from '../../../../../enums/index.js'; -import { TableActionMethodEnum } from '../../../../../enums/table-action-method-enum.js'; - -export class UpdateTableActionDS { - actionId: string; - type: TableActionTypeEnum; - url: string; - method: TableActionMethodEnum; - slack_url: string; - emails: string[]; - userId: string; -} diff --git a/backend/src/entities/table-actions/table-actions-module/use-cases/activate-table-actions.use.case.ts b/backend/src/entities/table-actions/table-actions-module/use-cases/activate-table-actions.use.case.ts deleted file mode 100644 index 0145d92c..00000000 --- a/backend/src/entities/table-actions/table-actions-module/use-cases/activate-table-actions.use.case.ts +++ /dev/null @@ -1,84 +0,0 @@ -import { HttpException, HttpStatus, Inject, Injectable } from '@nestjs/common'; -import AbstractUseCase from '../../../../common/abstract-use.case.js'; -import { IGlobalDatabaseContext } from '../../../../common/application/global-database-context.interface.js'; -import { BaseType } from '../../../../common/data-injection.tokens.js'; -import { LogOperationTypeEnum, OperationResultStatusEnum } from '../../../../enums/index.js'; -import { Messages } from '../../../../exceptions/text/messages.js'; -import { TableLogsService } from '../../../table-logs/table-logs.service.js'; -import { ActivateTableActionsDS } from '../application/data-sctructures/activate-table-actions.ds.js'; -import { ActivatedTableActionsDS } from '../application/data-sctructures/activated-table-action.ds.js'; -import { IActivateTableActions } from './table-actions-use-cases.interface.js'; -import { TableActionActivationService } from '../table-action-activation.service.js'; - -@Injectable() -export class ActivateTableActionsUseCase - extends AbstractUseCase - implements IActivateTableActions -{ - constructor( - @Inject(BaseType.GLOBAL_DB_CONTEXT) - protected _dbContext: IGlobalDatabaseContext, - private tableLogsService: TableLogsService, - private tableActionActivationService: TableActionActivationService, - ) { - super(); - } - - protected async implementation(inputData: ActivateTableActionsDS): Promise { - let operationResult = OperationResultStatusEnum.unknown; - const { actionId, request_body, connectionId, masterPwd, tableName, userId } = inputData; - const foundTableAction = await this._dbContext.tableActionRepository.findTableActionById(actionId); - if (!foundTableAction) { - throw new HttpException( - { - message: Messages.TABLE_ACTION_NOT_FOUND, - }, - HttpStatus.BAD_REQUEST, - ); - } - - const foundConnection = await this._dbContext.connectionRepository.findAndDecryptConnection( - connectionId, - masterPwd, - ); - - let primaryKeyValuesArray = []; - try { - const { receivedOperationResult, receivedPrimaryKeysObj, location } = - await this.tableActionActivationService.activateTableAction( - foundTableAction, - foundConnection, - request_body, - userId, - tableName, - null, - ); - operationResult = receivedOperationResult; - primaryKeyValuesArray = receivedPrimaryKeysObj; - if (location) { - return { location }; - } - return operationResult; - } catch (e) { - operationResult = OperationResultStatusEnum.unsuccessfully; - throw new HttpException( - { - message: e.message, - }, - e.response?.status || HttpStatus.BAD_REQUEST, - ); - } finally { - const logRecord = { - table_name: tableName, - userId: userId, - connection: foundConnection, - operationType: LogOperationTypeEnum.actionActivated, - operationStatusResult: operationResult, - row: { keys: primaryKeyValuesArray }, - old_data: null, - table_primary_key: JSON.stringify(primaryKeyValuesArray), - }; - await this.tableLogsService.crateAndSaveNewLogUtil(logRecord); - } - } -} diff --git a/backend/src/entities/table-actions/table-actions-module/use-cases/table-actions-use-cases.interface.ts b/backend/src/entities/table-actions/table-actions-module/use-cases/table-actions-use-cases.interface.ts deleted file mode 100644 index fc2d1f6c..00000000 --- a/backend/src/entities/table-actions/table-actions-module/use-cases/table-actions-use-cases.interface.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { InTransactionEnum } from '../../../../enums/index.js'; -import { ActivateTableActionsDS } from '../application/data-sctructures/activate-table-actions.ds.js'; -import { - ActivatedTableActionsDS -} from '../application/data-sctructures/activated-table-action.ds.js'; - -export interface IActivateTableActions { - execute(inputData: ActivateTableActionsDS, inTransaction: InTransactionEnum): Promise; -} - diff --git a/backend/src/entities/table-logs/dto/create-log-record.dto.ts b/backend/src/entities/table-logs/dto/create-log-record.dto.ts deleted file mode 100644 index 9437e7b3..00000000 --- a/backend/src/entities/table-logs/dto/create-log-record.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { ConnectionEntity } from '../../connection/connection.entity.js'; -import { LogOperationTypeEnum, OperationResultStatusEnum } from '../../../enums/index.js'; - -export class CreateLogRecordDto { - table_name: string; - cognitoUserName: string; - connection: ConnectionEntity; - operationType: LogOperationTypeEnum; - operationStatusResult: OperationResultStatusEnum; - row?: string; - old_data?: any; -} diff --git a/backend/src/entities/table-logs/dto/index.ts b/backend/src/entities/table-logs/dto/index.ts deleted file mode 100644 index 43ead482..00000000 --- a/backend/src/entities/table-logs/dto/index.ts +++ /dev/null @@ -1 +0,0 @@ -export { CreateLogRecordDto } from './create-log-record.dto.js'; diff --git a/backend/src/entities/table-logs/table-logs.interface.ts b/backend/src/entities/table-logs/table-logs.interface.ts deleted file mode 100644 index c0175e84..00000000 --- a/backend/src/entities/table-logs/table-logs.interface.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { LogOperationTypeEnum, OperationResultStatusEnum } from '../../enums/index.js'; - -export interface ITableLogRO { - table_name: string; - received_data: string; - cognitoUserName: string; - email: string; - operationType: LogOperationTypeEnum; - operationStatusResult: OperationResultStatusEnum; - createdAt: string; - connection_id: string; -} - diff --git a/backend/src/entities/table/table-datastructures.ts b/backend/src/entities/table/table-datastructures.ts index 4e92da80..bec915e6 100644 --- a/backend/src/entities/table/table-datastructures.ts +++ b/backend/src/entities/table/table-datastructures.ts @@ -47,20 +47,6 @@ export class ForeignKeyDSStructure { autocomplete_columns: Array; } -export class PaginationRO { - @ApiProperty() - total: number; - - @ApiProperty() - lastPage: number; - - @ApiProperty() - perPage: number; - - @ApiProperty() - currentPage: number; -} - export class PrimaryColumnNameDs { @ApiProperty() column_name: string; diff --git a/backend/src/entities/table/table.entity.ts b/backend/src/entities/table/table.entity.ts deleted file mode 100644 index e9f65bcd..00000000 --- a/backend/src/entities/table/table.entity.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { - Entity, - PrimaryGeneratedColumn, -} from 'typeorm'; - -@Entity('table') -export class TableEntity { - - @PrimaryGeneratedColumn('uuid') - id: string; -} diff --git a/backend/src/entities/user-actions/user-action.interface.ts b/backend/src/entities/user-actions/user-action.interface.ts deleted file mode 100644 index e69de29b..00000000 diff --git a/backend/src/entities/user/application/data-structures/created-user.ds.ts b/backend/src/entities/user/application/data-structures/created-user.ds.ts deleted file mode 100644 index cb518e73..00000000 --- a/backend/src/entities/user/application/data-structures/created-user.ds.ts +++ /dev/null @@ -1,6 +0,0 @@ -export class CreatedUserDs { - user: { - id: string; - createdAt: Date; - }; -} diff --git a/backend/src/entities/user/application/data-structures/google-login.ds.ts b/backend/src/entities/user/application/data-structures/google-login.ds.ts deleted file mode 100644 index 937ba64f..00000000 --- a/backend/src/entities/user/application/data-structures/google-login.ds.ts +++ /dev/null @@ -1,4 +0,0 @@ -export class GoogleLoginDs { - token: string; - glidCookieValue: string; -} diff --git a/backend/src/entities/user/application/data-structures/usual-register-user.ds.ts b/backend/src/entities/user/application/data-structures/usual-register-user.ds.ts index eeeb7b87..99baa8a3 100644 --- a/backend/src/entities/user/application/data-structures/usual-register-user.ds.ts +++ b/backend/src/entities/user/application/data-structures/usual-register-user.ds.ts @@ -1,7 +1,7 @@ import { ApiProperty } from '@nestjs/swagger'; import { UserRoleEnum } from '../../enums/user-role.enum.js'; -export class UsualRegisterUserDs { +class UsualRegisterUserDs { @ApiProperty() email: string; @@ -25,17 +25,3 @@ export class SaasUsualUserRegisterDS extends UsualRegisterUserDs { @ApiProperty({ required: false }) companyName?: string; } - -export class RegisterInvitedUserDS { - @ApiProperty() - email: string; - - @ApiProperty() - password: string; - - @ApiProperty() - name: string; - - @ApiProperty() - companyId: string; -} diff --git a/backend/src/entities/user/dto/change-usual-user-password.dto.ts b/backend/src/entities/user/dto/change-usual-user-password.dto.ts deleted file mode 100644 index 0c8f5d1d..00000000 --- a/backend/src/entities/user/dto/change-usual-user-password.dto.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class ChangeUsualUserPasswordDto { - @IsNotEmpty() - email: string; - - @IsNotEmpty() - oldPassword: string; - - @IsNotEmpty() - newPassword: string; -} diff --git a/backend/src/entities/user/dto/create-user.dto.ts b/backend/src/entities/user/dto/create-user.dto.ts deleted file mode 100644 index 31eddceb..00000000 --- a/backend/src/entities/user/dto/create-user.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class CreateUserDto { - @IsNotEmpty() - id: string; -} diff --git a/backend/src/entities/user/dto/index.ts b/backend/src/entities/user/dto/index.ts deleted file mode 100644 index 3378e1e2..00000000 --- a/backend/src/entities/user/dto/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { CreateUserDto } from './create-user.dto.js'; -export { LoginUserDto } from './login-user.dto.js'; -export { SocialNetworkLoginDto } from './social-network-login.dto.js'; -export { ChangeUsualUserPasswordDto } from './change-usual-user-password.dto.js'; -export { PasswordDto } from './password.dto.js'; -export { EmailDto } from './email.dto.js'; diff --git a/backend/src/entities/user/dto/social-network-login.dto.ts b/backend/src/entities/user/dto/social-network-login.dto.ts deleted file mode 100644 index a477bf8a..00000000 --- a/backend/src/entities/user/dto/social-network-login.dto.ts +++ /dev/null @@ -1,6 +0,0 @@ -import { IsNotEmpty } from 'class-validator'; - -export class SocialNetworkLoginDto { - @IsNotEmpty() - token: string; -} diff --git a/backend/src/entities/user/user.interface.ts b/backend/src/entities/user/user.interface.ts index 6a7e1708..628397b6 100644 --- a/backend/src/entities/user/user.interface.ts +++ b/backend/src/entities/user/user.interface.ts @@ -1,9 +1,5 @@ import { SubscriptionLevelEnum } from '../../enums/index.js'; -export interface IUserData { - id: string; -} - export interface IUserInfo { id: string; isActive: boolean; @@ -13,4 +9,3 @@ export interface IUserInfo { subscriptionLevel: SubscriptionLevelEnum; name: string; } - diff --git a/backend/src/entities/user/utils/build-created-user.ds.ts b/backend/src/entities/user/utils/build-created-user.ds.ts index 4849e4ef..d4aa56c5 100644 --- a/backend/src/entities/user/utils/build-created-user.ds.ts +++ b/backend/src/entities/user/utils/build-created-user.ds.ts @@ -1,16 +1,6 @@ -import { CreatedUserDs } from '../application/data-structures/created-user.ds.js'; import { SimpleFoundUserInfoDs } from '../dto/found-user.dto.js'; import { UserEntity } from '../user.entity.js'; -export function buildCreatedUserDs(user: UserEntity): CreatedUserDs { - return { - user: { - id: user.id, - createdAt: user.createdAt, - }, - }; -} - export function buildSimpleUserInfoDs(user: UserEntity): SimpleFoundUserInfoDs { if (!user) { return null; @@ -26,4 +16,4 @@ export function buildSimpleUserInfoDs(user: UserEntity): SimpleFoundUserInfoDs { role: user.role, externalRegistrationProvider: user.externalRegistrationProvider, }; -} \ No newline at end of file +} diff --git a/backend/src/entities/user/utils/build-test-table-settings.ts b/backend/src/entities/user/utils/build-test-table-settings.ts deleted file mode 100644 index b2fb9ec8..00000000 --- a/backend/src/entities/user/utils/build-test-table-settings.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { ConnectionEntity } from '../../connection/connection.entity.js'; -import { TableSettingForTestConnections } from '../../../helpers/constants/table-setting-for-test-connections.js'; -import { Constants } from '../../../helpers/constants/constants.js'; -import { CreateTableSettingsDto } from '../../table-settings/dto/index.js'; -import { TableSettingsEntity } from '../../table-settings/table-settings.entity.js'; - -export function buildTestTableSettings(connections: Array): Array> { - const testTablesSettingsEntities: Array> = []; - for (const connection of connections) { - let testSettings: Array = null; - let testSettingsEntities: Array = []; - switch (connection.host) { - case Constants.TEST_CONNECTION_TO_POSTGRES.host: - testSettings = TableSettingForTestConnections.getPostgresSettingsDTOs(connection.id); - testSettingsEntities = tableSettingsDtosToTableSettingsEntity(testSettings, connection); - testTablesSettingsEntities.push(testSettingsEntities); - break; - case Constants.TEST_SSH_CONNECTION_TO_MYSQL.host: - testSettings = TableSettingForTestConnections.getMySQLTableSettingsDTOs(connection.id); - testSettingsEntities = tableSettingsDtosToTableSettingsEntity(testSettings, connection); - testTablesSettingsEntities.push(testSettingsEntities); - break; - case Constants.TEST_CONNECTION_TO_ORACLE.host: - testSettings = TableSettingForTestConnections.getOracleSettingsDTOs(connection.id); - testSettingsEntities = tableSettingsDtosToTableSettingsEntity(testSettings, connection); - testTablesSettingsEntities.push(testSettingsEntities); - break; - case Constants.TEST_CONNECTION_TO_MSSQL.host: - testSettings = TableSettingForTestConnections.getMsSQLSettingsDTOs(connection.id); - testSettingsEntities = tableSettingsDtosToTableSettingsEntity(testSettings, connection); - testTablesSettingsEntities.push(testSettingsEntities); - break; - default: - testTablesSettingsEntities.push([]); - } - } - return testTablesSettingsEntities; -} - -function tableSettingsDtosToTableSettingsEntity( - tableSettings: Array, - connection: ConnectionEntity, -): Array { - const tableSettingsEntities: Array = []; - for (const tableSetting of tableSettings) { - const newSettings = new TableSettingsEntity(); - newSettings.connection_id = connection; - newSettings.display_name = tableSetting.display_name; - newSettings.table_name = tableSetting.table_name; - newSettings.search_fields = tableSetting.search_fields; - newSettings.excluded_fields = tableSetting.excluded_fields; - newSettings.list_fields = tableSetting.list_fields; - newSettings.list_per_page = tableSetting.list_per_page; - newSettings.ordering = tableSetting.ordering; - newSettings.ordering_field = tableSetting.ordering_field; - newSettings.readonly_fields = tableSetting.readonly_fields; - newSettings.sortable_by = tableSetting.sortable_by; - newSettings.autocomplete_columns = tableSetting.autocomplete_columns; - newSettings.custom_fields = tableSetting.custom_fields; - newSettings.table_widgets = tableSetting.table_widgets; - newSettings.identification_fields = tableSetting.identification_fields; - newSettings.columns_view = tableSetting.columns_view; - newSettings.identity_column = tableSetting.identity_column; - tableSettingsEntities.push(newSettings); - } - return tableSettingsEntities; -} diff --git a/backend/src/entities/user/utils/is-jwt-scope-need.util.ts b/backend/src/entities/user/utils/is-jwt-scope-need.util.ts index aefb663a..6c800d8f 100644 --- a/backend/src/entities/user/utils/is-jwt-scope-need.util.ts +++ b/backend/src/entities/user/utils/is-jwt-scope-need.util.ts @@ -2,7 +2,7 @@ import { CompanyInfoEntity } from '../../company-info/company-info.entity.js'; import { JwtScopesEnum } from '../enums/jwt-scopes.enum.js'; import { UserEntity } from '../user.entity.js'; -export function isJwt2faScopeNeed(user: UserEntity, userCompany: CompanyInfoEntity): boolean { +function isJwt2faScopeNeed(user: UserEntity, userCompany: CompanyInfoEntity): boolean { return userCompany?.is2faEnabled && !user.isOTPEnabled; } diff --git a/backend/src/entities/widget/dto/index.ts b/backend/src/entities/widget/dto/index.ts index 0d991beb..42d68a0b 100644 --- a/backend/src/entities/widget/dto/index.ts +++ b/backend/src/entities/widget/dto/index.ts @@ -1,3 +1,2 @@ -export { UpdateTableWidgetDto } from './update-table-widget.dto.js'; export { CreateTableWidgetDto } from './create-table-widget.dto.js'; export { CreateOrUpdateTableWidgetsDto } from './create-table-widget.dto.js'; diff --git a/backend/src/entities/widget/dto/update-table-widget.dto.ts b/backend/src/entities/widget/dto/update-table-widget.dto.ts deleted file mode 100644 index d0ac326a..00000000 --- a/backend/src/entities/widget/dto/update-table-widget.dto.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { WidgetTypeEnum } from '../../../enums/index.js'; - -export class UpdateTableWidgetDto { - id: string; - - field_name: string; - - widget_type: WidgetTypeEnum; - - widget_params: Array; -} diff --git a/backend/src/enums/administration-access-level.enum.ts b/backend/src/enums/administration-access-level.enum.ts deleted file mode 100644 index 96f5db7d..00000000 --- a/backend/src/enums/administration-access-level.enum.ts +++ /dev/null @@ -1,5 +0,0 @@ -export enum AdministrationAccessLevelEnum { - connection = 'connection', - group = 'group', - table = 'table', -} diff --git a/backend/src/enums/amplitude-event-type.enum.ts b/backend/src/enums/amplitude-event-type.enum.ts index 11790e19..da85878b 100644 --- a/backend/src/enums/amplitude-event-type.enum.ts +++ b/backend/src/enums/amplitude-event-type.enum.ts @@ -1,14 +1,10 @@ export enum AmplitudeEventTypeEnum { - userRegistered = 'Autoadmin_Backend: New user registered', - userAccountDelete = 'Autoadmin_Backend: User deleted account', - connectionAdded = 'Autoadmin_Backend: New connection created', connectionUpdated = 'Autoadmin_Backend: Connection was updated', connectionDeleted = 'Autoadmin_Backend: Connection was deleted', connectionReceived = 'Autoadmin_Backend: Connections received', connectionUsersReceived = 'Autoadmin_Backend: Connection users list received', connectionListReceived = 'Autoadmin_Backend: Connections list received', groupListReceived = 'Autoadmin_Backend: Groups list received', - groupAddedIntoConnection = 'Autoadmin_Backend: New group created in connection', groupDeleted = 'Autoadmin_Backend: Group deleted', groupUserAdded = 'Autoadmin_Backend: User added in group', groupUserRemoved = 'Autoadmin_Backend: User removed from group', @@ -17,19 +13,15 @@ export enum AmplitudeEventTypeEnum { tableRowsReceived = 'Autoadmin_Backend: Table rows received', tableRowReceived = 'Autoadmin_Backend: Table row received', tableRowAdded = 'Autoadmin_Backend: Table row added', - tableRowUpdated = 'Autoadmin_Backend: Table row updated', tableRowDeleted = 'Autoadmin_Backend: Table row deleted', connectionUpdatedTest = 'Autoadmin_Backend_Test: Connection was updated', connectionDeletedTest = 'Autoadmin_Backend_Test: Connection was deleted', connectionReceivedTest = 'Autoadmin_Backend_Test: Connections received', connectionUsersReceivedTest = 'Autoadmin_Backend_Test: Connection users list received', - groupAddedIntoConnectionTest = 'Autoadmin_Backend_Test: New group created in connection', - groupDeletedTest = 'Autoadmin_Backend_Test: Group deleted', tableListReceivedTest = 'Autoadmin_Backend_Test: Tables list received', tableRowsReceivedTest = 'Autoadmin_Backend_Test: Table rows received', tableRowReceivedTest = 'Autoadmin_Backend_Test: Table row received', tableRowAddedTest = 'Autoadmin_Backend_Test: Table row added', - tableRowUpdatedTest = 'Autoadmin_Backend_Test: Table row updated', tableRowDeletedTest = 'Autoadmin_Backend_Test: Table row deleted', } diff --git a/backend/src/enums/index.ts b/backend/src/enums/index.ts index 0897d03a..ac784e03 100644 --- a/backend/src/enums/index.ts +++ b/backend/src/enums/index.ts @@ -1,5 +1,4 @@ export { AccessLevelEnum } from './access-level.enum.js'; -export { AdministrationAccessLevelEnum } from './administration-access-level.enum.js'; export { AmplitudeEventTypeEnum } from './amplitude-event-type.enum.js'; export { EncryptionAlgorithmEnum } from './encryption-algorithm.enum.js'; export { FilterCriteriaEnum } from './filter-criteria.enum.js'; diff --git a/backend/src/guards/index.ts b/backend/src/guards/index.ts index f9844701..6833c7d7 100644 --- a/backend/src/guards/index.ts +++ b/backend/src/guards/index.ts @@ -6,4 +6,3 @@ export { TableAddGuard } from './table-add.guard.js'; export { TableDeleteGuard } from './table-delete.guard.js'; export { TableEditGuard } from './table-edit.guard.js'; export { TableReadGuard } from './table-read.guard.js'; -export { PaidFeatureGuard } from './paid-feature.guard.js'; diff --git a/backend/src/helpers/change-obj-prop-val-by-prop-name.ts b/backend/src/helpers/change-obj-prop-val-by-prop-name.ts deleted file mode 100644 index 8c9b0107..00000000 --- a/backend/src/helpers/change-obj-prop-val-by-prop-name.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { isObjectPropertyExists } from './validators/is-object-property-exists-validator.js'; - -export function changeObjPropValByPropName(obj: TObj, propName: string, value: TVal): TObj { - // check property existence before setting - if (obj !== undefined && isObjectPropertyExists(obj, propName)) { - // eslint-disable-next-line security/detect-object-injection - obj[propName] = value; - return obj; - } - return obj; -} diff --git a/backend/src/helpers/constants/table-setting-for-test-connections.ts b/backend/src/helpers/constants/table-setting-for-test-connections.ts deleted file mode 100644 index aaf94f5b..00000000 --- a/backend/src/helpers/constants/table-setting-for-test-connections.ts +++ /dev/null @@ -1,303 +0,0 @@ -import { CreateTableSettingsDto } from '../../entities/table-settings/dto/index.js'; -import { QueryOrderingEnum } from '../../enums/index.js'; - -export const TableSettingForTestConnections = { - // create table settings dtos for mysql database - - Users_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Users'; - newTableSettingsDto.display_name = 'Registered users'; - newTableSettingsDto.search_fields = ['FirstName', 'LastName', 'Email']; - newTableSettingsDto.excluded_fields = ['Password']; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 20; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'UserID'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = ['ProfileImage', 'UserID']; - newTableSettingsDto.sortable_by = ['UserID', 'FirstName', 'LastName', 'DateRegistered']; - newTableSettingsDto.autocomplete_columns = ['FirstName', 'LastName']; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = [ - 'Email', - 'FirstName', - 'LastName', - 'DateRegistered', - 'LastLoginDate', - 'ProfileImage', - 'Role', - 'UserID', - ]; - return newTableSettingsDto; - }, - - Vendors_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Vendors'; - newTableSettingsDto.display_name = undefined; - newTableSettingsDto.search_fields = ['VendorName']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 25; - newTableSettingsDto.ordering = QueryOrderingEnum.DESC; - newTableSettingsDto.ordering_field = 'VendorID'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = ['VendorID']; - newTableSettingsDto.sortable_by = ['ContactEmail']; - newTableSettingsDto.autocomplete_columns = ['VendorName']; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Categories_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Categories'; - newTableSettingsDto.display_name = 'Product categories'; - newTableSettingsDto.search_fields = ['CategoryName']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 30; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'CategoryID'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = ['CategoryID']; - newTableSettingsDto.sortable_by = ['CategoryID', 'CategoryName']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Products_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Products'; - newTableSettingsDto.display_name = undefined; - newTableSettingsDto.search_fields = ['ProductName']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 60; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'Price'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['Price', 'ProductName', 'VendorID']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Orders_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Orders'; - newTableSettingsDto.display_name = 'Created orders'; - newTableSettingsDto.search_fields = ['ShippingAddress']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 60; - newTableSettingsDto.ordering = QueryOrderingEnum.DESC; - newTableSettingsDto.ordering_field = 'OrderDate'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['TotalAmount', 'OrderDate', 'OrderStatus']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - OrderDetails_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'OrderDetails'; - newTableSettingsDto.display_name = 'Details of orders'; - newTableSettingsDto.search_fields = ['OrderID', 'ProductID', 'Price']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 10; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'OrderID'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['OrderID', 'ProductID', 'Price', 'Quantity']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Reviews_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Reviews'; - newTableSettingsDto.display_name = 'Product reviews'; - newTableSettingsDto.search_fields = ['ProductID', 'Comment']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 10; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'Rating'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['Rating', 'ProductID', 'UserID', 'ReviewID']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Payments_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Payments'; - newTableSettingsDto.display_name = undefined; - newTableSettingsDto.search_fields = ['OrderID', 'PaymentDate']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 10; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'PaymentDate'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['PaymentDate', 'OrderID', 'Amount']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - DiscountsCoupons_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'DiscountsCoupons'; - newTableSettingsDto.display_name = 'Discounts and coupons'; - newTableSettingsDto.search_fields = ['CouponID', 'CouponCode']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 15; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'ExpiryDate'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['ExpiryDate', 'MinimumOrderAmount', 'DiscountAmount']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - Shipping_dto: (connectionId: string): CreateTableSettingsDto => { - const newTableSettingsDto = new CreateTableSettingsDto(); - newTableSettingsDto.connection_id = connectionId; - newTableSettingsDto.table_name = 'Shipping'; - newTableSettingsDto.display_name = 'Shipping details'; - newTableSettingsDto.search_fields = ['OrderID', 'TrackingNumber']; - newTableSettingsDto.excluded_fields = undefined; - newTableSettingsDto.list_fields = undefined; - newTableSettingsDto.identification_fields = undefined; - newTableSettingsDto.list_per_page = 50; - newTableSettingsDto.ordering = QueryOrderingEnum.ASC; - newTableSettingsDto.ordering_field = 'ShippingDate'; - newTableSettingsDto.identity_column = undefined; - newTableSettingsDto.readonly_fields = undefined; - newTableSettingsDto.sortable_by = ['ShippingDate', 'EstimatedDeliveryDate']; - newTableSettingsDto.autocomplete_columns = undefined; - newTableSettingsDto.custom_fields = undefined; - newTableSettingsDto.table_widgets = undefined; - newTableSettingsDto.columns_view = undefined; - return newTableSettingsDto; - }, - - getMySQLTableSettingsDTOs: (connectionId: string): Array => { - const dtos = []; - dtos.push( - TableSettingForTestConnections.Users_dto(connectionId), - TableSettingForTestConnections.Vendors_dto(connectionId), - TableSettingForTestConnections.Categories_dto(connectionId), - TableSettingForTestConnections.Products_dto(connectionId), - TableSettingForTestConnections.Orders_dto(connectionId), - TableSettingForTestConnections.OrderDetails_dto(connectionId), - TableSettingForTestConnections.Reviews_dto(connectionId), - TableSettingForTestConnections.Payments_dto(connectionId), - TableSettingForTestConnections.DiscountsCoupons_dto(connectionId), - TableSettingForTestConnections.Shipping_dto(connectionId), - ); - return dtos; - }, - - getPostgresSettingsDTOs: (connectionId: string): Array => { - const dtos = []; - dtos.push( - TableSettingForTestConnections.Users_dto(connectionId), - TableSettingForTestConnections.Vendors_dto(connectionId), - TableSettingForTestConnections.Categories_dto(connectionId), - TableSettingForTestConnections.Products_dto(connectionId), - TableSettingForTestConnections.Orders_dto(connectionId), - TableSettingForTestConnections.OrderDetails_dto(connectionId), - TableSettingForTestConnections.Reviews_dto(connectionId), - TableSettingForTestConnections.Payments_dto(connectionId), - TableSettingForTestConnections.DiscountsCoupons_dto(connectionId), - TableSettingForTestConnections.Shipping_dto(connectionId), - ); - return dtos; - }, - - getOracleSettingsDTOs: (connectionId: string): Array => { - const dtos = []; - dtos.push( - TableSettingForTestConnections.Users_dto(connectionId), - TableSettingForTestConnections.Vendors_dto(connectionId), - TableSettingForTestConnections.Categories_dto(connectionId), - TableSettingForTestConnections.Products_dto(connectionId), - TableSettingForTestConnections.Orders_dto(connectionId), - TableSettingForTestConnections.OrderDetails_dto(connectionId), - TableSettingForTestConnections.Reviews_dto(connectionId), - TableSettingForTestConnections.Payments_dto(connectionId), - TableSettingForTestConnections.DiscountsCoupons_dto(connectionId), - TableSettingForTestConnections.Shipping_dto(connectionId), - ); - return dtos; - }, - - getMsSQLSettingsDTOs: (connectionId: string): Array => { - const dtos = []; - dtos.push( - TableSettingForTestConnections.Users_dto(connectionId), - TableSettingForTestConnections.Vendors_dto(connectionId), - TableSettingForTestConnections.Categories_dto(connectionId), - TableSettingForTestConnections.Products_dto(connectionId), - TableSettingForTestConnections.Orders_dto(connectionId), - TableSettingForTestConnections.OrderDetails_dto(connectionId), - TableSettingForTestConnections.Reviews_dto(connectionId), - TableSettingForTestConnections.Payments_dto(connectionId), - TableSettingForTestConnections.DiscountsCoupons_dto(connectionId), - TableSettingForTestConnections.Shipping_dto(connectionId), - ); - return dtos; - }, -}; diff --git a/backend/src/helpers/encryption/encryptor.spec.ts b/backend/src/helpers/encryption/encryptor.spec.ts deleted file mode 100644 index 8a4bc09d..00000000 --- a/backend/src/helpers/encryption/encryptor.spec.ts +++ /dev/null @@ -1,65 +0,0 @@ -import { EncryptionAlgorithmEnum } from '../../enums/index.js'; -import { Encryptor } from './encryptor.js'; - -describe('Encryptor', () => { - const testString = 'NeverViewAMainland'; - describe('processDataWithAlgorithm', () => { - it('should encrypt data with algorithm sha1', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha1); - expect(processedData).toBe('93b1b6f8c63bc10c9dcce125da79d06be22372ec'); - }); - - it('should encrypt data with algorithm sha3', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha3); - expect(processedData).toBe( - 'fa97f972c43ec6fcd793e62110afdc652b601c4c448da73cf568e2819091059d18f9378dd2888' + - '483ff3eb8d70b805d0a9fe385a0f09d8f1a286979f15da33026', - ); - }); - - it('should encrypt data with algorithm sha224', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha224); - expect(processedData).toBe('8aedc17c34b1ad4f6f8c0b634b3dd1a7e823f593b04543a9db86a1ec'); - }); - - it('should encrypt data with algorithm sha256', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha256); - expect(processedData).toBe('8abf6909094891cc035c87e5b0b578fbce1bdd804836ba53ba627d269f24b0b3'); - }); - - it('should encrypt data with algorithm sha512', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha512); - expect(processedData).toBe( - '84e8e7c30afb8a47a7f1ca602296cf4d8f28dd209899bf0b1ae5eebf282a11effa1792d00ee36' + - '7d7bca925fcb33834d4ef2263ccdaedeced6e44f40a8ece3fef', - ); - }); - - it('should encrypt data with algorithm sha384', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.sha384); - expect(processedData).toBe( - 'cea4f48acd60149fdebfddab8cb8e2653e1c40e1b3afc271fff5effe0b108fad0dc34c7e1ed13' + 'a2c2fec0c81111a7be3', - ); - }); - - it('should encrypt data with algorithm bcrypt', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.bcrypt); - expect(processedData.length).toBe(60); - }); - - it('should encrypt data with algorithm scrypt', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.scrypt); - expect(processedData.length).toBe(161); - }); - - it('should encrypt data with algorithm argon2', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.argon2); - expect(processedData.length).toBe(96); - }); - - it('should encrypt data with algorithm pbkdf2', async () => { - const processedData = await Encryptor.processDataWithAlgorithm(testString, EncryptionAlgorithmEnum.pbkdf2); - expect(processedData.length).toBe(64); - }); - }); -}); diff --git a/backend/src/helpers/find-gclid-cookie-value.ts b/backend/src/helpers/find-gclid-cookie-value.ts deleted file mode 100644 index 8f4b7664..00000000 --- a/backend/src/helpers/find-gclid-cookie-value.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { IRequestWithCognitoInfo } from '../authorization/index.js'; - -export function findGclidCookieValue(request: IRequestWithCognitoInfo): string | null { - if (request.headers) { - return request.headers['GCLID'] - ? request.headers['GCLID'] - : request.headers['gclid'] - ? request.headers['gclid'] - : null; - } - return null; -} diff --git a/backend/src/helpers/get-cognito-user-name.ts b/backend/src/helpers/get-cognito-user-name.ts deleted file mode 100644 index 7f0347be..00000000 --- a/backend/src/helpers/get-cognito-user-name.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { IRequestWithCognitoInfo } from '../authorization/index.js'; -import { HttpException } from '@nestjs/common/exceptions/http.exception.js'; -import { Messages } from '../exceptions/text/messages.js'; -import { HttpStatus } from '@nestjs/common'; - -export function getCognitoUserName(request: IRequestWithCognitoInfo): string { - const cognitoUserName = request.decoded.sub; - if (cognitoUserName) { - return cognitoUserName; - } else { - throw new HttpException( - { - message: Messages.COGNITO_USERNAME_MISSING, - }, - HttpStatus.BAD_REQUEST, - ); - } -} diff --git a/backend/src/helpers/get-master-password.ts b/backend/src/helpers/get-master-password.ts index 3cbf7833..8a50bfac 100644 --- a/backend/src/helpers/get-master-password.ts +++ b/backend/src/helpers/get-master-password.ts @@ -4,8 +4,3 @@ export function getMasterPwd(request: IRequestWithCognitoInfo): string | null { const masterPwd = request.headers['masterpwd']; return masterPwd ? masterPwd : null; } - -export function getNewMasterPwd(request: IRequestWithCognitoInfo): string | null { - const masterPwd = request.headers['newmasterpwd']; - return masterPwd ? masterPwd : null; -} diff --git a/backend/src/helpers/get-numbers-from-string.ts b/backend/src/helpers/get-numbers-from-string.ts deleted file mode 100644 index 51dfe7b7..00000000 --- a/backend/src/helpers/get-numbers-from-string.ts +++ /dev/null @@ -1,3 +0,0 @@ -export function getNumbersFromString(str: string): number { - return parseInt(str.match(/\d/g)?.join(''), 10); -} diff --git a/backend/src/helpers/index.ts b/backend/src/helpers/index.ts index 8182892f..b81d0cf3 100644 --- a/backend/src/helpers/index.ts +++ b/backend/src/helpers/index.ts @@ -1,22 +1,12 @@ export { binaryToHex, isBinary } from './binary-to-hex.js'; export { checkFieldAutoincrement } from './check-field-autoincrement.js'; export { compareArrayElements } from './compare-array-elements.js'; -export { changeObjPropValByPropName } from './change-obj-prop-val-by-prop-name.js'; -export { findGclidCookieValue } from './find-gclid-cookie-value.js'; -export { getCognitoUserName } from './get-cognito-user-name.js'; -export { getMasterPwd, getNewMasterPwd } from './get-master-password.js'; -export { getNumbersFromString } from './get-numbers-from-string.js'; +export { getMasterPwd } from './get-master-password.js'; export { getPropertyValueByDescriptor } from './get-property-value-by-descriptor.js'; export { getUniqArrayStrings } from './get-uniq-array-strings.js'; export { getValuesBetweenCurlies } from './operate-values-between-curlies.js'; export { isConnectionEntityAgent, isConnectionTypeAgent } from './is-connection-entity-agent.js'; -export { isTestConnection } from './is-test-connection.js'; export { isObjectEmpty } from './is-object-empty.js'; -export { lengthInBytes } from './str-length-in-bytes.js'; -export { objectKeysToLowercase } from './object-keys-to-lowercase.js'; -export { renameObjectKeyName } from './rename-object-key-name.js'; export { replaceTextInCurlies } from './operate-values-between-curlies.js'; export { slackPostMessage } from './slack/slack-post-message.js'; -export { tableSettingsFieldValidator } from './validators/table-settings-field-validator.js'; export { toPrettyErrorsMsg } from './to-pretty-errors-msg.js'; -export { pauseCode } from './pause-code.js'; diff --git a/backend/src/helpers/is-test-connection.ts b/backend/src/helpers/is-test-connection.ts deleted file mode 100644 index f14e2917..00000000 --- a/backend/src/helpers/is-test-connection.ts +++ /dev/null @@ -1,11 +0,0 @@ -import { CreateConnectionDto } from '../entities/connection/application/dto/create-connection.dto.js'; -import { ConnectionEntity } from '../entities/connection/connection.entity.js'; -import { Constants } from './constants/constants.js'; - -export function isTestConnection(connection: ConnectionEntity | CreateConnectionDto): boolean { - if (connection.isTestConnection) { - return true; - } - const testHosts = Constants.getTestConnectionsHostNamesArr(); - return testHosts.includes(connection.host); -} diff --git a/backend/src/helpers/object-keys-to-lowercase.ts b/backend/src/helpers/object-keys-to-lowercase.ts deleted file mode 100644 index 4954d732..00000000 --- a/backend/src/helpers/object-keys-to-lowercase.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { isObjectPropertyExists } from './validators/is-object-property-exists-validator.js'; - -export function objectKeysToLowercase(obj: any): any { - let key; - const keys = Object.keys(obj); - let n = keys.length; - const newobj = {}; - while (n--) { - key = keys.at(n); - if (isObjectPropertyExists(obj, key)) { - // eslint-disable-next-line security/detect-object-injection - newobj[key.toLowerCase()] = obj[key]; - } - } - return newobj; -} diff --git a/backend/src/helpers/rename-object-key-name.ts b/backend/src/helpers/rename-object-key-name.ts deleted file mode 100644 index be11f3b9..00000000 --- a/backend/src/helpers/rename-object-key-name.ts +++ /dev/null @@ -1,9 +0,0 @@ -import { isObjectPropertyExists } from './validators/is-object-property-exists-validator.js'; - -export function renameObjectKeyName(obj: any, oldKey: string, newKey: string): void { - if (oldKey !== newKey && isObjectPropertyExists(obj, oldKey)) { - Object.defineProperty(obj, newKey, Object.getOwnPropertyDescriptor(obj, oldKey)); - // eslint-disable-next-line security/detect-object-injection - delete obj[oldKey]; - } -} diff --git a/backend/src/helpers/str-length-in-bytes.ts b/backend/src/helpers/str-length-in-bytes.ts deleted file mode 100644 index df440fc4..00000000 --- a/backend/src/helpers/str-length-in-bytes.ts +++ /dev/null @@ -1,10 +0,0 @@ -export function lengthInBytes(str: string): number { - let s = str.length; - for (let i = str.length - 1; i >= 0; i--) { - const code = str.charCodeAt(i); - if (code > 0x7f && code <= 0x7ff) s++; - else if (code > 0x7ff && code <= 0xffff) s += 2; - if (code >= 0xdc00 && code <= 0xdfff) i--; - } - return s; -} diff --git a/backend/src/helpers/validators/table-settings-field-validator.ts b/backend/src/helpers/validators/table-settings-field-validator.ts deleted file mode 100644 index f030fb6b..00000000 --- a/backend/src/helpers/validators/table-settings-field-validator.ts +++ /dev/null @@ -1,153 +0,0 @@ -import { PrimaryKeyDS } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/data-structures/primary-key.ds.js'; -import { CreateTableSettingsDto } from '../../entities/table-settings/dto/index.js'; -import { QueryOrderingEnum } from '../../enums/index.js'; -import { Messages } from '../../exceptions/text/messages.js'; -import { isObjectEmpty } from '../is-object-empty.js'; - -export function tableSettingsFieldValidator( - tableStructure: any, - primaryColumns: Array, - settings: CreateTableSettingsDto, -): Array { - - const errorMessages = []; - if (isObjectEmpty(settings)) { - return errorMessages; - } - const { - search_fields, - excluded_fields, - list_fields, - readonly_fields, - sortable_by, - ordering_field, - ordering, - list_per_page, - identification_fields, - columns_view, - identity_column, - } = settings; - - const columnNames = tableStructure.map((column) => { - return column.column_name; - }); - //******************************************* - if (search_fields && !Array.isArray(search_fields)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`search_fields`)); - } - - if (excluded_fields && !Array.isArray(excluded_fields)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`excluded_fields`)); - } - - if (list_fields && !Array.isArray(list_fields)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`list_fields`)); - } - - if (identification_fields && !Array.isArray(identification_fields)) { - errorMessages.push(Messages.MUST_BE_ARRAY('identification_fields')); - } - - if (readonly_fields && !Array.isArray(readonly_fields)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`readonly_fields`)); - } - - if (sortable_by && !Array.isArray(sortable_by)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`sortable_by`)); - } - - if (columns_view && !Array.isArray(columns_view)) { - errorMessages.push(Messages.MUST_BE_ARRAY(`columns_view`)); - } - - if (errorMessages.length > 0) { - return errorMessages; - } - - //********************************************* - function excludedFields(checkedFields: Array, existingFields: Array): Array { - const excludedFields = []; - if (!checkedFields) { - return excludedFields; - } - for (const checkedField of checkedFields) { - if (!checkedField) { - continue; - } - if (!existingFields.includes(checkedField)) { - excludedFields.push(checkedField); - } - } - return excludedFields; - } - - const errors = Array.prototype.concat( - excludedFields(search_fields, columnNames), - excludedFields(excluded_fields, columnNames), - excludedFields(list_fields, columnNames), - excludedFields(identification_fields, columnNames), - excludedFields(readonly_fields, columnNames), - excludedFields(sortable_by, columnNames), - excludedFields([ordering_field], columnNames), - excludedFields(columns_view, columnNames), - excludedFields([identity_column], columnNames), - ); - - if (errors.length > 0) { - errorMessages.push(Messages.NO_SUCH_FIELDS_IN_TABLES(errors, settings.table_name)); - } - - if (ordering) { - if (!Object.keys(QueryOrderingEnum).find((key) => key === ordering)) { - errorMessages.push(Messages.ORDERING_FIELD_INCORRECT); - } - } - - if ((list_per_page && list_per_page < 0) || list_per_page === 0) { - errorMessages.push(Messages.LIST_PER_PAGE_INCORRECT); - } - - if (excluded_fields) { - for (const field of search_fields) { - const index = excluded_fields.indexOf(field); - if (index >= 0) { - errorMessages.push(Messages.CANT_LIST_AND_EXCLUDE(field)); - } - } - - const orderingFieldIndex = excluded_fields.indexOf(ordering_field); - if (orderingFieldIndex >= 0) { - errorMessages.push(Messages.CANT_ORDER_AND_EXCLUDE); - } - - if (readonly_fields && readonly_fields.length > 0) { - for (const field of readonly_fields) { - const index = excluded_fields.indexOf(field); - if (index >= 0) { - errorMessages.push(Messages.CANT_READONLY_AND_EXCLUDE(field)); - } - } - } - - if (columns_view && columns_view.length > 0) { - for (const field of columns_view) { - const index = excluded_fields.indexOf(field); - if (index >= 0) { - errorMessages.push(Messages.CANT_VIEW_AND_EXCLUDE(field)); - } - } - } - - if (primaryColumns && primaryColumns.length > 0) { - for (const column of primaryColumns) { - const index = excluded_fields.indexOf(column.column_name); - if (index >= 0) { - errors.push(Messages.CANT_EXCLUDE_PRIMARY_KEY(column.column_name)); - } - } - } - } - - return errorMessages; - -} diff --git a/backend/src/microservices/saas-microservice/data-structures/add-company-id-to-user.ds.ts b/backend/src/microservices/saas-microservice/data-structures/add-company-id-to-user.ds.ts deleted file mode 100644 index 3ba857f1..00000000 --- a/backend/src/microservices/saas-microservice/data-structures/add-company-id-to-user.ds.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { UserRoleEnum } from '../../../entities/user/enums/user-role.enum.js'; - -export class AddRemoveCompanyIdToUserDS { - userId: string; - companyId: string; - userRole: UserRoleEnum; -} diff --git a/backend/test/mock.factory.ts b/backend/test/mock.factory.ts index 76de3d55..b718332c 100644 --- a/backend/test/mock.factory.ts +++ b/backend/test/mock.factory.ts @@ -2,7 +2,6 @@ import { faker } from '@faker-js/faker'; import jwt from 'jsonwebtoken'; import { IRequestWithCognitoInfo } from '../src/authorization/index.js'; import { CreateConnectionPropertiesDto } from '../src/entities/connection-properties/dto/index.js'; -import { CreateGroupDto } from '../src/entities/group/dto/index.js'; import { TableActionEntity } from '../src/entities/table-actions/table-actions-module/table-action.entity.js'; import { CreateTableWidgetDto } from '../src/entities/widget/dto/index.js'; import { AccessLevelEnum, PermissionTypeEnum, QueryOrderingEnum, WidgetTypeEnum } from '../src/enums/index.js'; @@ -12,6 +11,13 @@ import { ConnectionTypeTestEnum } from '../src/enums/connection-type.enum.js'; import { CreateConnectionDto } from '../src/entities/connection/application/dto/create-connection.dto.js'; import { ConnectionTypesEnum } from '@rocketadmin/shared-code/dist/src/data-access-layer/shared/enums/connection-types-enum.js'; import { CreateTableActionDTO } from '../src/entities/table-actions/table-actions-module/dto/create-table-action.dto.js'; + +class CreateGroupDto { + title: string; + permissions?: Array; + isMain?: boolean; + users?: Array; +} export class MockFactory { generateCognitoUserName() { return 'a876284a-e902-11ea-adc1-0242ac120002'; diff --git a/backend/test/utils/create-test-table.ts b/backend/test/utils/create-test-table.ts index 6e3873fd..f38dd040 100644 --- a/backend/test/utils/create-test-table.ts +++ b/backend/test/utils/create-test-table.ts @@ -125,7 +125,7 @@ export async function createTestTable( }; } -export async function createTestElasticsearchTable( +async function createTestElasticsearchTable( connectionParams, testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', @@ -206,7 +206,7 @@ export async function createTestElasticsearchTable( }; } -export async function createTestTableIbmDb2( +async function createTestTableIbmDb2( connectionParams: any, testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', @@ -639,7 +639,7 @@ export async function createTestPostgresTableWithSchema( }; } -export async function createTestDynamoDBTable( +async function createTestDynamoDBTable( connectionParams: any, testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', @@ -728,7 +728,7 @@ export async function createTestDynamoDBTable( }; } -export async function createTestCassandraTable( +async function createTestCassandraTable( connectionParams: any, testEntitiesSeedsCount = 42, testSearchedUserName = 'Vasia', diff --git a/backend/test/utils/drop-test-tables.ts b/backend/test/utils/drop-test-tables.ts index fbce5767..c48bbc5d 100644 --- a/backend/test/utils/drop-test-tables.ts +++ b/backend/test/utils/drop-test-tables.ts @@ -18,23 +18,3 @@ export async function dropTestTables(tableNames: Array, connectionParams }), ); } - -export async function dropAllTestTables(connectionParams): Promise { - const connectionParamsCopy = { - ...connectionParams, - }; - if (connectionParams.type === 'mysql') { - connectionParamsCopy.type = 'mysql2'; - } - const foundKnex = getTestKnex(connectionParamsCopy); - const dao = getDataAccessObject(connectionParamsCopy); - const tables = (await dao.getTablesFromDB()).map((table) => table.tableName); - await Promise.all( - tables.map(async (tableName) => { - if (connectionParamsCopy.schema) { - await foundKnex.schema.withSchema(connectionParamsCopy.schema).dropTableIfExists(tableName); - } - await foundKnex.schema.dropTableIfExists(tableName); - }), - ); -} diff --git a/backend/test/utils/register-user-and-return-user-info.ts b/backend/test/utils/register-user-and-return-user-info.ts index 4ba507bf..a9acf869 100644 --- a/backend/test/utils/register-user-and-return-user-info.ts +++ b/backend/test/utils/register-user-and-return-user-info.ts @@ -20,7 +20,7 @@ export async function registerUserAndReturnUserInfo(app: INestApplication): Prom return await registerUserOnSaasAndReturnUserInfo(); } -export async function loginTestAdminUserAndReturnInfo(app: INestApplication): Promise<{ +async function loginTestAdminUserAndReturnInfo(app: INestApplication): Promise<{ token: string; email: string; password: string; @@ -44,30 +44,6 @@ export async function loginTestAdminUserAndReturnInfo(app: INestApplication): Pr return { token: token, ...userLoginInfo }; } -export async function registerUserOnCoreAndReturnUserInfo(app: INestApplication): Promise<{ - token: string; - email: string; - password: string; -}> { - const userRegisterInfo: RegisterUserData = { - email: `${faker.lorem.words(1)}_${faker.lorem.words(1)}_${faker.internet.email()}`, - password: '#r@dY^e&7R4b5Ib@31iE4xbn', - }; - - const registerAdminUserResponse = await request(app.getHttpServer()) - .post('/user/register/') - .send(userRegisterInfo) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - - if (registerAdminUserResponse.status > 300) { - console.info('registerAdminUserResponse.text -> ', registerAdminUserResponse.text); - } - - const token = `${Constants.JWT_COOKIE_KEY_NAME}=${TestUtils.getJwtTokenFromResponse(registerAdminUserResponse)}`; - return { token: token, ...userRegisterInfo }; -} - export async function registerUserOnSaasAndReturnUserInfo( email: string = `${faker.lorem.words(1)}_${faker.lorem.words(1)}_${faker.internet.email()}`, ): Promise<{ diff --git a/backend/test/utils/user-with-different-permissions-utils.ts b/backend/test/utils/user-with-different-permissions-utils.ts index cd687228..b58da857 100644 --- a/backend/test/utils/user-with-different-permissions-utils.ts +++ b/backend/test/utils/user-with-different-permissions-utils.ts @@ -9,129 +9,6 @@ import { registerUserAndReturnUserInfo, } from './register-user-and-return-user-info.js'; -export async function createConnectionsAndInviteNewUserInNewGroupInFirstConnection( - app: INestApplication, -): Promise { - const connectionsId = { - firstId: null, - secondId: null, - firstAdminGroupId: null, - }; - - const mockFactory = new MockFactory(); - const connectionAdminUserInfo = await registerUserAndReturnUserInfo(app); - const simpleUserRegisterInfo = await inviteUserInCompanyAndAcceptInvitation( - connectionAdminUserInfo.token, - undefined, - app, - undefined, - ); - const connectionAdminUserToken = connectionAdminUserInfo.token; - const simpleUserToken = simpleUserRegisterInfo.token; - - const newConnection = mockFactory.generateConnectionToTestPostgresDBInDocker(); - const newConnection2 = mockFactory.generateConnectionToTestMySQLDBInDocker(); - const newGroup1 = mockFactory.generateCreateGroupDto1(); - const firstTable = await createTestTable(newConnection); - const secondTable = await createTestTable(newConnection2); - - const tablePermissions = { - visibility: true, - readonly: false, - add: true, - delete: true, - edit: false, - }; - - const createFirstConnectionResponse = await request(app.getHttpServer()) - .post('/connection') - .set('Cookie', connectionAdminUserToken) - .send(newConnection) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - const createFirstConnectionRO = JSON.parse(createFirstConnectionResponse.text); - connectionsId.firstId = createFirstConnectionRO.id; - const createSecondConnectionResponse = await request(app.getHttpServer()) - .post('/connection') - .set('Cookie', connectionAdminUserToken) - .send(newConnection2) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - const createSecondConnectionRO = JSON.parse(createSecondConnectionResponse.text); - connectionsId.secondId = createSecondConnectionRO.id; - const email = simpleUserRegisterInfo.email; - - const createGroupResponse = await request(app.getHttpServer()) - .post(`/connection/group/${connectionsId.firstId}`) - .set('Cookie', connectionAdminUserToken) - .send(newGroup1) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - const groupId = JSON.parse(createGroupResponse.text).id; - - const permissions = { - connection: { - connectionId: connectionsId.firstId, - accessLevel: AccessLevelEnum.none, - }, - group: { - groupId: groupId, - accessLevel: AccessLevelEnum.none, - }, - tables: [ - { - tableName: firstTable.testTableName, - accessLevel: tablePermissions, - }, - ], - }; - - const createOrUpdatePermissionResponse = await request(app.getHttpServer()) - .put(`/permissions/${groupId}?connectionId=${connectionsId.firstId}`) - .send({ permissions }) - .set('Cookie', connectionAdminUserToken) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - - await request(app.getHttpServer()) - .put('/group/user') - .set('Cookie', connectionAdminUserToken) - .send({ groupId, email }) - .set('Content-Type', 'application/json') - .set('Accept', 'application/json'); - connectionsId.firstAdminGroupId = groupId; - - return { - firstTableInfo: firstTable, - secondTableInfo: secondTable, - permissions: { - table: { - visibility: true, - readonly: false, - add: true, - delete: true, - edit: false, - }, - }, - connections: { - firstId: connectionsId.firstId, - secondId: connectionsId.secondId, - }, - groups: { - firstAdminGroupId: groupId, - secondAdminGroupId: null, - }, - users: { - adminUserToken: connectionAdminUserToken, - simpleUserToken: simpleUserToken, - simpleUserEmail: simpleUserRegisterInfo.email, - adminUserEmail: connectionAdminUserInfo.email, - adminUserPassword: connectionAdminUserInfo.password, - simpleUserPassword: simpleUserRegisterInfo.password, - }, - }; -} - export async function createConnectionsAndInviteNewUserInNewGroupWithGroupPermissions( app: INestApplication, invitedUserEmail?: string, diff --git a/yarn.lock b/yarn.lock index 6f34d596..27bb7a63 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1441,22 +1441,22 @@ __metadata: languageName: node linkType: hard -"@emnapi/core@npm:^1.4.3": - version: 1.7.0 - resolution: "@emnapi/core@npm:1.7.0" +"@emnapi/core@npm:^1.4.3, @emnapi/core@npm:^1.5.0": + version: 1.7.1 + resolution: "@emnapi/core@npm:1.7.1" dependencies: "@emnapi/wasi-threads": 1.1.0 tslib: ^2.4.0 - checksum: 19df5bc99100c9a132060ab62aa9e4a5ed7053cd5109beeffa394c11fd933fcf292c9a688ec2e09c10c3ef4d6d0fb89fdf379ce3e140171903abc75ed36341ed + checksum: 45274d4916c29ca39bb1833269524b8ccccc4295902193e640843df37ae4c35cf65a9d557d34d2eff770745116542af75feeb60d73088086fee791192cbee292 languageName: node linkType: hard -"@emnapi/runtime@npm:^1.4.3": - version: 1.7.0 - resolution: "@emnapi/runtime@npm:1.7.0" +"@emnapi/runtime@npm:^1.4.3, @emnapi/runtime@npm:^1.5.0": + version: 1.7.1 + resolution: "@emnapi/runtime@npm:1.7.1" dependencies: tslib: ^2.4.0 - checksum: 2aa1b056f39f113b0fae006f8a113ce2e309c199a5a2b141906f9c3d76c0208d9e61601fe1cdffb3c0b769cfcf141635fe7f14e83a34447257306da4d5f2a0e4 + checksum: a7429af887703bae05c360bc089d1ffbb99a8b5fd2645d8e1034737523f0323e9d29510c3569c3b8f5a516e86975aa9fcdb3601d1907c216f972e1b8d3ce82e1 languageName: node linkType: hard @@ -2379,6 +2379,17 @@ __metadata: languageName: node linkType: hard +"@napi-rs/wasm-runtime@npm:^1.0.7": + version: 1.0.7 + resolution: "@napi-rs/wasm-runtime@npm:1.0.7" + dependencies: + "@emnapi/core": ^1.5.0 + "@emnapi/runtime": ^1.5.0 + "@tybys/wasm-util": ^0.10.1 + checksum: 9b59bd8b7310936ed163935befae0613dfffd563e7ff021d4f1b62b419fb0e3395f7206b17460a91db555bea6c471408f3472455e4e2ca9f5a0bff4468fa38d0 + languageName: node + linkType: hard + "@nestjs/cli@npm:^11.0.10": version: 11.0.10 resolution: "@nestjs/cli@npm:11.0.10" @@ -2498,49 +2509,6 @@ __metadata: languageName: node linkType: hard -"@nestjs/microservices@npm:^11.1.8": - version: 11.1.8 - resolution: "@nestjs/microservices@npm:11.1.8" - dependencies: - iterare: 1.2.1 - tslib: 2.8.1 - peerDependencies: - "@grpc/grpc-js": "*" - "@nestjs/common": ^11.0.0 - "@nestjs/core": ^11.0.0 - "@nestjs/websockets": ^11.0.0 - amqp-connection-manager: "*" - amqplib: "*" - cache-manager: "*" - ioredis: "*" - kafkajs: "*" - mqtt: "*" - nats: "*" - reflect-metadata: ^0.1.12 || ^0.2.0 - rxjs: ^7.1.0 - peerDependenciesMeta: - "@grpc/grpc-js": - optional: true - "@nestjs/websockets": - optional: true - amqp-connection-manager: - optional: true - amqplib: - optional: true - cache-manager: - optional: true - ioredis: - optional: true - kafkajs: - optional: true - mqtt: - optional: true - nats: - optional: true - checksum: 81818bdca6672dd91c561f5103ac598be5e0a820645ca59d9dd866015aec117bdc261bd552f5dedc2742b12520ef9796cb3c08baca64e35cb8faae01356cb5d4 - languageName: node - linkType: hard - "@nestjs/platform-express@npm:11.1.8, @nestjs/platform-express@npm:^11.1.8": version: 11.1.8 resolution: "@nestjs/platform-express@npm:11.1.8" @@ -3274,6 +3242,141 @@ __metadata: languageName: node linkType: hard +"@oxc-resolver/binding-android-arm-eabi@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-android-arm-eabi@npm:11.14.0" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-android-arm64@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-android-arm64@npm:11.14.0" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-darwin-arm64@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-darwin-arm64@npm:11.14.0" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-darwin-x64@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-darwin-x64@npm:11.14.0" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-freebsd-x64@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-freebsd-x64@npm:11.14.0" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm-gnueabihf@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-arm-gnueabihf@npm:11.14.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm-musleabihf@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-arm-musleabihf@npm:11.14.0" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm64-gnu@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-arm64-gnu@npm:11.14.0" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-arm64-musl@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-arm64-musl@npm:11.14.0" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-ppc64-gnu@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-ppc64-gnu@npm:11.14.0" + conditions: os=linux & cpu=ppc64 & libc=glibc + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-riscv64-gnu@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-riscv64-gnu@npm:11.14.0" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-riscv64-musl@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-riscv64-musl@npm:11.14.0" + conditions: os=linux & cpu=riscv64 & libc=musl + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-s390x-gnu@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-s390x-gnu@npm:11.14.0" + conditions: os=linux & cpu=s390x & libc=glibc + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-x64-gnu@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-x64-gnu@npm:11.14.0" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@oxc-resolver/binding-linux-x64-musl@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-linux-x64-musl@npm:11.14.0" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@oxc-resolver/binding-wasm32-wasi@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-wasm32-wasi@npm:11.14.0" + dependencies: + "@napi-rs/wasm-runtime": ^1.0.7 + conditions: cpu=wasm32 + languageName: node + linkType: hard + +"@oxc-resolver/binding-win32-arm64-msvc@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-win32-arm64-msvc@npm:11.14.0" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@oxc-resolver/binding-win32-ia32-msvc@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-win32-ia32-msvc@npm:11.14.0" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@oxc-resolver/binding-win32-x64-msvc@npm:11.14.0": + version: 11.14.0 + resolution: "@oxc-resolver/binding-win32-x64-msvc@npm:11.14.0" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@paralleldrive/cuid2@npm:^2.2.2": version: 2.3.1 resolution: "@paralleldrive/cuid2@npm:2.3.1" @@ -4178,7 +4281,7 @@ __metadata: languageName: node linkType: hard -"@tybys/wasm-util@npm:^0.10.0": +"@tybys/wasm-util@npm:^0.10.0, @tybys/wasm-util@npm:^0.10.1": version: 0.10.1 resolution: "@tybys/wasm-util@npm:0.10.1" dependencies: @@ -4480,12 +4583,12 @@ __metadata: languageName: node linkType: hard -"@types/node@npm:*, @types/node@npm:>=18, @types/node@npm:^24.9.1": - version: 24.10.0 - resolution: "@types/node@npm:24.10.0" +"@types/node@npm:*, @types/node@npm:>=18, @types/node@npm:^24.10.1, @types/node@npm:^24.9.1": + version: 24.10.1 + resolution: "@types/node@npm:24.10.1" dependencies: undici-types: ~7.16.0 - checksum: 268c843faae02ba88be2441759c26e73038583a7e221fa3000f2c1d7fdc1d06b28cb514fc5367f7cb147c3519cd25ddafdfa1f8566829b91fb096262ebe3f7bb + checksum: c2f370ae7a97c04991e0eee6b57e588a2abef0814a5f6e41fda5a9200cf02ae6654fad51c8372ee203ae4134bab80f5bf441c586f7f50e0fda3ba422f35eb3c0 languageName: node linkType: hard @@ -5757,7 +5860,6 @@ __metadata: "@nestjs/common": 11.1.8 "@nestjs/config": 4.0.2 "@nestjs/core": 11.1.8 - "@nestjs/microservices": ^11.1.8 "@nestjs/platform-express": 11.1.8 "@nestjs/schedule": ^6.0.1 "@nestjs/schematics": 11.0.9 @@ -5779,7 +5881,7 @@ __metadata: "@types/json2csv": ^5.0.7 "@types/jsonwebtoken": ^9.0.10 "@types/multer": ^2.0.0 - "@types/node": ^24.9.1 + "@types/node": ^24.10.1 "@types/nodemailer": ^7.0.3 "@types/nunjucks": ^3.2.6 "@types/qrcode": ^1.5.6 @@ -5809,7 +5911,6 @@ __metadata: eslint-plugin-import: ^2.32.0 eslint-plugin-security: 3.0.1 express: 5.1.0 - express-rate-limit: 8.1.0 fetch-blob: ^4.0.0 helmet: 8.1.0 i18n-iso-countries: ^7.14.0 @@ -5818,6 +5919,7 @@ __metadata: json2csv: ^5.0.7 jsonwebtoken: ^9.0.2 knex: 3.1.0 + knip: ^5.70.2 lru-cache: ^11.2.2 nanoid: 5.1.6 nock: ^14.0.10 @@ -5842,7 +5944,7 @@ __metadata: tsconfig-paths: ^4.2.0 typeorm: 0.3.27 typeorm-pglite: ^0.3.2 - typescript: 5.9.3 + typescript: ^5.9.3 uuid: ^13.0.0 validator: ^13.15.20 winston: 3.18.3 @@ -8051,17 +8153,6 @@ __metadata: languageName: node linkType: hard -"express-rate-limit@npm:8.1.0": - version: 8.1.0 - resolution: "express-rate-limit@npm:8.1.0" - dependencies: - ip-address: 10.0.1 - peerDependencies: - express: ">= 4.11" - checksum: 3bbb2239b328969fe1e8d6171c675a62d403be7ec16d1f852878bf4dc383e83078a56145bfecb132cb2bb5a1f78c3802bb8a6d6349d9a03c5b380a5655b7f405 - languageName: node - linkType: hard - "express@npm:5.1.0": version: 5.1.0 resolution: "express@npm:5.1.0" @@ -8181,6 +8272,15 @@ __metadata: languageName: node linkType: hard +"fd-package-json@npm:^2.0.0": + version: 2.0.0 + resolution: "fd-package-json@npm:2.0.0" + dependencies: + walk-up-path: ^4.0.0 + checksum: e595a1a23f8e208815cdcf26c92218240da00acce80468324408dc4a5cb6c26b6efb5076f0458a02f044562a1e60253731187a627d5416b4961468ddfc0ae426 + languageName: node + linkType: hard + "fdir@npm:^6.5.0": version: 6.5.0 resolution: "fdir@npm:6.5.0" @@ -8415,6 +8515,17 @@ __metadata: languageName: node linkType: hard +"formatly@npm:^0.3.0": + version: 0.3.0 + resolution: "formatly@npm:0.3.0" + dependencies: + fd-package-json: ^2.0.0 + bin: + formatly: bin/index.mjs + checksum: ef2bf133c048195fc30ced2a20e9acb5251a2a7cf7c2bf67afc71f6bbad78a3f8816b814ee22ec6db1bca7b339fb0d1eddbf168c7d36cc53459c664ff73e8d0d + languageName: node + linkType: hard + "formidable@npm:^3.5.4": version: 3.5.4 resolution: "formidable@npm:3.5.4" @@ -9119,7 +9230,7 @@ __metadata: languageName: node linkType: hard -"ip-address@npm:10.0.1, ip-address@npm:^10.0.1": +"ip-address@npm:^10.0.1": version: 10.0.1 resolution: "ip-address@npm:10.0.1" checksum: 525d5391cfd31a91f80f5857e98487aeaa8474e860a6725a0b6461ac8e436c7f8c869774dece391c8f8e7486306a34a4d1c094778c4c583a3f1f2cd905e5ed50 @@ -10074,6 +10185,15 @@ __metadata: languageName: node linkType: hard +"jiti@npm:^2.6.0": + version: 2.6.1 + resolution: "jiti@npm:2.6.1" + bin: + jiti: lib/jiti-cli.mjs + checksum: 9394e29c5e40d1ca8267923160d8d86706173c9ff30c901097883434b0c4866de2c060427b6a9a5843bb3e42fa3a3c8b5b2228531d3dd4f4f10c5c6af355bb86 + languageName: node + linkType: hard + "joi@npm:^18.0.1": version: 18.0.1 resolution: "joi@npm:18.0.1" @@ -10110,7 +10230,7 @@ __metadata: languageName: node linkType: hard -"js-yaml@npm:4.1.0, js-yaml@npm:^4.1.0": +"js-yaml@npm:4.1.0": version: 4.1.0 resolution: "js-yaml@npm:4.1.0" dependencies: @@ -10133,6 +10253,17 @@ __metadata: languageName: node linkType: hard +"js-yaml@npm:^4.1.0, js-yaml@npm:^4.1.1": + version: 4.1.1 + resolution: "js-yaml@npm:4.1.1" + dependencies: + argparse: ^2.0.1 + bin: + js-yaml: bin/js-yaml.js + checksum: ea2339c6930fe048ec31b007b3c90be2714ab3e7defcc2c27ebf30c74fd940358f29070b4345af0019ef151875bf3bc3f8644bea1bab0372652b5044813ac02d + languageName: node + linkType: hard + "jsesc@npm:^3.0.2": version: 3.1.0 resolution: "jsesc@npm:3.1.0" @@ -10338,6 +10469,32 @@ __metadata: languageName: node linkType: hard +"knip@npm:^5.70.2": + version: 5.70.2 + resolution: "knip@npm:5.70.2" + dependencies: + "@nodelib/fs.walk": ^1.2.3 + fast-glob: ^3.3.3 + formatly: ^0.3.0 + jiti: ^2.6.0 + js-yaml: ^4.1.1 + minimist: ^1.2.8 + oxc-resolver: ^11.13.2 + picocolors: ^1.1.1 + picomatch: ^4.0.1 + smol-toml: ^1.5.2 + strip-json-comments: 5.0.3 + zod: ^4.1.11 + peerDependencies: + "@types/node": ">=18" + typescript: ">=5.0.4 <7" + bin: + knip: bin/knip.js + knip-bun: bin/knip-bun.js + checksum: f84fc0a865e1843780725762feddf1466d14a9415d8f15401abb2e19d79d4b76fbfb30793b04a52dc348a3f33b5e598a7d15436c479f2b8a583af6b50b90d9c2 + languageName: node + linkType: hard + "kuler@npm:^2.0.0": version: 2.0.0 resolution: "kuler@npm:2.0.0" @@ -11588,6 +11745,72 @@ __metadata: languageName: node linkType: hard +"oxc-resolver@npm:^11.13.2": + version: 11.14.0 + resolution: "oxc-resolver@npm:11.14.0" + dependencies: + "@oxc-resolver/binding-android-arm-eabi": 11.14.0 + "@oxc-resolver/binding-android-arm64": 11.14.0 + "@oxc-resolver/binding-darwin-arm64": 11.14.0 + "@oxc-resolver/binding-darwin-x64": 11.14.0 + "@oxc-resolver/binding-freebsd-x64": 11.14.0 + "@oxc-resolver/binding-linux-arm-gnueabihf": 11.14.0 + "@oxc-resolver/binding-linux-arm-musleabihf": 11.14.0 + "@oxc-resolver/binding-linux-arm64-gnu": 11.14.0 + "@oxc-resolver/binding-linux-arm64-musl": 11.14.0 + "@oxc-resolver/binding-linux-ppc64-gnu": 11.14.0 + "@oxc-resolver/binding-linux-riscv64-gnu": 11.14.0 + "@oxc-resolver/binding-linux-riscv64-musl": 11.14.0 + "@oxc-resolver/binding-linux-s390x-gnu": 11.14.0 + "@oxc-resolver/binding-linux-x64-gnu": 11.14.0 + "@oxc-resolver/binding-linux-x64-musl": 11.14.0 + "@oxc-resolver/binding-wasm32-wasi": 11.14.0 + "@oxc-resolver/binding-win32-arm64-msvc": 11.14.0 + "@oxc-resolver/binding-win32-ia32-msvc": 11.14.0 + "@oxc-resolver/binding-win32-x64-msvc": 11.14.0 + dependenciesMeta: + "@oxc-resolver/binding-android-arm-eabi": + optional: true + "@oxc-resolver/binding-android-arm64": + optional: true + "@oxc-resolver/binding-darwin-arm64": + optional: true + "@oxc-resolver/binding-darwin-x64": + optional: true + "@oxc-resolver/binding-freebsd-x64": + optional: true + "@oxc-resolver/binding-linux-arm-gnueabihf": + optional: true + "@oxc-resolver/binding-linux-arm-musleabihf": + optional: true + "@oxc-resolver/binding-linux-arm64-gnu": + optional: true + "@oxc-resolver/binding-linux-arm64-musl": + optional: true + "@oxc-resolver/binding-linux-ppc64-gnu": + optional: true + "@oxc-resolver/binding-linux-riscv64-gnu": + optional: true + "@oxc-resolver/binding-linux-riscv64-musl": + optional: true + "@oxc-resolver/binding-linux-s390x-gnu": + optional: true + "@oxc-resolver/binding-linux-x64-gnu": + optional: true + "@oxc-resolver/binding-linux-x64-musl": + optional: true + "@oxc-resolver/binding-wasm32-wasi": + optional: true + "@oxc-resolver/binding-win32-arm64-msvc": + optional: true + "@oxc-resolver/binding-win32-ia32-msvc": + optional: true + "@oxc-resolver/binding-win32-x64-msvc": + optional: true + checksum: dbfe256de43fb848764828909d80a9041a8e2dc31f58a60397e905d5856712801a38d8e71d1c37dd7c90322b92323d576617de6c0f32bef2ca55fabd5561a855 + languageName: node + linkType: hard + "p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -11928,7 +12151,7 @@ __metadata: languageName: node linkType: hard -"picomatch@npm:^4.0.2, picomatch@npm:^4.0.3": +"picomatch@npm:^4.0.1, picomatch@npm:^4.0.2, picomatch@npm:^4.0.3": version: 4.0.3 resolution: "picomatch@npm:4.0.3" checksum: 6817fb74eb745a71445debe1029768de55fd59a42b75606f478ee1d0dc1aa6e78b711d041a7c9d5550e042642029b7f373dc1a43b224c4b7f12d23436735dba0 @@ -12974,6 +13197,13 @@ __metadata: languageName: node linkType: hard +"smol-toml@npm:^1.5.2": + version: 1.5.2 + resolution: "smol-toml@npm:1.5.2" + checksum: 75b7e8482151cbe48be094de205631502d5694c2a7d968446799e8b988b4105bd6efd3b6a986baa40d9e9b47cbb2daada21a302901a618793aabd35a670f195e + languageName: node + linkType: hard + "socks-proxy-agent@npm:^8.0.3": version: 8.0.5 resolution: "socks-proxy-agent@npm:8.0.5" @@ -13328,6 +13558,13 @@ __metadata: languageName: node linkType: hard +"strip-json-comments@npm:5.0.3": + version: 5.0.3 + resolution: "strip-json-comments@npm:5.0.3" + checksum: 3ccbf26f278220f785e4b71f8a719a6a063d72558cc63cb450924254af258a4f4c008b8c9b055373a680dc7bd525be9e543ad742c177f8a7667e0b726258e0e4 + languageName: node + linkType: hard + "strip-json-comments@npm:^3.1.1": version: 3.1.1 resolution: "strip-json-comments@npm:3.1.1" @@ -14103,7 +14340,7 @@ __metadata: languageName: node linkType: hard -"typescript@npm:5.9.3, typescript@npm:^5.9.3": +"typescript@npm:^5.9.3": version: 5.9.3 resolution: "typescript@npm:5.9.3" bin: @@ -14123,7 +14360,7 @@ __metadata: languageName: node linkType: hard -"typescript@patch:typescript@5.9.3#~builtin, typescript@patch:typescript@^5.9.3#~builtin": +"typescript@patch:typescript@^5.9.3#~builtin": version: 5.9.3 resolution: "typescript@patch:typescript@npm%3A5.9.3#~builtin::version=5.9.3&hash=1f5320" bin: @@ -14440,6 +14677,13 @@ __metadata: languageName: node linkType: hard +"walk-up-path@npm:^4.0.0": + version: 4.0.0 + resolution: "walk-up-path@npm:4.0.0" + checksum: 6a230b20e5de296895116dc12b09dafaec1f72b8060c089533d296e241aff059dfaebe0d015c77467f857e4b40c78e08f7481add76f340233a1f34fa8af9ed63 + languageName: node + linkType: hard + "walker@npm:^1.0.8": version: 1.0.8 resolution: "walker@npm:1.0.8" @@ -14927,3 +15171,10 @@ __metadata: checksum: 6ee42d665a4cc161c7de3f015b2a65d6c65d2808bfe3b99e228bd2b1b784ef1e54d1907415c025fc12b400f26f372bfc1b71966c6c738d998325ca422eb39363 languageName: node linkType: hard + +"zod@npm:^4.1.11": + version: 4.1.13 + resolution: "zod@npm:4.1.13" + checksum: e5459280d46567df0adc188b0c687d425e616a206d4a73ee3bacf62d246f5546e24ef45790c7c4762d3ce7659c5e41052a29445d32d0d272410be9fe23162d03 + languageName: node + linkType: hard