From 8f7a3c102d100fa35dafd170b5a558c83ac970b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Antonio=20David=20Guti=C3=A9rrez?= Date: Mon, 16 Dec 2024 13:20:53 +0100 Subject: [PATCH] fix: revert usage of node: built-in modules --- .eslintrc.js | 1 + plugins/main/server/controllers/wazuh-api.ts | 4 ++-- plugins/wazuh-core/common/constants.ts | 2 +- plugins/wazuh-core/common/services/settings-validator.ts | 2 +- plugins/wazuh-core/server/services/server-api-client.ts | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.eslintrc.js b/.eslintrc.js index 53f46b96fc..84f328f7c2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -172,6 +172,7 @@ module.exports = { 'unicorn/prefer-module': 'off', 'unicorn/prefer-ternary': 'off', 'unicorn/numeric-separators-style': 'off', + 'unicorn/prefer-node-protocol': 'off', // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/custom-error-definition.md 'unicorn/custom-error-definition': 'error', // https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/better-regex.md diff --git a/plugins/main/server/controllers/wazuh-api.ts b/plugins/main/server/controllers/wazuh-api.ts index f0016b62b1..d4e4eb2d00 100644 --- a/plugins/main/server/controllers/wazuh-api.ts +++ b/plugins/main/server/controllers/wazuh-api.ts @@ -12,8 +12,8 @@ */ // Require some libraries -import fs from 'node:fs'; -import path from 'node:path'; +import fs from 'fs'; +import path from 'path'; import { Parser } from 'json2csv'; import jwtDecode from 'jwt-decode'; import { diff --git a/plugins/wazuh-core/common/constants.ts b/plugins/wazuh-core/common/constants.ts index ff996a0568..1950b1ec9c 100644 --- a/plugins/wazuh-core/common/constants.ts +++ b/plugins/wazuh-core/common/constants.ts @@ -9,7 +9,7 @@ * * Find more information about this on the LICENSE file. */ -import path from 'node:path'; +import path from 'path'; import { version } from '../package.json'; // import { validate as validateNodeCronInterval } from 'node-cron'; import { SettingsValidator } from '../common/services/settings-validator'; diff --git a/plugins/wazuh-core/common/services/settings-validator.ts b/plugins/wazuh-core/common/services/settings-validator.ts index 15503d6330..e030eb41f8 100644 --- a/plugins/wazuh-core/common/services/settings-validator.ts +++ b/plugins/wazuh-core/common/services/settings-validator.ts @@ -1,4 +1,4 @@ -import path from 'node:path'; +import path from 'path'; import { formatBytes } from './file-size'; export const SettingsValidator = { diff --git a/plugins/wazuh-core/server/services/server-api-client.ts b/plugins/wazuh-core/server/services/server-api-client.ts index 910d01e39e..a0bdb6f481 100644 --- a/plugins/wazuh-core/server/services/server-api-client.ts +++ b/plugins/wazuh-core/server/services/server-api-client.ts @@ -10,7 +10,7 @@ * Find more information about this on the LICENSE file. */ -import https from 'node:https'; +import https from 'https'; import axios, { AxiosInstance, AxiosResponse } from 'axios'; import { Logger } from 'opensearch-dashboards/server'; import { getCookieValueByName } from './cookie';