Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BC-8508 - Remove exports from shared/*/index.ts #5454

Merged
merged 9 commits into from
Jan 23, 2025
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion apps/server/src/core/core.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InterceptorConfig } from '@shared/common';
import { InterceptorConfig } from '@shared/common/interceptor';
import { LoggerConfig } from './logger';

export interface CoreModuleConfig extends InterceptorConfig, LoggerConfig {}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { ErrorLogger, ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@core/logger';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { BadRequestException, HttpStatus, InternalServerErrorException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { BusinessError } from '@shared/common';
import { ErrorLogger, ErrorLogMessage, Loggable, LogMessage, ValidationErrorLogMessage } from '@core/logger';
import util from 'util';
import { BusinessError } from '@shared/common/error';
import { AxiosError } from 'axios';
import util from 'util';
import { AxiosErrorLoggable } from '../loggable';
import { ErrorLoggable } from '../loggable/error.loggable';
import { ErrorUtils } from '../utils';
import { AxiosErrorLoggable } from '../loggable';
import { DomainErrorHandler } from './domain-error-handler';

class SampleLoggableException extends BadRequestException implements Loggable {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValidationError } from '@nestjs/common';
import { ApiValidationError } from '@shared/common';
import { ApiValidationError } from '@shared/common/error';
import { ErrorResponse } from './error.response';
import { ValidationErrorDetailResponse } from './validation-error-detail.response';

Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/core/error/filter/global-error.filter.spec.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable promise/valid-params */
import { ErrorLogMessage, Loggable } from '@core/logger';
import { NotFound } from '@feathersjs/errors';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ArgumentsHost, BadRequestException, HttpStatus, InternalServerErrorException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { WsException } from '@nestjs/websockets';
import { BusinessError } from '@shared/common';
import { ErrorLogMessage, Loggable } from '@core/logger';
import { Response } from 'express';
import { BusinessError } from '@shared/common/error';
import { AxiosError } from 'axios';
import { Response } from 'express';
import { DomainErrorHandler } from '../domain';
import { ErrorResponse } from '../dto';
import { ErrorUtils } from '../utils';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/error/filter/global-error.filter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { IError, RpcMessage } from '@infra/rabbitmq';
import { ArgumentsHost, Catch, ExceptionFilter, HttpException, InternalServerErrorException } from '@nestjs/common';
import { WsException } from '@nestjs/websockets';
import { ApiValidationError, BusinessError } from '@shared/common';
import { ApiValidationError, BusinessError } from '@shared/common/error';
import { Response } from 'express';
import _ from 'lodash';
import { DomainErrorHandler } from '../domain';
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/core/error/loggable/error.loggable.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NotFound } from '@feathersjs/errors';
import { BadRequestException, HttpStatus, ValidationError } from '@nestjs/common';
import { ApiProperty } from '@nestjs/swagger';
import { ApiValidationError, BusinessError, ErrorLogMessage } from '@shared/common';
import { PrivacyProtect } from '@shared/controller';
import { ApiValidationError, BusinessError, ErrorLogMessage } from '@shared/common/error';
import { PrivacyProtect } from '@shared/controller/validator';
import { ErrorLoggable } from './error.loggable';

class SampleBusinessError extends BusinessError {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/error/loggable/error.loggable.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValidationError } from '@nestjs/common';
import { ApiValidationError } from '@shared/common';
import { ApiValidationError } from '@shared/common/error';
import { getMetadataStorage } from 'class-validator';
import util from 'util';
import { Loggable } from '../../logger/interfaces';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/error/utils/error.utils.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { FeathersError } from '@feathersjs/errors';
import { BadRequestException, HttpStatus } from '@nestjs/common';
import { BusinessError } from '@shared/common';
import { BusinessError } from '@shared/common/error';
import { ErrorUtils } from './error.utils';

class SampleBusinessError extends BusinessError {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/error/utils/error.utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { HttpException, HttpExceptionOptions } from '@nestjs/common';
import { BusinessError } from '@shared/common';
import { BusinessError } from '@shared/common/error';
import { FeathersError } from '../interface';

export class ErrorUtils {
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/core/interceptor/interceptor.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ClassSerializerInterceptor, Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { APP_INTERCEPTOR } from '@nestjs/core';
import { TimeoutInterceptor } from '@shared/common';
import { TimeoutInterceptor } from '@shared/common/interceptor';

/** *********************************************
* Global Interceptor setup
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ValidationError, ValidationPipe } from '@nestjs/common';
import { ApiValidationError } from '@shared/common';
import { ApiValidationError } from '@shared/common/error';

/** *********************************************
* Global Pipe setup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
UseGuards,
} from '@nestjs/common';
import { ApiBearerAuth } from '@nestjs/swagger';
import { extractJwtFromHeader } from '@shared/common';
import { extractJwtFromHeader } from '@shared/common/utils';
import { Request } from 'express';
import { JwtAuthGuard } from '../guard';
import { ICurrentUser } from '../interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypeGuard } from '@shared/common';
import { TypeGuard } from '@shared/common/guards';
import { EntityId } from '@shared/domain/types';
import { ICurrentUser } from '../interface';

Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/infra/auth-guard/strategy/jwt.strategy.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Injectable, UnauthorizedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { extractJwtFromHeader } from '@shared/common';
import { extractJwtFromHeader } from '@shared/common/utils';
import { Strategy } from 'passport-jwt';
import { JwtValidationAdapter } from '../adapter';
import { JwtAuthGuardConfig } from '../config';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { PassportStrategy } from '@nestjs/passport';
import { WsException } from '@nestjs/websockets';
import { JwtExtractor } from '@shared/common';
import { JwtExtractor } from '@shared/common/utils';
import { Strategy } from 'passport-jwt';
import { JwtValidationAdapter } from '../adapter';
import { JwtAuthGuardConfig } from '../config';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Inject, Injectable } from '@nestjs/common';
import { REQUEST } from '@nestjs/core';
import { extractJwtFromHeader } from '@shared/common';
import { extractJwtFromHeader } from '@shared/common/utils';
import { RawAxiosRequestConfig } from 'axios';
import { Request } from 'express';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { LegacyLogger } from '@core/logger';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { TeamDto, TeamUserDto } from '@modules/collaborative-storage/services/dto/team.dto';
import { PseudonymService } from '@modules/pseudonym';
Expand All @@ -9,8 +10,7 @@ import { Pseudonym, UserDO } from '@shared/domain/domainobject';
import { LtiToolDO } from '@shared/domain/domainobject/ltitool.do';
import { LtiPrivacyPermission, LtiRoleType, User } from '@shared/domain/entity';
import { RoleName } from '@shared/domain/interface';
import { LtiToolRepo } from '@shared/repo';
import { LegacyLogger } from '@core/logger';
import { LtiToolRepo } from '@shared/repo/ltitool';
import { ltiToolDOFactory, pseudonymFactory } from '@testing/factory/domainobject';
import { userDoFactory } from '@testing/factory/user.do.factory';
import { userFactory } from '@testing/factory/user.factory';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Injectable, InternalServerErrorException } from '@nestjs/common';
import { TypeGuard } from '@shared/common';
import { TypeGuard } from '@shared/common/guards';
import { EntityId } from '@shared/domain/types';
import { AxiosResponse } from 'axios';
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { InternalServerErrorException } from '@nestjs/common';
import { TypeGuard } from '@shared/common';
import { ErrorUtils } from '@core/error/utils';
import { InternalServerErrorException } from '@nestjs/common';
import { TypeGuard } from '@shared/common/guards';
import {
CreateAuthorUsingGET200ResponseData,
CreateGroupUsingGET200ResponseData,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest';
import KeycloakAdminClient from '@keycloak/keycloak-admin-client-cjs/keycloak-admin-client-cjs-index';
import { Users } from '@keycloak/keycloak-admin-client/lib/resources/users';
import { Test, TestingModule } from '@nestjs/testing';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { IdmAccount } from '@shared/domain/interface/account';
import { IdentityManagementService } from '../../identity-management.service';
import { KeycloakSettings } from '../../keycloak-administration/interface/keycloak-settings.interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import UserRepresentation from '@keycloak/keycloak-admin-client/lib/defs/userRepresentation';
import { Injectable } from '@nestjs/common';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { IdmAccount, IdmAccountUpdate } from '@shared/domain/interface';
import { Counted } from '@shared/domain/types';
import { IdentityManagementService, SearchOptions } from '../../identity-management.service';
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/infra/s3-client/s3-client.adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import {
ServiceOutputTypes,
} from '@aws-sdk/client-s3';
import { Upload } from '@aws-sdk/lib-storage';
import { Inject, Injectable, InternalServerErrorException, NotFoundException } from '@nestjs/common';
import { TypeGuard } from '@shared/common';
import { ErrorUtils } from '@core/error/utils';
import { LegacyLogger } from '@core/logger';
import { Inject, Injectable, InternalServerErrorException, NotFoundException } from '@nestjs/common';
import { TypeGuard } from '@shared/common/guards';
import { Readable } from 'stream';
import { S3_CLIENT, S3_CONFIG } from './constants';
import { CopyFiles, File, GetFile, ListFiles, ObjectKeysRecursive, S3Config } from './interface';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { PolymorphicArrayTransform } from '@shared/controller';
import { PolymorphicArrayTransform } from '@shared/controller/transformer';
import { ClassConstructor } from 'class-transformer';
import { IsArray, ValidateNested } from 'class-validator';
import { SchulconnexPoliciesInfoErrorResponse } from './schulconnex-policies-info-error-response';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HttpStatus } from '@nestjs/common';
import { BusinessError, ErrorLogMessage } from '@shared/common';
import { Loggable, LogMessage } from '@core/logger';
import { HttpStatus } from '@nestjs/common';
import { BusinessError, ErrorLogMessage } from '@shared/common/error';

export class TspSystemNotFoundLoggableException extends BusinessError implements Loggable {
constructor() {
Expand Down
6 changes: 3 additions & 3 deletions apps/server/src/modules/account/account-api.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { LoggerModule } from '@core/logger';
import { AuthorizationModule } from '@modules/authorization';
import { Module } from '@nestjs/common';
import { UserRepo } from '@shared/repo';
import { LoggerModule } from '@core/logger';
import { AccountUc } from './api/account.uc';
import { UserRepo } from '@shared/repo/user';
import { AccountModule } from './account.module';
import { AccountController } from './api/account.controller';
import { AccountUc } from './api/account.uc';

@Module({
imports: [AccountModule, LoggerModule, AuthorizationModule],
Expand Down
4 changes: 2 additions & 2 deletions apps/server/src/modules/account/account.module.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { LoggerModule } from '@core/logger/logger.module';
import { IdentityManagementModule } from '@infra/identity-management';
import { SystemModule } from '@modules/system';
import { Module } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { CqrsModule } from '@nestjs/cqrs';
import { UserRepo } from '@shared/repo';
import { LoggerModule } from '@core/logger/logger.module';
import { UserRepo } from '@shared/repo/user';
import { AccountConfig } from './account-config';
import { AccountServiceDb } from './domain/services/account-db.service';
import { AccountServiceIdm } from './domain/services/account-idm.service';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/modules/account/api/account.controller.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Body, Controller, Delete, Get, Param, Patch, Query } from '@nestjs/common';
import { ApiOperation, ApiResponse, ApiTags } from '@nestjs/swagger';
import { EntityNotFoundError, ForbiddenOperationError, ValidationError } from '@shared/common';
import { EntityNotFoundError, ForbiddenOperationError, ValidationError } from '@shared/common/error';

import { CurrentUser, ICurrentUser, JwtAuthentication } from '@infra/auth-guard';
import { AccountUc } from './account.uc';
Expand Down
2 changes: 1 addition & 1 deletion apps/server/src/modules/account/api/account.uc.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';

import { faker } from '@faker-js/faker';
import { AuthorizationService } from '@modules/authorization';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApiPropertyOptional } from '@nestjs/swagger';
import { PrivacyProtect, SanitizeHtml } from '@shared/controller';
import { IsBoolean, IsString, IsOptional, Matches, IsEmail } from 'class-validator';
import { SanitizeHtml } from '@shared/controller/transformer';
import { PrivacyProtect } from '@shared/controller/validator';
import { IsBoolean, IsEmail, IsOptional, IsString, Matches } from 'class-validator';
import { passwordPattern } from '../../../domain/password-pattern';

export class AccountByIdBodyParams {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ApiProperty } from '@nestjs/swagger';
import { PaginationParams } from '@shared/controller/dto';
import { SanitizeHtml } from '@shared/controller/transformer';
import { IsEnum, IsString } from 'class-validator';
import { PaginationParams, SanitizeHtml } from '@shared/controller';
import { AccountSearchType } from '../../../domain/type/account-search-type';

export class AccountSearchQueryParams extends PaginationParams {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ApiProperty, ApiPropertyOptional } from '@nestjs/swagger';
import { PrivacyProtect, SanitizeHtml } from '@shared/controller';
import { SanitizeHtml } from '@shared/controller/transformer';
import { PrivacyProtect } from '@shared/controller/validator';
import { IsEmail, IsOptional, IsString, Matches } from 'class-validator';
import { passwordPattern } from '../../../domain/password-pattern';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { PrivacyProtect } from '@shared/controller';
import { PrivacyProtect } from '@shared/controller/validator';
import { IsString, Matches } from 'class-validator';
import { passwordPattern } from '../../../domain/password-pattern';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable max-classes-per-file */
import { ApiPropertyOptional } from '@nestjs/swagger';
import { PrivacyProtect } from '@shared/controller';
import { PrivacyProtect } from '@shared/controller/validator';
import { EntityId } from '@shared/domain/types';
import { IsBoolean, IsDate, IsMongoId, IsNotEmpty, IsString, Matches } from 'class-validator';
import { passwordPattern } from '../../domain/password-pattern';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApiProperty } from '@nestjs/swagger';
import { PaginationResponse } from '@shared/controller';
import { PaginationResponse } from '@shared/controller/dto';
import { AccountResponse } from './account.response';

export class AccountSearchListResponse extends PaginationResponse<AccountResponse[]> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { IdentityManagementService } from '@infra/identity-management';
import { ObjectId } from '@mikro-orm/mongodb';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { IdmAccount } from '@shared/domain/interface';
import { EntityId } from '@shared/domain/types';
import { Logger } from '@core/logger';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IdentityManagementService } from '@infra/identity-management/identity-m
import { ObjectId } from '@mikro-orm/mongodb';
import { Injectable } from '@nestjs/common';
import { ConfigService } from '@nestjs/config/dist/config.service';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { Counted, EntityId } from '@shared/domain/types';
import bcrypt from 'bcryptjs';
import { AccountConfig } from '../../account-config';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { IdentityManagementOauthService, IdentityManagementService } from '@infr
import { NotImplementedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { IdmAccount } from '@shared/domain/interface';
import { Logger } from '@core/logger';
import { Account, AccountSave } from '..';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { IdentityManagementOauthService, IdentityManagementService } from '@infr
import { ObjectId } from '@mikro-orm/mongodb';
import { Injectable, NotImplementedException } from '@nestjs/common';
import { ConfigService } from '@nestjs/config/dist/config.service';
import { EntityNotFoundError } from '@shared/common';
import { EntityNotFoundError } from '@shared/common/error';
import { IdmAccountUpdate } from '@shared/domain/interface';
import { Counted, EntityId } from '@shared/domain/types';
import { Logger } from '@core/logger';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Logger } from '@core/logger';
import { createMock } from '@golevelup/ts-jest';
import { MongoMemoryDatabaseModule } from '@infra/database';
import { IdentityManagementModule, IdentityManagementService } from '@infra/identity-management';
Expand All @@ -9,8 +10,7 @@ import { ConfigModule } from '@nestjs/config';
import { EventBus } from '@nestjs/cqrs';
import { Test, TestingModule } from '@nestjs/testing';
import { IdmAccount } from '@shared/domain/interface';
import { UserRepo } from '@shared/repo';
import { Logger } from '@core/logger';
import { UserRepo } from '@shared/repo/user';
import { cleanupCollections } from '@testing/cleanup-collections';
import { v1 } from 'uuid';
import { Account, AccountSave } from '..';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { Logger } from '@core/logger';
import { faker } from '@faker-js/faker';
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { MikroORM } from '@mikro-orm/core';
Expand All @@ -14,10 +15,14 @@ import { systemFactory } from '@modules/system/testing';
import { ConfigService } from '@nestjs/config';
import { EventBus } from '@nestjs/cqrs';
import { Test, TestingModule } from '@nestjs/testing';
import { AuthorizationError, EntityNotFoundError, ForbiddenOperationError, ValidationError } from '@shared/common';
import {
AuthorizationError,
EntityNotFoundError,
ForbiddenOperationError,
ValidationError,
} from '@shared/common/error';
import { User } from '@shared/domain/entity';
import { UserRepo } from '@shared/repo';
import { Logger } from '@core/logger';
import { UserRepo } from '@shared/repo/user';
import { schoolEntityFactory } from '@testing/factory/school-entity.factory';
import { userFactory } from '@testing/factory/user.factory';
import { setupEntities } from '@testing/setup-entities';
Expand Down
Loading
Loading