Skip to content
Merged
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
1 change: 1 addition & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"prettier"
],
"rules": {
"@typescript-eslint/no-unsafe-function-type": "off",
"no-inner-declarations": "off",
"no-plusplus": "off",
"@typescript-eslint/no-explicit-any": "warn", // TODO: Remover this in the near future
Expand Down
12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Adds the `CacheRequestAdapter` wrapper of cache functionalities inside request adapter structure and interfaces
- Add the `CacheRequestAdapter` wrapper of cache functionalities inside request adapter structure and interfaces.

### Changed

- Update dependencies.
- Update Node.js version in Dockerfile.
- Add type corrections to the RabbitMQ server.

### Fixed

- Correct logic to enable offline logger.

## [2.3.0] - 2025-05-06

Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:20.17.0-slim AS builder
FROM node:22.15.0-slim AS builder

WORKDIR /home/node/app

Expand Down
16 changes: 16 additions & 0 deletions TEMPLATE-CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.4.0] - 2025-05-08

### Added

- Add the `CacheRequestAdapter` wrapper of cache functionalities inside request adapter structure and interfaces.

### Changed

- Update dependencies.
- Update Node.js version in Dockerfile.
- Add type corrections to the RabbitMQ server.

### Fixed

- Correct logic to enable offline logger.

## [2.3.0] - 2025-05-06

### Added
Expand Down
102 changes: 51 additions & 51 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "template-microservice",
"version": "2.3.0",
"version": "2.4.0",
"scripts": {
"helm:gen": "NODE_NO_WARNINGS=1 node script/helm/index.mjs",
"helm:gen:production": "NODE_NO_WARNINGS=1 node script/helm/index.mjs -e production --scan-routes",
Expand Down Expand Up @@ -35,94 +35,94 @@
"author": "badass-team",
"license": "ISC",
"devDependencies": {
"@babel/cli": "^7.24.8",
"@babel/core": "^7.25.2",
"@babel/node": "^7.25.0",
"@babel/cli": "^7.27.2",
"@babel/core": "^7.27.1",
"@babel/node": "^7.27.1",
"@babel/plugin-proposal-class-properties": "^7.18.6",
"@babel/plugin-proposal-decorators": "^7.24.7",
"@babel/plugin-proposal-decorators": "^7.27.1",
"@babel/plugin-proposal-private-property-in-object": "^7.21.11",
"@babel/plugin-transform-modules-commonjs": "^7.24.8",
"@babel/plugin-transform-typescript": "^7.25.2",
"@babel/preset-env": "^7.25.4",
"@babel/preset-typescript": "^7.24.7",
"@babel/plugin-transform-modules-commonjs": "^7.27.1",
"@babel/plugin-transform-typescript": "^7.27.1",
"@babel/preset-env": "^7.27.2",
"@babel/preset-typescript": "^7.27.1",
"@italog/codegen": "^1.6.0",
"@types/amqplib": "^0.10.5",
"@types/cors": "^2.8.17",
"@types/jest": "^29.5.12",
"@types/amqplib": "^0.10.7",
"@types/cors": "^2.8.18",
"@types/jest": "^29.5.14",
"@types/knex": "^0.16.1",
"@types/memjs": "^1.3.3",
"@types/mongodb": "^4.0.7",
"@types/node": "^20.12.12",
"@types/node": "^22.15.17",
"@types/string-template": "^1.0.6",
"@types/supertest": "^6.0.2",
"@types/uuid": "^9.0.8",
"@types/supertest": "^6.0.3",
"@types/uuid": "^10.0.0",
"@types/yup": "^0.29.14",
"@typescript-eslint/eslint-plugin": "^7.9.0",
"@typescript-eslint/parser": "^7.9.0",
"@typescript-eslint/typescript-estree": "^8.13.0",
"@typescript-eslint/eslint-plugin": "^8.32.0",
"@typescript-eslint/parser": "^8.32.0",
"@typescript-eslint/typescript-estree": "^8.32.0",
"babel-plugin-module-resolver": "^5.0.2",
"dotenv-cli": "^7.4.2",
"dotenv-cli": "^8.0.0",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-config-prettier": "^9.1.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-import-helpers": "^1.3.1",
"eslint-plugin-prettier": "^5.2.1",
"eslint-plugin-prettier": "^5.4.0",
"git-commit-msg-linter": "^5.0.8",
"husky": "^9.1.5",
"husky": "^9.1.7",
"jest": "^29.7.0",
"lint-staged": "^15.2.9",
"mongodb-memory-server": "^10.0.0",
"prettier": "^3.3.3",
"lint-staged": "^15.5.2",
"mongodb-memory-server": "^10.1.4",
"prettier": "^3.5.3",
"rimraf": "^6.0.1",
"supertest": "^7.0.0",
"ts-jest": "^29.2.5",
"supertest": "^7.1.0",
"ts-jest": "^29.3.2",
"ts-node-dev": "^2.0.0",
"tsconfig-paths": "^4.2.0",
"tsx": "^4.19.2",
"typescript": "5.5.4",
"yaml": "^2.5.0"
"tsx": "^4.19.4",
"typescript": "5.8.3",
"yaml": "^2.7.1"
},
"dependencies": {
"@badass-team-code/formatted-cases-words": "^1.0.0",
"@elastic/ecs-winston-format": "^1.5.3",
"@elastic/elasticsearch": "^8.15.0",
"@fastify/cors": "^9.0.1",
"@fastify/helmet": "^11.1.1",
"@fastify/static": "^7.0.4",
"@elastic/elasticsearch": "^9.0.1",
"@fastify/cors": "^11.0.1",
"@fastify/helmet": "^13.0.1",
"@fastify/static": "^8.1.1",
"@hokify/agenda": "^6.3.0",
"agenda": "^5.0.0",
"agendash": "^4.0.0",
"agentkeepalive": "^4.5.0",
"amqplib": "^0.10.4",
"axios": "^1.7.5",
"agentkeepalive": "^4.6.0",
"amqplib": "^0.10.8",
"axios": "^1.9.0",
"cors": "^2.8.5",
"cpf-cnpj-validator": "^1.0.3",
"date-fns": "^3.6.0",
"dotenv": "^16.4.5",
"elastic-apm-node": "^4.7.3",
"fastify": "^4.28.1",
"fastify-plugin": "^4.5.1",
"form-data": "^4.0.0",
"helmet": "^7.1.0",
"date-fns": "^4.1.0",
"dotenv": "^16.5.0",
"elastic-apm-node": "^4.13.0",
"fastify": "^5.3.2",
"fastify-plugin": "^5.0.1",
"form-data": "^4.0.2",
"helmet": "^8.1.0",
"knex": "^3.1.0",
"memjs": "^1.3.2",
"mongodb": "^6.8.0",
"mongoose": "^8.5.4",
"mongodb": "^6.16.0",
"mongoose": "^8.14.1",
"node-cache": "^5.1.2",
"reflect-metadata": "^0.2.2",
"socket.io": "^4.8.0",
"socket.io": "^4.8.1",
"sqlite3": "^5.1.7",
"string-template": "^1.0.0",
"tedious": "19.0.0",
"uuid": "^9.0.1",
"winston": "^3.14.2",
"uuid": "^11.1.0",
"winston": "^3.17.0",
"winston-daily-rotate-file": "^5.0.0",
"winston-elasticsearch": "^0.19.0",
"winston-transport": "^4.7.1",
"winston-transport": "^4.9.0",
"yargs": "13.2",
"yup": "^1.4.0"
"yup": "^1.6.1"
},
"resolutions": {
"wrap-ansi": "7.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/data/protocols/http/adapters/web-service-rest-adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ export type Data = {
};

export interface HttpClient<
B extends Object = GenericObject,
H extends Object = GenericObject
B extends object = GenericObject,
H extends object = GenericObject
> {
request: (data: Data) => Promise<HttpResponse<B, H>>;
}
Expand All @@ -34,8 +34,8 @@ export enum HttpStatusCode {
}

export type HttpResponse<
B extends Object = GenericObject,
H extends Object = GenericObject
B extends object = GenericObject,
H extends object = GenericObject
> = {
statusCode: HttpStatusCode;
body: B;
Expand Down
2 changes: 1 addition & 1 deletion src/data/protocols/util/logger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type LogParams = {
| 'verbose'
| 'debug'
| 'silly'
| String;
| string;
message: string;
payload?: object;
};
Expand Down
2 changes: 1 addition & 1 deletion src/data/protocols/util/object/filter-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ type Options<T> = {
deniedKeys?: (keyof T)[];
};

export type FilterKeys = <T extends Object>(
export type FilterKeys = <T extends object>(
object: T,
options: Options<T>
) => T;
2 changes: 1 addition & 1 deletion src/infra/cache/cache-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export class CacheServer {
try {
const string = response.value.toString();
return JSON.parse(string);
} catch (error) {
} catch (_error) {
throw new Error(this.Error.UNABLE_TO_CONVERT_VALUE_TO_JSON);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import mongoose from 'mongoose';

export interface InputAndOutputLogModel extends mongoose.Document {
type: string;
payload: Object;
payload: object;
created_at: Date;
}

Expand Down
2 changes: 1 addition & 1 deletion src/infra/db/mssql/util/knex/ knex.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ declare module 'knex' {
columnTwo: string
): KnexOriginal.QueryBuilder<TRecord, TResult>;
formattedSelect<TRecord, TResult>(
object: Object
object: object
): KnexOriginal.QueryBuilder<TRecord, TResult>;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import k from 'knex';

const DELIMITER = '.#@KNEX@#.';

function getValuesPath(object: Object) {
function getValuesPath(object: object) {
const paths: { path: string; value: unknown }[] = [];

function getPath(object: Object, previousPath?: string) {
function getPath(object: object, previousPath?: string) {
return Object.entries(object).forEach(([key, value]) => {
const path = previousPath ? [previousPath, key].join(DELIMITER) : key;

Expand All @@ -23,8 +23,8 @@ function getValuesPath(object: Object) {
return paths;
}

function transformResponse(response: Object[] | Object) {
function parseValue(item: Object) {
function transformResponse(response: object[] | object) {
function parseValue(item: object) {
if (typeof item !== 'object') return item;
const object: Record<string, unknown> = {};
const entries = Object.entries(item);
Expand Down Expand Up @@ -60,8 +60,8 @@ function transformResponse(response: Object[] | Object) {
return parseValue(response);
}

function resolveWrapper(resolve: (data: Object | Object[]) => void) {
return (data: Object | Object[]) => {
function resolveWrapper(resolve: (data: object | object[]) => void) {
return (data: object | object[]) => {
if (typeof data !== 'object') {
resolve(data);
return;
Expand All @@ -88,7 +88,7 @@ function resolveWrapper(resolve: (data: Object | Object[]) => void) {
}

export function formattedSelectPlugin(knex: typeof k) {
knex.QueryBuilder.extend('formattedSelect', function (schema: Object) {
knex.QueryBuilder.extend('formattedSelect', function (schema: object) {
const paths = getValuesPath(schema);
const entries = paths.map(({ path, value }) => [path, value]);
const selectObject = Object.fromEntries(entries);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ function convertToDateValue([key, value]: [string, unknown]): [
return [key, date];
}

function resolveWrapper(resolve: (data: Object | Object[]) => void) {
return (data: Object | Object[]) => {
function resolveWrapper(resolve: (data: object | object[]) => void) {
return (data: object | object[]) => {
if (typeof data !== 'object') return resolve(data);

if (!Array.isArray(data)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ function saveToCache(sql: Knex.Sql, result: unknown, service: Services) {
}

function resolveWrapperToSaveInCache(
resolve: (data: Object | Object[]) => void,
resolve: (data: object | object[]) => void,
sql: Knex.Sql,
service: Services
) {
return (data: Object | Object[]) => {
return (data: object | object[]) => {
try {
if (typeof data !== 'object') {
resolve(data);
Expand Down
2 changes: 1 addition & 1 deletion src/infra/db/mssql/util/schema/make-table-builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export const makeTableBuilder =
function getColumnsObject(keyCase: 'SNAKE'): {
[P in SnakeCase<Columns[number]>]: string;
};
function getColumnsObject(keyCase: KeyCase): Object {
function getColumnsObject(keyCase: KeyCase): object {
return makeColumns(
<string[]>(<unknown>options.columns),
table,
Expand Down
2 changes: 1 addition & 1 deletion src/infra/http/util/web-server/socket-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface WebSocketMethods {
message(...middlewares: RouteMiddlewareSocket[]): void;
close(...middlewares: RouteMiddlewareSocket[]): void;
ping(...middlewares: RouteMiddlewareSocket[]): void;
on(event: string | Symbol, ...middlewares: RouteMiddlewareSocket[]): void;
on(event: string | symbol, ...middlewares: RouteMiddlewareSocket[]): void;
}

export class SocketHandler {
Expand Down
Loading
Loading