From f2c62f3bf3c58def586a85ccbdd40f10c028f39c Mon Sep 17 00:00:00 2001 From: William Calderipe Date: Thu, 8 Feb 2024 12:10:53 +0100 Subject: [PATCH] Refactor @app/authz to use relative import paths --- .eslintrc.json | 3 +- apps/authz/.eslintrc.json | 11 +---- apps/authz/jest.e2e.ts | 2 - apps/authz/jest.integration.ts | 2 - apps/authz/jest.unit.ts | 2 - apps/authz/src/app/__test__/e2e/admin.spec.ts | 12 +++--- .../src/app/__test__/unit/app.service.spec.ts | 4 +- apps/authz/src/app/app.controller.ts | 4 +- apps/authz/src/app/app.module.ts | 8 ++-- apps/authz/src/app/app.service.ts | 6 +-- apps/authz/src/app/core/admin.service.ts | 4 +- apps/authz/src/app/evaluation-request.dto.ts | 4 +- .../http/rest/controller/admin.controller.ts | 42 +++++++++---------- .../http/rest/dto/address-book-account-dto.ts | 2 +- .../rest/dto/assign-user-group-request.dto.ts | 4 +- .../dto/assign-user-group-response.dto.ts | 2 +- .../dto/assign-user-wallet-request.dto.ts | 4 +- .../dto/assign-user-wallet-response.dto.ts | 2 +- .../dto/assign-wallet-group-request.dto.ts | 4 +- .../dto/assign-wallet-group-response.dto.ts | 2 +- .../dto/base-admin-request-payload.dto.ts | 2 +- .../dto/create-address-book-request.dto.ts | 6 +-- .../dto/create-address-book-response.dto.ts | 4 +- .../rest/dto/create-credential-request.dto.ts | 6 +-- .../dto/create-credential-response.dto.ts | 2 +- .../dto/create-organization-request.dto.ts | 6 +-- .../dto/create-organization-response.dto.ts | 6 +-- .../http/rest/dto/create-user-request.dto.ts | 6 +-- .../http/rest/dto/create-user-response.dto.ts | 6 +-- .../app/http/rest/dto/register-token-dto.ts | 2 +- .../rest/dto/register-tokens-request.dto.ts | 6 +-- .../rest/dto/register-tokens-response.dto.ts | 4 +- .../rest/dto/register-wallet-request.dto.ts | 6 +-- .../rest/dto/register-wallet-response.dto.ts | 4 +- .../http/rest/dto/update-user-request.dto.ts | 4 +- .../http/rest/dto/update-user-response.dto.ts | 4 +- apps/authz/src/app/http/rest/dto/user-dto.ts | 2 +- .../authz/src/app/http/rest/dto/wallet-dto.ts | 2 +- apps/authz/src/app/opa/opa.service.ts | 6 +-- .../integration/admin.repository.spec.ts | 8 ++-- .../repository/admin.repository.ts | 4 +- .../app/persistence/repository/mock_data.ts | 18 ++++---- apps/authz/src/opa/template/mockData.ts | 2 +- apps/authz/src/opa/template/script.ts | 2 +- .../module/persistence/persistence.module.ts | 4 +- .../src/shared/module/persistence/seed.ts | 4 +- .../__test__/unit/prisma.service.spec.ts | 2 +- .../persistence/service/prisma.service.ts | 2 +- apps/orchestration/.eslintrc.json | 11 +---- .../authz-shared/src/lib/type/domain.type.ts | 37 +++++++++------- packages/signature-verifier/project.json | 2 +- tsconfig.base.json | 3 +- 52 files changed, 145 insertions(+), 162 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index aa35e0b5d..5f6a588ce 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -1,7 +1,7 @@ { "root": true, "ignorePatterns": ["**/*"], - "plugins": ["@nx", "no-relative-import-paths"], + "plugins": ["@nx"], "overrides": [ { "files": ["*.ts", "*.tsx", "*.js", "*.jsx"], @@ -10,7 +10,6 @@ "error", { "enforceBuildableLibDependency": true, - "allow": ["@app/**", "@narval/**"], "depConstraints": [ { "sourceTag": "*", diff --git a/apps/authz/.eslintrc.json b/apps/authz/.eslintrc.json index 360c3953c..9d9c0db55 100644 --- a/apps/authz/.eslintrc.json +++ b/apps/authz/.eslintrc.json @@ -8,16 +8,7 @@ }, { "files": ["*.ts", "*.tsx"], - "rules": { - "no-relative-import-paths/no-relative-import-paths": [ - "error", - { - "allowSameFolder": true, - "rootDir": "apps", - "prefix": "@app" - } - ] - } + "rules": {} }, { "files": ["*.js", "*.jsx"], diff --git a/apps/authz/jest.e2e.ts b/apps/authz/jest.e2e.ts index 5e65d6150..b7d56d62b 100644 --- a/apps/authz/jest.e2e.ts +++ b/apps/authz/jest.e2e.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-relative-import-paths/no-relative-import-paths */ - import type { Config } from 'jest' import sharedConfig from './jest.config' diff --git a/apps/authz/jest.integration.ts b/apps/authz/jest.integration.ts index 3bd1b8e63..533d40428 100644 --- a/apps/authz/jest.integration.ts +++ b/apps/authz/jest.integration.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-relative-import-paths/no-relative-import-paths */ - import type { Config } from 'jest' import sharedConfig from './jest.config' diff --git a/apps/authz/jest.unit.ts b/apps/authz/jest.unit.ts index f41a2117d..9376919b3 100644 --- a/apps/authz/jest.unit.ts +++ b/apps/authz/jest.unit.ts @@ -1,5 +1,3 @@ -/* eslint-disable no-relative-import-paths/no-relative-import-paths */ - import type { Config } from 'jest' import sharedConfig from './jest.config' diff --git a/apps/authz/src/app/__test__/e2e/admin.spec.ts b/apps/authz/src/app/__test__/e2e/admin.spec.ts index b39b24fab..30962d3be 100644 --- a/apps/authz/src/app/__test__/e2e/admin.spec.ts +++ b/apps/authz/src/app/__test__/e2e/admin.spec.ts @@ -1,14 +1,14 @@ -import { load } from '@app/authz/app/app.config' -import { AppModule } from '@app/authz/app/app.module' -import { AAUser, AAUser_Credential_1 } from '@app/authz/app/persistence/repository/mock_data' -import { PersistenceModule } from '@app/authz/shared/module/persistence/persistence.module' -import { TestPrismaService } from '@app/authz/shared/module/persistence/service/test-prisma.service' -import { Organization } from '@app/authz/shared/types/entities.types' import { AccountClassification, AccountType, Action, Alg, Signature, UserRole } from '@narval/authz-shared' import { HttpStatus, INestApplication } from '@nestjs/common' import { ConfigModule } from '@nestjs/config' import { Test, TestingModule } from '@nestjs/testing' import request from 'supertest' +import { AppModule } from '../../../app/app.module' +import { AAUser, AAUser_Credential_1 } from '../../../app/persistence/repository/mock_data' +import { PersistenceModule } from '../../../shared/module/persistence/persistence.module' +import { TestPrismaService } from '../../../shared/module/persistence/service/test-prisma.service' +import { Organization } from '../../../shared/types/entities.types' +import { load } from '../../app.config' const REQUEST_HEADER_ORG_ID = 'x-org-id' describe('Admin Endpoints', () => { diff --git a/apps/authz/src/app/__test__/unit/app.service.spec.ts b/apps/authz/src/app/__test__/unit/app.service.spec.ts index 6bf6a70a4..82d2051bb 100644 --- a/apps/authz/src/app/__test__/unit/app.service.spec.ts +++ b/apps/authz/src/app/__test__/unit/app.service.spec.ts @@ -1,6 +1,6 @@ -import { finalizeDecision } from '@app/authz/app/app.service' -import { OpaResult } from '@app/authz/shared/types/rego' import { Decision, EntityType } from '@narval/authz-shared' +import { OpaResult } from '../../../shared/types/rego' +import { finalizeDecision } from '../../app.service' describe('finalizeDecision', () => { it('returns Forbid if any of the reasons is Forbid', () => { diff --git a/apps/authz/src/app/app.controller.ts b/apps/authz/src/app/app.controller.ts index bf22c55bb..ebe2ba492 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/app/persistence/repository/mock_data' import { EvaluationRequest } from '@narval/authz-shared' import { Body, Controller, Get, Logger, Post } from '@nestjs/common' +import { generateInboundRequest } from '../app/persistence/repository/mock_data' import { AppService } from './app.service' +import { EvaluationRequestDto } from './evaluation-request.dto' @Controller() export class AppController { diff --git a/apps/authz/src/app/app.module.ts b/apps/authz/src/app/app.module.ts index 5c9ef0bdb..e16e91047 100644 --- a/apps/authz/src/app/app.module.ts +++ b/apps/authz/src/app/app.module.ts @@ -1,14 +1,14 @@ -import { AdminService } from '@app/authz/app/core/admin.service' -import { AdminController } from '@app/authz/app/http/rest/controller/admin.controller' -import { AdminRepository } from '@app/authz/app/persistence/repository/admin.repository' -import { PersistenceModule } from '@app/authz/shared/module/persistence/persistence.module' import { Module, ValidationPipe } from '@nestjs/common' import { ConfigModule } from '@nestjs/config' import { APP_PIPE } from '@nestjs/core' +import { PersistenceModule } from '../shared/module/persistence/persistence.module' import { load } from './app.config' import { AppController } from './app.controller' import { AppService } from './app.service' +import { AdminService } from './core/admin.service' +import { AdminController } from './http/rest/controller/admin.controller' import { OpaService } from './opa/opa.service' +import { AdminRepository } from './persistence/repository/admin.repository' @Module({ imports: [ diff --git a/apps/authz/src/app/app.service.ts b/apps/authz/src/app/app.service.ts index da11ef8e3..62e3123d1 100644 --- a/apps/authz/src/app/app.service.ts +++ b/apps/authz/src/app/app.service.ts @@ -1,5 +1,3 @@ -import { AdminRepository } from '@app/authz/app/persistence/repository/admin.repository' -import { OpaResult, RegoInput } from '@app/authz/shared/types/domain.type' import { Action, Alg, @@ -18,6 +16,8 @@ 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 { AdminRepository } from '../app/persistence/repository/admin.repository' +import { OpaResult, RegoInput } from '../shared/types/domain.type' import { OpaService } from './opa/opa.service' const ENGINE_PRIVATE_KEY = '0x7cfef3303797cbc7515d9ce22ffe849c701b0f2812f999b0847229c47951fca5' @@ -189,7 +189,7 @@ export class AppService { const authzResponse: EvaluationResponse = { decision: finalDecision.decision, request, - transactionRequestIntent: intent, + // transactionRequestIntent: intent, approvals: finalDecision.totalApprovalsRequired?.length ? { required: finalDecision.totalApprovalsRequired, diff --git a/apps/authz/src/app/core/admin.service.ts b/apps/authz/src/app/core/admin.service.ts index e26546a27..64ee35758 100644 --- a/apps/authz/src/app/core/admin.service.ts +++ b/apps/authz/src/app/core/admin.service.ts @@ -1,5 +1,3 @@ -import { AdminRepository } from '@app/authz/app/persistence/repository/admin.repository' -import { AddressBookAccount, Organization, Token, User, Wallet } from '@app/authz/shared/types/entities.types' import { AssignUserGroupRequest, AssignUserWalletRequest, @@ -17,6 +15,8 @@ import { WalletGroupMembership } from '@narval/authz-shared' import { Injectable } from '@nestjs/common' +import { AddressBookAccount, Organization, Token, User, Wallet } from '../../shared/types/entities.types' +import { AdminRepository } from '../persistence/repository/admin.repository' @Injectable() export class AdminService { diff --git a/apps/authz/src/app/evaluation-request.dto.ts b/apps/authz/src/app/evaluation-request.dto.ts index e349cff9d..171442e28 100644 --- a/apps/authz/src/app/evaluation-request.dto.ts +++ b/apps/authz/src/app/evaluation-request.dto.ts @@ -1,9 +1,9 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { RequestSignatureDto } from '@app/authz/app/http/rest/dto/request-signature.dto' import { AccessList, AccountId, Action, Address, FiatCurrency, Hex } from '@narval/authz-shared' import { ApiExtraModels, ApiProperty, getSchemaPath } from '@nestjs/swagger' import { Transform, Type } from 'class-transformer' import { IsDefined, IsEthereumAddress, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator' +import { BaseActionDto } from './http/rest/dto/base-action.dto' +import { RequestSignatureDto } from './http/rest/dto/request-signature.dto' export class TransactionRequestDto { @IsString() diff --git a/apps/authz/src/app/http/rest/controller/admin.controller.ts b/apps/authz/src/app/http/rest/controller/admin.controller.ts index 75d974e23..f4f3154ae 100644 --- a/apps/authz/src/app/http/rest/controller/admin.controller.ts +++ b/apps/authz/src/app/http/rest/controller/admin.controller.ts @@ -1,24 +1,3 @@ -import { AdminService } from '@app/authz/app/core/admin.service' -import { AssignUserGroupRequestDto } from '@app/authz/app/http/rest/dto/assign-user-group-request.dto' -import { AssignUserGroupResponseDto } from '@app/authz/app/http/rest/dto/assign-user-group-response.dto' -import { AssignUserWalletRequestDto } from '@app/authz/app/http/rest/dto/assign-user-wallet-request.dto' -import { AssignUserWalletResponseDto } from '@app/authz/app/http/rest/dto/assign-user-wallet-response.dto' -import { AssignWalletGroupRequestDto } from '@app/authz/app/http/rest/dto/assign-wallet-group-request.dto' -import { AssignWalletGroupResponseDto } from '@app/authz/app/http/rest/dto/assign-wallet-group-response.dto' -import { CreateAddressBookAccountRequestDto } from '@app/authz/app/http/rest/dto/create-address-book-request.dto' -import { CreateAddressBookAccountResponseDto } from '@app/authz/app/http/rest/dto/create-address-book-response.dto' -import { CreateCredentialRequestDto } from '@app/authz/app/http/rest/dto/create-credential-request.dto' -import { CreateCredentialResponseDto } from '@app/authz/app/http/rest/dto/create-credential-response.dto' -import { CreateOrganizationRequestDto } from '@app/authz/app/http/rest/dto/create-organization-request.dto' -import { CreateOrganizationResponseDto } from '@app/authz/app/http/rest/dto/create-organization-response.dto' -import { CreateUserRequestDto } from '@app/authz/app/http/rest/dto/create-user-request.dto' -import { CreateUserResponseDto } from '@app/authz/app/http/rest/dto/create-user-response.dto' -import { RegisterTokensRequestDto } from '@app/authz/app/http/rest/dto/register-tokens-request.dto' -import { RegisterTokensResponseDto } from '@app/authz/app/http/rest/dto/register-tokens-response.dto' -import { RegisterWalletRequestDto } from '@app/authz/app/http/rest/dto/register-wallet-request.dto' -import { RegisterWalletResponseDto } from '@app/authz/app/http/rest/dto/register-wallet-response.dto' -import { UpdateUserRequestDto } from '@app/authz/app/http/rest/dto/update-user-request.dto' -import { UpdateUserResponseDto } from '@app/authz/app/http/rest/dto/update-user-response.dto' import { AssignUserGroupRequest, AssignUserWalletRequest, @@ -32,6 +11,27 @@ import { UpdateUserRequest } from '@narval/authz-shared' import { Body, Controller, Logger, Patch, Post } from '@nestjs/common' +import { AdminService } from '../../../core/admin.service' +import { AssignUserGroupRequestDto } from '../dto/assign-user-group-request.dto' +import { AssignUserGroupResponseDto } from '../dto/assign-user-group-response.dto' +import { AssignUserWalletRequestDto } from '../dto/assign-user-wallet-request.dto' +import { AssignUserWalletResponseDto } from '../dto/assign-user-wallet-response.dto' +import { AssignWalletGroupRequestDto } from '../dto/assign-wallet-group-request.dto' +import { AssignWalletGroupResponseDto } from '../dto/assign-wallet-group-response.dto' +import { CreateAddressBookAccountRequestDto } from '../dto/create-address-book-request.dto' +import { CreateAddressBookAccountResponseDto } from '../dto/create-address-book-response.dto' +import { CreateCredentialRequestDto } from '../dto/create-credential-request.dto' +import { CreateCredentialResponseDto } from '../dto/create-credential-response.dto' +import { CreateOrganizationRequestDto } from '../dto/create-organization-request.dto' +import { CreateOrganizationResponseDto } from '../dto/create-organization-response.dto' +import { CreateUserRequestDto } from '../dto/create-user-request.dto' +import { CreateUserResponseDto } from '../dto/create-user-response.dto' +import { RegisterTokensRequestDto } from '../dto/register-tokens-request.dto' +import { RegisterTokensResponseDto } from '../dto/register-tokens-response.dto' +import { RegisterWalletRequestDto } from '../dto/register-wallet-request.dto' +import { RegisterWalletResponseDto } from '../dto/register-wallet-response.dto' +import { UpdateUserRequestDto } from '../dto/update-user-request.dto' +import { UpdateUserResponseDto } from '../dto/update-user-response.dto' @Controller('/admin') export class AdminController { diff --git a/apps/authz/src/app/http/rest/dto/address-book-account-dto.ts b/apps/authz/src/app/http/rest/dto/address-book-account-dto.ts index 7b7f79e17..446c4038d 100644 --- a/apps/authz/src/app/http/rest/dto/address-book-account-dto.ts +++ b/apps/authz/src/app/http/rest/dto/address-book-account-dto.ts @@ -1,7 +1,7 @@ -import { AddressBookAccount } from '@app/authz/shared/types/entities.types' import { AccountClassification, Address } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsNumber, IsString } from 'class-validator' +import { AddressBookAccount } from '../../../../shared/types/entities.types' export class AddressBookAccountDataDto { constructor(addressBookAccount: AddressBookAccount) { diff --git a/apps/authz/src/app/http/rest/dto/assign-user-group-request.dto.ts b/apps/authz/src/app/http/rest/dto/assign-user-group-request.dto.ts index d8e0cc497..61e6ec9d5 100644 --- a/apps/authz/src/app/http/rest/dto/assign-user-group-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-user-group-request.dto.ts @@ -1,8 +1,8 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action, UserGroupMembership } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class AssignUserGroupActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/assign-user-group-response.dto.ts b/apps/authz/src/app/http/rest/dto/assign-user-group-response.dto.ts index a37f3466f..55191078a 100644 --- a/apps/authz/src/app/http/rest/dto/assign-user-group-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-user-group-response.dto.ts @@ -1,7 +1,7 @@ -import { UserGroupMembershipDto } from '@app/authz/app/http/rest/dto/user-group-membership.dto' import { UserGroupMembership } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { UserGroupMembershipDto } from './user-group-membership.dto' export class AssignUserGroupResponseDto { constructor(userGroup: UserGroupMembership) { diff --git a/apps/authz/src/app/http/rest/dto/assign-user-wallet-request.dto.ts b/apps/authz/src/app/http/rest/dto/assign-user-wallet-request.dto.ts index ddcd29017..6394b3d78 100644 --- a/apps/authz/src/app/http/rest/dto/assign-user-wallet-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-user-wallet-request.dto.ts @@ -1,8 +1,8 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action, UserWallet } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class AssignUserWalletActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/assign-user-wallet-response.dto.ts b/apps/authz/src/app/http/rest/dto/assign-user-wallet-response.dto.ts index d2823d171..134296da3 100644 --- a/apps/authz/src/app/http/rest/dto/assign-user-wallet-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-user-wallet-response.dto.ts @@ -1,7 +1,7 @@ -import { UserWalletDto } from '@app/authz/app/http/rest/dto/user-wallet.dto' import { UserWallet } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { UserWalletDto } from './user-wallet.dto' export class AssignUserWalletResponseDto { constructor(userWallet: UserWallet) { diff --git a/apps/authz/src/app/http/rest/dto/assign-wallet-group-request.dto.ts b/apps/authz/src/app/http/rest/dto/assign-wallet-group-request.dto.ts index cc8bbc6b5..3697a133d 100644 --- a/apps/authz/src/app/http/rest/dto/assign-wallet-group-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-wallet-group-request.dto.ts @@ -1,8 +1,8 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action, WalletGroupMembership } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class AssignWalletGroupActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/assign-wallet-group-response.dto.ts b/apps/authz/src/app/http/rest/dto/assign-wallet-group-response.dto.ts index 1024e9581..6b91e564a 100644 --- a/apps/authz/src/app/http/rest/dto/assign-wallet-group-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/assign-wallet-group-response.dto.ts @@ -1,7 +1,7 @@ -import { WalletGroupMembershipDto } from '@app/authz/app/http/rest/dto/wallet-group-membership.dto' import { WalletGroupMembership } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { WalletGroupMembershipDto } from './wallet-group-membership.dto' export class AssignWalletGroupResponseDto { constructor(walletGroup: WalletGroupMembership) { diff --git a/apps/authz/src/app/http/rest/dto/base-admin-request-payload.dto.ts b/apps/authz/src/app/http/rest/dto/base-admin-request-payload.dto.ts index ece3f613f..bd91342d6 100644 --- a/apps/authz/src/app/http/rest/dto/base-admin-request-payload.dto.ts +++ b/apps/authz/src/app/http/rest/dto/base-admin-request-payload.dto.ts @@ -1,6 +1,6 @@ -import { RequestSignatureDto } from '@app/authz/app/http/rest/dto/request-signature.dto' import { ApiExtraModels, ApiProperty } from '@nestjs/swagger' import { ArrayNotEmpty, IsDefined, ValidateNested } from 'class-validator' +import { RequestSignatureDto } from './request-signature.dto' @ApiExtraModels(RequestSignatureDto) export class BaseAdminRequestPayloadDto { diff --git a/apps/authz/src/app/http/rest/dto/create-address-book-request.dto.ts b/apps/authz/src/app/http/rest/dto/create-address-book-request.dto.ts index 29965bc95..daf4ee6a5 100644 --- a/apps/authz/src/app/http/rest/dto/create-address-book-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-address-book-request.dto.ts @@ -1,9 +1,9 @@ -import { AddressBookAccountDataDto } from '@app/authz/app/http/rest/dto/address-book-account-dto' -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { AddressBookAccountDataDto } from './address-book-account-dto' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class CreateAddressBookAccountActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/create-address-book-response.dto.ts b/apps/authz/src/app/http/rest/dto/create-address-book-response.dto.ts index b50fed536..a72cbb2f6 100644 --- a/apps/authz/src/app/http/rest/dto/create-address-book-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-address-book-response.dto.ts @@ -1,7 +1,7 @@ -import { AddressBookAccountDataDto } from '@app/authz/app/http/rest/dto/address-book-account-dto' -import { AddressBookAccount } from '@app/authz/shared/types/entities.types' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { AddressBookAccount } from '../../../../shared/types/entities.types' +import { AddressBookAccountDataDto } from './address-book-account-dto' export class CreateAddressBookAccountResponseDto { constructor(account: AddressBookAccount) { diff --git a/apps/authz/src/app/http/rest/dto/create-credential-request.dto.ts b/apps/authz/src/app/http/rest/dto/create-credential-request.dto.ts index d71efebf9..7ea96ecb0 100644 --- a/apps/authz/src/app/http/rest/dto/create-credential-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-credential-request.dto.ts @@ -1,9 +1,9 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { AuthCredentialDto } from './auth-credential.dto' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class CreateCredentialActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/create-credential-response.dto.ts b/apps/authz/src/app/http/rest/dto/create-credential-response.dto.ts index c355be2b0..50913a550 100644 --- a/apps/authz/src/app/http/rest/dto/create-credential-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-credential-response.dto.ts @@ -1,7 +1,7 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' import { AuthCredential } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { AuthCredentialDto } from './auth-credential.dto' export class CreateCredentialResponseDto { constructor(authCredential: AuthCredential) { diff --git a/apps/authz/src/app/http/rest/dto/create-organization-request.dto.ts b/apps/authz/src/app/http/rest/dto/create-organization-request.dto.ts index b51ac21fc..bea8a45af 100644 --- a/apps/authz/src/app/http/rest/dto/create-organization-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-organization-request.dto.ts @@ -1,9 +1,9 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsString, ValidateNested } from 'class-validator' +import { AuthCredentialDto } from './auth-credential.dto' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class CreateOrganizationDataDto { @IsString() diff --git a/apps/authz/src/app/http/rest/dto/create-organization-response.dto.ts b/apps/authz/src/app/http/rest/dto/create-organization-response.dto.ts index 4d98e7f65..cfc6b8f79 100644 --- a/apps/authz/src/app/http/rest/dto/create-organization-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-organization-response.dto.ts @@ -1,9 +1,9 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' -import { UserDto } from '@app/authz/app/http/rest/dto/user-dto' -import { Organization, User } from '@app/authz/shared/types/entities.types' import { AuthCredential } from '@narval/authz-shared' import { ApiExtraModels, ApiProperty } from '@nestjs/swagger' import { IsDefined, IsString, ValidateNested } from 'class-validator' +import { Organization, User } from '../../../../shared/types/entities.types' +import { AuthCredentialDto } from './auth-credential.dto' +import { UserDto } from './user-dto' class OrganizationDataDto { @IsString() diff --git a/apps/authz/src/app/http/rest/dto/create-user-request.dto.ts b/apps/authz/src/app/http/rest/dto/create-user-request.dto.ts index 7d95298bd..a6230b8b3 100644 --- a/apps/authz/src/app/http/rest/dto/create-user-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-user-request.dto.ts @@ -1,9 +1,9 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action, UserRole } from '@narval/authz-shared' import { ApiExtraModels, ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsOptional, IsString, ValidateNested } from 'class-validator' +import { AuthCredentialDto } from './auth-credential.dto' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class CreateUserDataDto { @IsString() diff --git a/apps/authz/src/app/http/rest/dto/create-user-response.dto.ts b/apps/authz/src/app/http/rest/dto/create-user-response.dto.ts index eeb8097a2..960b1b9a3 100644 --- a/apps/authz/src/app/http/rest/dto/create-user-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/create-user-response.dto.ts @@ -1,8 +1,8 @@ -import { AuthCredentialDto } from '@app/authz/app/http/rest/dto/auth-credential.dto' -import { UserDto } from '@app/authz/app/http/rest/dto/user-dto' -import { User } from '@app/authz/shared/types/entities.types' import { ApiExtraModels, ApiProperty } from '@nestjs/swagger' import { IsDefined, IsString, ValidateNested } from 'class-validator' +import { User } from '../../../../shared/types/entities.types' +import { AuthCredentialDto } from './auth-credential.dto' +import { UserDto } from './user-dto' class OrganizationDataDto { @IsString() diff --git a/apps/authz/src/app/http/rest/dto/register-token-dto.ts b/apps/authz/src/app/http/rest/dto/register-token-dto.ts index f814ba431..c8b42e418 100644 --- a/apps/authz/src/app/http/rest/dto/register-token-dto.ts +++ b/apps/authz/src/app/http/rest/dto/register-token-dto.ts @@ -1,7 +1,7 @@ -import { Token } from '@app/authz/shared/types/entities.types' import { Address } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsNumber, IsString } from 'class-validator' +import { Token } from '../../../../shared/types/entities.types' export class TokenDataDto { constructor(token: Token) { diff --git a/apps/authz/src/app/http/rest/dto/register-tokens-request.dto.ts b/apps/authz/src/app/http/rest/dto/register-tokens-request.dto.ts index 7ec91e4ec..0f4c999c6 100644 --- a/apps/authz/src/app/http/rest/dto/register-tokens-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/register-tokens-request.dto.ts @@ -1,9 +1,9 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' -import { TokenDataDto } from '@app/authz/app/http/rest/dto/register-token-dto' import { Action } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsArray, IsDefined, IsIn, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' +import { TokenDataDto } from './register-token-dto' class RegisterTokensActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/register-tokens-response.dto.ts b/apps/authz/src/app/http/rest/dto/register-tokens-response.dto.ts index 8467cf09b..016863d69 100644 --- a/apps/authz/src/app/http/rest/dto/register-tokens-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/register-tokens-response.dto.ts @@ -1,7 +1,7 @@ -import { TokenDataDto } from '@app/authz/app/http/rest/dto/register-token-dto' -import { Token } from '@app/authz/shared/types/entities.types' import { ApiProperty } from '@nestjs/swagger' import { IsArray, IsDefined, ValidateNested } from 'class-validator' +import { Token } from '../../../../shared/types/entities.types' +import { TokenDataDto } from './register-token-dto' export class RegisterTokensResponseDto { constructor(tokens: Token[]) { diff --git a/apps/authz/src/app/http/rest/dto/register-wallet-request.dto.ts b/apps/authz/src/app/http/rest/dto/register-wallet-request.dto.ts index c41d52b41..255d66ba7 100644 --- a/apps/authz/src/app/http/rest/dto/register-wallet-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/register-wallet-request.dto.ts @@ -1,9 +1,9 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' -import { WalletDataDto } from '@app/authz/app/http/rest/dto/wallet-dto' import { Action } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' +import { WalletDataDto } from './wallet-dto' class RegisterWalletActionDto extends BaseActionDto { @IsIn(Object.values(Action)) diff --git a/apps/authz/src/app/http/rest/dto/register-wallet-response.dto.ts b/apps/authz/src/app/http/rest/dto/register-wallet-response.dto.ts index 173b7510a..fba910197 100644 --- a/apps/authz/src/app/http/rest/dto/register-wallet-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/register-wallet-response.dto.ts @@ -1,7 +1,7 @@ -import { WalletDataDto } from '@app/authz/app/http/rest/dto/wallet-dto' -import { Wallet } from '@app/authz/shared/types/entities.types' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { Wallet } from '../../../../shared/types/entities.types' +import { WalletDataDto } from './wallet-dto' export class RegisterWalletResponseDto { constructor(wallet: Wallet) { diff --git a/apps/authz/src/app/http/rest/dto/update-user-request.dto.ts b/apps/authz/src/app/http/rest/dto/update-user-request.dto.ts index 373a2abc2..7b17d9809 100644 --- a/apps/authz/src/app/http/rest/dto/update-user-request.dto.ts +++ b/apps/authz/src/app/http/rest/dto/update-user-request.dto.ts @@ -1,8 +1,8 @@ -import { BaseActionDto } from '@app/authz/app/http/rest/dto/base-action.dto' -import { BaseAdminRequestPayloadDto } from '@app/authz/app/http/rest/dto/base-admin-request-payload.dto' import { Action, UserRole } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsString, ValidateNested } from 'class-validator' +import { BaseActionDto } from './base-action.dto' +import { BaseAdminRequestPayloadDto } from './base-admin-request-payload.dto' class UpdateUserDataDto { @IsString() diff --git a/apps/authz/src/app/http/rest/dto/update-user-response.dto.ts b/apps/authz/src/app/http/rest/dto/update-user-response.dto.ts index 31e6543ff..aeb4559c6 100644 --- a/apps/authz/src/app/http/rest/dto/update-user-response.dto.ts +++ b/apps/authz/src/app/http/rest/dto/update-user-response.dto.ts @@ -1,7 +1,7 @@ -import { UserDto } from '@app/authz/app/http/rest/dto/user-dto' -import { User } from '@app/authz/shared/types/entities.types' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, ValidateNested } from 'class-validator' +import { User } from '../../../../shared/types/entities.types' +import { UserDto } from './user-dto' export class UpdateUserResponseDto { constructor(user: User) { diff --git a/apps/authz/src/app/http/rest/dto/user-dto.ts b/apps/authz/src/app/http/rest/dto/user-dto.ts index b9cc987a4..6f9fdf497 100644 --- a/apps/authz/src/app/http/rest/dto/user-dto.ts +++ b/apps/authz/src/app/http/rest/dto/user-dto.ts @@ -1,7 +1,7 @@ -import { User } from '@app/authz/shared/types/entities.types' import { UserRole } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsString } from 'class-validator' +import { User } from '../../../../shared/types/entities.types' export class UserDto { constructor(user: User) { diff --git a/apps/authz/src/app/http/rest/dto/wallet-dto.ts b/apps/authz/src/app/http/rest/dto/wallet-dto.ts index 2a6d6d26d..32bfb6cb2 100644 --- a/apps/authz/src/app/http/rest/dto/wallet-dto.ts +++ b/apps/authz/src/app/http/rest/dto/wallet-dto.ts @@ -1,7 +1,7 @@ -import { Wallet } from '@app/authz/shared/types/entities.types' import { AccountType, Address } from '@narval/authz-shared' import { ApiProperty } from '@nestjs/swagger' import { IsDefined, IsIn, IsNumber, IsOptional, IsString } from 'class-validator' +import { Wallet } from '../../../../shared/types/entities.types' export class WalletDataDto { constructor(wallet: Wallet) { diff --git a/apps/authz/src/app/opa/opa.service.ts b/apps/authz/src/app/opa/opa.service.ts index de8cae313..a7a50ffe9 100644 --- a/apps/authz/src/app/opa/opa.service.ts +++ b/apps/authz/src/app/opa/opa.service.ts @@ -1,11 +1,11 @@ -import { AdminRepository } from '@app/authz/app/persistence/repository/admin.repository' -import { RegoData, User, UserGroup, WalletGroup } from '@app/authz/shared/types/entities.types' -import { OpaResult, RegoInput } from '@app/authz/shared/types/rego' import { Injectable, Logger, OnApplicationBootstrap } from '@nestjs/common' import { loadPolicy } from '@open-policy-agent/opa-wasm' import { readFileSync } from 'fs' import path from 'path' import * as R from 'remeda' +import { RegoData, User, UserGroup, WalletGroup } from '../../shared/types/entities.types' +import { OpaResult, RegoInput } from '../../shared/types/rego' +import { AdminRepository } from '../persistence/repository/admin.repository' type PromiseType> = T extends Promise ? U : never type OpaEngine = PromiseType> diff --git a/apps/authz/src/app/persistence/repository/__test__/integration/admin.repository.spec.ts b/apps/authz/src/app/persistence/repository/__test__/integration/admin.repository.spec.ts index 9174679e0..c39405a6b 100644 --- a/apps/authz/src/app/persistence/repository/__test__/integration/admin.repository.spec.ts +++ b/apps/authz/src/app/persistence/repository/__test__/integration/admin.repository.spec.ts @@ -1,10 +1,10 @@ -import { load } from '@app/authz/app/app.config' -import { AdminRepository } from '@app/authz/app/persistence/repository/admin.repository' -import { PersistenceModule } from '@app/authz/shared/module/persistence/persistence.module' -import { TestPrismaService } from '@app/authz/shared/module/persistence/service/test-prisma.service' import { Alg, UserRole } from '@narval/authz-shared' import { ConfigModule, ConfigService } from '@nestjs/config' import { Test, TestingModule } from '@nestjs/testing' +import { load } from '../../../../../app/app.config' +import { AdminRepository } from '../../../../../app/persistence/repository/admin.repository' +import { PersistenceModule } from '../../../../../shared/module/persistence/persistence.module' +import { TestPrismaService } from '../../../../../shared/module/persistence/service/test-prisma.service' describe(AdminRepository.name, () => { let module: TestingModule diff --git a/apps/authz/src/app/persistence/repository/admin.repository.ts b/apps/authz/src/app/persistence/repository/admin.repository.ts index 4a049f62d..3e5d7038c 100644 --- a/apps/authz/src/app/persistence/repository/admin.repository.ts +++ b/apps/authz/src/app/persistence/repository/admin.repository.ts @@ -1,8 +1,8 @@ -import { PrismaService } from '@app/authz/shared/module/persistence/service/prisma.service' -import { AddressBookAccount, Organization, RegoData, Token, User, Wallet } from '@app/authz/shared/types/entities.types' import { AccountClassification, AccountType, Address, Alg, AuthCredential, UserRole } from '@narval/authz-shared' import { Injectable, Logger, OnModuleInit } from '@nestjs/common' import { castArray } from 'lodash/fp' +import { PrismaService } from '../../../shared/module/persistence/service/prisma.service' +import { AddressBookAccount, Organization, RegoData, Token, User, Wallet } from '../../../shared/types/entities.types' import { mockEntityData, userAddressStore, userCredentialStore } from './mock_data' function convertResponse( diff --git a/apps/authz/src/app/persistence/repository/mock_data.ts b/apps/authz/src/app/persistence/repository/mock_data.ts index 2ba7f87b3..c376fdef7 100644 --- a/apps/authz/src/app/persistence/repository/mock_data.ts +++ b/apps/authz/src/app/persistence/repository/mock_data.ts @@ -1,12 +1,3 @@ -import { RegoInput } from '@app/authz/shared/types/domain.type' -import { - AddressBookAccount, - RegoData, - User, - UserGroup, - Wallet, - WalletGroup -} from '@app/authz/shared/types/entities.types' import { AccountClassification, AccountId, @@ -25,6 +16,15 @@ import { Intents } from 'packages/transaction-request-intent/src/lib/domain' import { TransferNative } from 'packages/transaction-request-intent/src/lib/intent.types' import { Address, sha256, toHex } from 'viem' import { privateKeyToAccount } from 'viem/accounts' +import { RegoInput } from '../../../shared/types/domain.type' +import { + AddressBookAccount, + RegoData, + User, + UserGroup, + Wallet, + WalletGroup +} from '../../../shared/types/entities.types' export const ONE_ETH = BigInt('1000000000000000000') diff --git a/apps/authz/src/opa/template/mockData.ts b/apps/authz/src/opa/template/mockData.ts index 8a679871a..cd2e2b728 100644 --- a/apps/authz/src/opa/template/mockData.ts +++ b/apps/authz/src/opa/template/mockData.ts @@ -1,6 +1,6 @@ -import { Criterion, PolicyCriterionBuilder, Then } from '@app/authz/shared/types/policy-builder.type' import { Action } from '@narval/authz-shared' import { Intents } from '@narval/transaction-request-intent' +import { Criterion, PolicyCriterionBuilder, Then } from '../../shared/types/policy-builder.type' export const examplePermitPolicy: PolicyCriterionBuilder = { then: Then.PERMIT, diff --git a/apps/authz/src/opa/template/script.ts b/apps/authz/src/opa/template/script.ts index 3ee5b953c..1fb7884d4 100644 --- a/apps/authz/src/opa/template/script.ts +++ b/apps/authz/src/opa/template/script.ts @@ -1,7 +1,7 @@ -import { Criterion, Then } from '@app/authz/shared/types/policy-builder.type' import { readFileSync, writeFileSync } from 'fs' import Handlebars from 'handlebars' import { isEmpty } from 'lodash' +import { Criterion, Then } from '../../shared/types/policy-builder.type' import { policies } from './mockData' Handlebars.registerHelper('criterion', function (item) { diff --git a/apps/authz/src/shared/module/persistence/persistence.module.ts b/apps/authz/src/shared/module/persistence/persistence.module.ts index 6fdf19ecf..95d5dcd4c 100644 --- a/apps/authz/src/shared/module/persistence/persistence.module.ts +++ b/apps/authz/src/shared/module/persistence/persistence.module.ts @@ -1,6 +1,6 @@ -import { PrismaService } from '@app/authz/shared/module/persistence/service/prisma.service' -import { TestPrismaService } from '@app/authz/shared/module/persistence/service/test-prisma.service' import { Module } from '@nestjs/common' +import { PrismaService } from './service/prisma.service' +import { TestPrismaService } from './service/test-prisma.service' @Module({ exports: [PrismaService, TestPrismaService], diff --git a/apps/authz/src/shared/module/persistence/seed.ts b/apps/authz/src/shared/module/persistence/seed.ts index 1bb961ea1..ebd0fb76d 100644 --- a/apps/authz/src/shared/module/persistence/seed.ts +++ b/apps/authz/src/shared/module/persistence/seed.ts @@ -1,7 +1,7 @@ -import { mockEntityData } from '@app/authz/app/persistence/repository/mock_data' -import { User } from '@app/authz/shared/types/entities.types' import { Logger } from '@nestjs/common' import { Organization, PrismaClient } from '@prisma/client/authz' +import { mockEntityData } from '../../../app/persistence/repository/mock_data' +import { User } from '../../../shared/types/entities.types' const prisma = new PrismaClient() diff --git a/apps/authz/src/shared/module/persistence/service/__test__/unit/prisma.service.spec.ts b/apps/authz/src/shared/module/persistence/service/__test__/unit/prisma.service.spec.ts index c5f079084..7524813da 100644 --- a/apps/authz/src/shared/module/persistence/service/__test__/unit/prisma.service.spec.ts +++ b/apps/authz/src/shared/module/persistence/service/__test__/unit/prisma.service.spec.ts @@ -1,6 +1,6 @@ -import { PrismaService } from '@app/authz/shared/module/persistence/service/prisma.service' import { ConfigService } from '@nestjs/config' import { mock } from 'jest-mock-extended' +import { PrismaService } from '../../prisma.service' describe(PrismaService.name, () => { describe('constructor', () => { diff --git a/apps/authz/src/shared/module/persistence/service/prisma.service.ts b/apps/authz/src/shared/module/persistence/service/prisma.service.ts index d830e73a1..db1c6a955 100644 --- a/apps/authz/src/shared/module/persistence/service/prisma.service.ts +++ b/apps/authz/src/shared/module/persistence/service/prisma.service.ts @@ -1,7 +1,7 @@ -import { Config } from '@app/authz/app/app.config' import { Inject, Injectable, Logger, OnApplicationShutdown, OnModuleDestroy, OnModuleInit } from '@nestjs/common' import { ConfigService } from '@nestjs/config' import { PrismaClient } from '@prisma/client/authz' +import { Config } from '../../../../app/app.config' @Injectable() export class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy, OnApplicationShutdown { diff --git a/apps/orchestration/.eslintrc.json b/apps/orchestration/.eslintrc.json index 360c3953c..9d9c0db55 100644 --- a/apps/orchestration/.eslintrc.json +++ b/apps/orchestration/.eslintrc.json @@ -8,16 +8,7 @@ }, { "files": ["*.ts", "*.tsx"], - "rules": { - "no-relative-import-paths/no-relative-import-paths": [ - "error", - { - "allowSameFolder": true, - "rootDir": "apps", - "prefix": "@app" - } - ] - } + "rules": {} }, { "files": ["*.js", "*.jsx"], diff --git a/packages/authz-shared/src/lib/type/domain.type.ts b/packages/authz-shared/src/lib/type/domain.type.ts index 0f9bdbee1..d8cd8d535 100644 --- a/packages/authz-shared/src/lib/type/domain.type.ts +++ b/packages/authz-shared/src/lib/type/domain.type.ts @@ -1,11 +1,5 @@ -import { - AssetId, - CreateOrganizationAction, - SignMessageAction, - SignTransactionAction, - Signature -} from '@narval/authz-shared' -import { Intent } from '@narval/transaction-request-intent' +import { AssetId } from '../util/caip.util' +import { CreateOrganizationAction, SignMessageAction, SignTransactionAction, Signature } from './action.type' export enum Decision { PERMIT = 'Permit', @@ -34,14 +28,30 @@ export enum FiatCurrency { } export type HistoricalTransfer = { - amount: string // Amount in the smallest unit of the token (eg. wei for ETH) + /** + * Amount in the smallest unit of the token (eg. wei for ETH). + */ + amount: string from: string - to: string // In case we want spending limit per destination address + /** + * In case we want spending limit per destination address + */ + to: string chainId: number token: string - rates: Record // eg. { fiat:usd: '0.01', fiat:eur: '0.02' } - initiatedBy: string // uid of the user who initiated the spending - timestamp: number // unix timestamp in ms + /** + * @example + * { fiat:usd: '0.01', fiat:eur: '0.02' } + */ + rates: Record + /** + * UID of the user who initiated the transfer. + */ + initiatedBy: string + /** + * Unix timestamp in milliseconds. + */ + timestamp: number } /** @@ -137,5 +147,4 @@ export type EvaluationResponse = { satisfied: ApprovalRequirement[] } attestation?: Signature - transactionRequestIntent?: Intent } diff --git a/packages/signature-verifier/project.json b/packages/signature-verifier/project.json index 7b23a4e22..64e8d1776 100644 --- a/packages/signature-verifier/project.json +++ b/packages/signature-verifier/project.json @@ -20,5 +20,5 @@ } } }, - "tags": [] + "tags": ["package"] } diff --git a/tsconfig.base.json b/tsconfig.base.json index 0a5f1fd91..b18c3ba51 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -13,8 +13,7 @@ "noImplicitAny": true, "noImplicitThis": true, "paths": { - "@app/authz/*": ["apps/authz/src/*"], - "@app/orchestration/*": ["apps/orchestration/src/*"], + "@app/*": ["apps/*"], "@narval/authz-shared": ["packages/authz-shared/src/index.ts"], "@narval/signature-verifier": ["packages/signature-verifier/src/index.ts"], "@narval/transaction-engine-module": ["packages/transaction-engine-module/src/index.ts"],