Browse Source
Task/refactor imports of built-in Node.js core modules (#5513)
* Prefix crypto imports
* Prefix fs imports
* Prefix path imports
* Update changelog
pull/4522/merge
Thomas Kaul
1 week ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with
21 additions and
20 deletions
-
CHANGELOG.md
-
apps/api/src/app/app.module.ts
-
apps/api/src/app/endpoints/assets/assets.controller.ts
-
apps/api/src/app/endpoints/sitemap/sitemap.controller.ts
-
apps/api/src/app/portfolio/calculator/portfolio-calculator-test-utils.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btceur.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd-short.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-btcusd.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell-partially.spec.ts
-
apps/api/src/app/portfolio/calculator/roai/portfolio-calculator-novn-buy-and-sell.spec.ts
-
apps/api/src/app/redis-cache/redis-cache.service.ts
-
apps/api/src/app/user/user.service.ts
-
apps/api/src/helper/string.helper.ts
-
apps/api/src/middlewares/html-template.middleware.ts
-
apps/api/src/services/api-key/api-key.service.ts
-
apps/api/src/services/i18n/i18n.service.ts
|
|
@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
- Improved the search in the _Yahoo Finance_ service |
|
|
|
- Moved the holdings table into the holdings section on the public page |
|
|
|
- Refactored the login with access token dialog component to standalone |
|
|
|
- Prefixed the `crypto`, `fs` and `path` imports with `node:` |
|
|
|
|
|
|
|
## 2.198.0 - 2025-09-11 |
|
|
|
|
|
|
|
|
|
@ -21,7 +21,7 @@ import { EventEmitterModule } from '@nestjs/event-emitter'; |
|
|
|
import { ScheduleModule } from '@nestjs/schedule'; |
|
|
|
import { ServeStaticModule } from '@nestjs/serve-static'; |
|
|
|
import { StatusCodes } from 'http-status-codes'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
import { AccessModule } from './access/access.module'; |
|
|
|
import { AccountModule } from './account/account.module'; |
|
|
|
|
|
@ -10,8 +10,8 @@ import { |
|
|
|
VERSION_NEUTRAL |
|
|
|
} from '@nestjs/common'; |
|
|
|
import { Response } from 'express'; |
|
|
|
import { readFileSync } from 'fs'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { readFileSync } from 'node:fs'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
@Controller('assets') |
|
|
|
export class AssetsController { |
|
|
|
|
|
@ -8,8 +8,8 @@ import { |
|
|
|
import { Controller, Get, Res, VERSION_NEUTRAL, Version } from '@nestjs/common'; |
|
|
|
import { format } from 'date-fns'; |
|
|
|
import { Response } from 'express'; |
|
|
|
import { readFileSync } from 'fs'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { readFileSync } from 'node:fs'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
import { SitemapService } from './sitemap.service'; |
|
|
|
|
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { readFileSync } from 'fs'; |
|
|
|
import { readFileSync } from 'node:fs'; |
|
|
|
|
|
|
|
export const activityDummyData = { |
|
|
|
accountId: undefined, |
|
|
|
|
|
@ -20,7 +20,7 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
|
|
|
|
import { Tag } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
return { |
|
|
|
|
|
@ -20,7 +20,7 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
|
|
|
|
import { Tag } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
return { |
|
|
|
|
|
@ -20,7 +20,7 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
|
|
|
|
import { Tag } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
return { |
|
|
|
|
|
@ -20,7 +20,7 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
|
|
|
|
import { Tag } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
return { |
|
|
|
|
|
@ -20,7 +20,7 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
|
|
|
|
import { Tag } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
jest.mock('@ghostfolio/api/app/portfolio/current-rate.service', () => { |
|
|
|
return { |
|
|
|
|
|
@ -4,9 +4,9 @@ import { AssetProfileIdentifier, Filter } from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
|
|
import { CACHE_MANAGER, Cache } from '@nestjs/cache-manager'; |
|
|
|
import { Inject, Injectable, Logger } from '@nestjs/common'; |
|
|
|
import { createHash } from 'crypto'; |
|
|
|
import Keyv from 'keyv'; |
|
|
|
import ms from 'ms'; |
|
|
|
import { createHash } from 'node:crypto'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class RedisCacheService { |
|
|
|
|
|
@ -48,9 +48,9 @@ import { PerformanceCalculationType } from '@ghostfolio/common/types/performance |
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { EventEmitter2 } from '@nestjs/event-emitter'; |
|
|
|
import { Prisma, Role, User } from '@prisma/client'; |
|
|
|
import { createHmac } from 'crypto'; |
|
|
|
import { differenceInDays, subDays } from 'date-fns'; |
|
|
|
import { sortBy, without } from 'lodash'; |
|
|
|
import { createHmac } from 'node:crypto'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class UserService { |
|
|
|
|
|
@ -1,4 +1,4 @@ |
|
|
|
import { randomBytes } from 'crypto'; |
|
|
|
import { randomBytes } from 'node:crypto'; |
|
|
|
|
|
|
|
export function getRandomString(length: number) { |
|
|
|
const bytes = randomBytes(length); |
|
|
|
|
|
@ -10,8 +10,8 @@ import { DATE_FORMAT, interpolate } from '@ghostfolio/common/helper'; |
|
|
|
import { Injectable, Logger, NestMiddleware } from '@nestjs/common'; |
|
|
|
import { format } from 'date-fns'; |
|
|
|
import { NextFunction, Request, Response } from 'express'; |
|
|
|
import * as fs from 'fs'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { readFileSync } from 'node:fs'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
const title = 'Ghostfolio'; |
|
|
|
|
|
|
@ -87,7 +87,7 @@ export class HtmlTemplateMiddleware implements NestMiddleware { |
|
|
|
this.indexHtmlMap = SUPPORTED_LANGUAGE_CODES.reduce( |
|
|
|
(map, languageCode) => ({ |
|
|
|
...map, |
|
|
|
[languageCode]: fs.readFileSync( |
|
|
|
[languageCode]: readFileSync( |
|
|
|
join(__dirname, '..', 'client', languageCode, 'index.html'), |
|
|
|
'utf8' |
|
|
|
) |
|
|
|
|
|
@ -3,7 +3,7 @@ import { PrismaService } from '@ghostfolio/api/services/prisma/prisma.service'; |
|
|
|
import { ApiKeyResponse } from '@ghostfolio/common/interfaces'; |
|
|
|
|
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { pbkdf2Sync } from 'crypto'; |
|
|
|
import { pbkdf2Sync } from 'node:crypto'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class ApiKeyService { |
|
|
|
|
|
@ -2,8 +2,8 @@ import { DEFAULT_LANGUAGE_CODE } from '@ghostfolio/common/config'; |
|
|
|
|
|
|
|
import { Injectable, Logger } from '@nestjs/common'; |
|
|
|
import * as cheerio from 'cheerio'; |
|
|
|
import { readFileSync, readdirSync } from 'fs'; |
|
|
|
import { join } from 'path'; |
|
|
|
import { readFileSync, readdirSync } from 'node:fs'; |
|
|
|
import { join } from 'node:path'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class I18nService { |
|
|
|