feat(ts_interfaces): add TypedRequest interfaces for admin and configuration requests
fix(dependencies): include @api.global/typedrequest-interfaces in package.json chore(docs): create OpsServer implementation plan in readme.opsserver.md
This commit is contained in:
46
ts_interfaces/requests/admin.ts
Normal file
46
ts_interfaces/requests/admin.ts
Normal file
@ -0,0 +1,46 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as authInterfaces from '../data/auth.js';
|
||||
|
||||
// Admin Login
|
||||
export interface IReq_AdminLoginWithUsernameAndPassword extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_AdminLoginWithUsernameAndPassword
|
||||
> {
|
||||
method: 'adminLoginWithUsernameAndPassword';
|
||||
request: {
|
||||
username: string;
|
||||
password: string;
|
||||
};
|
||||
response: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
};
|
||||
}
|
||||
|
||||
// Admin Logout
|
||||
export interface IReq_AdminLogout extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_AdminLogout
|
||||
> {
|
||||
method: 'adminLogout';
|
||||
request: {
|
||||
identity: authInterfaces.IIdentity;
|
||||
};
|
||||
response: {
|
||||
success: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
// Verify Identity
|
||||
export interface IReq_VerifyIdentity extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_VerifyIdentity
|
||||
> {
|
||||
method: 'verifyIdentity';
|
||||
request: {
|
||||
identity: authInterfaces.IIdentity;
|
||||
};
|
||||
response: {
|
||||
valid: boolean;
|
||||
identity?: authInterfaces.IIdentity;
|
||||
};
|
||||
}
|
35
ts_interfaces/requests/config.ts
Normal file
35
ts_interfaces/requests/config.ts
Normal file
@ -0,0 +1,35 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as authInterfaces from '../data/auth.js';
|
||||
|
||||
// Get Configuration
|
||||
export interface IReq_GetConfiguration extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetConfiguration
|
||||
> {
|
||||
method: 'getConfiguration';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
section?: string;
|
||||
};
|
||||
response: {
|
||||
config: any;
|
||||
section?: string;
|
||||
};
|
||||
}
|
||||
|
||||
// Update Configuration
|
||||
export interface IReq_UpdateConfiguration extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_UpdateConfiguration
|
||||
> {
|
||||
method: 'updateConfiguration';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
section: string;
|
||||
config: any;
|
||||
};
|
||||
response: {
|
||||
updated: boolean;
|
||||
config: any;
|
||||
};
|
||||
}
|
4
ts_interfaces/requests/index.ts
Normal file
4
ts_interfaces/requests/index.ts
Normal file
@ -0,0 +1,4 @@
|
||||
export * from './admin.js';
|
||||
export * from './config.js';
|
||||
export * from './logs.js';
|
||||
export * from './stats.js';
|
44
ts_interfaces/requests/logs.ts
Normal file
44
ts_interfaces/requests/logs.ts
Normal file
@ -0,0 +1,44 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as authInterfaces from '../data/auth.js';
|
||||
import * as statsInterfaces from '../data/stats.js';
|
||||
|
||||
// Get Recent Logs
|
||||
export interface IReq_GetRecentLogs extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetRecentLogs
|
||||
> {
|
||||
method: 'getRecentLogs';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
level?: 'debug' | 'info' | 'warn' | 'error';
|
||||
category?: 'smtp' | 'dns' | 'security' | 'system' | 'email';
|
||||
limit?: number;
|
||||
offset?: number;
|
||||
search?: string;
|
||||
timeRange?: '1h' | '6h' | '24h' | '7d' | '30d';
|
||||
};
|
||||
response: {
|
||||
logs: statsInterfaces.ILogEntry[];
|
||||
total: number;
|
||||
hasMore: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
// Get Log Stream
|
||||
export interface IReq_GetLogStream extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetLogStream
|
||||
> {
|
||||
method: 'getLogStream';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
follow?: boolean;
|
||||
filters?: {
|
||||
level?: string[];
|
||||
category?: string[];
|
||||
};
|
||||
};
|
||||
response: {
|
||||
logStream: plugins.typedrequestInterfaces.IVirtualStream;
|
||||
};
|
||||
}
|
162
ts_interfaces/requests/stats.ts
Normal file
162
ts_interfaces/requests/stats.ts
Normal file
@ -0,0 +1,162 @@
|
||||
import * as plugins from '../plugins.js';
|
||||
import * as authInterfaces from '../data/auth.js';
|
||||
import * as statsInterfaces from '../data/stats.js';
|
||||
|
||||
// Server Statistics
|
||||
export interface IReq_GetServerStatistics extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetServerStatistics
|
||||
> {
|
||||
method: 'getServerStatistics';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
includeHistory?: boolean;
|
||||
timeRange?: '1h' | '6h' | '24h' | '7d' | '30d';
|
||||
};
|
||||
response: {
|
||||
stats: statsInterfaces.IServerStats;
|
||||
history?: Array<{
|
||||
timestamp: number;
|
||||
value: number;
|
||||
}>;
|
||||
};
|
||||
}
|
||||
|
||||
// Email Statistics
|
||||
export interface IReq_GetEmailStatistics extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetEmailStatistics
|
||||
> {
|
||||
method: 'getEmailStatistics';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
timeRange?: '1h' | '6h' | '24h' | '7d' | '30d';
|
||||
domain?: string;
|
||||
includeDetails?: boolean;
|
||||
};
|
||||
response: {
|
||||
stats: statsInterfaces.IEmailStats;
|
||||
domainBreakdown?: {
|
||||
[domain: string]: statsInterfaces.IEmailStats;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// DNS Statistics
|
||||
export interface IReq_GetDnsStatistics extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetDnsStatistics
|
||||
> {
|
||||
method: 'getDnsStatistics';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
timeRange?: '1h' | '6h' | '24h' | '7d' | '30d';
|
||||
domain?: string;
|
||||
includeQueryTypes?: boolean;
|
||||
};
|
||||
response: {
|
||||
stats: statsInterfaces.IDnsStats;
|
||||
domainBreakdown?: {
|
||||
[domain: string]: statsInterfaces.IDnsStats;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Rate Limit Status
|
||||
export interface IReq_GetRateLimitStatus extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetRateLimitStatus
|
||||
> {
|
||||
method: 'getRateLimitStatus';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
domain?: string;
|
||||
ip?: string;
|
||||
includeBlocked?: boolean;
|
||||
};
|
||||
response: {
|
||||
limits: statsInterfaces.IRateLimitInfo[];
|
||||
globalLimit?: {
|
||||
current: number;
|
||||
limit: number;
|
||||
remaining: number;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Security Metrics
|
||||
export interface IReq_GetSecurityMetrics extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetSecurityMetrics
|
||||
> {
|
||||
method: 'getSecurityMetrics';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
timeRange?: '1h' | '6h' | '24h' | '7d' | '30d';
|
||||
includeDetails?: boolean;
|
||||
};
|
||||
response: {
|
||||
metrics: statsInterfaces.ISecurityMetrics;
|
||||
trends?: {
|
||||
spam: Array<{ timestamp: number; value: number }>;
|
||||
malware: Array<{ timestamp: number; value: number }>;
|
||||
phishing: Array<{ timestamp: number; value: number }>;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Active Connections
|
||||
export interface IReq_GetActiveConnections extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetActiveConnections
|
||||
> {
|
||||
method: 'getActiveConnections';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
protocol?: 'smtp' | 'smtps' | 'http' | 'https';
|
||||
state?: string;
|
||||
};
|
||||
response: {
|
||||
connections: statsInterfaces.IConnectionInfo[];
|
||||
summary: {
|
||||
total: number;
|
||||
byProtocol: {
|
||||
[protocol: string]: number;
|
||||
};
|
||||
byState: {
|
||||
[state: string]: number;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
// Queue Status
|
||||
export interface IReq_GetQueueStatus extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetQueueStatus
|
||||
> {
|
||||
method: 'getQueueStatus';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
queueName?: string;
|
||||
};
|
||||
response: {
|
||||
queues: statsInterfaces.IQueueStatus[];
|
||||
totalItems: number;
|
||||
};
|
||||
}
|
||||
|
||||
// Health Check
|
||||
export interface IReq_GetHealthStatus extends plugins.typedrequestInterfaces.implementsTR<
|
||||
plugins.typedrequestInterfaces.ITypedRequest,
|
||||
IReq_GetHealthStatus
|
||||
> {
|
||||
method: 'getHealthStatus';
|
||||
request: {
|
||||
identity?: authInterfaces.IIdentity;
|
||||
detailed?: boolean;
|
||||
};
|
||||
response: {
|
||||
health: statsInterfaces.IHealthStatus;
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user