From 7d64bec4b2c4a4bbaa0463769db0e15aa92224b7 Mon Sep 17 00:00:00 2001 From: Matt Schoch Date: Wed, 17 Jan 2024 21:03:27 -0500 Subject: [PATCH] format & lint --- apps/authz/src/app/app.controller.ts | 6 +++--- apps/authz/src/app/app.service.ts | 10 ++++++---- apps/authz/src/app/evaluation-request.dto.ts | 4 ++-- apps/authz/src/shared/module/persistence/mock_data.ts | 4 ++-- apps/authz/src/shared/types/http.ts | 1 - 5 files changed, 13 insertions(+), 12 deletions(-) diff --git a/apps/authz/src/app/app.controller.ts b/apps/authz/src/app/app.controller.ts index 1a012612f..333793f0d 100644 --- a/apps/authz/src/app/app.controller.ts +++ b/apps/authz/src/app/app.controller.ts @@ -1,8 +1,8 @@ +import { EvaluationRequestDto } from '@app/authz/app/evaluation-request.dto' import { generateInboundRequest } from '@app/authz/shared/module/persistence/mock_data' +import { AuthZRequestPayload } from '@app/authz/shared/types/http' import { Body, Controller, Get, Logger, Post } from '@nestjs/common' import { AppService } from './app.service' -import { EvaluationRequestDto } from '@app/authz/app/evaluation-request.dto' -import { AuthZRequestPayload } from '@app/authz/shared/types/http' @Controller() export class AppController { @@ -31,7 +31,7 @@ export class AppController { }) // Map the DTO into the TS type because it's nicer to deal with. - const payload: AuthZRequestPayload = body; + const payload: AuthZRequestPayload = body const result = await this.appService.runEvaluation(payload) this.logger.log({ diff --git a/apps/authz/src/app/app.service.ts b/apps/authz/src/app/app.service.ts index ec592c320..7515e08cc 100644 --- a/apps/authz/src/app/app.service.ts +++ b/apps/authz/src/app/app.service.ts @@ -12,11 +12,11 @@ import { import { OpaResult, RegoInput } from '@app/authz/shared/types/rego' import { safeDecode } from '@narval/transaction-request-intent' import { Injectable } from '@nestjs/common' +import { InputType } from 'packages/transaction-request-intent/src/lib/domain' import { Intent } from 'packages/transaction-request-intent/src/lib/intent.types' import { Hex, verifyMessage } from 'viem' import { privateKeyToAccount } from 'viem/accounts' import { OpaService } from './opa/opa.service' -import { InputType } from 'packages/transaction-request-intent/src/lib/domain' const ENGINE_PRIVATE_KEY = '0x7cfef3303797cbc7515d9ce22ffe849c701b0f2812f999b0847229c47951fca5' @@ -76,9 +76,11 @@ export class AppService { principal: { uid: principal.userId }, - resource: request.resourceId ? { - uid: request.resourceId - } : undefined, + resource: request.resourceId + ? { + uid: request.resourceId + } + : undefined, approvals: approvals || [] } } diff --git a/apps/authz/src/app/evaluation-request.dto.ts b/apps/authz/src/app/evaluation-request.dto.ts index ee8607d61..2ed00265a 100644 --- a/apps/authz/src/app/evaluation-request.dto.ts +++ b/apps/authz/src/app/evaluation-request.dto.ts @@ -1,5 +1,5 @@ import { Action, Alg } from '@app/authz/shared/types/enums' -import { Address, Hex, FiatSymbols } from '@app/authz/shared/types/http' +import { Address, FiatSymbols, Hex } from '@app/authz/shared/types/http' import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger' import { Transform, Type } from 'class-transformer' import { IsDefined, IsEnum, IsEthereumAddress, IsString, ValidateNested } from 'class-validator' @@ -65,7 +65,7 @@ export class TransactionRequestDto { accessList?: { address: Address; storageKeys: Hex[] }[] - type?: "2" + type?: '2' } export class SignTransactionRequestDataDto extends BaseRequestDataDto { diff --git a/apps/authz/src/shared/module/persistence/mock_data.ts b/apps/authz/src/shared/module/persistence/mock_data.ts index b027a5a77..595f3cd28 100644 --- a/apps/authz/src/shared/module/persistence/mock_data.ts +++ b/apps/authz/src/shared/module/persistence/mock_data.ts @@ -8,7 +8,7 @@ import { Wallet, WalletGroup } from '@app/authz/shared/types/entities.types' -import { AccountType, Alg, Action, UserRoles } from '@app/authz/shared/types/enums' +import { AccountType, Action, Alg, UserRoles } from '@app/authz/shared/types/enums' import { AuthCredential, AuthZRequestPayload, TransactionRequest } from '@app/authz/shared/types/http' import { RegoInput } from '@app/authz/shared/types/rego' import { Caip10, Caip19 } from 'packages/transaction-request-intent/src/lib/caip' @@ -377,4 +377,4 @@ export const generateInboundRequest = async (): Promise => } } - */ \ No newline at end of file + */ diff --git a/apps/authz/src/shared/types/http.ts b/apps/authz/src/shared/types/http.ts index 3675c1fc1..fdf2cc1bf 100644 --- a/apps/authz/src/shared/types/http.ts +++ b/apps/authz/src/shared/types/http.ts @@ -17,7 +17,6 @@ export type HistoricalTransfer = { timestamp: number // unix timestamp } - // Types ripped from viem; combining a few though because they don't have chainId on txRequest export type Hex = `0x${string}` export type Address = `0x${string}`