From 18184d9b064945907db5261056c806bc11d04ab1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 15:44:41 +0000 Subject: [PATCH 1/2] Bump prettier from 2.8.8 to 3.2.5 Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.2.5. - [Release notes](https://github.com/prettier/prettier/releases) - [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md) - [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.2.5) --- updated-dependencies: - dependency-name: prettier dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package-lock.json | 12 ++++++------ package.json | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/package-lock.json b/package-lock.json index bb18cce80..67f9cc3db 100644 --- a/package-lock.json +++ b/package-lock.json @@ -100,7 +100,7 @@ "lint-staged": "15.2.0", "nock": "^13.5.1", "nx": "17.1.3", - "prettier": "^2.6.2", + "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", "prisma": "^5.8.1", "supertest": "^6.3.4", @@ -24619,15 +24619,15 @@ } }, "node_modules/prettier": { - "version": "2.8.8", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.8.8.tgz", - "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", + "version": "3.2.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-3.2.5.tgz", + "integrity": "sha512-3/GWa9aOC0YeD7LUfvOG2NiDyhOWRvt1k+rcKhOuYnMY24iiCphgneUfJDyFXd6rZCAnuLBv6UeAULtrhT/F4A==", "dev": true, "bin": { - "prettier": "bin-prettier.js" + "prettier": "bin/prettier.cjs" }, "engines": { - "node": ">=10.13.0" + "node": ">=14" }, "funding": { "url": "https://github.com/prettier/prettier?sponsor=1" diff --git a/package.json b/package.json index c16474e87..be14d8730 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "lint-staged": "15.2.0", "nock": "^13.5.1", "nx": "17.1.3", - "prettier": "^2.6.2", + "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", "prisma": "^5.8.1", "supertest": "^6.3.4", From e483080e0256ee9efabe8dffdc95bf9233a386f2 Mon Sep 17 00:00:00 2001 From: William Calderipe Date: Mon, 19 Feb 2024 09:32:29 +0100 Subject: [PATCH 2/2] Format the codebase with Prettier 3.2.5 --- apps/authz/src/app/app.service.ts | 5 ++- .../core/service/price-feed.service.ts | 5 ++- .../core/service/cluster.service.ts | 15 +++++--- .../src/price/core/service/price.service.ts | 38 +++++++++++-------- .../core/service/organization.service.ts | 5 ++- .../store/entity/core/service/user.service.ts | 5 ++- .../entity/core/service/wallet.service.ts | 5 ++- .../authz-shared/src/lib/util/enum.util.ts | 23 ++++++----- 8 files changed, 64 insertions(+), 37 deletions(-) diff --git a/apps/authz/src/app/app.service.ts b/apps/authz/src/app/app.service.ts index c2e01b536..bceac6b0f 100644 --- a/apps/authz/src/app/app.service.ts +++ b/apps/authz/src/app/app.service.ts @@ -68,7 +68,10 @@ export const finalizeDecision = (response: OpaResult[]) => { @Injectable() export class AppService { - constructor(private opaService: OpaService, private entityRepository: EntityRepository) {} + constructor( + private opaService: OpaService, + private entityRepository: EntityRepository + ) {} async #verifySignature(requestSignature: Signature, verificationMessage: string): Promise { const { pubKey, alg, sig } = requestSignature diff --git a/apps/orchestration/src/data-feed/core/service/price-feed.service.ts b/apps/orchestration/src/data-feed/core/service/price-feed.service.ts index 82e6ada5f..ed340d0f9 100644 --- a/apps/orchestration/src/data-feed/core/service/price-feed.service.ts +++ b/apps/orchestration/src/data-feed/core/service/price-feed.service.ts @@ -16,7 +16,10 @@ import { DataFeed } from '../type/data-feed.type' export class PriceFeedService implements DataFeed { static SOURCE_ID = 'armory/price-feed' - constructor(private priceService: PriceService, private configService: ConfigService) {} + constructor( + private priceService: PriceService, + private configService: ConfigService + ) {} getId(): string { return PriceFeedService.SOURCE_ID diff --git a/apps/orchestration/src/policy-engine/core/service/cluster.service.ts b/apps/orchestration/src/policy-engine/core/service/cluster.service.ts index 44831196b..f75f0cc12 100644 --- a/apps/orchestration/src/policy-engine/core/service/cluster.service.ts +++ b/apps/orchestration/src/policy-engine/core/service/cluster.service.ts @@ -106,13 +106,16 @@ export class ClusterService { nodes: Node[], responses: EvaluationResponse[] ): { node: Node; response: EvaluationResponse }[] { - return zip(nodes, responses).reduce((acc, [node, response]) => { - if (node && response) { - return [...acc, { node, response }] - } + return zip(nodes, responses).reduce( + (acc, [node, response]) => { + if (node && response) { + return [...acc, { node, response }] + } - return acc - }, [] as { node: Node; response: EvaluationResponse }[]) + return acc + }, + [] as { node: Node; response: EvaluationResponse }[] + ) } private async recoverPubKey(response: EvaluationResponse) { diff --git a/apps/orchestration/src/price/core/service/price.service.ts b/apps/orchestration/src/price/core/service/price.service.ts index e053ec0af..440a7b8fb 100644 --- a/apps/orchestration/src/price/core/service/price.service.ts +++ b/apps/orchestration/src/price/core/service/price.service.ts @@ -16,7 +16,10 @@ type GetPricesOption = { export class PriceService { private logger = new Logger(PriceService.name) - constructor(private coinGeckoClient: CoinGeckoClient, private coinGeckoAssetRepository: CoinGeckoAssetRepository) {} + constructor( + private coinGeckoClient: CoinGeckoClient, + private coinGeckoAssetRepository: CoinGeckoAssetRepository + ) {} async getPrices(options: GetPricesOption): Promise { this.logger.log('Get prices', options) @@ -68,22 +71,25 @@ export class PriceService { } private getAssetsPriceInformation(simplePrice: SimplePrice) { - return Object.keys(simplePrice).reduce((acc, coinId) => { - const sourceAssetIds = this.coinGeckoAssetRepository.getAssetIds(coinId) - - if (sourceAssetIds) { - return [ - ...acc, - ...sourceAssetIds.map((sourceAssetId) => ({ - sourceAssetId, - coinId, - values: this.getValues(simplePrice, coinId) - })) - ] - } + return Object.keys(simplePrice).reduce( + (acc, coinId) => { + const sourceAssetIds = this.coinGeckoAssetRepository.getAssetIds(coinId) - return acc - }, [] as { sourceAssetId: AssetId; coinId: string; values: unknown }[]) + if (sourceAssetIds) { + return [ + ...acc, + ...sourceAssetIds.map((sourceAssetId) => ({ + sourceAssetId, + coinId, + values: this.getValues(simplePrice, coinId) + })) + ] + } + + return acc + }, + [] as { sourceAssetId: AssetId; coinId: string; values: unknown }[] + ) } private getValues(simplePrice: SimplePrice, coinId: string) { diff --git a/apps/orchestration/src/store/entity/core/service/organization.service.ts b/apps/orchestration/src/store/entity/core/service/organization.service.ts index 99e73b130..0672df1db 100644 --- a/apps/orchestration/src/store/entity/core/service/organization.service.ts +++ b/apps/orchestration/src/store/entity/core/service/organization.service.ts @@ -5,7 +5,10 @@ import { UserService } from './user.service' @Injectable() export class OrganizationService { - constructor(private orgRepository: OrganizationRepository, private userService: UserService) {} + constructor( + private orgRepository: OrganizationRepository, + private userService: UserService + ) {} async create(input: { uid: string; rootCredential: CredentialEntity }): Promise<{ organization: OrganizationEntity diff --git a/apps/orchestration/src/store/entity/core/service/user.service.ts b/apps/orchestration/src/store/entity/core/service/user.service.ts index 6dd9b6840..7a60b353b 100644 --- a/apps/orchestration/src/store/entity/core/service/user.service.ts +++ b/apps/orchestration/src/store/entity/core/service/user.service.ts @@ -5,7 +5,10 @@ import { UserRepository } from '../../persistence/repository/user.repository' @Injectable() export class UserService { - constructor(private userRepository: UserRepository, private userWalletRepository: UserWalletRepository) {} + constructor( + private userRepository: UserRepository, + private userWalletRepository: UserWalletRepository + ) {} create(orgId: string, user: UserEntity, credential?: CredentialEntity): Promise { return this.userRepository.create(orgId, user, credential) diff --git a/apps/orchestration/src/store/entity/core/service/wallet.service.ts b/apps/orchestration/src/store/entity/core/service/wallet.service.ts index a1d32ada1..51bc76957 100644 --- a/apps/orchestration/src/store/entity/core/service/wallet.service.ts +++ b/apps/orchestration/src/store/entity/core/service/wallet.service.ts @@ -5,7 +5,10 @@ import { WalletRepository } from '../../persistence/repository/wallet.repository @Injectable() export class WalletService { - constructor(private walletRepository: WalletRepository, private walletGroupRepository: WalletGroupRepository) {} + constructor( + private walletRepository: WalletRepository, + private walletGroupRepository: WalletGroupRepository + ) {} async create(orgId: string, wallet: WalletEntity): Promise { return this.walletRepository.create(orgId, wallet) diff --git a/packages/authz-shared/src/lib/util/enum.util.ts b/packages/authz-shared/src/lib/util/enum.util.ts index 98a894da2..db856ceae 100644 --- a/packages/authz-shared/src/lib/util/enum.util.ts +++ b/packages/authz-shared/src/lib/util/enum.util.ts @@ -29,17 +29,20 @@ export const convertEnums = >( enumMap: EnumMap, data: T ): EnumConverted> => { - return Object.entries(data).reduce((acc, [key, value]) => { - if (key in enumMap) { - acc[key as keyof T] = toEnum(enumMap[key as keyof EnumMap], value) as EnumConverted>[keyof T] - if (acc[key] === undefined || acc[key] === null) { - throw new Error(`Invalid enum value for key ${key}: ${value}`) + return Object.entries(data).reduce( + (acc, [key, value]) => { + if (key in enumMap) { + acc[key as keyof T] = toEnum(enumMap[key as keyof EnumMap], value) as EnumConverted>[keyof T] + if (acc[key] === undefined || acc[key] === null) { + throw new Error(`Invalid enum value for key ${key}: ${value}`) + } + } else { + acc[key as keyof T] = value as EnumConverted>[keyof T] } - } else { - acc[key as keyof T] = value as EnumConverted>[keyof T] - } - return acc - }, {} as EnumConverted>) + return acc + }, + {} as EnumConverted> + ) } export const convertEnumsArray = >(