diff --git a/package.json b/package.json index 869f2e9d..e8748714 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "private": true, "scripts": { "prebuild": "rimraf ./dist", - "build": "turbo run build", + "build": "turbo run build --concurrency=1", "test": "turbo run test --concurrency=1", "clean": "turbo run clean", "lint": "lint-staged", @@ -51,48 +51,48 @@ ] }, "dependencies": { - "@nestjs/axios": "0.0.7", + "@nestjs/axios": "^1.0.1", "@nestjs/class-validator": "^0.13.3", - "@nestjs/common": "^8.2.6", - "@nestjs/config": "^1.1.6", - "@nestjs/core": "^8.2.6", - "@nestjs/microservices": "^8.2.6", - "@nestjs/platform-express": "^8.2.6", - "@nestjs/swagger": "^5.2.0", - "@nestjs/terminus": "^8.0.4", - "@nestjs/typeorm": "^8.0.3", - "axios": "^0.26.0", - "axios-retry": "^3.2.4", + "@nestjs/common": "^9.2.1", + "@nestjs/config": "^2.2.0", + "@nestjs/core": "^9.2.1", + "@nestjs/microservices": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", + "@nestjs/swagger": "^6.1.4", + "@nestjs/terminus": "^9.1.4", + "@nestjs/typeorm": "^9.0.1", + "axios": "^1.2.3", + "axios-retry": "^3.4.0", "camunda-external-task-client-js": "^2.2.0", "lodash": "^4.17.21", - "mongodb": "^3.6.0", + "mongodb": "^4.13.0", "mysql": "^2.18.1", - "mysql2": "^2.2.5", + "mysql2": "^3.0.1", "pg": "^8.5.1", - "pino": "^7.6.3", + "pino": "^8.8.0", "pino-multi-stream": "^6.0.0", - "pino-pretty": "^7.3.0", + "pino-pretty": "^9.1.1", "redis": "^4.1.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", "shx": "^0.3.4", - "testcontainers": "^8.10.0", + "testcontainers": "^9.1.1", "typeorm": "^0.3.6", - "uuid": "^8.3.2" + "uuid": "^9.0.0" }, "devDependencies": { - "@babel/core": "^7.16.10", + "@babel/core": "^7.20.12", "@babel/plugin-proposal-class-properties": "^7.16.7", - "@babel/plugin-proposal-decorators": "^7.16.7", - "@babel/plugin-proposal-object-rest-spread": "^7.16.7", - "@babel/plugin-proposal-optional-chaining": "^7.16.7", + "@babel/plugin-proposal-decorators": "^7.20.7", + "@babel/plugin-proposal-object-rest-spread": "^7.20.7", + "@babel/plugin-proposal-optional-chaining": "^7.20.7", "@babel/preset-typescript": "^7.16.7", - "@commitlint/cli": "^16.1.0", - "@commitlint/config-conventional": "^16.0.0", + "@commitlint/cli": "^17.4.2", + "@commitlint/config-conventional": "^17.4.2", "@elastic/elasticsearch-mock": "^2.0.0", - "@nestjs/cli": "^8.2.0", - "@nestjs/schematics": "^8.0.4", - "@nestjs/testing": "^8.2.5", + "@nestjs/cli": "^9.1.8", + "@nestjs/schematics": "^9.0.4", + "@nestjs/testing": "^9.2.1", "@pika/cli": "^0.2.0", "@pika/pack": "^0.5.0", "@pika/plugin-build-node": "^0.9.2", @@ -103,37 +103,37 @@ "@types/ejs": "^3.1.1", "@types/elasticsearch": "^5.0.40", "@types/express": "^4.17.13", - "@types/glob": "^7.2.0", + "@types/glob": "^8.0.1", "@types/inline-css": "^3.0.1", - "@types/jest": "^27.4.0", - "@types/node": "^18.11.9", + "@types/jest": "^29.2.6", + "@types/node": "^18.11.18", "@types/nodemailer": "^6.4.4", "@types/pug": "^2.0.6", "@types/supertest": "^2.0.11", - "@types/uuid": "^8.3.4", - "@typescript-eslint/eslint-plugin": "^5.10.0", - "@typescript-eslint/parser": "^5.10.0", - "eslint": "^8.7.0", - "eslint-config-prettier": "^8.1.0", + "@types/uuid": "^9.0.0", + "@typescript-eslint/eslint-plugin": "^5.48.2", + "@typescript-eslint/parser": "^5.48.2", + "eslint": "^8.32.0", + "eslint-config-prettier": "^8.6.0", "eslint-plugin-prettier": "^4.0.0", - "husky": "^7.0.4", - "jest": "^27.4.7", - "jest-extended": "^2.0.0", + "husky": "^8.0.3", + "jest": "^29.3.1", + "jest-extended": "^3.2.3", "jest-mock-extended": "^3.0.1", "jest-sonar-reporter": "^2.0.0", "lerna": "^4.0.0", - "lint-staged": "^12.2.2", + "lint-staged": "^13.1.0", "nodemailer-mock": "^1.5.12", "plop": "^3.0.5", - "prettier": "^2.5.1", - "rimraf": "^3.0.2", + "prettier": "^2.8.3", + "rimraf": "^4.1.1", "supertest": "^6.2.2", - "testcontainers": "^8.10.0", - "ts-jest": "^27.1.2", + "testcontainers": "^9.1.1", + "ts-jest": "^29.0.5", "ts-loader": "^9.2.6", "ts-node": "^10.4.0", - "tsconfig-paths": "^3.12.0", - "turbo": "latest", + "tsconfig-paths": "^4.1.2", + "turbo": "^1.7.0", "typescript": "^4.5.5" } } diff --git a/packages/archetype/package.json b/packages/archetype/package.json index d930d751..5d1f5652 100644 --- a/packages/archetype/package.json +++ b/packages/archetype/package.json @@ -36,9 +36,9 @@ "directory": "../../dist/archetype" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, diff --git a/packages/archetype/src/__test__/archetype.service.spec.ts b/packages/archetype/src/__test__/archetype.service.spec.ts index 11b9f462..6885c7a9 100644 --- a/packages/archetype/src/__test__/archetype.service.spec.ts +++ b/packages/archetype/src/__test__/archetype.service.spec.ts @@ -84,15 +84,15 @@ describe('ArchetypeService', () => { '@tresdoce-nestjs-toolkit/http-client': '0.0.1', '@nestjs/class-transformer': '^0.4.0', '@nestjs/class-validator': '^0.13.3', - '@nestjs/common': '^8.2.5', - '@nestjs/config': '^1.1.6', + '@nestjs/common': '^9.2.1', + '@nestjs/config': '^2.2.0', '@nestjs/core': '^8.2.5', '@nestjs/platform-express': '^8.2.5', '@nestjs/swagger': '^5.1.5', }, devDependencies: { '@tresdoce-nestjs-toolkit/commons': '0.0.1', - '@nestjs/cli': '^8.2.0', + '@nestjs/cli': '^9.1.8', '@nestjs/schematics': '^8.0.4', '@nestjs/testing': '^8.2.5', }, diff --git a/packages/archetype/tsconfig.json b/packages/archetype/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/archetype/tsconfig.json +++ b/packages/archetype/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/camunda/package.json b/packages/camunda/package.json index 5930adee..5c35e51d 100644 --- a/packages/camunda/package.json +++ b/packages/camunda/package.json @@ -36,16 +36,16 @@ "directory": "../../dist/camunda" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/microservices": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/microservices": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "camunda-external-task-client-js": "^2.2.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, "dependencies": { - "@nestjs/microservices": "^8.2.6", + "@nestjs/microservices": "^9.2.1", "camunda-external-task-client-js": "^2.2.0" }, "devDependencies": { diff --git a/packages/camunda/tsconfig.json b/packages/camunda/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/camunda/tsconfig.json +++ b/packages/camunda/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/commons/tsconfig.json b/packages/commons/tsconfig.json index fc8caf65..bf96524d 100644 --- a/packages/commons/tsconfig.json +++ b/packages/commons/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit", "node"] + "types": ["tresdoce-nestjs-toolkit", "node", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/config/tsconfig.json b/packages/config/tsconfig.json index 5035590a..db1003d6 100644 --- a/packages/config/tsconfig.json +++ b/packages/config/tsconfig.json @@ -20,6 +20,7 @@ "experimentalDecorators": true, "emitDecoratorMetadata": true, "esModuleInterop": true, - "strict": false + "strict": false, + "skipLibCheck": true } } diff --git a/packages/core/package.json b/packages/core/package.json index 709e73cb..a0045b79 100644 --- a/packages/core/package.json +++ b/packages/core/package.json @@ -36,9 +36,9 @@ "directory": "../../dist/core" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, diff --git a/packages/core/src/typings/index.ts b/packages/core/src/typings/index.ts index ad0c9e27..ccec5106 100644 --- a/packages/core/src/typings/index.ts +++ b/packages/core/src/typings/index.ts @@ -1,4 +1,4 @@ -import { AxiosRequestConfig } from 'axios'; +import { RawAxiosRequestConfig } from 'axios'; import { TypeOrmModuleOptions } from '@nestjs/typeorm'; import { RedisOptions } from '@tresdoce-nestjs-toolkit/redis'; import { MailerOptions } from '@tresdoce-nestjs-toolkit/mailer'; @@ -55,7 +55,7 @@ export interface IParamsConfig { [key: string]: any; } -export interface IServicesConfig extends AxiosRequestConfig { +export interface IServicesConfig extends RawAxiosRequestConfig { healthPath?: string; [key: string]: any; } diff --git a/packages/core/tsconfig.json b/packages/core/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/core/tsconfig.json +++ b/packages/core/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/elk/package.json b/packages/elk/package.json index 680bafee..0653b395 100644 --- a/packages/elk/package.json +++ b/packages/elk/package.json @@ -36,15 +36,15 @@ "directory": "../../dist/elk" }, "peerDependencies": { - "@elastic/elasticsearch": "^8.2.1", - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@elastic/elasticsearch": "^8.6.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, "dependencies": { - "@elastic/elasticsearch": "^8.2.1" + "@elastic/elasticsearch": "^8.6.0" }, "devDependencies": { "@tresdoce-nestjs-toolkit/config": "^0.2.2", diff --git a/packages/elk/tsconfig.json b/packages/elk/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/elk/tsconfig.json +++ b/packages/elk/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/filters/package.json b/packages/filters/package.json index 598f113e..1bf753a3 100644 --- a/packages/filters/package.json +++ b/packages/filters/package.json @@ -37,9 +37,9 @@ }, "peerDependencies": { "@nestjs/class-validator": "^0.13.3", - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, diff --git a/packages/filters/tsconfig.json b/packages/filters/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/filters/tsconfig.json +++ b/packages/filters/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/health/package.json b/packages/health/package.json index 60a25b04..f44fee0e 100644 --- a/packages/health/package.json +++ b/packages/health/package.json @@ -36,23 +36,23 @@ "directory": "../../dist/health" }, "peerDependencies": { - "@nestjs/axios": "0.0.7", - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", - "@nestjs/swagger": "^5.2.0", - "@nestjs/terminus": "^8.0.4", - "@nestjs/typeorm": "^8.0.3", + "@nestjs/axios": "^1.0.1", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", + "@nestjs/swagger": "^6.1.4", + "@nestjs/terminus": "^9.1.4", + "@nestjs/typeorm": "^9.0.1", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", "typeorm": "^0.3.6" }, "dependencies": { - "@nestjs/axios": "0.0.7", - "@nestjs/swagger": "^5.2.0", - "@nestjs/terminus": "^8.0.4", - "@nestjs/typeorm": "^8.0.3", + "@nestjs/axios": "^1.0.1", + "@nestjs/swagger": "^6.1.4", + "@nestjs/terminus": "^9.1.4", + "@nestjs/typeorm": "^9.0.1", "lodash": "^4.17.21", "typeorm": "^0.3.6" }, diff --git a/packages/health/src/__test__/readiness.controller.spec.ts b/packages/health/src/__test__/readiness.controller.spec.ts index fb07a88d..546b4fe7 100644 --- a/packages/health/src/__test__/readiness.controller.spec.ts +++ b/packages/health/src/__test__/readiness.controller.spec.ts @@ -17,9 +17,9 @@ const mockedConfig = { timeout: 3000, }, demoApi: { - url: 'https://rudemex-nestjs-starter.herokuapp.com', + url: 'https://nestjs-starter.up.railway.app', timeout: 3000, - healthPath: '/liveness', + healthPath: '/v1/health/liveness', }, }, database: { diff --git a/packages/health/tsconfig.json b/packages/health/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/health/tsconfig.json +++ b/packages/health/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/http-client/package.json b/packages/http-client/package.json index f265035e..54c69574 100644 --- a/packages/http-client/package.json +++ b/packages/http-client/package.json @@ -36,19 +36,19 @@ "directory": "../../dist/http-client" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/config": "^1.1.6", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", - "axios": "^0.26.0", - "axios-retry": "^3.2.4", + "@nestjs/common": "^9.2.1", + "@nestjs/config": "^2.2.0", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", + "axios": "^1.2.3", + "axios-retry": "^3.4.0", "lodash": "^4.17.21", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, "dependencies": { - "axios": "^0.26.0", - "axios-retry": "^3.2.4", + "axios": "^1.2.3", + "axios-retry": "^3.4.0", "lodash": "^4.17.21" }, "devDependencies": { diff --git a/packages/http-client/src/http/constants/http.constants.ts b/packages/http-client/src/http/constants/http.constants.ts index e36aeeb0..7c77573d 100644 --- a/packages/http-client/src/http/constants/http.constants.ts +++ b/packages/http-client/src/http/constants/http.constants.ts @@ -1,5 +1,5 @@ import https from 'https'; -import { HttpModuleOptions } from '../interfaces/http-module.interface'; +import { DefaultConfigAxiosInstance, HttpModuleOptions } from '../interfaces/http-module.interface'; export const AXIOS_INSTANCE_TOKEN = 'AXIOS_INSTANCE_TOKEN'; export const HTTP_MODULE_ID = 'HTTP_MODULE_ID'; diff --git a/packages/http-client/src/http/interfaces/http-module.interface.ts b/packages/http-client/src/http/interfaces/http-module.interface.ts index c9353ffd..c2e6023c 100644 --- a/packages/http-client/src/http/interfaces/http-module.interface.ts +++ b/packages/http-client/src/http/interfaces/http-module.interface.ts @@ -1,8 +1,10 @@ import { ModuleMetadata, Provider, Type } from '@nestjs/common'; -import { AxiosRequestConfig } from 'axios'; import { IAxiosRetryConfig } from 'axios-retry'; +import { RawAxiosRequestConfig, CreateAxiosDefaults } from 'axios'; -export type HttpModuleOptions = AxiosRequestConfig & IAxiosRetryConfig; +export type DefaultConfigAxiosInstance = RawAxiosRequestConfig; + +export type HttpModuleOptions = CreateAxiosDefaults & IAxiosRetryConfig; //AxiosRequestConfig & IAxiosRetryConfig; export interface HttpModuleOptionsFactory { createHttpOptions(): Promise | HttpModuleOptions; diff --git a/packages/http-client/src/http/services/httpClient.service.ts b/packages/http-client/src/http/services/httpClient.service.ts index ecb1070e..a445656b 100644 --- a/packages/http-client/src/http/services/httpClient.service.ts +++ b/packages/http-client/src/http/services/httpClient.service.ts @@ -1,5 +1,10 @@ import { Inject, Injectable } from '@nestjs/common'; -import Axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios'; +import Axios, { + AxiosInstance, + RawAxiosRequestConfig, + AxiosResponse, + AxiosRequestConfig, +} from 'axios'; import { AXIOS_INSTANCE_TOKEN, RequestMethod } from '../constants/http.constants'; import * as _ from 'lodash'; @@ -31,11 +36,11 @@ export class HttpClientService { /** * Make and http request in base of default config, and configuration * @param url API url for request - * @param config AxiosRequestConfig type user configuration + * @param config RawAxiosRequestConfig type user configuration */ private fetch = async ( url: string, - config: AxiosRequestConfig, + config: RawAxiosRequestConfig, ): Promise> => { try { config = _.omit(config, ['url']); @@ -51,20 +56,20 @@ export class HttpClientService { /** * Make http request based on axios using userĀ“s config - * @param config Contain request configuration (headers, data, url, method...) type AxiosRequestConfig + * @param config Contain request configuration (headers, data, url, method...) type RawAxiosRequestConfig */ - public request = async (config: AxiosRequestConfig): Promise> => { + public request = async (config: RawAxiosRequestConfig): Promise> => { return this.fetch(config.url, config); }; /** * Make get http request based on axios * @param url API url for request - * @param config Contain request configuration (headers, httpAgent...) type AxiosRequestConfig + * @param config Contain request configuration (headers, httpAgent...) type RawAxiosRequestConfig */ public get = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.GET }); }; @@ -72,11 +77,11 @@ export class HttpClientService { /** * Make post http request based on axios * @param url API url for request - * @param config Contain request configuration (headers, data...) type AxiosRequestConfig + * @param config Contain request configuration (headers, data...) type RawAxiosRequestConfig */ public post = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.POST }); }; @@ -84,11 +89,11 @@ export class HttpClientService { /** * Make put http request based on axios * @param url API url for request - * @param config Contain request configuration (headers, data...) type AxiosRequestConfig + * @param config Contain request configuration (headers, data...) type RawAxiosRequestConfig */ public put = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.PUT }); }; @@ -96,11 +101,11 @@ export class HttpClientService { /** * Make patch patch request based on axios * @param url API url for request - * @param config Contain request configuration (headers, data...) type AxiosRequestConfig + * @param config Contain request configuration (headers, data...) type RawAxiosRequestConfig */ public patch = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.PATCH }); }; @@ -108,11 +113,11 @@ export class HttpClientService { /** * Make delete http request based on axios * @param url API url for request - * @param config Contain request configuration (headers, params...) type AxiosRequestConfig + * @param config Contain request configuration (headers, params...) type RawAxiosRequestConfig */ public delete = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.DELETE }); }; @@ -120,11 +125,11 @@ export class HttpClientService { /** * Make head http request based on axios * @param url API url for request - * @param config Contain request configuration (params, httpAgent...) type AxiosRequestConfig + * @param config Contain request configuration (params, httpAgent...) type RawAxiosRequestConfig */ public head = async ( url: string, - config?: AxiosRequestConfig, + config?: RawAxiosRequestConfig, ): Promise> => { return this.fetch(url, { ...config, method: RequestMethod.HEAD }); }; diff --git a/packages/http-client/tsconfig.json b/packages/http-client/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/http-client/tsconfig.json +++ b/packages/http-client/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/mailer/package.json b/packages/mailer/package.json index ea2f6b46..2df03409 100644 --- a/packages/mailer/package.json +++ b/packages/mailer/package.json @@ -36,26 +36,26 @@ "directory": "../../dist/mailer" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "ejs": "^3.1.2", - "glob": "8.0.3", + "glob": "8.1.0", "handlebars": "^4.7.6", - "inline-css": "3.0.0", + "inline-css": "4.0.1", "mjml": "^4.12.0", - "nodemailer": "6.8.0", + "nodemailer": "6.9.0", "pug": "^3.0.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, "dependencies": { "ejs": "^3.1.2", - "glob": "8.0.3", + "glob": "8.1.0", "handlebars": "^4.7.6", - "inline-css": "3.0.0", + "inline-css": "4.0.1", "mjml": "^4.12.0", - "nodemailer": "6.8.0", + "nodemailer": "6.9.0", "pug": "^3.0.1" }, "devDependencies": { diff --git a/packages/mailer/src/__test__/mailer.service.spec.ts b/packages/mailer/src/__test__/mailer.service.spec.ts index 509dd42f..1ceca2c3 100644 --- a/packages/mailer/src/__test__/mailer.service.spec.ts +++ b/packages/mailer/src/__test__/mailer.service.spec.ts @@ -303,7 +303,9 @@ describe('MailerService', () => { expect(send).toHaveBeenCalled(); expect(lastMail.data.from).toBe('user1@example.test'); - expect(lastMail.data.html).toBe('

Handlebars test template. by Nest-modules TM

'); + expect(lastMail.data.html).toBe( + '

Handlebars test template. by Nest-modules TM

', + ); }); it('should compile template with the handlebars adapter with relative path', async () => { @@ -338,7 +340,9 @@ describe('MailerService', () => { expect(send).toHaveBeenCalled(); expect(lastMail.data.from).toBe('user1@example.test'); - expect(lastMail.data.html).toBe('

Handlebars test template. by Nest-modules TM

'); + expect(lastMail.data.html).toBe( + '

Handlebars test template. by Nest-modules TM

', + ); }); it('should compile template with the handlebars adapter with error template path', async () => { @@ -466,7 +470,9 @@ describe('MailerService', () => { expect(send).toHaveBeenCalled(); expect(lastMail.data.from).toBe('user1@example.test'); - expect(lastMail.data.html).toBe('

Pug test template.

Hello World!

'); + expect(lastMail.data.html).toBe( + '

Pug test template.

Hello World!

', + ); }); it('should compile template with the pug adapter with relative path', async () => { @@ -495,7 +501,9 @@ describe('MailerService', () => { expect(send).toHaveBeenCalled(); expect(lastMail.data.from).toBe('user1@example.test'); - expect(lastMail.data.html).toBe('

Pug test template.

Hello World!

'); + expect(lastMail.data.html).toBe( + '

Pug test template.

Hello World!

', + ); }); it('should compile template with the pug adapter with error to read template', async () => { @@ -707,6 +715,8 @@ describe('MailerService', () => { expect(send).toHaveBeenCalled(); expect(lastMail.data.from).toBe('user1@example.test'); - expect(lastMail.data.html).toBe('

Ejs test template. by Nest-modules TM

'); + expect(lastMail.data.html).toBe( + '

Ejs test template. by Nest-modules TM

', + ); }); }); diff --git a/packages/mailer/tsconfig.json b/packages/mailer/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/mailer/tsconfig.json +++ b/packages/mailer/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/paas/package.json b/packages/paas/package.json index 29bbc359..07c6588c 100644 --- a/packages/paas/package.json +++ b/packages/paas/package.json @@ -37,9 +37,9 @@ "directory": "../../dist/paas" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "@tresdoce-nestjs-toolkit/core": "^0.1.0", "@tresdoce-nestjs-toolkit/filters": "^0.1.0", "@tresdoce-nestjs-toolkit/health": "^0.1.0", diff --git a/packages/paas/tsconfig.json b/packages/paas/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/paas/tsconfig.json +++ b/packages/paas/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/redis/package.json b/packages/redis/package.json index cb428355..edc868fb 100644 --- a/packages/redis/package.json +++ b/packages/redis/package.json @@ -36,17 +36,17 @@ "directory": "../../dist/redis" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "redis": "^4.1.0", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", - "uuid": "^8.3.2" + "uuid": "^9.0.0" }, "dependencies": { "redis": "^4.1.0", - "uuid": "^8.3.2" + "uuid": "^9.0.0" }, "devDependencies": { "@tresdoce-nestjs-toolkit/config": "^0.2.2", diff --git a/packages/redis/tsconfig.json b/packages/redis/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/redis/tsconfig.json +++ b/packages/redis/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/response-parser/package.json b/packages/response-parser/package.json index 6b7bc9f8..f02a9984 100644 --- a/packages/response-parser/package.json +++ b/packages/response-parser/package.json @@ -36,9 +36,9 @@ "directory": "../../dist/response-parser" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "@tresdoce-nestjs-toolkit/filters": "^0.1.3", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" diff --git a/packages/response-parser/tsconfig.json b/packages/response-parser/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/response-parser/tsconfig.json +++ b/packages/response-parser/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/test-utils/package.json b/packages/test-utils/package.json index 26875601..06c7f8bc 100644 --- a/packages/test-utils/package.json +++ b/packages/test-utils/package.json @@ -36,15 +36,15 @@ "directory": "../../dist/test-utils" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", - "testcontainers": "^8.10.0" + "testcontainers": "^9.1.1" }, "dependencies": { - "testcontainers": "^8.10.0" + "testcontainers": "^9.1.1" }, "devDependencies": { "@tresdoce-nestjs-toolkit/config": "^0.2.2", diff --git a/packages/test-utils/src/__test__/config.spec.ts b/packages/test-utils/src/__test__/config.spec.ts index fa4a1e15..d2bf11fc 100644 --- a/packages/test-utils/src/__test__/config.spec.ts +++ b/packages/test-utils/src/__test__/config.spec.ts @@ -1,5 +1,5 @@ import { config, dynamicConfig } from '../config/index'; -import { appConfigBase } from '../fixtures/index'; +import { appConfigBase } from '../fixtures'; describe('config', () => { it('should be return config', async () => { diff --git a/packages/test-utils/src/fixtures/appConfigBase.ts b/packages/test-utils/src/fixtures/appConfigBase.ts index 2ab091a1..3f173235 100644 --- a/packages/test-utils/src/fixtures/appConfigBase.ts +++ b/packages/test-utils/src/fixtures/appConfigBase.ts @@ -34,9 +34,6 @@ export const appConfigBase: Typings.AppConfig = { swagger: { path: 'docs', enabled: false }, params: { testEnv: 'testKeyEnv-test' }, services: { - nestJsDocs: { - url: 'https://docs.nestjs.com', - }, rickAndMortyAPI: { url: 'https://rickandmortyapi.com/api', timeout: 3000, diff --git a/packages/test-utils/src/fixtures/manifest.ts b/packages/test-utils/src/fixtures/manifest.ts index 1a90acf3..8bb9740e 100644 --- a/packages/test-utils/src/fixtures/manifest.ts +++ b/packages/test-utils/src/fixtures/manifest.ts @@ -15,8 +15,8 @@ export const manifest = { '@tresdoce-nestjs-toolkit/http-client': '0.0.1', '@nestjs/class-transformer': '^0.4.0', '@nestjs/class-validator': '^0.13.3', - '@nestjs/common': '^8.2.5', - '@nestjs/config': '^1.1.6', + '@nestjs/common': '^9.2.1', + '@nestjs/config': '^2.2.0', '@nestjs/core': '^8.2.5', '@nestjs/platform-express': '^8.2.5', '@nestjs/swagger': '^5.1.5', @@ -25,7 +25,7 @@ export const manifest = { }, devDependencies: { '@tresdoce-nestjs-toolkit/commons': '0.0.1', - '@nestjs/cli': '^8.2.0', + '@nestjs/cli': '^9.1.8', '@nestjs/schematics': '^8.0.4', '@nestjs/testing': '^8.2.5', husky: '^4.3.8', diff --git a/packages/test-utils/src/fixtures/responses.ts b/packages/test-utils/src/fixtures/responses.ts index 774a7006..912ec58d 100644 --- a/packages/test-utils/src/fixtures/responses.ts +++ b/packages/test-utils/src/fixtures/responses.ts @@ -1,9 +1,20 @@ +/* USERS */ export const fixtureUserResponse: any = { id: 1, name: 'juan', lastname: 'perez', }; +export const fixtureUserArrayResponse: any = [ + fixtureUserResponse, + { + id: 2, + name: 'juan pablo', + lastname: 'garcia', + }, +]; + +/* POSTS */ export const fixturePostResponse: any = { id: 1, title: 'test post 1', @@ -11,6 +22,12 @@ export const fixturePostResponse: any = { isActive: true, }; -export const fixtureUserArrayResponse: any = [fixtureUserResponse]; - -export const fixturePostArrayResponse: any = [fixturePostResponse]; +export const fixturePostArrayResponse: any = [ + fixturePostResponse, + { + id: 2, + title: 'test post 2', + description: 'this is a description of post 2', + isActive: true, + }, +]; diff --git a/packages/test-utils/src/testcontainers/testContainersTD.ts b/packages/test-utils/src/testcontainers/testContainersTD.ts index 49c0e20f..8893d5ca 100644 --- a/packages/test-utils/src/testcontainers/testContainersTD.ts +++ b/packages/test-utils/src/testcontainers/testContainersTD.ts @@ -1,11 +1,9 @@ import { GenericContainer, StartedTestContainer, TestContainer, Wait } from 'testcontainers'; import { RandomUuid } from 'testcontainers/dist/uuid'; import { StopOptions } from 'testcontainers/dist/test-container'; -import { ContainerName, Env, Host } from 'testcontainers/dist/docker/types'; import * as _ from 'lodash'; -import { ITestContainerOptions } from './types'; -import { Port } from 'testcontainers/dist/port'; +import { ITestContainerOptions, Env } from './types'; export default class TestContainersTD { private static _instance?: TestContainersTD; @@ -58,15 +56,13 @@ export default class TestContainersTD { /* Add container envs */ if (_.has(options, 'envs') && !_.isEmpty(options.envs)) { - Object.keys(options.envs).forEach((key) => { - genericContainer.withEnv(`${key}`, `${options.envs[key]}`); - }); + genericContainer.withEnvironment(options.envs); } /* Add command to container */ /* istanbul ignore next */ if (_.has(options, 'command') && !_.isEmpty(options.command)) { - genericContainer.withCmd(options.command); + genericContainer.withCommand(options.command); } /* Add startup timeout container */ @@ -138,21 +134,21 @@ export default class TestContainersTD { /** * Get host of container */ - public getHost(): Host { + public getHost(): string { return this._container.getHost(); } /** * Get container name */ - public getName(): ContainerName { + public getName(): string { return this._container.getName(); } /** * Get mapped ports */ - public getMappedPort(port: Port): Port { + public getMappedPort(port: number): number { return this._container.getMappedPort(port); } } diff --git a/packages/test-utils/tsconfig.json b/packages/test-utils/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/test-utils/tsconfig.json +++ b/packages/test-utils/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/packages/tresdoce-types/package.json b/packages/tresdoce-types/package.json index 642fa7cd..a4799962 100755 --- a/packages/tresdoce-types/package.json +++ b/packages/tresdoce-types/package.json @@ -5,7 +5,7 @@ "main": "", "types": "index", "dependencies": { - "jest-extended": "^1.2.0" + "jest-extended": "^3.2.3" }, "scripts": { "test": "echo \"Error: no test specified\"", diff --git a/packages/typeorm/package.json b/packages/typeorm/package.json index e80bef93..b8b4072f 100644 --- a/packages/typeorm/package.json +++ b/packages/typeorm/package.json @@ -36,23 +36,23 @@ "directory": "../../dist/typeorm" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", - "@nestjs/typeorm": "^8.0.3", - "mongodb": "^3.6.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", + "@nestjs/typeorm": "^9.0.1", + "mongodb": "^4.13.0", "mysql": "^2.18.1", - "mysql2": "^2.2.5", + "mysql2": "^3.0.1", "pg": "^8.5.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5", "typeorm": "^0.3.6" }, "dependencies": { - "@nestjs/typeorm": "^8.0.3", - "mongodb": "^3.6.0", + "@nestjs/typeorm": "^9.0.1", + "mongodb": "^4.13.0", "mysql": "^2.18.1", - "mysql2": "^2.2.5", + "mysql2": "^3.0.1", "pg": "^8.5.1", "typeorm": "^0.3.6" }, diff --git a/packages/typeorm/src/__test__/typeorm.module.spec.ts b/packages/typeorm/src/__test__/typeorm.module.spec.ts index 185773f2..1706b0d8 100644 --- a/packages/typeorm/src/__test__/typeorm.module.spec.ts +++ b/packages/typeorm/src/__test__/typeorm.module.spec.ts @@ -9,6 +9,7 @@ import { testContainers, fixturePostResponse, fixtureUserResponse, + fixtureUserArrayResponse, } from '@tresdoce-nestjs-toolkit/test-utils'; import { Repository } from 'typeorm'; @@ -159,9 +160,9 @@ describe('TypeOrm - Mongo', () => { }, 50000); it('should be return an array of user', async () => { - await repository.save([fixtureUserResponse]); + await repository.save(fixtureUserArrayResponse); const query = await repository.find(); - expect(query).toEqual([fixtureUserResponse]); + expect(query).toEqual(expect.any(Array)); }); }); diff --git a/packages/typeorm/tsconfig.json b/packages/typeorm/tsconfig.json index 32b40009..a4a905b2 100644 --- a/packages/typeorm/tsconfig.json +++ b/packages/typeorm/tsconfig.json @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/plops-templates/packages/basic/package.json.hbs b/plops-templates/packages/basic/package.json.hbs index de14d376..28ae155a 100644 --- a/plops-templates/packages/basic/package.json.hbs +++ b/plops-templates/packages/basic/package.json.hbs @@ -36,9 +36,9 @@ "directory": "../../dist/{{kebabCase packageName}}" }, "peerDependencies": { - "@nestjs/common": "^8.2.0", - "@nestjs/core": "^8.2.0", - "@nestjs/platform-express": "^8.2.0", + "@nestjs/common": "^9.2.1", + "@nestjs/core": "^9.2.1", + "@nestjs/platform-express": "^9.2.1", "reflect-metadata": "^0.1.13", "rxjs": "^7.5.5" }, diff --git a/plops-templates/packages/basic/tsconfig.json.hbs b/plops-templates/packages/basic/tsconfig.json.hbs index 32b40009..a4a905b2 100644 --- a/plops-templates/packages/basic/tsconfig.json.hbs +++ b/plops-templates/packages/basic/tsconfig.json.hbs @@ -2,7 +2,7 @@ "extends": "@tresdoce-nestjs-toolkit/config", "compilerOptions": { "rootDir": "./src", - "types": ["tresdoce-nestjs-toolkit"] + "types": ["tresdoce-nestjs-toolkit", "jest"] }, "include": ["src/**/*"], "exclude": [ diff --git a/turbo.json b/turbo.json index d230ad1a..da2cd881 100644 --- a/turbo.json +++ b/turbo.json @@ -3,7 +3,8 @@ "pipeline": { "build": { "dependsOn": ["^build"], - "outputs": ["dist/**"] + "outputs": ["dist/**"], + "cache": true }, "test": { "outputs": ["coverage/**"],