Fix TypeScript build errors
This commit is contained in:
117
src/account.routes.ts
Normal file
117
src/account.routes.ts
Normal file
@@ -0,0 +1,117 @@
|
||||
/**
|
||||
* @swagger
|
||||
* tags:
|
||||
* name: Accounts
|
||||
* description: Bank Account Management
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
import { zeroTrustAuthMiddleware } from '@/integration/api-gateway/middleware/auth.middleware';
|
||||
import { accountService } from './account.service';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/accounts:
|
||||
* post:
|
||||
* summary: Create a new bank account
|
||||
* description: Create a new account for a sovereign bank
|
||||
* tags: [Accounts]
|
||||
* security:
|
||||
* - SovereignToken: []
|
||||
* requestBody:
|
||||
* required: true
|
||||
* content:
|
||||
* application/json:
|
||||
* schema:
|
||||
* type: object
|
||||
* required:
|
||||
* - accountType
|
||||
* - currencyCode
|
||||
* properties:
|
||||
* accountType:
|
||||
* type: string
|
||||
* enum: [sovereign, treasury, commercial, correspondent, settlement]
|
||||
* currencyCode:
|
||||
* type: string
|
||||
* description: ISO 4217 currency code
|
||||
* example: "USD"
|
||||
* assetType:
|
||||
* type: string
|
||||
* enum: [fiat, cbdc, commodity, security]
|
||||
* default: fiat
|
||||
* reserveRequirement:
|
||||
* type: string
|
||||
* description: Reserve requirement percentage
|
||||
* responses:
|
||||
* 201:
|
||||
* description: Account created successfully
|
||||
* 400:
|
||||
* description: Validation error
|
||||
*/
|
||||
router.post('/', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
try {
|
||||
const sovereignBankId = (req as any).sovereignBankId;
|
||||
const account = await accountService.createAccount(
|
||||
sovereignBankId,
|
||||
req.body.accountType,
|
||||
req.body.currencyCode,
|
||||
req.body.assetType,
|
||||
req.body.reserveRequirement
|
||||
);
|
||||
|
||||
res.status(201).json({
|
||||
success: true,
|
||||
data: account,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* @swagger
|
||||
* /api/accounts/{id}:
|
||||
* get:
|
||||
* summary: Get account by ID
|
||||
* description: Retrieve account details
|
||||
* tags: [Accounts]
|
||||
* security:
|
||||
* - SovereignToken: []
|
||||
* parameters:
|
||||
* - in: path
|
||||
* name: id
|
||||
* required: true
|
||||
* schema:
|
||||
* type: string
|
||||
* responses:
|
||||
* 200:
|
||||
* description: Account retrieved
|
||||
* 404:
|
||||
* description: Account not found
|
||||
*/
|
||||
router.get('/:id', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
try {
|
||||
const account = await accountService.getAccount(req.params.id);
|
||||
if (!account) {
|
||||
return res.status(404).json({
|
||||
success: false,
|
||||
error: { code: 'NOT_FOUND', message: 'Account not found' },
|
||||
timestamp: new Date(),
|
||||
});
|
||||
}
|
||||
|
||||
res.json({
|
||||
success: true,
|
||||
data: account,
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Generate consolidated statements, SCB reports
|
||||
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { accountService } from '@/core/accounts/account.service';
|
||||
import { treasuryService } from '@/core/treasury/treasury.service';
|
||||
@@ -82,7 +83,7 @@ export class ReportingEngineService {
|
||||
periodStart,
|
||||
periodEnd,
|
||||
status: 'final',
|
||||
statementData: consolidatedData,
|
||||
statementData: consolidatedData as Prisma.InputJsonValue,
|
||||
publishedAt: new Date(),
|
||||
},
|
||||
});
|
||||
@@ -165,7 +166,7 @@ export class ReportingEngineService {
|
||||
periodStart,
|
||||
periodEnd,
|
||||
status: 'final',
|
||||
statementData: reportData,
|
||||
statementData: reportData as Prisma.InputJsonValue,
|
||||
publishedAt: new Date(),
|
||||
},
|
||||
});
|
||||
@@ -234,7 +235,7 @@ export class ReportingEngineService {
|
||||
periodStart,
|
||||
periodEnd,
|
||||
status: 'final',
|
||||
statementData: adequacyData,
|
||||
statementData: adequacyData as Prisma.InputJsonValue,
|
||||
publishedAt: new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ router.post('/', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ router.get('/:id', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
99
src/core/admin/bridge-admin/bridge-admin.routes.ts
Normal file
99
src/core/admin/bridge-admin/bridge-admin.routes.ts
Normal file
@@ -0,0 +1,99 @@
|
||||
/**
|
||||
* Bridge Admin API Routes
|
||||
* Provides endpoints for bridge management and monitoring
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
import { BridgeReserveService } from '../../../../smom-dbis-138/services/bridge-reserve/bridge-reserve.service';
|
||||
|
||||
const router = Router();
|
||||
|
||||
// Initialize service (would be injected via DI in production)
|
||||
// const bridgeReserveService = new BridgeReserveService(...);
|
||||
|
||||
/**
|
||||
* GET /api/admin/bridge/overview
|
||||
* Get bridge overview metrics
|
||||
*/
|
||||
router.get('/overview', async (req, res) => {
|
||||
try {
|
||||
// In production, this would call bridgeReserveService
|
||||
res.json({
|
||||
totalVolume: 0,
|
||||
activeClaims: 0,
|
||||
challengeStatistics: {
|
||||
total: 0,
|
||||
successful: 0,
|
||||
failed: 0,
|
||||
},
|
||||
liquidityPoolStatus: {
|
||||
eth: { total: 0, available: 0 },
|
||||
weth: { total: 0, available: 0 },
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get bridge overview' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/bridge/claims
|
||||
* List all claims
|
||||
*/
|
||||
router.get('/claims', async (req, res) => {
|
||||
try {
|
||||
// In production, query from contracts/DB
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get claims' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/bridge/challenges
|
||||
* Get challenge statistics
|
||||
*/
|
||||
router.get('/challenges', async (req, res) => {
|
||||
try {
|
||||
res.json({
|
||||
total: 0,
|
||||
successful: 0,
|
||||
failed: 0,
|
||||
pending: 0,
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get challenge statistics' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/bridge/liquidity
|
||||
* Get liquidity pool status
|
||||
*/
|
||||
router.get('/liquidity', async (req, res) => {
|
||||
try {
|
||||
res.json({
|
||||
eth: { total: 0, available: 0, pending: 0 },
|
||||
weth: { total: 0, available: 0, pending: 0 },
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get liquidity status' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* POST /api/admin/bridge/rebalance
|
||||
* Trigger rebalancing
|
||||
*/
|
||||
router.post('/rebalance', async (req, res) => {
|
||||
try {
|
||||
const { asset, amount } = req.body;
|
||||
// In production, call bridgeReserveService.triggerRebalancing
|
||||
res.json({ success: true, txHash: '0x...' });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to trigger rebalancing' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -49,7 +49,7 @@ export class CorridorControlsService {
|
||||
resourceId: update.routeId,
|
||||
beforeState: { cap: route.sireCost?.toString() },
|
||||
afterState: { cap: update.newCap.toString() },
|
||||
metadata: update,
|
||||
metadata: update as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Update route (would need to add cap field to schema or use existing fields)
|
||||
@@ -74,7 +74,7 @@ export class CorridorControlsService {
|
||||
permission: AdminPermission.CORRIDOR_THROTTLE,
|
||||
resourceType: 'settlement_route',
|
||||
resourceId: request.routeId,
|
||||
metadata: request,
|
||||
metadata: request as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Update route status or add throttling config
|
||||
@@ -109,7 +109,7 @@ export class CorridorControlsService {
|
||||
resourceId: request.routeId,
|
||||
beforeState: { status: route.status },
|
||||
afterState: { status: request.action === 'enable' ? 'active' : 'inactive' },
|
||||
metadata: request,
|
||||
metadata: request as Record<string, unknown>,
|
||||
});
|
||||
|
||||
await prisma.settlementRoute.update({
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Admin Console - GRU Controls Service
|
||||
// GRU issuance, locks, circuit breakers, bond issuance windows
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -106,7 +107,7 @@ export class GRUControlsService {
|
||||
resourceType: 'gru_index',
|
||||
resourceId: config.indexId,
|
||||
beforeState: {},
|
||||
afterState: config,
|
||||
afterState: config as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Update GRU index
|
||||
@@ -134,7 +135,7 @@ export class GRUControlsService {
|
||||
permission: AdminPermission.GRU_BOND_ISSUANCE_WINDOW,
|
||||
resourceType: 'gru_bond',
|
||||
resourceId: request.bondId,
|
||||
metadata: request,
|
||||
metadata: request as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Update bond
|
||||
|
||||
@@ -38,7 +38,7 @@ export class NetworkControlsService {
|
||||
permission: AdminPermission.NETWORK_QUIESCE_SUBSYSTEM,
|
||||
resourceType: 'network_subsystem',
|
||||
resourceId: request.subsystem,
|
||||
metadata: request,
|
||||
metadata: request as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Would integrate with actual subsystem control
|
||||
@@ -66,7 +66,7 @@ export class NetworkControlsService {
|
||||
permission: AdminPermission.NETWORK_KILL_SWITCH,
|
||||
resourceType: 'network',
|
||||
resourceId: request.targetId || 'global',
|
||||
metadata: request,
|
||||
metadata: request as Record<string, unknown>,
|
||||
});
|
||||
|
||||
// Critical action - would require additional confirmation in production
|
||||
|
||||
@@ -14,9 +14,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const overview = await dbisAdminService.globalOverview.getGlobalOverview();
|
||||
res.json(overview);
|
||||
return res.json(overview);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -28,9 +28,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const participants = await dbisAdminService.participants.getParticipantDirectory();
|
||||
res.json(participants);
|
||||
return res.json(participants);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -46,9 +46,9 @@ router.get(
|
||||
if (!participant) {
|
||||
return res.status(404).json({ error: 'Participant not found' });
|
||||
}
|
||||
res.json(participant);
|
||||
return res.json(participant);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -64,9 +64,9 @@ router.get(
|
||||
if (!settings) {
|
||||
return res.status(404).json({ error: 'Jurisdiction settings not found' });
|
||||
}
|
||||
res.json(settings);
|
||||
return res.json(settings);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -77,9 +77,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const corridors = await dbisAdminService.participants.getCorridors();
|
||||
res.json(corridors);
|
||||
return res.json(corridors);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -91,9 +91,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const dashboard = await dbisAdminService.gruCommand.getGRUCommandDashboard();
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -108,9 +108,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.status(201).json(result);
|
||||
return res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -122,9 +122,9 @@ router.post(
|
||||
try {
|
||||
const employeeId = req.headers['x-employee-id'] as string || req.sovereignBankId || '';
|
||||
const result = await dbisAdminService.gruControls.lockUnlockGRUClass(employeeId, req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -136,9 +136,9 @@ router.post(
|
||||
try {
|
||||
const employeeId = req.headers['x-employee-id'] as string || req.sovereignBankId || '';
|
||||
const result = await dbisAdminService.gruControls.setCircuitBreakers(employeeId, req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -153,9 +153,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -172,9 +172,9 @@ router.post(
|
||||
bondId,
|
||||
amount
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -186,9 +186,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const dashboard = await dbisAdminService.gasQps.getGASQPSDashboard();
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -200,9 +200,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const dashboard = await dbisAdminService.cbdcFx.getCBDCFXDashboard();
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -214,9 +214,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const dashboard = await dbisAdminService.metaverseEdge.getMetaverseEdgeDashboard();
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -228,9 +228,9 @@ router.get(
|
||||
async (req, res, next) => {
|
||||
try {
|
||||
const dashboard = await dbisAdminService.riskCompliance.getRiskComplianceDashboard();
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -246,9 +246,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -263,9 +263,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -280,9 +280,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -295,9 +295,9 @@ router.post(
|
||||
try {
|
||||
const employeeId = req.headers['x-employee-id'] as string || req.sovereignBankId || '';
|
||||
const result = await dbisAdminService.networkControls.quiesceSubsystem(employeeId, req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -312,9 +312,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -329,9 +329,9 @@ router.post(
|
||||
employeeId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
112
src/core/admin/liquidity-admin/liquidity-admin.routes.ts
Normal file
112
src/core/admin/liquidity-admin/liquidity-admin.routes.ts
Normal file
@@ -0,0 +1,112 @@
|
||||
/**
|
||||
* Liquidity Admin API Routes
|
||||
* Provides endpoints for liquidity engine management and routing configuration
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
import { LiquidityEngine, SwapProvider, SwapSize } from '../../../../smom-dbis-138/services/liquidity-engine/liquidity-engine.service';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* GET /api/admin/liquidity/decision-map
|
||||
* Get current decision logic map
|
||||
*/
|
||||
router.get('/decision-map', async (req, res) => {
|
||||
try {
|
||||
// In production, load from LiquidityEngine service
|
||||
res.json({
|
||||
sizeThresholds: {
|
||||
small: { max: 10000, providers: ['UniswapV3', 'Dodoex'] },
|
||||
medium: { max: 100000, providers: ['Dodoex', 'Balancer', 'UniswapV3'] },
|
||||
large: { providers: ['Dodoex', 'Curve', 'Balancer'] },
|
||||
},
|
||||
slippageRules: {
|
||||
lowSlippage: { max: 0.1, prefer: 'Dodoex' },
|
||||
mediumSlippage: { max: 0.5, prefer: 'Balancer' },
|
||||
highSlippage: { prefer: 'Curve' },
|
||||
},
|
||||
liquidityRules: {
|
||||
highLiquidity: { min: 1000000, prefer: 'UniswapV3' },
|
||||
mediumLiquidity: { prefer: 'Dodoex' },
|
||||
lowLiquidity: { prefer: 'Curve' },
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get decision map' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* PUT /api/admin/liquidity/decision-map
|
||||
* Update decision logic map
|
||||
*/
|
||||
router.put('/decision-map', async (req, res) => {
|
||||
try {
|
||||
const { sizeThresholds, slippageRules, liquidityRules } = req.body;
|
||||
// In production, update LiquidityEngine service
|
||||
res.json({ success: true });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to update decision map' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/liquidity/quotes
|
||||
* Get quotes from all providers for comparison
|
||||
*/
|
||||
router.get('/quotes', async (req, res) => {
|
||||
try {
|
||||
const { inputToken, outputToken, amount } = req.query;
|
||||
// In production, call QuoteAggregator
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get quotes' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/liquidity/routing-stats
|
||||
* Get routing statistics
|
||||
*/
|
||||
router.get('/routing-stats', async (req, res) => {
|
||||
try {
|
||||
res.json({
|
||||
totalSwaps: 0,
|
||||
byProvider: {
|
||||
UniswapV3: 0,
|
||||
Dodoex: 0,
|
||||
Balancer: 0,
|
||||
Curve: 0,
|
||||
OneInch: 0,
|
||||
},
|
||||
averageSlippage: 0,
|
||||
averageGasUsed: 0,
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get routing stats' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* POST /api/admin/liquidity/simulate-route
|
||||
* Simulate routing decision for a swap
|
||||
*/
|
||||
router.post('/simulate-route', async (req, res) => {
|
||||
try {
|
||||
const { inputToken, outputToken, amount } = req.body;
|
||||
// In production, call LiquidityEngine.findBestRoute
|
||||
res.json({
|
||||
provider: 'Dodoex',
|
||||
expectedOutput: amount,
|
||||
slippage: 0.1,
|
||||
confidence: 95,
|
||||
reasoning: 'Selected Dodoex for medium swap based on decision logic',
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to simulate route' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
71
src/core/admin/market-admin/market-admin.routes.ts
Normal file
71
src/core/admin/market-admin/market-admin.routes.ts
Normal file
@@ -0,0 +1,71 @@
|
||||
/**
|
||||
* Market Reporting API Routes
|
||||
* Provides endpoints for market reporting status and configuration
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* GET /api/admin/market/status
|
||||
* Get API connection status
|
||||
*/
|
||||
router.get('/status', async (req, res) => {
|
||||
try {
|
||||
res.json({
|
||||
crypto: {
|
||||
binance: { connected: true, lastReport: Date.now() },
|
||||
coinbase: { connected: true, lastReport: Date.now() },
|
||||
kraken: { connected: true, lastReport: Date.now() },
|
||||
},
|
||||
fx: {
|
||||
fxcm: { connected: false, lastReport: null },
|
||||
alphavantage: { connected: false, lastReport: null },
|
||||
},
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get market status' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/market/reports
|
||||
* Get recent reports
|
||||
*/
|
||||
router.get('/reports', async (req, res) => {
|
||||
try {
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get reports' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* POST /api/admin/market/configure
|
||||
* Configure API endpoints
|
||||
*/
|
||||
router.post('/configure', async (req, res) => {
|
||||
try {
|
||||
const { provider, apiKey, enabled } = req.body;
|
||||
// In production, update configuration
|
||||
res.json({ success: true });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to configure market APIs' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/market/history
|
||||
* Get reporting history
|
||||
*/
|
||||
router.get('/history', async (req, res) => {
|
||||
try {
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get reporting history' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
75
src/core/admin/peg-admin/peg-admin.routes.ts
Normal file
75
src/core/admin/peg-admin/peg-admin.routes.ts
Normal file
@@ -0,0 +1,75 @@
|
||||
/**
|
||||
* Peg Management API Routes
|
||||
* Provides endpoints for peg status monitoring and management
|
||||
*/
|
||||
|
||||
import { Router } from 'express';
|
||||
|
||||
const router = Router();
|
||||
|
||||
/**
|
||||
* GET /api/admin/peg/status
|
||||
* Get all peg statuses
|
||||
*/
|
||||
router.get('/status', async (req, res) => {
|
||||
try {
|
||||
res.json({
|
||||
stablecoins: [
|
||||
{ asset: 'USDT', currentPrice: '1.00', targetPrice: '1.00', deviationBps: 0, isMaintained: true },
|
||||
{ asset: 'USDC', currentPrice: '1.00', targetPrice: '1.00', deviationBps: 0, isMaintained: true },
|
||||
],
|
||||
weth: {
|
||||
asset: 'WETH',
|
||||
currentPrice: '1.00',
|
||||
targetPrice: '1.00',
|
||||
deviationBps: 0,
|
||||
isMaintained: true,
|
||||
},
|
||||
commodities: [],
|
||||
});
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get peg status' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/peg/deviations
|
||||
* Get peg deviations
|
||||
*/
|
||||
router.get('/deviations', async (req, res) => {
|
||||
try {
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get peg deviations' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* POST /api/admin/peg/rebalance/:asset
|
||||
* Trigger rebalancing for asset
|
||||
*/
|
||||
router.post('/rebalance/:asset', async (req, res) => {
|
||||
try {
|
||||
const { asset } = req.params;
|
||||
// In production, call stablecoinPegManager.triggerRebalancing
|
||||
res.json({ success: true, asset });
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to trigger rebalancing' });
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* GET /api/admin/peg/history/:asset
|
||||
* Get peg history for asset
|
||||
*/
|
||||
router.get('/history/:asset', async (req, res) => {
|
||||
try {
|
||||
const { asset } = req.params;
|
||||
res.json([]);
|
||||
} catch (error) {
|
||||
res.status(500).json({ error: 'Failed to get peg history' });
|
||||
}
|
||||
});
|
||||
|
||||
export default router;
|
||||
|
||||
@@ -18,9 +18,9 @@ router.get(
|
||||
return res.status(400).json({ error: 'Sovereign Bank ID required' });
|
||||
}
|
||||
const overview = await scbAdminService.overview.getSCBOverview(scbId);
|
||||
res.json(overview);
|
||||
return res.json(overview);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -36,9 +36,9 @@ router.get(
|
||||
return res.status(400).json({ error: 'Sovereign Bank ID required' });
|
||||
}
|
||||
const dashboard = await scbAdminService.fiManagement.getFIManagementDashboard(scbId);
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -58,9 +58,9 @@ router.post(
|
||||
scbId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -76,9 +76,9 @@ router.post(
|
||||
}
|
||||
const employeeId = req.headers['x-employee-id'] as string || scbId;
|
||||
const result = await scbAdminService.fiControls.setFILimits(employeeId, scbId, req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -98,9 +98,9 @@ router.post(
|
||||
scbId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -116,9 +116,9 @@ router.get(
|
||||
return res.status(400).json({ error: 'Sovereign Bank ID required' });
|
||||
}
|
||||
const dashboard = await scbAdminService.corridorPolicy.getCorridorPolicyDashboard(scbId);
|
||||
res.json(dashboard);
|
||||
return res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -139,9 +139,9 @@ router.post(
|
||||
scbId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -161,9 +161,9 @@ router.post(
|
||||
scbId,
|
||||
req.body
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post(
|
||||
const result = await gapAuditEngineService.executeGapAudit(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -39,7 +39,7 @@ router.get(
|
||||
}
|
||||
res.json(audit);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -57,7 +57,7 @@ router.get(
|
||||
const history = await gapAuditEngineService.getAuditHistory(limit);
|
||||
res.json(history);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -75,7 +75,7 @@ router.get(
|
||||
const modules = await moduleGeneratorService.getGeneratedModules(gapType);
|
||||
res.json(modules);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Predictive penalty contract application
|
||||
// Logic: if (SRP_risk > threshold) impose_liquidity_penalty()
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -79,7 +80,7 @@ export class BeiePenaltyService {
|
||||
penaltyReason: request.penaltyReason,
|
||||
riskScore,
|
||||
threshold,
|
||||
predictiveContract: request.predictiveContract || null,
|
||||
predictiveContract: request.predictiveContract ? (request.predictiveContract as Prisma.InputJsonValue) : Prisma.JsonNull,
|
||||
status: 'pending',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -17,9 +17,9 @@ const router = Router();
|
||||
router.post('/metric', async (req, res, next) => {
|
||||
try {
|
||||
const result = await beieMetricsService.calculateMetric(req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,9 +32,9 @@ router.post('/metric', async (req, res, next) => {
|
||||
router.get('/metrics/:entityId', async (req, res, next) => {
|
||||
try {
|
||||
const metrics = await beieMetricsService.getMetrics(req.params.entityId);
|
||||
res.json(metrics);
|
||||
return res.json(metrics);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -47,9 +47,9 @@ router.get('/metrics/:entityId', async (req, res, next) => {
|
||||
router.post('/incentive', async (req, res, next) => {
|
||||
try {
|
||||
const result = await beieIncentiveService.createIncentive(req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,9 +65,9 @@ router.get('/incentive/:incentiveId', async (req, res, next) => {
|
||||
if (!incentive) {
|
||||
return res.status(404).json({ error: 'Incentive not found' });
|
||||
}
|
||||
res.json(incentive);
|
||||
return res.json(incentive);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,9 +84,9 @@ router.get('/incentives/:entityId', async (req, res, next) => {
|
||||
req.params.entityId,
|
||||
status as string | undefined
|
||||
);
|
||||
res.json(incentives);
|
||||
return res.json(incentives);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,9 +99,9 @@ router.get('/incentives/:entityId', async (req, res, next) => {
|
||||
router.post('/penalty', async (req, res, next) => {
|
||||
try {
|
||||
const result = await beiePenaltyService.createPenalty(req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,9 +115,9 @@ router.post('/penalty/check/:entityId', async (req, res, next) => {
|
||||
try {
|
||||
const { entityType } = req.body;
|
||||
await beiePenaltyService.checkAndApplyPenalties(req.params.entityId, entityType);
|
||||
res.json({ status: 'checked' });
|
||||
return res.json({ status: 'checked' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -134,9 +134,9 @@ router.get('/penalties/:entityId', async (req, res, next) => {
|
||||
req.params.entityId,
|
||||
status as string | undefined
|
||||
);
|
||||
res.json(penalties);
|
||||
return res.json(penalties);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -149,9 +149,9 @@ router.get('/penalties/:entityId', async (req, res, next) => {
|
||||
router.post('/profile', async (req, res, next) => {
|
||||
try {
|
||||
const result = await beieProfileService.createOrUpdateProfile(req.body);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -174,9 +174,9 @@ router.get('/profile/:entityId', async (req, res, next) => {
|
||||
if (!profile) {
|
||||
return res.status(404).json({ error: 'Profile not found' });
|
||||
}
|
||||
res.json(profile);
|
||||
return res.json(profile);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -190,9 +190,9 @@ router.get('/profiles', async (req, res, next) => {
|
||||
try {
|
||||
const { riskLevel } = req.query;
|
||||
const profiles = await beieProfileService.listProfiles(riskLevel as string | undefined);
|
||||
res.json(profiles);
|
||||
return res.json(profiles);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// CBDC Wallet System
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { CbdcWallet, CbdcWalletType } from '@/shared/types';
|
||||
@@ -25,7 +26,7 @@ export class CbdcWalletService {
|
||||
currencyCode,
|
||||
balance: new Decimal(0),
|
||||
status: 'active',
|
||||
tieredAccess: this.getDefaultTieredAccess(walletType),
|
||||
tieredAccess: this.getDefaultTieredAccess(walletType) as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ import { accountService } from '@/core/accounts/account.service';
|
||||
import { LedgerEntryType } from '@/shared/types';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { DbisError, ErrorCode } from '@/shared/types';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
|
||||
export class CbdcService {
|
||||
@@ -45,7 +46,7 @@ export class CbdcService {
|
||||
operatorIdentity,
|
||||
reserveBacking: new Decimal(amount), // 1:1 backing
|
||||
timestampUtc: new Date(),
|
||||
metadata: reason ? { reason } : null,
|
||||
metadata: reason ? ({ reason } as Prisma.InputJsonValue) : Prisma.JsonNull,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -94,7 +95,7 @@ export class CbdcService {
|
||||
operationType: CbdcOperationType.BURN,
|
||||
operatorIdentity,
|
||||
timestampUtc: new Date(),
|
||||
metadata: reason ? { reason } : null,
|
||||
metadata: reason ? ({ reason } as Prisma.InputJsonValue) : Prisma.JsonNull,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// FACE Behavioral Engine Service
|
||||
// AI behavioral engine (integrates with Volume V SARE)
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -25,7 +24,7 @@ export class FaceBehavioralService {
|
||||
return prisma.faceBehavioralEngine.update({
|
||||
where: { engineId: existing.engineId },
|
||||
data: {
|
||||
engineConfig: request.engineConfig,
|
||||
engineConfig: request.engineConfig as Prisma.InputJsonValue,
|
||||
behaviorModel: request.behaviorModel,
|
||||
lastUpdated: new Date(),
|
||||
},
|
||||
@@ -38,7 +37,7 @@ export class FaceBehavioralService {
|
||||
data: {
|
||||
engineId,
|
||||
economyId: request.economyId,
|
||||
engineConfig: request.engineConfig,
|
||||
engineConfig: request.engineConfig as Prisma.InputJsonValue,
|
||||
behaviorModel: request.behaviorModel,
|
||||
status: 'active',
|
||||
lastUpdated: new Date(),
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// FACE Incentive Service
|
||||
// Reward/penalty system
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -28,7 +27,7 @@ export class FaceIncentiveService {
|
||||
incentiveType: request.incentiveType,
|
||||
targetBehavior: request.targetBehavior,
|
||||
incentiveAmount: new Decimal(request.incentiveAmount),
|
||||
conditions: request.conditions,
|
||||
conditions: request.conditions as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// FACE Stabilization Contract Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Auto-stabilization: if SRI_risk > threshold: impose_rate_adjustment()
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -27,9 +28,9 @@ export class FaceStabilizationService {
|
||||
economyId: request.economyId,
|
||||
contractType: 'auto_stabilization',
|
||||
sriThreshold: new Decimal(request.sriThreshold),
|
||||
rateAdjustmentRule: request.rateAdjustmentRule || {
|
||||
rateAdjustmentRule: (request.rateAdjustmentRule || {
|
||||
rule: 'if SRI_risk > threshold: impose_rate_adjustment()',
|
||||
},
|
||||
}) as Prisma.InputJsonValue,
|
||||
adjustmentType: request.adjustmentType,
|
||||
status: 'active',
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// FACE Supply Contract Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Automatic supply contracts: if velocity < target: mint_cbdc() elif velocity > danger_threshold: burn_cbdc()
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -29,12 +30,12 @@ export class FaceSupplyService {
|
||||
contractType: 'automatic_supply_adjustment',
|
||||
velocityTarget: new Decimal(request.velocityTarget),
|
||||
velocityDangerThreshold: new Decimal(request.velocityDangerThreshold),
|
||||
mintCondition: request.mintCondition || {
|
||||
mintCondition: (request.mintCondition || {
|
||||
condition: 'if velocity < target: mint_cbdc()',
|
||||
},
|
||||
burnCondition: request.burnCondition || {
|
||||
}) as Prisma.InputJsonValue,
|
||||
burnCondition: (request.burnCondition || {
|
||||
condition: 'elif velocity > danger_threshold: burn_cbdc()',
|
||||
},
|
||||
}) as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -15,7 +15,7 @@ router.post('/economies', async (req, res, next) => {
|
||||
const economy = await faceEconomyService.createEconomy(req.body);
|
||||
res.json(economy);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ router.get('/economies', async (req, res, next) => {
|
||||
const economies = await faceEconomyService.getEconomiesForBank(req.query.sovereignBankId as string);
|
||||
res.json(economies);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ router.get('/economies/:economyId', async (req, res, next) => {
|
||||
const economy = await faceEconomyService.getEconomy(req.params.economyId);
|
||||
res.json(economy);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ router.post('/behavioral', async (req, res, next) => {
|
||||
const engine = await faceBehavioralService.createBehavioralEngine(req.body);
|
||||
res.json(engine);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ router.get('/behavioral/:economyId', async (req, res, next) => {
|
||||
const engine = await faceBehavioralService.getBehavioralEngine(req.params.economyId);
|
||||
res.json(engine);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -61,7 +61,7 @@ router.post('/behavioral/:economyId/analyze', async (req, res, next) => {
|
||||
const analysis = await faceBehavioralService.analyzeBehavior(req.params.economyId, req.body);
|
||||
res.json(analysis);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -71,7 +71,7 @@ router.post('/supply', async (req, res, next) => {
|
||||
const contract = await faceSupplyService.createSupplyContract(req.body);
|
||||
res.json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ router.get('/supply/:economyId', async (req, res, next) => {
|
||||
const contracts = await faceSupplyService.getContractsForEconomy(req.params.economyId);
|
||||
res.json(contracts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ router.post('/supply/:contractId/check', async (req, res, next) => {
|
||||
const result = await faceSupplyService.checkSupplyContract(req.params.contractId, req.body.currentVelocity);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ router.post('/stabilization', async (req, res, next) => {
|
||||
const contract = await faceStabilizationService.createStabilizationContract(req.body);
|
||||
res.json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ router.get('/stabilization/:economyId', async (req, res, next) => {
|
||||
const contracts = await faceStabilizationService.getContractsForEconomy(req.params.economyId);
|
||||
res.json(contracts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ router.post('/stabilization/:contractId/check', async (req, res, next) => {
|
||||
const result = await faceStabilizationService.checkStabilizationContract(req.params.contractId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -127,7 +127,7 @@ router.post('/incentives', async (req, res, next) => {
|
||||
const incentive = await faceIncentiveService.createIncentive(req.body);
|
||||
res.json(incentive);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -136,7 +136,7 @@ router.get('/incentives/:economyId', async (req, res, next) => {
|
||||
const incentives = await faceIncentiveService.getIncentivesForEconomy(req.params.economyId);
|
||||
res.json(incentives);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ router.post('/incentives/:incentiveId/apply', async (req, res, next) => {
|
||||
const result = await faceIncentiveService.checkAndApplyIncentive(req.params.incentiveId, req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ router.post('/supply-control', async (req, res, next) => {
|
||||
const control = await cbdcSupplyControlService.createSupplyControl(req.body);
|
||||
res.status(201).json(control);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ router.post('/velocity-control', async (req, res, next) => {
|
||||
const control = await cbdcVelocityControlService.createVelocityControl(req.body);
|
||||
res.status(201).json(control);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ router.post('/liquidity-window', async (req, res, next) => {
|
||||
const window = await cbdcLiquidityManagementService.createLiquidityWindow(req.body);
|
||||
res.status(201).json(window);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ router.post('/simulation', async (req, res, next) => {
|
||||
const simulation = await cbdcMonetarySimulationService.runSimulation(req.body);
|
||||
res.json(simulation);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// CBDC Monetary Simulation Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Simulation: impact = CBDC_supply_change * velocity_factor * FX_reserve_strength
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -52,7 +53,7 @@ export class CbdcMonetarySimulationService {
|
||||
where: { simulationId },
|
||||
data: {
|
||||
impactScore: new Decimal(impactScore),
|
||||
simulationResults,
|
||||
simulationResults: simulationResults as Prisma.InputJsonValue,
|
||||
status: 'completed',
|
||||
completedAt: new Date(),
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// CBDC Velocity Control Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Wallet limits, spending categories, throttles
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -30,7 +31,7 @@ export class CbdcVelocityControlService {
|
||||
walletId: request.walletId,
|
||||
walletLevelLimit: request.walletLevelLimit ? new Decimal(request.walletLevelLimit) : null,
|
||||
spendingCategory: request.spendingCategory,
|
||||
timeBasedThrottle: request.timeBasedThrottle || null,
|
||||
timeBasedThrottle: request.timeBasedThrottle ? (request.timeBasedThrottle as Prisma.InputJsonValue) : Prisma.JsonNull,
|
||||
status: 'active',
|
||||
effectiveDate: request.effectiveDate,
|
||||
expiryDate: request.expiryDate || null,
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/identity/map', async (req, res, next) => {
|
||||
const result = await cimIdentityService.mapIdentity(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ router.post('/interledger/convert', async (req, res, next) => {
|
||||
const result = await cimInterledgerService.convertCbdc(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ router.get('/contracts/templates', async (req, res, next) => {
|
||||
);
|
||||
res.json(templates);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ router.post('/offline/sync-capsule', async (req, res, next) => {
|
||||
const result = await cimOfflineService.syncCapsuleGlobally(capsuleId);
|
||||
res.json({ success: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Wallet Attestation Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Device attestation (12-hour cycle)
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -60,7 +61,7 @@ export class WalletAttestationService {
|
||||
data: {
|
||||
waoId,
|
||||
walletId: request.walletId,
|
||||
deviceAttestation: request.deviceAttestation,
|
||||
deviceAttestation: request.deviceAttestation as Prisma.InputJsonValue,
|
||||
attestationHash,
|
||||
attestationCycle,
|
||||
status: 'valid',
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Wallet Risk Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Real-time risk scoring
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -89,7 +90,7 @@ export class WalletRiskService {
|
||||
scoreId,
|
||||
walletId: request.walletId,
|
||||
riskScore: new Decimal(riskScore),
|
||||
riskFactors,
|
||||
riskFactors: riskFactors as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ZK-CBDC Validation: Mode 1 - ZK-Balance Proofs (zkBP)
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Prove wallet has sufficient funds without revealing amount
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -61,12 +62,12 @@ export class ZkBalanceProofService {
|
||||
proofId,
|
||||
walletId: request.walletId,
|
||||
proofType: 'zkBP',
|
||||
proofData,
|
||||
proofData: proofData as string,
|
||||
publicInputs: {
|
||||
walletId: request.walletId,
|
||||
currencyCode: request.currencyCode,
|
||||
sufficient: true,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
verificationKey: 'default_zkbp_vk', // In production, use actual verification key
|
||||
status: 'verified',
|
||||
verifiedAt: new Date(),
|
||||
@@ -103,7 +104,7 @@ export class ZkBalanceProofService {
|
||||
}
|
||||
|
||||
// Verify proof (simplified - in production would use ZK verification)
|
||||
const isValid = await this.verifyZkProof(proof.proofData, proof.publicInputs as unknown as Record<string, unknown>);
|
||||
const isValid = await this.verifyZkProof(proof.proofData, proof.publicInputs as Prisma.InputJsonValue);
|
||||
|
||||
if (isValid) {
|
||||
await prisma.zkProof.update({
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/balance-proof', async (req, res, next) => {
|
||||
const result = await zkBalanceProofService.generateBalanceProof(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.post('/compliance-proof', async (req, res, next) => {
|
||||
const result = await zkComplianceProofService.generateComplianceProof(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ router.post('/identity-proof', async (req, res, next) => {
|
||||
const result = await zkIdentityProofService.generateIdentityProof(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ router.post('/verify', async (req, res, next) => {
|
||||
const result = await zkVerificationService.verifyCbdcTransfer(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ZK-CBDC Validation: Mode 2 - ZK-Compliance Proofs (zkCP)
|
||||
import { Prisma } from '@prisma/client';
|
||||
// AML rules satisfied, sanctions clear, transaction within policy limits
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -61,14 +62,14 @@ export class ZkComplianceProofService {
|
||||
proofId,
|
||||
walletId: request.walletId,
|
||||
proofType: 'zkCP',
|
||||
proofData,
|
||||
proofData: proofData as string,
|
||||
publicInputs: {
|
||||
walletId: request.walletId,
|
||||
compliant: true,
|
||||
amlClear: true,
|
||||
sanctionsClear: true,
|
||||
policyCompliant: true,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
verificationKey: 'default_zkcp_vk',
|
||||
status: 'verified',
|
||||
verifiedAt: new Date(),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ZK-CBDC Validation: Mode 3 - ZK-Identity Proofs (zkIP)
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Wallet ownership verification without identity disclosure
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -51,12 +52,12 @@ export class ZkIdentityProofService {
|
||||
proofId,
|
||||
walletId: request.walletId,
|
||||
proofType: 'zkIP',
|
||||
proofData,
|
||||
proofData: proofData as string,
|
||||
publicInputs: {
|
||||
walletId: request.walletId,
|
||||
verified: true,
|
||||
kycLevel: identityInfo.kycLevel,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
verificationKey: 'default_zkip_vk',
|
||||
status: 'verified',
|
||||
verifiedAt: new Date(),
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// ZK-CBDC Verification Service
|
||||
// Smart contract verification: if zkBP && zkCP && zkIP: execute_CBDC_transfer()
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
import { zkBalanceProofService } from './zk-balance-proof.service';
|
||||
|
||||
@@ -18,7 +18,7 @@ router.post('/cdt/mint', async (req, res, next) => {
|
||||
const cdtId = await cdtService.mintCdt(req.body);
|
||||
res.json({ cdtId });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.post('/cdt/burn', async (req, res, next) => {
|
||||
const result = await cdtService.burnCdt(cdtId, reason);
|
||||
res.json({ success: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ router.get('/cdt/:cdtId', async (req, res, next) => {
|
||||
}
|
||||
res.json(cdt);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ router.post('/reserve-certificate/create', async (req, res, next) => {
|
||||
const certificateId = await reserveCertificateService.createReserveCertificate(req.body);
|
||||
res.json({ certificateId });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -82,7 +82,7 @@ router.post('/settle', async (req, res, next) => {
|
||||
const transactionId = await cdtSettlementService.executeSettlement(req.body);
|
||||
res.json({ transactionId });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import {
|
||||
import { COMPLIANCE_THRESHOLDS } from '@/shared/constants';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { supervisionEngineService } from './regtech/supervision-engine.service';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
|
||||
export class AmlService {
|
||||
@@ -72,7 +73,7 @@ export class AmlService {
|
||||
entityType,
|
||||
riskScore,
|
||||
status,
|
||||
screeningResult: screeningResults,
|
||||
screeningResult: screeningResults as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ARI Cortex Layer
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Regulatory policy generator, predictive modeling
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -36,7 +37,7 @@ export class AriCortexService {
|
||||
policyId,
|
||||
policyType: request.policyType,
|
||||
policyName: `${request.policyType}_policy_${Date.now()}`,
|
||||
policyRules: policyRules as unknown as Record<string, unknown>,
|
||||
policyRules: policyRules as Prisma.InputJsonValue,
|
||||
layer: 'cortex',
|
||||
status: 'active',
|
||||
effectiveDate: new Date(),
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ARI Decisioning Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Decision engine: if SARE.FXSP > 0.35: tighten_FX_band(SCB), reduce_liquidity_limit(SCB)
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -47,7 +48,7 @@ export class AriDecisioningService {
|
||||
triggerCondition: `FXSP > 0.35 (actual: ${riskPredictions.fxShockProbability})`,
|
||||
actions: ['tighten_fx_band', 'reduce_liquidity_limit'],
|
||||
fxShockProbability: riskPredictions.fxShockProbability,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
triggerCondition: request.triggerCondition || `SARE.FXSP > 0.35`,
|
||||
status: 'pending',
|
||||
},
|
||||
@@ -74,7 +75,7 @@ export class AriDecisioningService {
|
||||
decisionData: {
|
||||
liquidityTension: riskPredictions.liquidityTension,
|
||||
action: 'adjust_liquidity_policy',
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
triggerCondition: `Liquidity tension > 70 (actual: ${riskPredictions.liquidityTension})`,
|
||||
status: 'pending',
|
||||
},
|
||||
@@ -115,11 +116,11 @@ export class AriDecisioningService {
|
||||
updateId: `ARI-UPDATE-${uuidv4()}`,
|
||||
policyId: currentPolicy.policyId,
|
||||
updateType: 'modification',
|
||||
previousRules: currentPolicy.policyRules,
|
||||
previousRules: currentPolicy.policyRules as Prisma.InputJsonValue,
|
||||
newRules: {
|
||||
...rules,
|
||||
interventionThreshold: newInterventionThreshold,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
reason: `Liquidity policy adjusted due to high tension: ${liquidityTension}`,
|
||||
updatedBy: 'ari',
|
||||
status: 'approved',
|
||||
@@ -132,7 +133,7 @@ export class AriDecisioningService {
|
||||
policyRules: {
|
||||
...rules,
|
||||
interventionThreshold: newInterventionThreshold,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// ARI Reflex Layer
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Real-time AML/FX adjustments, autonomous sanctions updates, automated rule deployment
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -49,8 +50,8 @@ export class AriReflexService {
|
||||
updateId: `ARI-UPDATE-${uuidv4()}`,
|
||||
policyId: currentPolicy.policyId,
|
||||
updateType: 'modification',
|
||||
previousRules: currentPolicy.policyRules,
|
||||
newRules: adjustedRules as unknown as Record<string, unknown>,
|
||||
previousRules: currentPolicy.policyRules as Prisma.InputJsonValue,
|
||||
newRules: adjustedRules as Prisma.InputJsonValue,
|
||||
reason: `Automatic AML rule adjustment due to ${riskLevel} risk level`,
|
||||
updatedBy: 'ari',
|
||||
status: 'approved', // Auto-approved for reflex layer
|
||||
@@ -61,7 +62,7 @@ export class AriReflexService {
|
||||
await prisma.ariPolicy.update({
|
||||
where: { policyId: currentPolicy.policyId },
|
||||
data: {
|
||||
policyRules: adjustedRules as unknown as Record<string, unknown>,
|
||||
policyRules: adjustedRules as Prisma.InputJsonValue,
|
||||
updatedAt: new Date(),
|
||||
},
|
||||
});
|
||||
@@ -96,11 +97,11 @@ export class AriReflexService {
|
||||
updateId: `ARI-UPDATE-${uuidv4()}`,
|
||||
policyId: currentPolicy.policyId,
|
||||
updateType: 'modification',
|
||||
previousRules: currentPolicy.policyRules,
|
||||
previousRules: currentPolicy.policyRules as Prisma.InputJsonValue,
|
||||
newRules: {
|
||||
...rules,
|
||||
bandWidth: newBandWidth,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
reason: `FX band tightened due to high shock probability: ${fxShockProbability}`,
|
||||
updatedBy: 'ari',
|
||||
status: 'approved',
|
||||
@@ -113,7 +114,7 @@ export class AriReflexService {
|
||||
policyRules: {
|
||||
...rules,
|
||||
bandWidth: newBandWidth,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -145,12 +146,12 @@ export class AriReflexService {
|
||||
updateId: `ARI-UPDATE-${uuidv4()}`,
|
||||
policyId: currentPolicy.policyId,
|
||||
updateType: 'modification',
|
||||
previousRules: currentPolicy.policyRules,
|
||||
previousRules: currentPolicy.policyRules as Prisma.InputJsonValue,
|
||||
newRules: {
|
||||
...(currentPolicy.policyRules as unknown as Record<string, unknown>),
|
||||
sanctionsList: sanctionsData,
|
||||
lastUpdate: new Date().toISOString(),
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
reason: 'Autonomous sanctions list update',
|
||||
updatedBy: 'ari',
|
||||
status: 'approved',
|
||||
@@ -164,7 +165,7 @@ export class AriReflexService {
|
||||
...(currentPolicy.policyRules as unknown as Record<string, unknown>),
|
||||
sanctionsList: sanctionsData,
|
||||
lastUpdate: new Date().toISOString(),
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/policy/generate', async (req, res, next) => {
|
||||
const result = await ariCortexService.generatePolicy(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.post('/predict', async (req, res, next) => {
|
||||
const result = await ariCortexService.predictRisk(req.body.sovereignBankId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ router.post('/decision', async (req, res, next) => {
|
||||
const result = await ariDecisioningService.makeDecision(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ router.post('/execute', async (req, res, next) => {
|
||||
const result = await ariExecutionService.executeDecision(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
import { amlVelocityEngineService } from '@/core/compliance/ai/aml-velocity-engine.service';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
|
||||
export interface AmlScanRequest {
|
||||
@@ -47,7 +48,7 @@ export class DscnAmlScannerService {
|
||||
details: {
|
||||
anomalies: amlAnomalies,
|
||||
riskScore,
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'pending',
|
||||
syncedToDbis: false,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// DSCN Identity Verifier
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Local identity verification
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -45,7 +46,7 @@ export class DscnIdentityVerifierService {
|
||||
verified: identityVerified,
|
||||
trustScore,
|
||||
verifiedAt: new Date().toISOString(),
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'pending',
|
||||
syncedToDbis: false,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// DSCN Sanctions Checker
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Local sanctions checks
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -37,7 +38,7 @@ export class DscnSanctionsCheckerService {
|
||||
details: {
|
||||
isSanctioned,
|
||||
checkedAt: new Date().toISOString(),
|
||||
} as unknown as Record<string, unknown>,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'pending',
|
||||
syncedToDbis: false,
|
||||
},
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// DSCN Sync Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Ledger synchronization with DBIS
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -46,7 +47,7 @@ export class DscnSyncService {
|
||||
syncId,
|
||||
nodeId: request.nodeId,
|
||||
syncType: request.syncType,
|
||||
syncData: request.syncData as unknown as Record<string, unknown>,
|
||||
syncData: request.syncData as Prisma.InputJsonValue,
|
||||
dbisLedgerHash: dbisLedgerHash || null,
|
||||
syncStatus: 'synced',
|
||||
syncedAt: new Date(),
|
||||
@@ -87,7 +88,7 @@ export class DscnSyncService {
|
||||
syncId,
|
||||
nodeId: request.nodeId,
|
||||
syncType: request.syncType,
|
||||
syncData: request.syncData as unknown as Record<string, unknown>,
|
||||
syncData: request.syncData as Prisma.InputJsonValue,
|
||||
syncStatus: 'failed',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -20,7 +20,7 @@ router.post('/node/register', async (req, res, next) => {
|
||||
const result = await dscnNodeManagerService.registerNode(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ router.post('/aml/scan', async (req, res, next) => {
|
||||
const result = await dscnAmlScannerService.performAmlScan(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/sanctions/check', async (req, res, next) => {
|
||||
const result = await dscnSanctionsCheckerService.performSanctionsCheck(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ router.post('/identity/verify', async (req, res, next) => {
|
||||
const result = await dscnIdentityVerifierService.performIdentityVerification(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -80,7 +80,7 @@ router.post('/sync', async (req, res, next) => {
|
||||
const result = await dscnSyncService.syncToDbis(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,9 +19,9 @@ const router = Router();
|
||||
router.post('/sanctions/sync', async (req, res, next) => {
|
||||
try {
|
||||
await gaseService.syncSanctionsLists(req.body.sovereignBankId);
|
||||
res.json({ message: 'Sanctions lists synchronized' });
|
||||
return res.json({ message: 'Sanctions lists synchronized' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -38,9 +38,9 @@ router.post('/sanctions/search', async (req, res, next) => {
|
||||
req.body.entityName,
|
||||
req.body.threshold
|
||||
);
|
||||
res.json(matches);
|
||||
return res.json(matches);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -54,9 +54,9 @@ router.post('/sanctions/search', async (req, res, next) => {
|
||||
router.post('/pep/add', async (req, res, next) => {
|
||||
try {
|
||||
const pep = await gaseService.addPEP(req.body);
|
||||
res.json(pep);
|
||||
return res.json(pep);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -73,9 +73,9 @@ router.get('/pep/:entityId/connections', async (req, res, next) => {
|
||||
req.params.entityId,
|
||||
req.query.maxDepth ? parseInt(req.query.maxDepth as string) : undefined
|
||||
);
|
||||
res.json(connections);
|
||||
return res.json(connections);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -92,9 +92,9 @@ router.post('/sas/calculate', async (req, res, next) => {
|
||||
req.body.transactionId,
|
||||
req.body.entityId
|
||||
);
|
||||
res.json(sas);
|
||||
return res.json(sas);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -111,9 +111,9 @@ router.get('/sas/:transactionId', async (req, res, next) => {
|
||||
if (!sas) {
|
||||
return res.status(404).json({ error: 'SAS not found' });
|
||||
}
|
||||
res.json(sas);
|
||||
return res.json(sas);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,9 +130,9 @@ router.get('/risk-tier/:entityId', async (req, res, next) => {
|
||||
if (!tier) {
|
||||
return res.status(404).json({ error: 'Risk tier not found' });
|
||||
}
|
||||
res.json({ entityId: req.params.entityId, riskTier: tier });
|
||||
return res.json({ entityId: req.params.entityId, riskTier: tier });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -146,9 +146,9 @@ router.get('/risk-tier/:entityId', async (req, res, next) => {
|
||||
router.post('/risk-tier/:entityId/assign', async (req, res, next) => {
|
||||
try {
|
||||
const tier = await gaseService.assignRiskTier(req.params.entityId);
|
||||
res.json({ entityId: req.params.entityId, riskTier: tier });
|
||||
return res.json({ entityId: req.params.entityId, riskTier: tier });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// Sanctions Synchronization Service
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
@@ -39,13 +40,13 @@ export class SanctionsSyncService {
|
||||
status: 'active',
|
||||
effectiveDate: list.effectiveDate,
|
||||
expiryDate: list.expiryDate,
|
||||
metadata: list.metadata,
|
||||
metadata: list.metadata as Prisma.InputJsonValue as Prisma.InputJsonValue,
|
||||
},
|
||||
update: {
|
||||
status: 'active',
|
||||
effectiveDate: list.effectiveDate,
|
||||
expiryDate: list.expiryDate,
|
||||
metadata: list.metadata,
|
||||
metadata: list.metadata as Prisma.InputJsonValue as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ router.post('/initialize', async (req, res, next) => {
|
||||
await grhsService.initialize();
|
||||
res.json({ message: 'GRHS initialized successfully' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -43,7 +43,7 @@ router.get('/rep/:sovereignBankId', async (req, res, next) => {
|
||||
}
|
||||
res.json(score);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ router.post('/rep/:sovereignBankId/calculate', async (req, res, next) => {
|
||||
const score = await grhsService.calculateREPScore(req.params.sovereignBankId);
|
||||
res.json(score);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -75,7 +75,7 @@ router.get('/compliance/:sovereignBankId', async (req, res, next) => {
|
||||
const compliance = await grhsService.assessCompliance(req.params.sovereignBankId);
|
||||
res.json(compliance);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -91,7 +91,7 @@ router.post('/fast-track/:sovereignBankId', async (req, res, next) => {
|
||||
await grhsService.grantFastTrackPrivileges(req.params.sovereignBankId);
|
||||
res.json({ message: 'Fast-track privileges granted' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ router.get('/fast-track/:sovereignBankId/:privilegeType', async (req, res, next)
|
||||
);
|
||||
res.json({ hasPrivilege });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -126,7 +126,7 @@ router.get('/rules/monetary', async (req, res, next) => {
|
||||
const rules = await monetaryHarmonizationService.getRules();
|
||||
res.json(rules);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -142,7 +142,7 @@ router.get('/rules/legal', async (req, res, next) => {
|
||||
const rules = await legalHarmonizationService.getRules();
|
||||
res.json(rules);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -158,7 +158,7 @@ router.get('/rules/compliance', async (req, res, next) => {
|
||||
const rules = await complianceHarmonizationService.getRules();
|
||||
res.json(rules);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -174,7 +174,7 @@ router.get('/rules/trade', async (req, res, next) => {
|
||||
const rules = await tradeHarmonizationService.getRules();
|
||||
res.json(rules);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Supervisory Dashboard Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Real-time SRI, liquidity stress, CBDC penetration reports
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -268,7 +269,7 @@ export class DashboardService {
|
||||
async updateDashboard(
|
||||
dashboardType: string,
|
||||
sovereignBankId: string | null,
|
||||
metrics: Record<string, unknown>
|
||||
metrics: Prisma.InputJsonValue
|
||||
) {
|
||||
const dashboard = await prisma.supervisoryDashboard.findFirst({
|
||||
where: {
|
||||
|
||||
@@ -42,7 +42,7 @@ router.post('/monitor/aml', async (req, res, next) => {
|
||||
const results = await supervisionEngineService.monitorAMLBehaviors(transactionId, sovereignBankId);
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ router.post('/monitor/velocity', async (req, res, next) => {
|
||||
);
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -101,7 +101,7 @@ router.get('/dashboard/sri', async (req, res, next) => {
|
||||
const dashboard = await dashboardService.getSRIDashboard(sovereignBankId);
|
||||
res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -117,7 +117,7 @@ router.get('/dashboard/liquidity', async (req, res, next) => {
|
||||
const dashboard = await dashboardService.getLiquidityStressDashboard(sovereignBankId);
|
||||
res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -133,7 +133,7 @@ router.get('/dashboard/comprehensive', async (req, res, next) => {
|
||||
const dashboard = await dashboardService.getComprehensiveDashboard(sovereignBankId);
|
||||
res.json(dashboard);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -149,7 +149,7 @@ router.post('/sandbox', async (req, res, next) => {
|
||||
const sandbox = await sandboxService.createSandboxScenario(sovereignBankId, scenario);
|
||||
res.status(201).json(sandbox);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -164,7 +164,7 @@ router.post('/sandbox/:sandboxId/run', async (req, res, next) => {
|
||||
const result = await sandboxService.runSandboxScenario(req.params.sandboxId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Compliance Sandbox Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Rule testing, AML scenario simulation
|
||||
|
||||
import prisma from '@/shared/database/prisma';
|
||||
@@ -9,14 +10,14 @@ import { supervisionEngineService } from './supervision-engine.service';
|
||||
export interface SandboxScenario {
|
||||
scenarioName: string;
|
||||
scenarioType: string;
|
||||
scenarioConfig: Record<string, unknown>;
|
||||
scenarioConfig: Prisma.InputJsonValue;
|
||||
}
|
||||
|
||||
export interface SandboxResult {
|
||||
sandboxId: string;
|
||||
scenarioName: string;
|
||||
passed: boolean;
|
||||
results: Record<string, unknown>;
|
||||
results: Prisma.InputJsonValue;
|
||||
errors?: string[];
|
||||
}
|
||||
|
||||
@@ -102,8 +103,8 @@ export class SandboxService {
|
||||
*/
|
||||
private async executeScenario(
|
||||
scenarioType: string,
|
||||
config: Record<string, unknown>
|
||||
): Promise<Record<string, unknown>> {
|
||||
config: Prisma.InputJsonValue
|
||||
): Promise<Prisma.InputJsonValue> {
|
||||
switch (scenarioType) {
|
||||
case 'rule_change':
|
||||
return await this.testRuleChange(config);
|
||||
@@ -119,7 +120,7 @@ export class SandboxService {
|
||||
/**
|
||||
* Test rule change
|
||||
*/
|
||||
private async testRuleChange(config: Record<string, unknown>): Promise<Record<string, unknown>> {
|
||||
private async testRuleChange(config: Prisma.InputJsonValue): Promise<Prisma.InputJsonValue> {
|
||||
const ruleId = config.ruleId as string;
|
||||
const newThreshold = config.newThreshold as number;
|
||||
|
||||
@@ -148,7 +149,7 @@ export class SandboxService {
|
||||
/**
|
||||
* Test AML scenario
|
||||
*/
|
||||
private async testAMLScenario(config: Record<string, unknown>): Promise<Record<string, unknown> {
|
||||
private async testAMLScenario(config: Prisma.InputJsonValue): Promise<Prisma.InputJsonValue> {
|
||||
const transactionId = config.transactionId as string;
|
||||
const sovereignBankId = config.sovereignBankId as string;
|
||||
|
||||
@@ -169,9 +170,9 @@ export class SandboxService {
|
||||
/**
|
||||
* Test policy validation
|
||||
*/
|
||||
private async testPolicyValidation(config: Record<string, unknown>): Promise<Record<string, unknown> {
|
||||
const policy = config.policy as Record<string, unknown>;
|
||||
const testCases = config.testCases as Array<Record<string, unknown>>;
|
||||
private async testPolicyValidation(config: Prisma.InputJsonValue): Promise<Prisma.InputJsonValue> {
|
||||
const policy = config.policy as Prisma.InputJsonValue;
|
||||
const testCases = config.testCases as Array<Prisma.InputJsonValue>;
|
||||
|
||||
const results: Array<{ testCase: string; passed: boolean; details: unknown }> = [];
|
||||
|
||||
@@ -204,13 +205,13 @@ export class SandboxService {
|
||||
failedTests: totalCount - passedCount,
|
||||
results,
|
||||
passed: passedCount === totalCount,
|
||||
};
|
||||
} as Prisma.InputJsonValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate policy against test case
|
||||
*/
|
||||
private validatePolicy(policy: Record<string, unknown>, testCase: Record<string, unknown>): boolean {
|
||||
private validatePolicy(policy: Prisma.InputJsonValue, testCase: Prisma.InputJsonValue): boolean {
|
||||
// Simplified policy validation
|
||||
// In production, would use a policy engine
|
||||
return true;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
// Supervision Engine Service
|
||||
import { Prisma } from '@prisma/client';
|
||||
// Automated monitoring (AML behaviors, velocity, clustering)
|
||||
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
@@ -10,7 +11,7 @@ export interface MonitoringResult {
|
||||
ruleName: string;
|
||||
triggered: boolean;
|
||||
severity: string;
|
||||
details: Record<string, unknown>;
|
||||
details: Prisma.InputJsonValue;
|
||||
}
|
||||
|
||||
export class SupervisionEngineService {
|
||||
@@ -81,6 +82,7 @@ export class SupervisionEngineService {
|
||||
creditAccount: {
|
||||
sovereignBankId,
|
||||
},
|
||||
},
|
||||
],
|
||||
timestampUtc: {
|
||||
gte: cutoffTime,
|
||||
@@ -142,6 +144,7 @@ export class SupervisionEngineService {
|
||||
creditAccount: {
|
||||
sovereignBankId,
|
||||
},
|
||||
},
|
||||
],
|
||||
timestampUtc: {
|
||||
gte: cutoffTime,
|
||||
@@ -296,7 +299,7 @@ export class SupervisionEngineService {
|
||||
): Promise<boolean> {
|
||||
// In production, this would evaluate the rule logic
|
||||
// For now, simplified evaluation
|
||||
const ruleLogic = rule.ruleLogic as Record<string, unknown>;
|
||||
const ruleLogic = rule.ruleLogic as Prisma.InputJsonValue;
|
||||
|
||||
if (ruleLogic.type === 'threshold') {
|
||||
const threshold = rule.threshold ? parseFloat(rule.threshold.toString()) : 0;
|
||||
@@ -320,7 +323,7 @@ export class SupervisionEngineService {
|
||||
async createSupervisionRule(
|
||||
ruleName: string,
|
||||
ruleType: string,
|
||||
ruleLogic: Record<string, unknown>,
|
||||
ruleLogic: Prisma.InputJsonValue,
|
||||
threshold?: number,
|
||||
severity: string = 'medium'
|
||||
) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Risk Management Service
|
||||
|
||||
import { sriMonitorService } from './sri/sri-monitor.service';
|
||||
import { sriCalculatorService } from './sri/sri-calculator.service';
|
||||
import { sriMonitorService } from '@/core/risk/sri/sri-monitor.service';
|
||||
import { sriCalculatorService } from '@/core/risk/sri/sri-calculator.service';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
|
||||
export class RiskService {
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/initialize', async (req, res, next) => {
|
||||
await waplService.initialize();
|
||||
res.json({ message: 'WAPL initialized successfully' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ router.get('/patterns', async (req, res, next) => {
|
||||
const patterns = await patternLibraryService.getActivePatterns();
|
||||
res.json(patterns);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ router.get('/patterns/:patternCode', async (req, res, next) => {
|
||||
}
|
||||
res.json(pattern);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ router.post('/match/:transactionId', async (req, res, next) => {
|
||||
const matches = await waplService.matchPatterns(req.params.transactionId);
|
||||
res.json(matches);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@ router.get('/alerts', async (req, res, next) => {
|
||||
const alerts = await waplService.getAlerts(req.query.status as string);
|
||||
res.json(alerts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ router.post('/patterns', async (req, res, next) => {
|
||||
const pattern = await patternLibraryService.upsertPattern(req.body);
|
||||
res.json(pattern);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// Main neural consensus engine
|
||||
// consensus_state = neural_vote(SCB_signals + AI_forecasts + quantum_signatures)
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
@@ -28,8 +29,8 @@ export class NceEngineService {
|
||||
|
||||
// Process neural vote
|
||||
const neuralVote = await nceNeuralService.processNeuralVote({
|
||||
scbSignals: request.scbSignals,
|
||||
aiForecasts: request.aiForecasts,
|
||||
scbSignals: request.scbSignals as Prisma.InputJsonValue,
|
||||
aiForecasts: request.aiForecasts as Prisma.InputJsonValue,
|
||||
});
|
||||
|
||||
// Get quantum signatures
|
||||
@@ -41,9 +42,9 @@ export class NceEngineService {
|
||||
stateId,
|
||||
ledgerStateHash: request.ledgerStateHash,
|
||||
neuralVote: new Decimal(neuralVote.confidence),
|
||||
scbSignals: request.scbSignals,
|
||||
aiForecasts: request.aiForecasts,
|
||||
quantumSignatures,
|
||||
scbSignals: request.scbSignals as Prisma.InputJsonValue,
|
||||
aiForecasts: request.aiForecasts as Prisma.InputJsonValue,
|
||||
quantumSignatures: quantumSignatures as Prisma.InputJsonValue,
|
||||
consensusResult: neuralVote.confidence >= confidenceThreshold ? 'approved' : 'pending',
|
||||
confidenceThreshold: new Decimal(confidenceThreshold),
|
||||
status: 'pending',
|
||||
@@ -51,10 +52,10 @@ export class NceEngineService {
|
||||
});
|
||||
|
||||
// Process layers
|
||||
await nceNeuralService.createLayers(stateId, {
|
||||
scbSignals: request.scbSignals,
|
||||
aiForecasts: request.aiForecasts,
|
||||
});
|
||||
await nceNeuralService.createLayers(stateId, {
|
||||
scbSignals: request.scbSignals,
|
||||
aiForecasts: request.aiForecasts,
|
||||
});
|
||||
|
||||
// Validate quantum signatures
|
||||
const quantumValid = await nceQuantumService.validateSignatures(stateId, quantumSignatures);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// Neural Network Layer Processing Service
|
||||
// Mock/interface with configurable confidence
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -76,7 +77,7 @@ export class NceNeuralService {
|
||||
layerData: {
|
||||
scbSignals: data.scbSignals,
|
||||
aiForecasts: data.aiForecasts,
|
||||
},
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
processedAt: new Date(),
|
||||
},
|
||||
@@ -94,11 +95,11 @@ export class NceNeuralService {
|
||||
layerType: 'consensus',
|
||||
layerData: {
|
||||
processing: 'neural_consensus_algorithm',
|
||||
},
|
||||
} as Prisma.InputJsonValue,
|
||||
output: {
|
||||
confidence: voteResult.confidence,
|
||||
vote: voteResult.vote,
|
||||
},
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
processedAt: new Date(),
|
||||
},
|
||||
@@ -113,12 +114,12 @@ export class NceNeuralService {
|
||||
layerType: 'decision',
|
||||
layerData: {
|
||||
decision: voteResult.vote,
|
||||
},
|
||||
} as Prisma.InputJsonValue,
|
||||
output: {
|
||||
finalDecision: voteResult.vote,
|
||||
confidence: voteResult.confidence,
|
||||
reasoning: voteResult.reasoning,
|
||||
},
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
processedAt: new Date(),
|
||||
},
|
||||
|
||||
@@ -14,7 +14,7 @@ router.post('/consensus', async (req, res, next) => {
|
||||
const state = await nceEngineService.createConsensus(req.body);
|
||||
res.json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ router.get('/consensus', async (req, res, next) => {
|
||||
const states = await nceEngineService.getConsensusStates(req.query);
|
||||
res.json(states);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ router.get('/consensus/:stateId', async (req, res, next) => {
|
||||
const state = await nceEngineService.getConsensusState(req.params.stateId);
|
||||
res.json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ router.post('/consensus/:stateId/confirm', async (req, res, next) => {
|
||||
const state = await nceEngineService.confirmConsensus(req.params.stateId);
|
||||
res.json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ router.get('/layers/:stateId', async (req, res, next) => {
|
||||
const layers = await nceNeuralService.getLayers(req.params.stateId);
|
||||
res.json(layers);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ router.post('/signatures', async (req, res, next) => {
|
||||
);
|
||||
res.json(signature);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,7 +74,7 @@ router.get('/signatures/:stateId', async (req, res, next) => {
|
||||
const signatures = await nceQuantumService.getSignaturesForState(req.params.stateId);
|
||||
res.json(signatures);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.post('/state/validate', async (req, res, next) => {
|
||||
const valid = await nceStateService.validateStateIntegrity(req.body.ledgerStateHash);
|
||||
res.json({ valid });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ router.post('/state/verify', async (req, res, next) => {
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
// DBIS Sovereign Contract Fabric (DCF)
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import {
|
||||
SmartContract,
|
||||
@@ -27,8 +28,8 @@ export class ContractFabricService {
|
||||
sovereignBankId,
|
||||
templateType,
|
||||
contractState: ContractState.DRAFT,
|
||||
parameters: parameters,
|
||||
signatories: signatories,
|
||||
parameters: parameters as Prisma.InputJsonValue,
|
||||
signatories: signatories as Prisma.InputJsonValue,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -43,7 +44,7 @@ export class ContractFabricService {
|
||||
where: { contractId },
|
||||
data: {
|
||||
contractState: ContractState.EXECUTED,
|
||||
executionResult: executionResult,
|
||||
executionResult: executionResult as Prisma.InputJsonValue,
|
||||
executedAt: new Date(),
|
||||
},
|
||||
});
|
||||
|
||||
@@ -14,9 +14,9 @@ const router = Router();
|
||||
router.post('/contracts', async (req, res, next) => {
|
||||
try {
|
||||
const result = await rssckService.createRealitySpanningContract(req.body);
|
||||
res.status(201).json(result);
|
||||
return res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,9 +32,9 @@ router.get('/contracts/:contractId', async (req, res, next) => {
|
||||
if (!contract) {
|
||||
return res.status(404).json({ error: 'Contract not found' });
|
||||
}
|
||||
res.json(contract);
|
||||
return res.json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,9 +50,9 @@ router.post('/contracts/:contractId/execute', async (req, res, next) => {
|
||||
contractId: req.params.contractId,
|
||||
...req.body,
|
||||
});
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,9 +69,9 @@ router.post('/contracts/:contractId/resolve', async (req, res, next) => {
|
||||
req.body.resolutionType,
|
||||
req.body.resolutionResult
|
||||
);
|
||||
res.json(result);
|
||||
return res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Volume XIV: Reality-Spanning Smart Contract Kernel (RSSCK)
|
||||
// Executes smart contracts that operate across dimensions, timelines, simulated and physical layers
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { createHash } from 'crypto';
|
||||
@@ -53,22 +54,22 @@ export class RssckService {
|
||||
data: {
|
||||
contractId,
|
||||
contractHash,
|
||||
contractCode: request.contractCode as unknown as object,
|
||||
dimensions: (request.dimensions || []) as unknown as object,
|
||||
contractCode: request.contractCode as Prisma.InputJsonValue,
|
||||
dimensions: (request.dimensions || []) as Prisma.InputJsonValue,
|
||||
timelines: request.timelines
|
||||
? (request.timelines as unknown as object)
|
||||
: null,
|
||||
? (request.timelines as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
simulatedLayers: request.simulatedLayers
|
||||
? (request.simulatedLayers as unknown as object)
|
||||
: null,
|
||||
? (request.simulatedLayers as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
quantumStates: request.quantumStates
|
||||
? (request.quantumStates as unknown as object)
|
||||
: null,
|
||||
? (request.quantumStates as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
realityAgreement,
|
||||
agreementDetails: {
|
||||
checkedAt: new Date().toISOString(),
|
||||
agreementStatus: realityAgreement ? 'agreed' : 'disagreed',
|
||||
} as unknown as object,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: realityAgreement ? 'agreed' : 'resolving',
|
||||
},
|
||||
});
|
||||
@@ -127,7 +128,7 @@ export class RssckService {
|
||||
conflictDetails: {
|
||||
reason: 'reality_disagreement',
|
||||
contractDetails: contract,
|
||||
} as unknown as object,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'pending',
|
||||
},
|
||||
});
|
||||
@@ -139,7 +140,7 @@ export class RssckService {
|
||||
ossmResolution: {
|
||||
resolutionId: resolution.resolutionId,
|
||||
initiatedAt: new Date().toISOString(),
|
||||
} as unknown as object,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'resolving',
|
||||
},
|
||||
});
|
||||
@@ -184,16 +185,16 @@ export class RssckService {
|
||||
executionId: `EXEC-${uuidv4()}`,
|
||||
contractId: contract.id,
|
||||
executionType: request.executionType,
|
||||
executionData: request.executionData as unknown as object,
|
||||
executionData: request.executionData as Prisma.InputJsonValue,
|
||||
intentProbabilities: request.intentProbabilities
|
||||
? (request.intentProbabilities as unknown as object)
|
||||
: null,
|
||||
? (request.intentProbabilities as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
consciousnessSignatures: request.consciousnessSignatures
|
||||
? (request.consciousnessSignatures as unknown as object)
|
||||
: null,
|
||||
? (request.consciousnessSignatures as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
quantumSymmetry: request.quantumSymmetry
|
||||
? (request.quantumSymmetry as unknown as object)
|
||||
: null,
|
||||
? (request.quantumSymmetry as Prisma.InputJsonValue)
|
||||
: Prisma.JsonNull,
|
||||
status: 'executing',
|
||||
},
|
||||
});
|
||||
@@ -209,7 +210,7 @@ export class RssckService {
|
||||
await prisma.contractExecution.update({
|
||||
where: { id: execution.id },
|
||||
data: {
|
||||
executionResult: executionResult as unknown as object,
|
||||
executionResult: executionResult as Prisma.InputJsonValue,
|
||||
status: 'completed',
|
||||
executedAt: new Date(),
|
||||
},
|
||||
@@ -220,7 +221,7 @@ export class RssckService {
|
||||
where: { contractId: request.contractId },
|
||||
data: {
|
||||
status: 'executed',
|
||||
executionResult: executionResult as unknown as object,
|
||||
executionResult: executionResult as Prisma.InputJsonValue,
|
||||
executedAt: new Date(),
|
||||
},
|
||||
});
|
||||
@@ -267,7 +268,7 @@ export class RssckService {
|
||||
await prisma.contractResolution.update({
|
||||
where: { id: resolution.id },
|
||||
data: {
|
||||
resolutionResult: resolutionResult as unknown as object,
|
||||
resolutionResult: resolutionResult as Prisma.InputJsonValue,
|
||||
status: 'resolved',
|
||||
resolvedAt: new Date(),
|
||||
},
|
||||
@@ -402,8 +403,8 @@ export class RssckService {
|
||||
conflictDetails: {
|
||||
contractId: contract.contractId,
|
||||
conflictType: 'reality_disagreement',
|
||||
} as unknown as object,
|
||||
resolutionResult: resolutionResult as unknown as object,
|
||||
} as Prisma.InputJsonValue,
|
||||
resolutionResult: resolutionResult as Prisma.InputJsonValue,
|
||||
status: 'resolved',
|
||||
resolvedAt: new Date(),
|
||||
},
|
||||
@@ -418,7 +419,7 @@ export class RssckService {
|
||||
resolved: true,
|
||||
resolutionId: resolution.resolutionId,
|
||||
resolvedAt: new Date().toISOString(),
|
||||
} as unknown as object,
|
||||
} as Prisma.InputJsonValue,
|
||||
status: 'agreed',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DeFi Module Service
|
||||
// Permissioned module management
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
|
||||
@@ -32,7 +33,7 @@ export class DeFiModuleService {
|
||||
moduleName: request.moduleName,
|
||||
moduleType: request.moduleType,
|
||||
permissionLevel: request.permissionLevel,
|
||||
moduleConfig: request.moduleConfig,
|
||||
moduleConfig: request.moduleConfig as Prisma.InputJsonValue,
|
||||
status: 'pending',
|
||||
},
|
||||
});
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { contractFabricService } from '@/core/contracts/contract-fabric.service';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import { v4 as uuidv4 } from 'uuid';
|
||||
import { contractFabricService } from '@/core/contracts/contract-fabric.service';
|
||||
import { gsdsPricingService } from './gsds-pricing.service';
|
||||
import { sriCalculatorService } from '@/core/risk/sri/sri-calculator.service';
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
|
||||
@@ -63,7 +64,7 @@ export class GsdsContractService {
|
||||
party2BankId: request.party2BankId || null,
|
||||
underlyingAsset: request.underlyingAsset,
|
||||
notionalAmount: new Decimal(request.notionalAmount),
|
||||
contractTerms: request.contractTerms,
|
||||
contractTerms: request.contractTerms as Prisma.InputJsonValue,
|
||||
status: 'active',
|
||||
maturityDate: request.maturityDate || null,
|
||||
},
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/contract', async (req, res, next) => {
|
||||
const result = await gsdsContractService.createContract(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ router.get('/contract/:derivativeId', async (req, res, next) => {
|
||||
}
|
||||
res.json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ router.post('/contract/:derivativeId/activate', async (req, res, next) => {
|
||||
await gsdsContractService.activateContract(req.params.derivativeId);
|
||||
res.json({ status: 'activated' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,7 +74,7 @@ router.get('/contracts', async (req, res, next) => {
|
||||
);
|
||||
res.json(contracts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ router.post('/pricing', async (req, res, next) => {
|
||||
const result = await gsdsPricingService.calculatePrice(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -107,7 +107,7 @@ router.get('/pricing/:derivativeId', async (req, res, next) => {
|
||||
}
|
||||
res.json(pricing);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ router.post('/collateral', async (req, res, next) => {
|
||||
const result = await gsdsCollateralService.addCollateral(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -137,7 +137,7 @@ router.post('/collateral/:collateralId/release', async (req, res, next) => {
|
||||
await gsdsCollateralService.releaseCollateral(req.params.collateralId);
|
||||
res.json({ status: 'released' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -152,7 +152,7 @@ router.get('/collateral/:derivativeId', async (req, res, next) => {
|
||||
const collaterals = await gsdsCollateralService.getCollateral(req.params.derivativeId);
|
||||
res.json(collaterals);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -167,7 +167,7 @@ router.post('/settlement', async (req, res, next) => {
|
||||
const result = await gsdsSettlementService.executeSettlement(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -182,7 +182,7 @@ router.post('/settlement/:settlementId/finalize', async (req, res, next) => {
|
||||
await gsdsSettlementService.finalizeSettlement(req.params.settlementId);
|
||||
res.json({ status: 'finalized' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -200,7 +200,7 @@ router.get('/settlement/:settlementId', async (req, res, next) => {
|
||||
}
|
||||
res.json(settlement);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -215,7 +215,7 @@ router.get('/settlements/:derivativeId', async (req, res, next) => {
|
||||
const settlements = await gsdsSettlementService.listSettlements(req.params.derivativeId);
|
||||
res.json(settlements);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ router.post('/measure', async (req, res, next) => {
|
||||
const result = await eeiService.measureEntanglement(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.get('/latest', async (req, res, next) => {
|
||||
}
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/history', async (req, res, next) => {
|
||||
const result = await eeiService.getEntanglementHistory(limit);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ router.get('/:entanglementId', async (req, res, next) => {
|
||||
}
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.get('/trends', async (req, res, next) => {
|
||||
const result = await eeiService.analyzeEntanglementTrends(days);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Meta-Reality Economic Convergence Protocol - Harmonization Service
|
||||
// Stabilizes harmonized field
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import { mrecpConvergenceService } from './mrecp-convergence.service';
|
||||
|
||||
@@ -17,7 +17,7 @@ router.post('/calculate', async (req, res, next) => {
|
||||
const result = await mrecpConvergenceService.calculateConvergence(req.body);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ router.get('/:convergenceId', async (req, res, next) => {
|
||||
}
|
||||
res.json(convergence);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/stable', async (req, res, next) => {
|
||||
const convergences = await mrecpConvergenceService.getStableConvergences();
|
||||
res.json(convergences);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ router.post('/minimize/:realityId', async (req, res, next) => {
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.post('/harmonize/:convergenceId', async (req, res, next) => {
|
||||
const result = await mrecpHarmonizationService.applyHarmonization(req.params.convergenceId);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ router.post('/harmonize/all', async (req, res, next) => {
|
||||
const results = await mrecpHarmonizationService.harmonizeAllUnstable();
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Unified Holographic Economic Model - Correction Service
|
||||
// Non-physical deviation correction
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
@@ -37,7 +38,7 @@ export class UhemCorrectionService {
|
||||
stateId: request.stateId,
|
||||
deviationType: request.deviationType,
|
||||
deviationMagnitude: new Decimal(request.deviationMagnitude),
|
||||
correctionApplied: request.correctionDetails,
|
||||
correctionApplied: request.correctionDetails as Prisma.InputJsonValue,
|
||||
correctionMethod: request.correctionMethod,
|
||||
status: 'pending',
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Unified Holographic Economic Model - Encoding Service
|
||||
// Holographic state encoding (CBDC flow, FX matrix, SSU pressure, stability fields)
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { createHash } from 'crypto';
|
||||
@@ -23,10 +24,10 @@ export class UhemEncodingService {
|
||||
|
||||
// Create encoded state
|
||||
const encodedState = {
|
||||
cbdcFlow: request.cbdcFlow,
|
||||
fxMatrix: request.fxMatrix,
|
||||
ssuPressure: request.ssuPressure,
|
||||
stabilityFields: request.stabilityFields,
|
||||
cbdcFlow: request.cbdcFlow as Prisma.InputJsonValue,
|
||||
fxMatrix: request.fxMatrix as Prisma.InputJsonValue,
|
||||
ssuPressure: request.ssuPressure as Prisma.InputJsonValue,
|
||||
stabilityFields: request.stabilityFields as Prisma.InputJsonValue,
|
||||
timestamp: new Date().toISOString(),
|
||||
};
|
||||
|
||||
@@ -39,10 +40,10 @@ export class UhemEncodingService {
|
||||
data: {
|
||||
stateId,
|
||||
stateHash,
|
||||
cbdcFlow: request.cbdcFlow,
|
||||
fxMatrix: request.fxMatrix,
|
||||
ssuPressure: request.ssuPressure,
|
||||
stabilityFields: request.stabilityFields,
|
||||
cbdcFlow: request.cbdcFlow as Prisma.InputJsonValue,
|
||||
fxMatrix: request.fxMatrix as Prisma.InputJsonValue,
|
||||
ssuPressure: request.ssuPressure as Prisma.InputJsonValue,
|
||||
stabilityFields: request.stabilityFields as Prisma.InputJsonValue,
|
||||
encodedState: encodedState,
|
||||
timestamp: new Date(),
|
||||
},
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Unified Holographic Economic Model - Projection Service
|
||||
// Cross-reality economic projection
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/states', async (req, res, next) => {
|
||||
const state = await uhemEncodingService.encodeState(req.body);
|
||||
res.status(201).json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ router.get('/states/latest', async (req, res, next) => {
|
||||
}
|
||||
res.json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ router.post('/projections', async (req, res, next) => {
|
||||
const projection = await uhemProjectionService.createProjection(req.body);
|
||||
res.status(201).json(projection);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ router.post('/projections/forward', async (req, res, next) => {
|
||||
const projection = await uhemProjectionService.forwardProject(stateId, targetReality);
|
||||
res.json(projection);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -83,7 +83,7 @@ router.post('/corrections', async (req, res, next) => {
|
||||
const correction = await uhemCorrectionService.createCorrection(req.body);
|
||||
res.status(201).json(correction);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ router.post('/corrections/:correctionId/apply', async (req, res, next) => {
|
||||
const correction = await uhemCorrectionService.applyCorrection(req.params.correctionId);
|
||||
res.json(correction);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -116,7 +116,7 @@ router.get('/analytics/trends', async (req, res, next) => {
|
||||
const trends = await uhemAnalyticsService.analyzeTrends(timeRange);
|
||||
res.json(trends);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@ router.get('/analytics/accuracy', async (req, res, next) => {
|
||||
const stats = await uhemAnalyticsService.getProjectionAccuracy();
|
||||
res.json(stats);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ router.post('/orders', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Multiverse-Consistent FX/SSU Stability Framework - FX Service
|
||||
// FX stability across realities
|
||||
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { multiverseStabilityService } from './multiverse-stability.service';
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
// DBIS Multiverse-Consistent FX/SSU Stability Framework - SSU Service
|
||||
// SSU inertia and stability
|
||||
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
import prisma from '@/shared/database/prisma';
|
||||
import { multiverseStabilityService } from './multiverse-stability.service';
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/calculate', async (req, res, next) => {
|
||||
const index = await multiverseStabilityService.calculateStability(req.body);
|
||||
res.status(201).json(index);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.get('/indices', async (req, res, next) => {
|
||||
const indices = await multiverseStabilityService.getAllStabilityIndices();
|
||||
res.json(indices);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/fx/calculate', async (req, res, next) => {
|
||||
const result = await multiverseFxService.calculateFxStability(realityLayer, fxData);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ router.post('/ssu/calculate', async (req, res, next) => {
|
||||
const result = await multiverseSsuService.calculateSsuInertia(realityLayer, ssuData);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ router.post('/divergence/detect', async (req, res, next) => {
|
||||
const divergence = await multiverseDivergenceService.detectDivergence(req.body);
|
||||
res.status(201).json(divergence);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ router.get('/divergence/unresolved', async (req, res, next) => {
|
||||
const divergences = await multiverseDivergenceService.getUnresolvedDivergences();
|
||||
res.json(divergences);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -111,7 +111,7 @@ router.get('/divergence/statistics', async (req, res, next) => {
|
||||
const stats = await multiverseDivergenceService.getDivergenceStatistics();
|
||||
res.json(stats);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ router.post('/calculate', async (req, res, next) => {
|
||||
const result = await tmfplParityService.calculateFxParity(req.body);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ router.get('/:parityId', async (req, res, next) => {
|
||||
}
|
||||
res.json(parity);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -54,7 +54,7 @@ router.get('/latest/:currencyPair', async (req, res, next) => {
|
||||
}
|
||||
res.json(parity);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ router.get('/corrections/required', async (req, res, next) => {
|
||||
const parities = await tmfplParityService.getParitiesRequiringCorrection();
|
||||
res.json(parities);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.post('/correct/:parityId', async (req, res, next) => {
|
||||
const result = await tmfplCorrectionService.triggerTemporalFxCorrection(req.params.parityId);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ router.post('/correct/all', async (req, res, next) => {
|
||||
const results = await tmfplCorrectionService.applyAllCorrections();
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@ router.post('/monitor/:parityId', async (req, res, next) => {
|
||||
const alert = await tmfplMonitoringService.monitorParityDivergence(req.params.parityId);
|
||||
res.json(alert);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -129,7 +129,7 @@ router.post('/monitor/all', async (req, res, next) => {
|
||||
const alerts = await tmfplMonitoringService.monitorAllParities();
|
||||
res.json(alerts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ router.get('/divergences', async (req, res, next) => {
|
||||
const divergences = await tmfplMonitoringService.getActiveDivergences();
|
||||
res.json(divergences);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ router.post('/calculate', async (req, res, next) => {
|
||||
const result = await udaeEngineService.calculateArbitrageDelta(req.body);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ router.get('/:arbitrageId', async (req, res, next) => {
|
||||
}
|
||||
res.json(arbitrage);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ router.get('/opportunities', async (req, res, next) => {
|
||||
const opportunities = await udaeEngineService.getArbitrageOpportunities();
|
||||
res.json(opportunities);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ router.get('/dimension/:dimension', async (req, res, next) => {
|
||||
const arbitrages = await udaeEngineService.getArbitrageByDimension(req.params.dimension);
|
||||
res.json(arbitrages);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -82,7 +82,7 @@ router.post('/compress/:arbitrageId', async (req, res, next) => {
|
||||
const result = await udaeCompressionService.checkAndCompress(req.params.arbitrageId, tolerance);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -98,7 +98,7 @@ router.post('/compress/all', async (req, res, next) => {
|
||||
const results = await udaeCompressionService.compressAllArbitrageOpportunities(tolerance);
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ router.post('/rebalance/:arbitrageId', async (req, res, next) => {
|
||||
const result = await udaeRebalanceService.executeDimensionalRebalance(req.params.arbitrageId);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@ router.get('/rebalance/:rebalanceId', async (req, res, next) => {
|
||||
}
|
||||
res.json(rebalance);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ router.get('/articles', async (req, res, next) => {
|
||||
const articles = await constitutionService.getAllArticles();
|
||||
res.json(articles);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/articles/:articleNumber', async (req, res, next) => {
|
||||
}
|
||||
res.json(article);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -65,7 +65,7 @@ router.get('/legal-personality', async (req, res, next) => {
|
||||
const status = await constitutionService.checkLegalPersonality();
|
||||
res.json(status);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -92,7 +92,7 @@ router.get('/governance/bodies', async (req, res, next) => {
|
||||
res.json(bodies);
|
||||
}
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -107,7 +107,7 @@ router.get('/governance/voting-weight/:sovereignBankId', async (req, res, next)
|
||||
const weight = await governanceService.calculateVotingWeight(req.params.sovereignBankId);
|
||||
res.json(weight);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -122,7 +122,7 @@ router.post('/governance/proposals', async (req, res, next) => {
|
||||
const proposal = await governanceService.createProposal(req.body);
|
||||
res.status(201).json(proposal);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -138,7 +138,7 @@ router.post('/governance/votes', async (req, res, next) => {
|
||||
const result = await governanceService.castVote(votingRecordId, memberId, vote);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ router.post('/disputes', async (req, res, next) => {
|
||||
const dispute = await disputeResolutionService.initiateDispute(req.body);
|
||||
res.status(201).json(dispute);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -176,7 +176,7 @@ router.post('/disputes/:disputeId/escalate', async (req, res, next) => {
|
||||
}
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ router.get('/nexus/prime', async (req, res, next) => {
|
||||
}
|
||||
res.json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ router.post('/nexus/prime', async (req, res, next) => {
|
||||
const nexus = await hsmnNexusService.initializePrimeNexus(anchorValue, stabilityIndex);
|
||||
res.status(201).json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ router.get('/nexus', async (req, res, next) => {
|
||||
const layers = await hsmnNexusService.getAllNexusLayers();
|
||||
res.json(layers);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -74,7 +74,7 @@ router.get('/nexus/:layerNumber', async (req, res, next) => {
|
||||
}
|
||||
res.json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -89,7 +89,7 @@ router.post('/multiversal/initialize', async (req, res, next) => {
|
||||
const nexus = await hsmnMultiversalService.initializeMultiversalNexus();
|
||||
res.status(201).json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -110,7 +110,7 @@ router.post('/multiversal/map', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(mapping);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -125,7 +125,7 @@ router.post('/temporal/initialize', async (req, res, next) => {
|
||||
const nexus = await hsmnTemporalService.initializeTemporalNexus();
|
||||
res.status(201).json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -146,7 +146,7 @@ router.post('/temporal/register', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -161,7 +161,7 @@ router.get('/temporal/consistency/:sovereignBankId', async (req, res, next) => {
|
||||
const result = await hsmnTemporalService.checkTemporalConsistency(req.params.sovereignBankId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -176,7 +176,7 @@ router.post('/consciousness/initialize', async (req, res, next) => {
|
||||
const nexus = await hsmnConsciousnessService.initializeConsciousnessNexus();
|
||||
res.status(201).json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -197,7 +197,7 @@ router.post('/consciousness/register', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -212,7 +212,7 @@ router.post('/quantum/initialize', async (req, res, next) => {
|
||||
const nexus = await hsmnQuantumService.initializeQuantumNexus();
|
||||
res.status(201).json(nexus);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -233,7 +233,7 @@ router.post('/quantum/register', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -249,7 +249,7 @@ router.post('/binding/unify', async (req, res, next) => {
|
||||
const result = await hsmnBindingService.unifySovereignIdentity(sovereignBankId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -264,7 +264,7 @@ router.get('/binding/status/:sovereignBankId', async (req, res, next) => {
|
||||
const status = await hsmnBindingService.getBindingStatus(req.params.sovereignBankId);
|
||||
res.json(status);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -279,7 +279,7 @@ router.get('/binding/bound', async (req, res, next) => {
|
||||
const bound = await hsmnBindingService.getBoundSovereigns();
|
||||
res.json(bound);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ router.post('/councils', async (req, res, next) => {
|
||||
const council = await msgfCouncilService.createCouncil(req.body);
|
||||
res.json(council);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -24,7 +24,7 @@ router.get('/councils', async (req, res, next) => {
|
||||
const councils = await msgfCouncilService.getAllCouncils(req.query.councilType as string);
|
||||
res.json(councils);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ router.get('/councils/:councilId', async (req, res, next) => {
|
||||
const council = await msgfCouncilService.getCouncil(req.params.councilId);
|
||||
res.json(council);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -45,7 +45,7 @@ router.post('/councils/:councilId/members', async (req, res, next) => {
|
||||
});
|
||||
res.json(member);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -58,7 +58,7 @@ router.post('/councils/:councilId/decisions', async (req, res, next) => {
|
||||
);
|
||||
res.json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ router.post('/decisions/:decisionId/approve', async (req, res, next) => {
|
||||
const decision = await msgfCouncilService.approveDecision(req.params.decisionId);
|
||||
res.json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -76,7 +76,7 @@ router.post('/decisions/:decisionId/execute', async (req, res, next) => {
|
||||
const decision = await msgfCouncilService.executeDecision(req.params.decisionId);
|
||||
res.json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -86,7 +86,7 @@ router.post('/tiers', async (req, res, next) => {
|
||||
const tier = await msgfTierService.createTier(req.body);
|
||||
res.json(tier);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -95,7 +95,7 @@ router.get('/tiers', async (req, res, next) => {
|
||||
const tiers = await msgfTierService.getAllTiers();
|
||||
res.json(tiers);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -104,7 +104,7 @@ router.get('/tiers/:tierId', async (req, res, next) => {
|
||||
const tier = await msgfTierService.getTier(req.params.tierId);
|
||||
res.json(tier);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ router.post('/tiers/delegations', async (req, res, next) => {
|
||||
const delegation = await msgfTierService.createDelegation(req.body);
|
||||
res.json(delegation);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ router.post('/policies', async (req, res, next) => {
|
||||
const policy = await msgfPolicyService.createPolicy(req.body);
|
||||
res.json(policy);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -132,7 +132,7 @@ router.get('/policies', async (req, res, next) => {
|
||||
const policies = await msgfPolicyService.getAllPolicies(req.query);
|
||||
res.json(policies);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -141,7 +141,7 @@ router.get('/policies/:policyId', async (req, res, next) => {
|
||||
const policy = await msgfPolicyService.getPolicy(req.params.policyId);
|
||||
res.json(policy);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ router.post('/policies/:policyId/activate', async (req, res, next) => {
|
||||
);
|
||||
res.json(policy);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -163,7 +163,7 @@ router.post('/enforcements', async (req, res, next) => {
|
||||
const enforcement = await msgfEnforcementService.createEnforcement(req.body);
|
||||
res.json(enforcement);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -172,7 +172,7 @@ router.post('/enforcements/:enforcementId/execute', async (req, res, next) => {
|
||||
const enforcement = await msgfEnforcementService.executeEnforcement(req.params.enforcementId);
|
||||
res.json(enforcement);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -181,7 +181,7 @@ router.post('/privileges/suspend', async (req, res, next) => {
|
||||
const privilege = await msgfEnforcementService.suspendPrivilege(req.body);
|
||||
res.json(privilege);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -190,7 +190,7 @@ router.post('/privileges/:privilegeId/restore', async (req, res, next) => {
|
||||
const privilege = await msgfEnforcementService.restorePrivilege(req.params.privilegeId);
|
||||
res.json(privilege);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -199,7 +199,7 @@ router.get('/privileges/:sovereignBankId', async (req, res, next) => {
|
||||
const privileges = await msgfEnforcementService.getPrivileges(req.params.sovereignBankId);
|
||||
res.json(privileges);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -209,7 +209,7 @@ router.post('/aesu/analyze', async (req, res, next) => {
|
||||
const recommendations = await aesuService.performAnalysis(req.body);
|
||||
res.json(recommendations);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -221,7 +221,7 @@ router.post('/aesu/recommendations', async (req, res, next) => {
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -233,7 +233,7 @@ router.post('/aesu/decisions', async (req, res, next) => {
|
||||
);
|
||||
res.json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ router.post('/detect', async (req, res, next) => {
|
||||
const result = await proeOversightService.detectDeviation(req.body);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -35,7 +35,7 @@ router.get('/deviation/:deviationId', async (req, res, next) => {
|
||||
}
|
||||
res.json(deviation);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.get('/deviations', async (req, res, next) => {
|
||||
const deviations = await proeOversightService.getActiveDeviations();
|
||||
res.json(deviations);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ router.post('/monitor', async (req, res, next) => {
|
||||
const results = await proeOversightService.monitorAllRealities(threshold);
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ router.post('/align/:deviationId', async (req, res, next) => {
|
||||
const result = await proeAlignmentService.enforcePrimeRealityAlignment(req.params.deviationId);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ router.post('/align/all', async (req, res, next) => {
|
||||
const results = await proeAlignmentService.enforceAllAlignments();
|
||||
res.json(results);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post('/arbitrations', async (req, res, next) => {
|
||||
const arbitration = await qtaeDetectionService.createArbitration(req.body);
|
||||
res.status(201).json(arbitration);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.post('/contradictions/detect', async (req, res, next) => {
|
||||
const event = await qtaeDetectionService.detectContradiction(req.body);
|
||||
res.status(201).json(event);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ router.get('/contradictions/unresolved', async (req, res, next) => {
|
||||
const contradictions = await qtaeDetectionService.getUnresolvedContradictions();
|
||||
res.json(contradictions);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ router.post('/rollbacks', async (req, res, next) => {
|
||||
const rollback = await qtaeResolutionService.createRollback(req.body);
|
||||
res.status(201).json(rollback);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ router.post('/rollbacks/:rollbackId/execute', async (req, res, next) => {
|
||||
const rollback = await qtaeResolutionService.executeRollback(req.params.rollbackId);
|
||||
res.json(rollback);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ router.post('/arbitrations/:arbitrationId/rollback', async (req, res, next) => {
|
||||
const result = await qtaeResolutionService.rollbackToConsistentState(req.params.arbitrationId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -109,7 +109,7 @@ router.post('/decisions', async (req, res, next) => {
|
||||
const decision = await qtaeAffirmationService.createDecision(req.body);
|
||||
res.status(201).json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -124,7 +124,7 @@ router.post('/arbitrations/:arbitrationId/affirm', async (req, res, next) => {
|
||||
const decision = await qtaeAffirmationService.affirmFinality(req.params.arbitrationId);
|
||||
res.json(decision);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -139,7 +139,7 @@ router.post('/notifications/msa/:decisionId', async (req, res, next) => {
|
||||
const result = await qtaeNotificationService.notifyMSA(req.params.decisionId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ router.get('/charter', async (req, res, next) => {
|
||||
}
|
||||
res.json(charter);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ router.post('/charter', async (req, res, next) => {
|
||||
const charter = await scdcCharterService.createCharter(req.body);
|
||||
res.status(201).json(charter);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -55,7 +55,7 @@ router.get('/charter/:charterId', async (req, res, next) => {
|
||||
}
|
||||
res.json(charter);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -70,7 +70,7 @@ router.post('/articles', async (req, res, next) => {
|
||||
const article = await scdcCharterService.createArticle(req.body);
|
||||
res.status(201).json(article);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -85,7 +85,7 @@ router.get('/articles/:charterId', async (req, res, next) => {
|
||||
const articles = await scdcCharterService.getArticles(req.params.charterId);
|
||||
res.json(articles);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -100,7 +100,7 @@ router.get('/authority/scope', async (req, res, next) => {
|
||||
const scope = await scdcAuthorityService.getAuthorityScope();
|
||||
res.json(scope);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -115,7 +115,7 @@ router.post('/authority/verify', async (req, res, next) => {
|
||||
const verified = await scdcAuthorityService.verifySettlementSupremacy(req.body);
|
||||
res.json({ verified });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -130,7 +130,7 @@ router.post('/temporal-integrity/check', async (req, res, next) => {
|
||||
const check = await scdcTemporalIntegrityService.performIntegrityCheck(req.body);
|
||||
res.status(201).json(check);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -145,7 +145,7 @@ router.get('/temporal-integrity/unresolved', async (req, res, next) => {
|
||||
const checks = await scdcTemporalIntegrityService.getUnresolvedChecks();
|
||||
res.json(checks);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -160,7 +160,7 @@ router.post('/ai-actions', async (req, res, next) => {
|
||||
const action = await scdcAIMandateService.createAIAction(req.body);
|
||||
res.status(201).json(action);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -175,7 +175,7 @@ router.post('/ai-actions/:actionId/execute', async (req, res, next) => {
|
||||
await scdcAIMandateService.executeAction(req.params.actionId);
|
||||
res.json({ message: 'Action executed' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ router.post('/identities', async (req, res, next) => {
|
||||
const result = await ilieService.createInfiniteIdentity(req.body);
|
||||
res.status(201).json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.get('/identities/:identityId', async (req, res, next) => {
|
||||
}
|
||||
res.json(identity);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ router.get('/identities/:identityId/drift', async (req, res, next) => {
|
||||
const result = await ilieService.measureIdentityDrift(req.params.identityId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -64,7 +64,7 @@ router.post('/identities/:identityId/correct', async (req, res, next) => {
|
||||
const result = await ilieService.correctIdentityDrift(req.params.identityId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -79,7 +79,7 @@ router.post('/identities/:identityId/layers', async (req, res, next) => {
|
||||
const result = await ilieService.addIdentityLayer(req.params.identityId, req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -94,7 +94,7 @@ router.post('/identities/:identityId/align', async (req, res, next) => {
|
||||
const result = await ilieService.alignIdentityLayers(req.params.identityId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ router.post('/issue', async (req, res, next) => {
|
||||
const passport = await sdipService.issuePassport(req.body);
|
||||
res.json(passport);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -33,7 +33,7 @@ router.get('/verify/:passportId', async (req, res, next) => {
|
||||
const result = await sdipService.verifyPassport(req.params.passportId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -52,7 +52,7 @@ router.get('/:passportId', async (req, res, next) => {
|
||||
}
|
||||
res.json(passport);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ router.get('/entity/:entityId', async (req, res, next) => {
|
||||
const passports = await sdipService.getPassportsByEntity(req.params.entityId);
|
||||
res.json(passports);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.get('/:passportId/trust-score', async (req, res, next) => {
|
||||
const score = await sdipService.calculateTrustScore(req.params.passportId);
|
||||
res.json({ passportId: req.params.passportId, trustScore: score });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -103,7 +103,7 @@ router.post('/:passportId/renew', async (req, res, next) => {
|
||||
);
|
||||
res.json(passport);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -123,7 +123,7 @@ router.post('/:passportId/revoke', async (req, res, next) => {
|
||||
});
|
||||
res.json({ message: 'Passport revoked successfully' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -140,7 +140,7 @@ router.get('/expiring', async (req, res, next) => {
|
||||
const passports = await sdipService.getExpiringPassports(daysAhead);
|
||||
res.json(passports);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ router.post('/state', async (req, res, next) => {
|
||||
const state = await climIntegrationService.hashConsciousnessState(req.body);
|
||||
res.status(201).json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ router.get('/state/:stateId', async (req, res, next) => {
|
||||
}
|
||||
res.json(state);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ router.get('/state/agent/:agentId', async (req, res, next) => {
|
||||
const states = await climIntegrationService.getConsciousnessStatesForAgent(req.params.agentId);
|
||||
res.json(states);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ router.post('/contract', async (req, res, next) => {
|
||||
const contract = await climContractService.createCognitiveContract(req.body);
|
||||
res.status(201).json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -84,7 +84,7 @@ router.get('/contract/:contractId', async (req, res, next) => {
|
||||
}
|
||||
res.json(contract);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ router.post('/contract/:contractId/execute', async (req, res, next) => {
|
||||
const result = await climContractService.executeCognitiveContract(req.params.contractId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -114,7 +114,7 @@ router.get('/contract/pending', async (req, res, next) => {
|
||||
const contracts = await climContractService.getPendingExecutionContracts();
|
||||
res.json(contracts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -129,7 +129,7 @@ router.get('/analytics/:agentId', async (req, res, next) => {
|
||||
const analytics = await climAnalyticsService.getBehavioralAnalytics(req.params.agentId);
|
||||
res.json(analytics);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ router.get('/analytics/aggregate', async (req, res, next) => {
|
||||
const analytics = await climAnalyticsService.getAggregateAnalytics();
|
||||
res.json(analytics);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ router.post('/blocks', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(block);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -23,7 +23,7 @@ router.get('/blocks/:blockId', async (req, res, next) => {
|
||||
const block = await gqlBlockEngineService.getBlock(req.params.blockId);
|
||||
res.json(block);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -37,7 +37,7 @@ router.post('/signatures', async (req, res, next) => {
|
||||
);
|
||||
res.status(201).json(signature);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ router.post('/ledgers', async (req, res, next) => {
|
||||
const ledger = await ilcInterfaceService.createLedger(req.body);
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,7 @@ router.get('/ledgers', async (req, res, next) => {
|
||||
const ledgers = await ilcInterfaceService.getAllLedgers(req.query);
|
||||
res.json(ledgers);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -31,7 +31,7 @@ router.get('/ledgers/:ledgerId', async (req, res, next) => {
|
||||
const ledger = await ilcInterfaceService.getLedger(req.params.ledgerId);
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -40,7 +40,7 @@ router.put('/ledgers/:ledgerId/state', async (req, res, next) => {
|
||||
const ledger = await ilcInterfaceService.updateLedgerState(req.params.ledgerId, req.body);
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/dimensions/:ledgerId', async (req, res, next) => {
|
||||
const dimension = await ilcDimensionService.createDimension(req.params.ledgerId, req.body);
|
||||
res.json(dimension);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ router.get('/dimensions/:ledgerId', async (req, res, next) => {
|
||||
const dimensions = await ilcDimensionService.getDimensionsForLedger(req.params.ledgerId);
|
||||
res.json(dimensions);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -68,7 +68,7 @@ router.post('/dimensions/:ledgerId/initialize', async (req, res, next) => {
|
||||
const dimensions = await ilcDimensionService.initializeStandardDimensions(req.params.ledgerId);
|
||||
res.json(dimensions);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ router.post('/consistency/:ledgerId/check', async (req, res, next) => {
|
||||
const result = await ilcConsistencyService.checkConsistency(req.params.ledgerId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -87,7 +87,7 @@ router.post('/consistency/:ledgerId/maintain', async (req, res, next) => {
|
||||
const ledger = await ilcConsistencyService.maintainIntegrity(req.params.ledgerId);
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ router.get('/consistency/:ledgerId/reconciliations', async (req, res, next) => {
|
||||
const reconciliations = await ilcConsistencyService.getReconciliations(req.params.ledgerId);
|
||||
res.json(reconciliations);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ router.post('/entries', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -163,7 +163,7 @@ router.get('/entries/:id', zeroTrustAuthMiddleware, async (req, res, next) => {
|
||||
timestamp: new Date(),
|
||||
});
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ router.post('/ledger', async (req, res, next) => {
|
||||
const ledger = await mrliInterfaceService.createLedger(req.body);
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -36,7 +36,7 @@ router.get('/ledger/:ledgerId', async (req, res, next) => {
|
||||
}
|
||||
res.json(ledger);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,7 +51,7 @@ router.post('/interface/ci', async (req, res, next) => {
|
||||
const result = await mrliInterfaceService.createCI(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -66,7 +66,7 @@ router.post('/interface/dli', async (req, res, next) => {
|
||||
const result = await mrliInterfaceService.createDLI(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -81,7 +81,7 @@ router.post('/interface/qli', async (req, res, next) => {
|
||||
const result = await mrliInterfaceService.createQLI(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -96,7 +96,7 @@ router.post('/interface/si', async (req, res, next) => {
|
||||
const result = await mrliInterfaceService.createSI(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -111,7 +111,7 @@ router.post('/sync', async (req, res, next) => {
|
||||
const result = await mrliSyncService.synchronize(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -129,7 +129,7 @@ router.get('/sync/:syncId', async (req, res, next) => {
|
||||
}
|
||||
res.json(sync);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -144,7 +144,7 @@ router.post('/conflict/:syncId/resolve', async (req, res, next) => {
|
||||
const result = await mrliConflictService.resolveConflictByArbitration(req.params.syncId);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ router.post(
|
||||
const result = await dsezService.createDsez(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -39,7 +39,7 @@ router.get(
|
||||
}
|
||||
res.json(dsez);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -56,7 +56,7 @@ router.get(
|
||||
const dsezs = await dsezService.getAllDsezs();
|
||||
res.json(dsezs);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -76,7 +76,7 @@ router.get(
|
||||
}
|
||||
res.json(dsez);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -96,7 +96,7 @@ router.patch(
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -113,7 +113,7 @@ router.post(
|
||||
await dsezService.suspendDsez(req.params.dsezId);
|
||||
res.json({ message: 'D-SEZ suspended' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -130,7 +130,7 @@ router.post(
|
||||
await dsezService.activateDsez(req.params.dsezId);
|
||||
res.json({ message: 'D-SEZ activated' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -6,6 +6,7 @@ import prisma from '@/shared/database/prisma';
|
||||
import { v4 as uuidv4 } from 'uuid';
|
||||
import { logger } from '@/infrastructure/monitoring/logger';
|
||||
import { crossMetaverseFxService } from './cross-metaverse-fx.service';
|
||||
import { Decimal } from '@prisma/client/runtime/library';
|
||||
|
||||
|
||||
export interface MultiDsezBridgeRequest {
|
||||
|
||||
@@ -49,7 +49,7 @@ router.post(
|
||||
const result = await metaverseNodeService.createMetaverseNode(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -71,7 +71,7 @@ router.get(
|
||||
}
|
||||
res.json(node);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -88,7 +88,7 @@ router.get(
|
||||
const nodes = await metaverseNodeService.getAllMetaverseNodes();
|
||||
res.json(nodes);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -107,7 +107,7 @@ router.post(
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -129,7 +129,7 @@ router.get(
|
||||
}
|
||||
res.json(settlement);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -148,7 +148,7 @@ router.post(
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -170,7 +170,7 @@ router.get(
|
||||
}
|
||||
res.json(identity);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -187,7 +187,7 @@ router.post(
|
||||
const result = await metaverseFxService.executeInterMetaverseFx(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -204,7 +204,7 @@ router.post(
|
||||
const result = await metaverseBridgeService.createBridge(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -226,7 +226,7 @@ router.get(
|
||||
}
|
||||
res.json(bridge);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -246,7 +246,7 @@ router.post(
|
||||
const result = await metaverseSettlementPipelineService.executeSettlementPipeline(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -263,7 +263,7 @@ router.post(
|
||||
const result = await onRampService.executeOnRamp(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -280,7 +280,7 @@ router.post(
|
||||
const result = await offRampService.executeOffRamp(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -297,7 +297,7 @@ router.post(
|
||||
const result = await gpuEdgeIntegrationService.allocateGpuEdgeNode(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -314,7 +314,7 @@ router.post(
|
||||
const result = await nodeTypeManagerService.createComputeNode(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -331,7 +331,7 @@ router.post(
|
||||
const result = await sixGFabricService.connectToSixGFabric(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -348,7 +348,7 @@ router.post(
|
||||
const result = await zkVerificationService.verifyAssetExchange(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -365,7 +365,7 @@ router.post(
|
||||
const result = await holographicRenderingService.initiateRendering(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -382,7 +382,7 @@ router.post(
|
||||
const result = await assetTokenizationService.tokenizeAsset(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -399,7 +399,7 @@ router.post(
|
||||
const result = await tokenClassManagerService.createTokenClass(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -416,7 +416,7 @@ router.post(
|
||||
const result = await crossMetaverseFxService.executeCrossMetaverseFx(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -433,7 +433,7 @@ router.post(
|
||||
const result = await multiDsezBridgeService.createMultiDsezBridge(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -450,7 +450,7 @@ router.post(
|
||||
const result = await realitySpanningService.executeRealitySpanning(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -467,7 +467,7 @@ router.post(
|
||||
const result = await multiverseConsistencyService.performConsistencyCheck(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -484,7 +484,7 @@ router.post(
|
||||
const result = await identityMappingService.createIdentityMapping(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -501,7 +501,7 @@ router.post(
|
||||
const result = await avatarIdentityAnchorService.anchorAvatarIdentity(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -19,7 +19,7 @@ router.get('/reality-layers', async (req, res, next) => {
|
||||
const layers = await gmmtUnitsService.getRealityLayers();
|
||||
res.json(layers);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -34,7 +34,7 @@ router.post('/reality-layers', async (req, res, next) => {
|
||||
const layer = await gmmtUnitsService.createRealityLayer(req.body.layerName, req.body.layerType);
|
||||
res.status(201).json(layer);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -49,7 +49,7 @@ router.post('/units', async (req, res, next) => {
|
||||
const unit = await gmmtUnitsService.createUnit(req.body);
|
||||
res.status(201).json(unit);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -67,7 +67,7 @@ router.get('/units/pmu', async (req, res, next) => {
|
||||
}
|
||||
res.json(pmu);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -82,7 +82,7 @@ router.post('/valuations', async (req, res, next) => {
|
||||
const valuation = await gmmtValuationService.calculateValuation(req.body);
|
||||
res.status(201).json(valuation);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -97,7 +97,7 @@ router.post('/conversions', async (req, res, next) => {
|
||||
const conversion = await gmmtConversionService.createConversion(req.body);
|
||||
res.status(201).json(conversion);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -113,7 +113,7 @@ router.post('/conversions/convert', async (req, res, next) => {
|
||||
const result = await gmmtConversionService.convertAmount(sourceUnitId, targetUnitId, amount);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -128,7 +128,7 @@ router.get('/stability/report', async (req, res, next) => {
|
||||
const report = await gmmtStabilityService.getStabilityReport();
|
||||
res.json(report);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -62,7 +62,7 @@ export class BondPricingService {
|
||||
let indexAdjustment = new Decimal(0);
|
||||
let liquidityAdjustment = new Decimal(0);
|
||||
let riskAdjustment = new Decimal(0);
|
||||
let yield: Decimal | undefined;
|
||||
let bondYield: Decimal | undefined;
|
||||
|
||||
switch (request.pricingModel) {
|
||||
case 'base':
|
||||
@@ -74,7 +74,7 @@ export class BondPricingService {
|
||||
case 'liquidity_loop_linked':
|
||||
const result = await this.calculateLiquidityLoopLinkedYield(bond);
|
||||
basePrice = result.price;
|
||||
yield = result.yield;
|
||||
bondYield = result.yield;
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown pricing model: ${request.pricingModel}`);
|
||||
@@ -105,7 +105,7 @@ export class BondPricingService {
|
||||
liquidityAdjustment,
|
||||
riskAdjustment,
|
||||
finalPrice,
|
||||
yield,
|
||||
yield: bondYield,
|
||||
discountRate: request.discountRate ? new Decimal(request.discountRate) : null,
|
||||
calculationDetails: JSON.stringify({
|
||||
indexCodes: request.indexCodes,
|
||||
@@ -124,7 +124,7 @@ export class BondPricingService {
|
||||
liquidityAdjustment,
|
||||
riskAdjustment,
|
||||
finalPrice,
|
||||
yield,
|
||||
yield: bondYield,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -173,14 +173,14 @@ export class BondPricingService {
|
||||
// Sovereign risk (simplified - would use SRI)
|
||||
const riskPenalty = new Decimal(0.002); // -0.2%
|
||||
|
||||
const yield = baseYield.plus(loopAdjustment).plus(volatilityAdjustment).minus(riskPenalty);
|
||||
const calculatedYield = baseYield.plus(loopAdjustment).plus(volatilityAdjustment).minus(riskPenalty);
|
||||
|
||||
// Calculate price from yield
|
||||
const principal = bond.principalAmount;
|
||||
const annualCoupon = principal.times(bond.couponRate || new Decimal(0.05));
|
||||
const price = annualCoupon.div(yield);
|
||||
const price = annualCoupon.div(calculatedYield);
|
||||
|
||||
return { price, yield };
|
||||
return { price, yield: calculatedYield };
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -79,7 +79,7 @@ export class GruAuditService {
|
||||
|
||||
// Allow 1% variance
|
||||
const variance = actualRatio.minus(expectedRatio).abs();
|
||||
if (variance.isGreaterThan(new Decimal(0.01))) {
|
||||
if (variance.greaterThan(new Decimal(0.01))) {
|
||||
auditPassed = false;
|
||||
auditDetails.error = `XAU ratio deviation: ${variance.toString()}`;
|
||||
} else {
|
||||
@@ -176,7 +176,7 @@ export class GruAuditService {
|
||||
|
||||
// Check if current value is reasonable compared to base value
|
||||
const changePercent = index.changePercent || new Decimal(0);
|
||||
if (changePercent.abs().isGreaterThan(new Decimal(50))) {
|
||||
if (changePercent.abs().greaterThan(new Decimal(50))) {
|
||||
// More than 50% change from base
|
||||
auditPassed = false;
|
||||
auditDetails.warning = 'Significant deviation from base value';
|
||||
@@ -196,7 +196,7 @@ export class GruAuditService {
|
||||
const avgChange = recentChanges.reduce((sum, c) => sum.plus(c), new Decimal(0))
|
||||
.dividedBy(recentChanges.length);
|
||||
|
||||
if (avgChange.isGreaterThan(new Decimal(0.1))) {
|
||||
if (avgChange.greaterThan(new Decimal(0.1))) {
|
||||
// More than 10% average change
|
||||
auditDetails.warning = 'High volatility detected';
|
||||
auditDetails.avgChangePercent = avgChange.times(100).toString();
|
||||
|
||||
@@ -20,7 +20,7 @@ router.post('/synthetic/issue', async (req, res) => {
|
||||
const result = await syntheticBondsService.issueSyntheticBond(req.body);
|
||||
res.json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -32,7 +32,7 @@ router.get('/synthetic/:syntheticBondId', async (req, res) => {
|
||||
}
|
||||
res.json(bond);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -41,7 +41,7 @@ router.get('/synthetic/bank/:sovereignBankId', async (req, res) => {
|
||||
const bonds = await syntheticBondsService.getSyntheticBondsForBank(req.params.sovereignBankId);
|
||||
res.json(bonds);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -50,7 +50,7 @@ router.post('/synthetic/:syntheticBondId/price', async (req, res) => {
|
||||
await syntheticBondsService.updatePrice(req.params.syntheticBondId, req.body.price, req.body.nav);
|
||||
res.json({ success: true });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -59,7 +59,7 @@ router.post('/synthetic/:syntheticBondId/settle', async (req, res) => {
|
||||
const bondId = await syntheticBondsService.settleSyntheticBond(req.params.syntheticBondId);
|
||||
res.json({ bondId, status: 'settled' });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -69,7 +69,7 @@ router.post('/market/create', async (req, res) => {
|
||||
const marketId = await bondMarketService.createMarket(req.body);
|
||||
res.json({ marketId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -78,7 +78,7 @@ router.post('/market/participant/register', async (req, res) => {
|
||||
const participantId = await bondMarketService.registerParticipant(req.body);
|
||||
res.json({ participantId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -87,7 +87,7 @@ router.post('/market/bond/list', async (req, res) => {
|
||||
const listingId = await bondMarketService.listBond(req.body);
|
||||
res.json({ listingId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -99,7 +99,7 @@ router.get('/market/:marketId', async (req, res) => {
|
||||
}
|
||||
res.json(market);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -108,7 +108,7 @@ router.get('/market/layer/:layer', async (req, res) => {
|
||||
const markets = await bondMarketService.getMarketsByLayer(req.params.layer as any);
|
||||
res.json(markets);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -118,7 +118,7 @@ router.post('/pricing/calculate', async (req, res) => {
|
||||
const result = await bondPricingService.calculatePrice(req.body);
|
||||
res.json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -131,7 +131,7 @@ router.get('/pricing/history', async (req, res) => {
|
||||
);
|
||||
res.json(history);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -143,7 +143,7 @@ router.get('/pricing/latest', async (req, res) => {
|
||||
);
|
||||
res.json(pricing);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -153,7 +153,7 @@ router.post('/liquidity/engine/create', async (req, res) => {
|
||||
const engineId = await syntheticLiquidityService.createEngine(req.body);
|
||||
res.json({ engineId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -162,7 +162,7 @@ router.post('/liquidity/operation', async (req, res) => {
|
||||
const operationId = await syntheticLiquidityService.executeOperation(req.body);
|
||||
res.json({ operationId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -171,7 +171,7 @@ router.post('/liquidity/tensor', async (req, res) => {
|
||||
const tensorId = await syntheticLiquidityService.createTensorEntry(req.body);
|
||||
res.json({ tensorId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -183,7 +183,7 @@ router.get('/liquidity/engine/:engineId', async (req, res) => {
|
||||
}
|
||||
res.json(engine);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -193,7 +193,7 @@ router.post('/settlement/execute', async (req, res) => {
|
||||
const result = await bondSettlementService.executeBondSettlement(req.body);
|
||||
res.json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -202,7 +202,7 @@ router.post('/settlement/reconcile/:bondId', async (req, res) => {
|
||||
const state = await bondSettlementService.reconcilePerpetualState(req.params.bondId);
|
||||
res.json(state);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -214,7 +214,7 @@ router.get('/settlement/:settlementId', async (req, res) => {
|
||||
}
|
||||
res.json(settlement);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -224,7 +224,7 @@ router.post('/supranational/issue', async (req, res) => {
|
||||
const bondId = await supranationalBondsService.issueBond(req.body);
|
||||
res.json({ bondId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -233,7 +233,7 @@ router.post('/supranational/:bondId/coupon', async (req, res) => {
|
||||
const couponId = await supranationalBondsService.payCoupon(req.params.bondId);
|
||||
res.json({ couponId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -242,7 +242,7 @@ router.post('/supranational/reserve/verify', async (req, res) => {
|
||||
const verificationId = await supranationalBondsService.verifyReserve(req.body);
|
||||
res.json({ verificationId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -252,7 +252,7 @@ router.post('/metaverse/avatar/issue', async (req, res) => {
|
||||
const bondId = await metaverseBondsService.issueAvatarLinkedBond(req.body);
|
||||
res.json({ bondId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -261,7 +261,7 @@ router.post('/metaverse/holographic/issue', async (req, res) => {
|
||||
const bondId = await metaverseBondsService.issueHolographicBond(req.body);
|
||||
res.json({ bondId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -271,7 +271,7 @@ router.post('/quantum/issue', async (req, res) => {
|
||||
const bondId = await quantumBondsService.issueQuantumBond(req.body);
|
||||
res.json({ bondId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -280,7 +280,7 @@ router.post('/quantum/:bondId/collapse', async (req, res) => {
|
||||
const hash = await quantumBondsService.collapseQuantumBond(req.params.bondId, req.body.observerId);
|
||||
res.json({ truthSamplingHash: hash });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -289,7 +289,7 @@ router.post('/quantum/timeline/sync', async (req, res) => {
|
||||
const syncId = await quantumBondsService.synchronizeTimeline(req.body);
|
||||
res.json({ syncId });
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -299,7 +299,7 @@ router.post('/risk/assess', async (req, res) => {
|
||||
const result = await bondRiskService.assessBondRisk(req.body);
|
||||
res.json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -311,7 +311,7 @@ router.get('/risk/assessment/:assessmentId', async (req, res) => {
|
||||
}
|
||||
res.json(assessment);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
@@ -320,7 +320,7 @@ router.post('/risk/monitor', async (req, res) => {
|
||||
const result = await bondRiskService.monitorBondRisk(req.body.bondId, req.body.syntheticBondId);
|
||||
res.json(result);
|
||||
} catch (error: any) {
|
||||
res.status(400).json({ error: error.message });
|
||||
return res.status(400).json({ error: error.message });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -74,16 +74,16 @@ export class GruMetaverseStressService {
|
||||
|
||||
// Check if impact is acceptable
|
||||
const impactThreshold = new Decimal(0.5); // 50% impact threshold
|
||||
const passed = combinedImpact.isLessThan(impactThreshold);
|
||||
const passed = combinedImpact.lessThan(impactThreshold);
|
||||
|
||||
// Determine impact level
|
||||
let impactLevel = 'low';
|
||||
const impactPercent = combinedImpact.times(100);
|
||||
if (impactPercent.isGreaterThan(40)) {
|
||||
if (impactPercent.greaterThan(40)) {
|
||||
impactLevel = 'critical';
|
||||
} else if (impactPercent.isGreaterThan(30)) {
|
||||
} else if (impactPercent.greaterThan(30)) {
|
||||
impactLevel = 'high';
|
||||
} else if (impactPercent.isGreaterThan(20)) {
|
||||
} else if (impactPercent.greaterThan(20)) {
|
||||
impactLevel = 'medium';
|
||||
}
|
||||
|
||||
|
||||
@@ -116,9 +116,9 @@ export class GruOmegaReconciliationService {
|
||||
let status = 'stabilized';
|
||||
if (avgPostStress.isZero()) {
|
||||
status = 'fully_merged';
|
||||
} else if (avgPostStress.isLessThan(2)) {
|
||||
} else if (avgPostStress.lessThan(2)) {
|
||||
status = 'corrected';
|
||||
} else if (avgPostStress.isLessThan(5)) {
|
||||
} else if (avgPostStress.lessThan(5)) {
|
||||
status = 'harmonized';
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ router.post(
|
||||
const result = await gruAccountService.createGruAccount(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -51,7 +51,7 @@ router.get(
|
||||
}
|
||||
res.json(account);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -70,7 +70,7 @@ router.get(
|
||||
);
|
||||
res.json(accounts);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -91,7 +91,7 @@ router.post(
|
||||
const result = await gruDailyOperationsService.initializeDailyOperations(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -108,7 +108,7 @@ router.post(
|
||||
const result = await gruDailyOperationsService.executeEndOfDayCloseout(req.body);
|
||||
res.json({ closeoutId: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -125,7 +125,7 @@ router.post(
|
||||
const result = await gruDailyOperationsService.processTransaction(req.body);
|
||||
res.json({ transactionId: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -146,7 +146,7 @@ router.post(
|
||||
const result = await gruReconciliationService.reconcileGAS(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -163,7 +163,7 @@ router.post(
|
||||
await gruReconciliationService.correctQuantumDrift(req.body);
|
||||
res.json({ status: 'completed' });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -183,7 +183,7 @@ router.post(
|
||||
);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -204,7 +204,7 @@ router.get(
|
||||
const result = await gruLiquidityManagementService.monitorXAUAnchor(req.query);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -221,7 +221,7 @@ router.post(
|
||||
const result = await gruLiquidityManagementService.runPredictiveModels(req.body);
|
||||
res.json({ predictionId: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -238,7 +238,7 @@ router.post(
|
||||
const result = await gruLiquidityManagementService.evaluateLiquidityDemand(req.body);
|
||||
res.json({ demandId: result });
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -259,7 +259,7 @@ router.post(
|
||||
const result = await gruRiskManagementService.runDailyRiskControls(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -276,7 +276,7 @@ router.get(
|
||||
const result = await gruRiskManagementService.screenVolatility(req.query);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -297,7 +297,7 @@ router.post(
|
||||
const result = await gruSettlementOperationsService.executeClassicalSettlement(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -314,7 +314,7 @@ router.post(
|
||||
const result = await gruSettlementOperationsService.executeQuantumSettlement(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -331,7 +331,7 @@ router.post(
|
||||
const result = await gruSettlementOperationsService.executeTemporalSettlement(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -348,7 +348,7 @@ router.post(
|
||||
const result = await gruSettlementOperationsService.processSettlementPipeline(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -369,7 +369,7 @@ router.get(
|
||||
const result = await gruComplianceReportingService.generateDailyReports(req.query);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -386,7 +386,7 @@ router.get(
|
||||
const result = await gruComplianceReportingService.generateMonthlyReports(req.query);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -403,7 +403,7 @@ router.get(
|
||||
const result = await gruComplianceReportingService.generateAnnualReports(req.query);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -424,7 +424,7 @@ router.post(
|
||||
const result = await gruSecurityOperationsService.verifyQuantumEnvelopeKeys(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -441,7 +441,7 @@ router.post(
|
||||
const result = await gruSecurityOperationsService.detectThreats(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -486,7 +486,7 @@ router.post(
|
||||
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -503,7 +503,7 @@ router.post(
|
||||
const result = await gruInteroperabilityService.routeToSWIFT(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
@@ -520,7 +520,7 @@ router.post(
|
||||
const result = await gruInteroperabilityService.routeToMetaverse(req.body);
|
||||
res.json(result);
|
||||
} catch (error) {
|
||||
next(error);
|
||||
return next(error);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
@@ -83,16 +83,16 @@ export class GruQuantumStressService {
|
||||
|
||||
// Check if variance is acceptable
|
||||
const varianceThreshold = baseValue.times(0.05); // 5% variance threshold
|
||||
const passed = variance.isLessThan(varianceThreshold);
|
||||
const passed = variance.lessThan(varianceThreshold);
|
||||
|
||||
// Determine impact level
|
||||
let impactLevel = 'low';
|
||||
const variancePercent = variance.dividedBy(baseValue).times(100);
|
||||
if (variancePercent.isGreaterThan(10)) {
|
||||
if (variancePercent.greaterThan(10)) {
|
||||
impactLevel = 'critical';
|
||||
} else if (variancePercent.isGreaterThan(7)) {
|
||||
} else if (variancePercent.greaterThan(7)) {
|
||||
impactLevel = 'high';
|
||||
} else if (variancePercent.isGreaterThan(5)) {
|
||||
} else if (variancePercent.greaterThan(5)) {
|
||||
impactLevel = 'medium';
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ export class GruQuantumStressService {
|
||||
}
|
||||
|
||||
const recentVariance = history[0].indexValue.minus(history[1].indexValue).abs();
|
||||
const isSuppressed = recentVariance.isLessThan(arbitrageWindow);
|
||||
const isSuppressed = recentVariance.lessThan(arbitrageWindow);
|
||||
|
||||
logger.info('GRU Quantum Stress: Quantum arbitrage suppression check', {
|
||||
indexCode,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user