59 lines
1.9 KiB
TypeScript
59 lines
1.9 KiB
TypeScript
import { capabilityRegistryService } from '@/core/solacenet/registry/capability-registry.service';
|
|
import { logger } from '@/infrastructure/monitoring/logger';
|
|
|
|
async function main() {
|
|
try {
|
|
logger.info('Registering DBIS Gateway Microservices capability...');
|
|
await capabilityRegistryService.createCapability({
|
|
capabilityId: 'gateway-microservices',
|
|
name: 'DBIS Gateway Microservices',
|
|
version: '1.0.0',
|
|
description:
|
|
'Regulated-grade integration fabric for SWIFT, DTC/DTCC, and extensible financial rails',
|
|
defaultState: 'enabled' as any,
|
|
dependencies: ['ledger', 'iso20022', 'reconciliation'].filter(Boolean),
|
|
});
|
|
|
|
const subCapabilities = [
|
|
{ capabilityId: 'gateway-edge', name: 'Gateway Edge Plane' },
|
|
{ capabilityId: 'gateway-control', name: 'Gateway Control Plane' },
|
|
{ capabilityId: 'gateway-operations', name: 'Gateway Operations Plane' },
|
|
{ capabilityId: 'gateway-adapters', name: 'Gateway Adapter Plane' },
|
|
];
|
|
|
|
for (const sub of subCapabilities) {
|
|
try {
|
|
await capabilityRegistryService.createCapability({
|
|
capabilityId: sub.capabilityId,
|
|
name: sub.name,
|
|
version: '1.0.0',
|
|
description: sub.name,
|
|
defaultState: 'enabled' as any,
|
|
dependencies: ['gateway-microservices'],
|
|
});
|
|
} catch (err: any) {
|
|
if (err?.message?.includes('already exists')) {
|
|
logger.info(`Capability ${sub.capabilityId} already exists, skipping`);
|
|
} else {
|
|
throw err;
|
|
}
|
|
}
|
|
}
|
|
|
|
logger.info('Gateway capabilities registered.');
|
|
} catch (error: any) {
|
|
if (error?.message?.includes('already exists')) {
|
|
logger.info('Capability gateway-microservices already exists, skipping');
|
|
} else {
|
|
logger.error('Failed to register gateway capability', { error: error?.message || error });
|
|
process.exitCode = 1;
|
|
}
|
|
}
|
|
}
|
|
|
|
if (require.main === module) {
|
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
main();
|
|
}
|
|
|