Skip to content

Commit

Permalink
Rename policy engine module to orchestration
Browse files Browse the repository at this point in the history
  • Loading branch information
wcalderipe committed Feb 20, 2024
1 parent 5c3f631 commit 829edd5
Show file tree
Hide file tree
Showing 62 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { Decision, Signature, TransactionRequest } from '@narval/authz-shared'
import { AuthorizationRequestStatus } from '@prisma/client/armory'
import { z } from 'zod'
import { Fixture } from 'zod-fixture'
import { Approval, AuthorizationRequest, SignTransaction } from '../../policy-engine/core/type/domain.type'
import { readRequestSchema } from '../../policy-engine/persistence/schema/request.schema'
import { readSignTransactionSchema } from '../../policy-engine/persistence/schema/sign-transaction.schema'
import { signatureSchema } from '../../policy-engine/persistence/schema/signature.schema'
import { readTransactionRequestSchema } from '../../policy-engine/persistence/schema/transaction-request.schema'
import { Approval, AuthorizationRequest, SignTransaction } from '../../orchestration/core/type/domain.type'
import { readRequestSchema } from '../../orchestration/persistence/schema/request.schema'
import { readSignTransactionSchema } from '../../orchestration/persistence/schema/sign-transaction.schema'
import { signatureSchema } from '../../orchestration/persistence/schema/signature.schema'
import { readTransactionRequestSchema } from '../../orchestration/persistence/schema/transaction-request.schema'
import { addressGenerator, chainIdGenerator, hexGenerator } from './shared.fixture'

const approvalSchema = signatureSchema.extend({
Expand Down
2 changes: 1 addition & 1 deletion apps/armory/src/__test__/fixture/feed.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { times } from 'lodash/fp'
import { z } from 'zod'
import { Fixture } from 'zod-fixture'
import { HistoricalTransferFeedService } from '../../data-feed/core/service/historical-transfer-feed.service'
import { signatureSchema } from '../../policy-engine/persistence/schema/signature.schema'
import { signatureSchema } from '../../orchestration/persistence/schema/signature.schema'
import { hexGenerator } from './shared.fixture'
import { generateTransfer } from './transfer-tracking.fixture'

Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/armory.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ClassSerializerInterceptor, Module } from '@nestjs/common'
import { ConfigModule } from '@nestjs/config'
import { APP_INTERCEPTOR } from '@nestjs/core'
import { load } from './armory.config'
import { PolicyEngineModule } from './policy-engine/policy-engine.module'
import { OrchestrationModule } from './orchestration/orchestration.module'
import { QueueModule } from './shared/module/queue/queue.module'
import { StoreModule } from './store/store.module'
import { TransferTrackingModule } from './transfer-tracking/transfer-tracking.module'
Expand All @@ -14,7 +14,7 @@ import { TransferTrackingModule } from './transfer-tracking/transfer-tracking.mo
isGlobal: true
}),
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
TransferTrackingModule,
StoreModule
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../../../../../__test__/fixture/authorization-request.fixture'
import { generateHistoricalTransfers } from '../../../../../__test__/fixture/feed.fixture'
import { generatePrices } from '../../../../../__test__/fixture/price.fixture'
import { AuthorizationRequest } from '../../../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../../../orchestration/core/type/domain.type'
import { ChainId } from '../../../../../shared/core/lib/chains.lib'
import { PrismaService } from '../../../../../shared/module/persistence/service/prisma.service'
import { FeedService } from '../../feed.service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '../../../../../__test__/fixture/authorization-request.fixture'
import { generateTransfer } from '../../../../../__test__/fixture/transfer-tracking.fixture'
import { load } from '../../../../../armory.config'
import { AuthorizationRequest } from '../../../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../../../orchestration/core/type/domain.type'
import { ChainId } from '../../../../../shared/core/lib/chains.lib'
import { Transfer } from '../../../../../shared/core/type/transfer-tracking.type'
import { TransferTrackingService } from '../../../../../transfer-tracking/core/service/transfer-tracking.service'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
} from '../../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../../armory.config'
import { FIAT_ID_USD, POLYGON } from '../../../../../armory.constant'
import { AuthorizationRequest } from '../../../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../../../orchestration/core/type/domain.type'
import { PriceService } from '../../../../../price/core/service/price.service'
import { ChainId } from '../../../../../shared/core/lib/chains.lib'
import { PriceFeedService } from '../../../../core/service/price-feed.service'
Expand Down
2 changes: 1 addition & 1 deletion apps/armory/src/data-feed/core/service/feed.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Prisma } from '@prisma/client/armory'
import { v4 as uuid } from 'uuid'
import { HistoricalTransferFeedService } from '../../../data-feed/core/service/historical-transfer-feed.service'
import { PriceFeedService } from '../../../data-feed/core/service/price-feed.service'
import { AuthorizationRequest } from '../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../orchestration/core/type/domain.type'
import { DataFeedException } from '../../../shared/core/exception/data-feed.exception'
import { PrismaService } from '../../../shared/module/persistence/service/prisma.service'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { mapValues, omit } from 'lodash/fp'
import { privateKeyToAccount } from 'viem/accounts'
import { Config } from '../../../armory.config'
import { DataFeed } from '../../../data-feed/core/type/data-feed.type'
import { AuthorizationRequest } from '../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../orchestration/core/type/domain.type'
import { Transfer } from '../../../shared/core/type/transfer-tracking.type'
import { TransferTrackingService } from '../../../transfer-tracking/core/service/transfer-tracking.service'

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { uniq } from 'lodash/fp'
import { privateKeyToAccount } from 'viem/accounts'
import { Config } from '../../../armory.config'
import { FIAT_ID_USD } from '../../../armory.constant'
import { AuthorizationRequest } from '../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../orchestration/core/type/domain.type'
import { PriceService } from '../../../price/core/service/price.service'
import { getChain } from '../../../shared/core/lib/chains.lib'
import { Prices } from '../../../shared/core/type/price.type'
Expand Down
2 changes: 1 addition & 1 deletion apps/armory/src/data-feed/core/type/data-feed.type.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Feed, Signature } from '@narval/authz-shared'
// TODO (@wcalderipe, 06/02/24): Move the AuthorizationRequest type to shared
import { AuthorizationRequest } from '../../../policy-engine/core/type/domain.type'
import { AuthorizationRequest } from '../../../orchestration/core/type/domain.type'

export interface DataFeed<Data> {
getId(): string
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ import request from 'supertest'
import { stringToHex } from 'viem'
import { load } from '../../../armory.config'
import { AUTHORIZATION_REQUEST_PROCESSING_QUEUE, REQUEST_HEADER_ORG_ID } from '../../../armory.constant'
import { AuthorizationRequest } from '../../../policy-engine/core/type/domain.type'
import { SignatureDto } from '../../../policy-engine/http/rest/dto/signature.dto'
import { AuthorizationRequestRepository } from '../../../policy-engine/persistence/repository/authorization-request.repository'
import { PolicyEngineModule } from '../../../policy-engine/policy-engine.module'
import { AuthorizationRequest } from '../../../orchestration/core/type/domain.type'
import { SignatureDto } from '../../../orchestration/http/rest/dto/signature.dto'
import { AuthorizationRequestRepository } from '../../../orchestration/persistence/repository/authorization-request.repository'
import { PersistenceModule } from '../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../shared/module/queue/queue.module'
import { OrchestrationModule } from '../../orchestration.module'

const ENDPOINT_PREFIX = '/authorization-requests'

Expand Down Expand Up @@ -62,7 +62,7 @@ describe('Authorization Request', () => {
}),
QueueModule.forRoot(),
PersistenceModule,
PolicyEngineModule
OrchestrationModule
]
}).compile()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,4 @@ import { AuthorizationRequestProcessingProducer } from './queue/producer/authori
],
exports: [AuthorizationRequestGateway]
})
export class PolicyEngineModule {}
export class OrchestrationModule {}
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ import { EvaluationLog } from '@prisma/client/armory'
import { SetOptional } from 'type-fest'
import { ZodIssueCode, ZodSchema, z } from 'zod'
import { AuthorizationRequest, Evaluation } from '../../core/type/domain.type'
import { ACTION_REQUEST } from '../../orchestration.constant'
import { DecodeAuthorizationRequestException } from '../../persistence/exception/decode-authorization-request.exception'
import { signatureSchema } from '../../persistence/schema/signature.schema'
import { AuthorizationRequestModel } from '../../persistence/type/model.type'
import { ACTION_REQUEST } from '../../policy-engine.constant'

type Model = SetOptional<AuthorizationRequestModel, 'evaluationLog'>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Address Book Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/credential.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { sha256 } from 'viem'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -50,7 +50,7 @@ describe('Credential Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/entity.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import request from 'supertest'
import { sha256 } from 'viem'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -177,7 +177,7 @@ describe('Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import request from 'supertest'
import { sha256 } from 'viem'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -51,7 +51,7 @@ describe('Organization Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/token.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Token Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/user-group.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('User Group Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/user-wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -64,7 +64,7 @@ describe('User Wallet Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/user.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { sha256 } from 'viem'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -59,7 +59,7 @@ describe('User Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -53,7 +53,7 @@ describe('Wallet Group Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/__test__/e2e/wallet.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import request from 'supertest'
import { generateSignature } from '../../../../__test__/fixture/authorization-request.fixture'
import { load } from '../../../../armory.config'
import { REQUEST_HEADER_ORG_ID } from '../../../../armory.constant'
import { PolicyEngineModule } from '../../../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../../../orchestration/orchestration.module'
import { PersistenceModule } from '../../../../shared/module/persistence/persistence.module'
import { TestPrismaService } from '../../../../shared/module/persistence/service/test-prisma.service'
import { QueueModule } from '../../../../shared/module/queue/queue.module'
Expand Down Expand Up @@ -42,7 +42,7 @@ describe('Wallet Entity', () => {
}),
PersistenceModule,
QueueModule.forRoot(),
PolicyEngineModule,
OrchestrationModule,
EntityStoreModule
]
}).compile()
Expand Down
4 changes: 2 additions & 2 deletions apps/armory/src/store/entity/entity-store.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ClassSerializerInterceptor, Module, ValidationPipe } from '@nestjs/comm
import { ConfigModule } from '@nestjs/config'
import { APP_INTERCEPTOR, APP_PIPE } from '@nestjs/core'
import { load } from '../../armory.config'
import { PolicyEngineModule } from '../../policy-engine/policy-engine.module'
import { OrchestrationModule } from '../../orchestration/orchestration.module'
import { PersistenceModule } from '../../shared/module/persistence/persistence.module'
import { AddressBookService } from './core/service/address-book.service'
import { CredentialService } from './core/service/credential.service'
Expand Down Expand Up @@ -34,7 +34,7 @@ import { WalletGroupRepository } from './persistence/repository/wallet-group.rep
import { WalletRepository } from './persistence/repository/wallet.repository'

@Module({
imports: [ConfigModule.forRoot({ load: [load] }), PersistenceModule, PolicyEngineModule],
imports: [ConfigModule.forRoot({ load: [load] }), PersistenceModule, OrchestrationModule],
controllers: [
AddressBookController,
CredentialController,
Expand Down

0 comments on commit 829edd5

Please sign in to comment.