Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Chore: Replace module-alias with native package imports #385

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 21 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -138,15 +138,28 @@
"last 1 versions",
"> 1%"
],
"imports": {
"#core/utils": "./built/core/utils/index.js",
"#core/defaults.json": "./built/core/defaults.json",
"#core/*": "./built/core/*.js",
"#apps/*": "./built/apps/*.js",
"#api/utils": "./built/api/utils/index.js",
"#api/*": "./built/api/*.js",
"#config": "./built/config/config.js",
"#locale": "./built/locales/current.js",
"#models/*": "./built/models/*.js",
"#type/*": "./built/type/*.js",
"#enums/*": "./built/enums/*.js"
},
"_moduleAliases": {
"@core": "./built/core",
"@api": "./built/api",
"@apps": "./built/apps",
"@config": "./built/config/config.js",
"@locale": "./built/locales/current.js",
"@models": "./built/models",
"@type": "./built/type",
"@enums": "./built/enums"
"#core": "./built/core",
"#api": "./built/api",
"#apps": "./built/apps",
"#config": "./built/config/config.js",
"#locale": "./built/locales/current.js",
"#models": "./built/models",
"#type": "./built/type",
"#enums": "./built/enums"
},
"overrides": {
"gulp-sourcemaps": {
Expand Down
12 changes: 6 additions & 6 deletions src/api/app.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import "module-alias/register";
// import "module-alias/register";
import "reflect-metadata";

import { RoleType } from "@beabee/beabee-common";
Expand Down Expand Up @@ -38,13 +38,13 @@ import {
log as mainLogger,
requestErrorLogger,
requestLogger
} from "@core/logging";
import sessions from "@core/sessions";
import { initApp, startServer } from "@core/server";
} from "#core/logging";
import sessions from "#core/sessions";
import { initApp, startServer } from "#core/server";

import Contact from "@models/Contact";
import Contact from "#models/Contact";

import config from "@config";
import config from "#config";

function currentUserChecker(action: { request: Request }): Contact | undefined {
return action.request.auth?.entity instanceof Contact
Expand Down
18 changes: 9 additions & 9 deletions src/api/controllers/ApiKeyController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ import {
Param
} from "routing-controllers";

import { getRepository } from "@core/database";
import { generateApiKey } from "@core/utils/auth";
import { getRepository } from "#core/database";
import { generateApiKey } from "#core/utils/auth";

import ApiKey from "@models/ApiKey";
import Contact from "@models/Contact";
import ApiKey from "#models/ApiKey";
import Contact from "#models/Contact";

import { CurrentAuth } from "@api/decorators/CurrentAuth";
import { CurrentAuth } from "#api/decorators/CurrentAuth";
import {
CreateApiKeyDto,
GetApiKeyDto,
ListApiKeysDto,
NewApiKeyDto
} from "@api/dto/ApiKeyDto";
import { PaginatedDto } from "@api/dto/PaginatedDto";
import ApiKeyTransformer from "@api/transformers/ApiKeyTransformer";
} from "#api/dto/ApiKeyDto";
import { PaginatedDto } from "#api/dto/PaginatedDto";
import ApiKeyTransformer from "#api/transformers/ApiKeyTransformer";

import { AuthInfo } from "@type/auth-info";
import { AuthInfo } from "#type/auth-info";

@JsonController("/api-key")
@Authorized("admin")
Expand Down
20 changes: 10 additions & 10 deletions src/api/controllers/AuthController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@ import {

import { UnauthorizedError } from "../errors/UnauthorizedError";

import { getRepository } from "@core/database";
import passport from "@core/lib/passport";
import { getRepository } from "#core/database";
import passport from "#core/lib/passport";

import ContactsService from "@core/services/ContactsService";
import ContactsService from "#core/services/ContactsService";

import { LoginDto } from "@api/dto/LoginDto";
import { login } from "@api/utils";
import { LoginDto } from "#api/dto/LoginDto";
import { login } from "#api/utils";

import Contact from "@models/Contact";
import ContactRole from "@models/ContactRole";
import Contact from "#models/Contact";
import ContactRole from "#models/ContactRole";

import { LOGIN_CODES } from "@enums/login-codes";
import { LOGIN_CODES } from "#enums/login-codes";

import { PassportLoginInfo } from "@type/passport-login-info";
import { PassportLoginInfo } from "#type/passport-login-info";

import config from "@config";
import config from "#config";

@JsonController("/auth")
export class AuthController {
Expand Down
50 changes: 25 additions & 25 deletions src/api/controllers/CalloutController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,48 @@ import {
Res
} from "routing-controllers";

import CalloutsService from "@core/services/CalloutsService";
import CalloutsService from "#core/services/CalloutsService";

import { getRepository } from "@core/database";
import { verify } from "@core/lib/captchafox";
import { getRepository } from "#core/database";
import { verify } from "#core/lib/captchafox";

import { GetExportQuery } from "@api/dto/BaseDto";
import { GetExportQuery } from "#api/dto/BaseDto";

import {
CreateCalloutDto,
GetCalloutDto,
GetCalloutOptsDto,
ListCalloutsDto
} from "@api/dto/CalloutDto";
} from "#api/dto/CalloutDto";
import {
CreateCalloutResponseDto,
GetCalloutResponseDto,
GetCalloutResponseMapDto,
ListCalloutResponsesDto
} from "@api/dto/CalloutResponseDto";
import { CreateCalloutTagDto, GetCalloutTagDto } from "@api/dto/CalloutTagDto";
import { PaginatedDto } from "@api/dto/PaginatedDto";
} from "#api/dto/CalloutResponseDto";
import { CreateCalloutTagDto, GetCalloutTagDto } from "#api/dto/CalloutTagDto";
import { PaginatedDto } from "#api/dto/PaginatedDto";

import { CalloutId } from "@api/decorators/CalloutId";
import { CurrentAuth } from "@api/decorators/CurrentAuth";
import PartialBody from "@api/decorators/PartialBody";
import InvalidCalloutResponse from "@api/errors/InvalidCalloutResponse";
import UnauthorizedError from "@api/errors/UnauthorizedError";
import CalloutTagTransformer from "@api/transformers/CalloutTagTransformer";
import CalloutTransformer from "@api/transformers/CalloutTransformer";
import CalloutResponseExporter from "@api/transformers/CalloutResponseExporter";
import CalloutResponseMapTransformer from "@api/transformers/CalloutResponseMapTransformer";
import CalloutResponseTransformer from "@api/transformers/CalloutResponseTransformer";
import { validateOrReject } from "@api/utils";
import { CalloutId } from "#api/decorators/CalloutId";
import { CurrentAuth } from "#api/decorators/CurrentAuth";
import PartialBody from "#api/decorators/PartialBody";
import InvalidCalloutResponse from "#api/errors/InvalidCalloutResponse";
import UnauthorizedError from "#api/errors/UnauthorizedError";
import CalloutTagTransformer from "#api/transformers/CalloutTagTransformer";
import CalloutTransformer from "#api/transformers/CalloutTransformer";
import CalloutResponseExporter from "#api/transformers/CalloutResponseExporter";
import CalloutResponseMapTransformer from "#api/transformers/CalloutResponseMapTransformer";
import CalloutResponseTransformer from "#api/transformers/CalloutResponseTransformer";
import { validateOrReject } from "#api/utils";

import Callout from "@models/Callout";
import CalloutResponseTag from "@models/CalloutResponseTag";
import CalloutTag from "@models/CalloutTag";
import Contact from "@models/Contact";
import Callout from "#models/Callout";
import CalloutResponseTag from "#models/CalloutResponseTag";
import CalloutTag from "#models/CalloutTag";
import Contact from "#models/Contact";

import { CalloutCaptcha } from "@enums/callout-captcha";
import { CalloutCaptcha } from "#enums/callout-captcha";

import { AuthInfo } from "@type/auth-info";
import { AuthInfo } from "#type/auth-info";

@JsonController("/callout")
export class CalloutController {
Expand Down
20 changes: 10 additions & 10 deletions src/api/controllers/CalloutResponseCommentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,24 +13,24 @@ import {
QueryParams
} from "routing-controllers";

import { getRepository } from "@core/database";
import { getRepository } from "#core/database";

import { CurrentAuth } from "@api/decorators/CurrentAuth";
import PartialBody from "@api/decorators/PartialBody";
import { CurrentAuth } from "#api/decorators/CurrentAuth";
import PartialBody from "#api/decorators/PartialBody";
import {
CreateCalloutResponseCommentDto,
GetCalloutResponseCommentDto,
ListCalloutResponseCommentsDto
} from "@api/dto/CalloutResponseCommentDto";
import { PaginatedDto } from "@api/dto/PaginatedDto";
import { UUIDParams } from "@api/params/UUIDParams";
} from "#api/dto/CalloutResponseCommentDto";
import { PaginatedDto } from "#api/dto/PaginatedDto";
import { UUIDParams } from "#api/params/UUIDParams";

import CalloutResponseCommentTransformer from "@api/transformers/CalloutResponseCommentTransformer";
import CalloutResponseCommentTransformer from "#api/transformers/CalloutResponseCommentTransformer";

import CalloutResponseComment from "@models/CalloutResponseComment";
import Contact from "@models/Contact";
import CalloutResponseComment from "#models/CalloutResponseComment";
import Contact from "#models/Contact";

import { AuthInfo } from "@type/auth-info";
import { AuthInfo } from "#type/auth-info";

@JsonController("/callout-response-comments")
@Authorized("admin")
Expand Down
14 changes: 7 additions & 7 deletions src/api/controllers/CalloutResponseController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import {
QueryParams
} from "routing-controllers";

import { CurrentAuth } from "@api/decorators/CurrentAuth";
import PartialBody from "@api/decorators/PartialBody";
import { UUIDParams } from "@api/params/UUIDParams";
import { CurrentAuth } from "#api/decorators/CurrentAuth";
import PartialBody from "#api/decorators/PartialBody";
import { UUIDParams } from "#api/params/UUIDParams";

import {
BatchUpdateCalloutResponseDto,
Expand All @@ -19,11 +19,11 @@ import {
GetCalloutResponseDto,
GetCalloutResponseOptsDto,
ListCalloutResponsesDto
} from "@api/dto/CalloutResponseDto";
import { PaginatedDto } from "@api/dto/PaginatedDto";
import CalloutResponseTransformer from "@api/transformers/CalloutResponseTransformer";
} from "#api/dto/CalloutResponseDto";
import { PaginatedDto } from "#api/dto/PaginatedDto";
import CalloutResponseTransformer from "#api/transformers/CalloutResponseTransformer";

import { AuthInfo } from "@type/auth-info";
import { AuthInfo } from "#type/auth-info";

@JsonController("/callout-responses")
export class CalloutResponseController {
Expand Down
70 changes: 35 additions & 35 deletions src/api/controllers/ContactController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,62 +18,62 @@ import {
Res
} from "routing-controllers";

import ContactsService from "@core/services/ContactsService";
import OptionsService from "@core/services/OptionsService";
import PaymentFlowService from "@core/services/PaymentFlowService";
import PaymentService from "@core/services/PaymentService";
import ContactMfaService from "@core/services/ContactMfaService";
import ContactsService from "#core/services/ContactsService";
import OptionsService from "#core/services/OptionsService";
import PaymentFlowService from "#core/services/PaymentFlowService";
import PaymentService from "#core/services/PaymentService";
import ContactMfaService from "#core/services/ContactMfaService";

import { generatePassword } from "@core/utils/auth";
import { generatePassword } from "#core/utils/auth";

import Contact from "@models/Contact";
import JoinFlow from "@models/JoinFlow";
import Contact from "#models/Contact";
import JoinFlow from "#models/JoinFlow";

import { GetExportQuery } from "@api/dto/BaseDto";
import { GetExportQuery } from "#api/dto/BaseDto";
import {
CreateContactDto,
GetContactDto,
GetContactOptsDto,
GetContributionInfoDto,
ListContactsDto,
UpdateContactDto
} from "@api/dto/ContactDto";
} from "#api/dto/ContactDto";
import {
CreateContactMfaDto,
DeleteContactMfaDto,
GetContactMfaDto
} from "@api/dto/ContactMfaDto";
} from "#api/dto/ContactMfaDto";
import {
GetContactRoleDto,
UpdateContactRoleDto
} from "@api/dto/ContactRoleDto";
} from "#api/dto/ContactRoleDto";
import {
StartContributionDto,
ForceUpdateContributionDto,
UpdateContributionDto
} from "@api/dto/ContributionDto";
import { CompleteJoinFlowDto, StartJoinFlowDto } from "@api/dto/JoinFlowDto";
import { PaginatedDto } from "@api/dto/PaginatedDto";
import { GetPaymentDto, ListPaymentsDto } from "@api/dto/PaymentDto";
import { GetPaymentFlowDto } from "@api/dto/PaymentFlowDto";

import { CurrentAuth } from "@api/decorators/CurrentAuth";
import PartialBody from "@api/decorators/PartialBody";
import { TargetUser } from "@api/decorators/TargetUser";
import { UnauthorizedError } from "@api/errors/UnauthorizedError";
import CantUpdateContribution from "@api/errors/CantUpdateContribution";
import NoPaymentMethod from "@api/errors/NoPaymentMethod";
import { ContactRoleParams } from "@api/params/ContactRoleParams";
import { mergeRules } from "@api/utils/rules";

import ContactExporter from "@api/transformers/ContactExporter";
import ContactTransformer from "@api/transformers/ContactTransformer";
import ContactRoleTransformer from "@api/transformers/ContactRoleTransformer";
import PaymentTransformer from "@api/transformers/PaymentTransformer";

import { GetContactWith } from "@enums/get-contact-with";

import { AuthInfo } from "@type/auth-info";
} from "#api/dto/ContributionDto";
import { CompleteJoinFlowDto, StartJoinFlowDto } from "#api/dto/JoinFlowDto";
import { PaginatedDto } from "#api/dto/PaginatedDto";
import { GetPaymentDto, ListPaymentsDto } from "#api/dto/PaymentDto";
import { GetPaymentFlowDto } from "#api/dto/PaymentFlowDto";

import { CurrentAuth } from "#api/decorators/CurrentAuth";
import PartialBody from "#api/decorators/PartialBody";
import { TargetUser } from "#api/decorators/TargetUser";
import { UnauthorizedError } from "#api/errors/UnauthorizedError";
import CantUpdateContribution from "#api/errors/CantUpdateContribution";
import NoPaymentMethod from "#api/errors/NoPaymentMethod";
import { ContactRoleParams } from "#api/params/ContactRoleParams";
import { mergeRules } from "#api/utils/rules";

import ContactExporter from "#api/transformers/ContactExporter";
import ContactTransformer from "#api/transformers/ContactTransformer";
import ContactRoleTransformer from "#api/transformers/ContactRoleTransformer";
import PaymentTransformer from "#api/transformers/PaymentTransformer";

import { GetContactWith } from "#enums/get-contact-with";

import { AuthInfo } from "#type/auth-info";

@JsonController("/contact")
@Authorized()
Expand Down
8 changes: 4 additions & 4 deletions src/api/controllers/ContentController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Patch
} from "routing-controllers";

import PartialBody from "@api/decorators/PartialBody";
import PartialBody from "#api/decorators/PartialBody";
import {
GetContactsContentDto,
GetContentDto,
Expand All @@ -17,9 +17,9 @@ import {
GetJoinSetupContentDto,
GetProfileContentDto,
GetShareContentDto
} from "@api/dto/ContentDto";
import { ContentParams } from "@api/params/ContentParams";
import ContentTransformer from "@api/transformers/ContentTransformer";
} from "#api/dto/ContentDto";
import { ContentParams } from "#api/params/ContentParams";
import ContentTransformer from "#api/transformers/ContentTransformer";

@JsonController("/content")
export class ContentController {
Expand Down
Loading
Loading