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:
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