Browse Source
Task/refactor from v4 as uuidv4 from uuid to crypto.randomUUID() (#5990)
* Refactor from v4 as uuidv4 from uuid to randomUUID() from node:crypto
* Update changelog
pull/5981/head^2
Thomas Kaul
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with
12 additions and
9 deletions
-
CHANGELOG.md
-
apps/api/src/app/import/import.service.ts
-
apps/api/src/app/order/order.service.ts
-
apps/api/src/services/demo/demo.service.ts
-
package-lock.json
-
package.json
|
|
|
@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 |
|
|
|
|
|
|
|
## Unreleased |
|
|
|
|
|
|
|
### Changed |
|
|
|
|
|
|
|
- Eliminated `uuid` in favor of using `randomUUID` from `node:crypto` |
|
|
|
|
|
|
|
### Fixed |
|
|
|
|
|
|
|
- Fixed an issue with the exchange rate calculation when converting between derived currencies and their root currencies |
|
|
|
|
|
|
|
@ -35,7 +35,7 @@ import { DataSource, Prisma, SymbolProfile } from '@prisma/client'; |
|
|
|
import { Big } from 'big.js'; |
|
|
|
import { endOfToday, isAfter, isSameSecond, parseISO } from 'date-fns'; |
|
|
|
import { omit, uniqBy } from 'lodash'; |
|
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
import { randomUUID } from 'node:crypto'; |
|
|
|
|
|
|
|
import { ImportDataDto } from './import-data.dto'; |
|
|
|
|
|
|
|
@ -277,7 +277,7 @@ export class ImportService { |
|
|
|
|
|
|
|
// Asset profile belongs to a different user
|
|
|
|
if (existingAssetProfile) { |
|
|
|
const symbol = uuidv4(); |
|
|
|
const symbol = randomUUID(); |
|
|
|
assetProfileSymbolMapping[assetProfile.symbol] = symbol; |
|
|
|
assetProfile.symbol = symbol; |
|
|
|
} |
|
|
|
@ -496,7 +496,7 @@ export class ImportService { |
|
|
|
accountId: validatedAccount?.id, |
|
|
|
accountUserId: undefined, |
|
|
|
createdAt: new Date(), |
|
|
|
id: uuidv4(), |
|
|
|
id: randomUUID(), |
|
|
|
isDraft: isAfter(date, endOfToday()), |
|
|
|
SymbolProfile: { |
|
|
|
assetClass, |
|
|
|
|
|
|
|
@ -37,7 +37,7 @@ import { Big } from 'big.js'; |
|
|
|
import { isUUID } from 'class-validator'; |
|
|
|
import { endOfToday, isAfter } from 'date-fns'; |
|
|
|
import { groupBy, uniqBy } from 'lodash'; |
|
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
import { randomUUID } from 'node:crypto'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class OrderService { |
|
|
|
@ -143,7 +143,7 @@ export class OrderService { |
|
|
|
} else { |
|
|
|
// Create custom asset profile
|
|
|
|
name = name ?? data.SymbolProfile.connectOrCreate.create.symbol; |
|
|
|
symbol = uuidv4(); |
|
|
|
symbol = randomUUID(); |
|
|
|
} |
|
|
|
|
|
|
|
data.SymbolProfile.connectOrCreate.create.assetClass = assetClass; |
|
|
|
|
|
|
|
@ -7,7 +7,7 @@ import { |
|
|
|
} from '@ghostfolio/common/config'; |
|
|
|
|
|
|
|
import { Injectable } from '@nestjs/common'; |
|
|
|
import { v4 as uuidv4 } from 'uuid'; |
|
|
|
import { randomUUID } from 'node:crypto'; |
|
|
|
|
|
|
|
@Injectable() |
|
|
|
export class DemoService { |
|
|
|
@ -41,7 +41,7 @@ export class DemoService { |
|
|
|
accountId: demoAccountId, |
|
|
|
accountUserId: demoUserId, |
|
|
|
comment: null, |
|
|
|
id: uuidv4(), |
|
|
|
id: randomUUID(), |
|
|
|
userId: demoUserId |
|
|
|
}; |
|
|
|
}); |
|
|
|
|
|
|
|
@ -89,7 +89,6 @@ |
|
|
|
"svgmap": "2.14.0", |
|
|
|
"tablemark": "4.1.0", |
|
|
|
"twitter-api-v2": "1.27.0", |
|
|
|
"uuid": "11.1.0", |
|
|
|
"yahoo-finance2": "3.10.2", |
|
|
|
"zone.js": "0.15.1" |
|
|
|
}, |
|
|
|
@ -40596,6 +40595,7 @@ |
|
|
|
"https://github.com/sponsors/ctavan" |
|
|
|
], |
|
|
|
"license": "MIT", |
|
|
|
"optional": true, |
|
|
|
"bin": { |
|
|
|
"uuid": "dist/esm/bin/uuid" |
|
|
|
} |
|
|
|
|
|
|
|
@ -135,7 +135,6 @@ |
|
|
|
"svgmap": "2.14.0", |
|
|
|
"tablemark": "4.1.0", |
|
|
|
"twitter-api-v2": "1.27.0", |
|
|
|
"uuid": "11.1.0", |
|
|
|
"yahoo-finance2": "3.10.2", |
|
|
|
"zone.js": "0.15.1" |
|
|
|
}, |
|
|
|
|