Implements federated command messages following TDD principles and mirroring the QueryService pattern for consistency. ## Implementation ### Schema Changes - Added commandType and payload fields to FederationMessage model - Supports COMMAND message type (already defined in enum) - Applied schema changes with prisma db push ### Type Definitions - CommandMessage: Request structure with commandType and payload - CommandResponse: Response structure with correlation - CommandMessageDetails: Full message details for API responses ### CommandService - sendCommand(): Send command to remote instance with signature - handleIncomingCommand(): Process incoming commands with verification - processCommandResponse(): Handle command responses - getCommandMessages(): List commands for workspace - getCommandMessage(): Get single command details - Full signature verification and timestamp validation - Error handling and status tracking ### CommandController - POST /api/v1/federation/command - Send command (authenticated) - POST /api/v1/federation/incoming/command - Handle incoming (public) - GET /api/v1/federation/commands - List commands (authenticated) - GET /api/v1/federation/commands/:id - Get command (authenticated) ## Testing - CommandService: 15 tests, 90.21% coverage - CommandController: 8 tests, 100% coverage - All 23 tests passing - Exceeds 85% coverage requirement - Total 47 tests passing (includes command tests) ## Security - RSA signature verification for all incoming commands - Timestamp validation to prevent replay attacks - Connection status validation - Authorization checks on command types ## Quality Checks - TypeScript compilation: PASSED - All tests: 47 PASSED - Code coverage: >85% (90.21% for CommandService, 100% for CommandController) - Linting: PASSED Fixes #89 Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
20 lines
628 B
TypeScript
20 lines
628 B
TypeScript
/**
|
|
* Federation Module Exports
|
|
*/
|
|
|
|
export * from "./federation.module";
|
|
export * from "./federation.service";
|
|
export * from "./federation.controller";
|
|
export * from "./identity-linking.service";
|
|
export * from "./identity-resolution.service";
|
|
export * from "./identity-linking.controller";
|
|
export * from "./crypto.service";
|
|
export * from "./audit.service";
|
|
export * from "./query.service";
|
|
export * from "./query.controller";
|
|
export * from "./command.service";
|
|
export * from "./command.controller";
|
|
export * from "./types/instance.types";
|
|
export * from "./types/identity-linking.types";
|
|
export * from "./types/message.types";
|