Skip to content

Commit 760207f

Browse files
committed
fix: pkg update
1 parent 8525d9b commit 760207f

13 files changed

+91
-43
lines changed

.eslintrc.cjs

+2-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = defineConfig({
66
parserOptions: {
77
project: 'tsconfig.json',
88
},
9-
ignorePatterns: ['migrations', 'src/generated'],
9+
ignorePatterns: ['migrations', 'src/generated', '**/*.spec.ts', '**/*.e2e.ts'], // optimize this
1010
extends: ['@rubiin/eslint-config-typescript'],
1111
root: true,
1212
settings: {
@@ -19,6 +19,7 @@ module.exports = defineConfig({
1919
},
2020
rules: {
2121
'unicorn/prefer-module': 'off',
22+
'@typescript-eslint/no-floating-promises': 'off',
2223
'no-useless-constructor': 'off', // optimize this
2324
'@typescript-eslint/require-await': 'off', // optimize this
2425
'@typescript-eslint/no-unsafe-assignment': 'off', // optimize this

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,6 @@
103103
"isomorphic-dompurify": "^1.8.0",
104104
"joi": "^17.9.2",
105105
"jspdf": "^2.5.1",
106-
"load-pkg": "^4.0.0",
107106
"nestjs-cloudinary": "^2.0.6",
108107
"nestjs-fastjwt": "^0.0.1",
109108
"nestjs-i18n": "^10.2.6",
@@ -124,6 +123,7 @@
124123
"prom-client": "^14.2.0",
125124
"pug": "^3.0.2",
126125
"qrcode": "^1.5.3",
126+
"read-pkg": "^8.0.0",
127127
"redis": "^4.6.7",
128128
"reflect-metadata": "0.1.13",
129129
"rxjs": "^7.8.1",

pnpm-lock.yaml

+62-18
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/_mocks_/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-unsafe-return */
12
import type { Request, Response } from 'express';
23
import type { AmqpConnection } from '@golevelup/nestjs-rabbitmq';
34
import { createMock } from '@golevelup/ts-jest';

src/common/constant/string.constants.ts

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { capitalize } from 'helper-fns';
2-
import pkg from 'load-pkg';
2+
import { readPackageSync } from 'read-pkg';
33

44
export const REQUEST_ID_TOKEN_HEADER = 'x-request-id';
55
export const VERSION_VALIDATION_MESSAGE = 'Version must start with "v" followed by a number.';
@@ -11,11 +11,7 @@ export const MULTER_IMAGE_FILTER = 'Only image files are allowed!.';
1111
export const API_UNAUTHORISED_RESPONSE = 'No auth token in request.';
1212

1313
// swagger constants
14-
const packageJson: {
15-
name: string;
16-
version: string;
17-
description: string;
18-
} = pkg.sync();
14+
const packageJson = readPackageSync();
1915

2016
export const APP_NAME = packageJson.name;
2117
export const SWAGGER_API_CURRENT_VERSION = packageJson.version;

src/common/decorators/validation/is-after.validator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { isAfter } from 'date-fns';
1313
class IsAfterConstraint implements ValidatorConstraintInterface {
1414
async validate(value: string, arguments_: ValidationArguments) {
1515
const [relatedPropertyName] = arguments_.constraints;
16-
const relatedValue = (arguments_.object as any)[relatedPropertyName];
16+
const relatedValue = (arguments_.object as any)[relatedPropertyName] as string | Date;
1717

1818
return isAfter(new Date(value), new Date(relatedValue));
1919
}

src/common/decorators/validation/is-enum-field.decorator.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const IsEnumField = (entity: object, options_?: EnumFieldOptions) => {
2121
const decoratorsToApply = [
2222
IsEnum(entity, {
2323
each: options.each,
24-
message: `must be a valid enum value,${enumToString(entity)}`,
24+
message: `must be a valid enum value,${enumToString(entity).join(',')}`,
2525
}),
2626
];
2727

src/common/decorators/validation/validation-field.generator.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ import { Sanitize, Trim } from './transform.decorator';
1515

1616
import { validationI18nMessage } from '@lib/i18n';
1717
import { MinMaxLength } from '@common/decorators';
18+
import type { NumberFieldOptions, StringFieldOptions } from '@common/@types';
1819

1920
export class ValidatorFieldBuilder {
2021
private decoratorsToApply: PropertyDecorator[];
2122

22-
constructor(readonly options: any) {}
23+
constructor(readonly options: NumberFieldOptions & StringFieldOptions) {}
2324

2425
number() {
2526
this.decoratorsToApply.push(
@@ -48,11 +49,11 @@ export class ValidatorFieldBuilder {
4849
return this;
4950
}
5051

51-
enum(entity: object) {
52+
enum(entity: Record<any, any>) {
5253
this.decoratorsToApply.push(
5354
IsEnum(entity, {
5455
each: this.options.each,
55-
message: `must be a valid enum value,${enumToString(entity)}`,
56+
message: `must be a valid enum value,${enumToString(entity).join(',')}`,
5657
}),
5758
);
5859

src/common/guards/auth.guard.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export class AuthGuard implements CanActivate {
1717
canActivate(context: ExecutionContext): boolean {
1818
const request = context.switchToHttp().getRequest();
1919

20-
const token = request.headers.authorization;
20+
const token: string = request.headers.authorization;
2121

2222
if (!token)
2323
throw new UnauthorizedException(translate('exception.apiUnauthorizedResponse'));

0 commit comments

Comments
 (0)