fix(platformservice): Update dependency versions and refactor import paths for improved compatibility; add initial DcRouter plan documentation.

This commit is contained in:
2025-05-04 10:10:07 +00:00
parent a29cff2fc5
commit efd64d6304
10 changed files with 1743 additions and 1235 deletions

View File

@ -3,6 +3,6 @@
*/
export const commitinfo = {
name: '@serve.zone/platformservice',
version: '2.3.0',
version: '2.3.1',
description: 'A multifaceted platform service handling mail, SMS, letter delivery, and AI services.'
}

View File

@ -0,0 +1,49 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import { type IMtaConfig, MtaService } from '../mta/classes.mta.js';
export interface IDcRouterOptions {
portProxyConfig?: plugins.smartproxy.IPortProxySettings;
mtaConfig?: IMtaConfig;
dnsServerConfig?: plugins.smartdns.IDnsServerOptions;
}
/**
* DcRouter can be run on ingress and egress to and from a datacenter site.
*/
export class DcRouter {
private options: IDcRouterOptions;
public smartProxy: plugins.smartproxy.SmartProxy;
public mta: MtaService;
public dnsServer: plugins.smartdns.DnsServer;
constructor(optionsArg: IDcRouterOptions) {
this.options = optionsArg;
if (this.options.portProxyConfig) {
this.smartProxy = new plugins.smartproxy.SmartProxy(this.options.portProxyConfig);
}
if (this.options.mtaConfig) {
this.mta = new MtaService(null, this.options.mtaConfig);
}
}
public async start() {
if (this.smartProxy) {
await this.smartProxy.start();
}
if (this.mta) {
await this.mta.start();
}
}
public async stop() {
if (this.smartProxy) {
await this.smartProxy.stop();
}
if (this.mta) {
await this.mta.stop();
}
}
}
export default DcRouter;

View File

@ -61,7 +61,7 @@ export class ApiManager {
);
// Add endpoint to check email status
this.typedRouter.addTypedHandler<{ emailId: string }>(
this.typedRouter.addTypedHandler<plugins.servezoneInterfaces.platformservice.mta.IReq_CheckEmailStatus>(
new plugins.typedrequest.TypedHandler('checkEmailStatus', async (requestData) => {
// If MTA is enabled, use it to check status
if (this.emailRef.mtaConnector) {
@ -78,7 +78,7 @@ export class ApiManager {
);
// Add statistics endpoint
this.typedRouter.addTypedHandler<void>(
this.typedRouter.addTypedHandler<plugins.servezoneInterfaces.platformservice.mta.IReq_GetEMailStats>(
new plugins.typedrequest.TypedHandler('getEmailStats', async () => {
return this.emailRef.getStats();
})

View File

@ -1,6 +1,6 @@
import * as plugins from '../plugins.js';
import * as paths from '../paths.js';
import type { MtaService } from './mta.classes.mta.js';
import type { MtaService } from './classes.mta.js';
/**
* Interface for DNS record information

View File

@ -1,5 +1,5 @@
import * as plugins from '../plugins.js';
import type { MtaService } from './mta.classes.mta.js';
import type { MtaService } from './classes.mta.js';
interface Headers {
[key: string]: string;

View File

@ -41,6 +41,7 @@ export {
import * as projectinfo from '@push.rocks/projectinfo';
import * as qenv from '@push.rocks/qenv';
import * as smartdata from '@push.rocks/smartdata';
import * as smartdns from '@push.rocks/smartdns';
import * as smartfile from '@push.rocks/smartfile';
import * as smartlog from '@push.rocks/smartlog';
import * as smartmail from '@push.rocks/smartmail';
@ -51,7 +52,7 @@ import * as smartrequest from '@push.rocks/smartrequest';
import * as smartrule from '@push.rocks/smartrule';
import * as smartrx from '@push.rocks/smartrx';
export { projectinfo, qenv, smartdata, smartfile, smartlog, smartmail, smartpath, smartproxy, smartpromise, smartrequest, smartrule, smartrx };
export { projectinfo, qenv, smartdata, smartdns, smartfile, smartlog, smartmail, smartpath, smartproxy, smartpromise, smartrequest, smartrule, smartrx };
// apiclient.xyz scope
import * as letterxpress from '@apiclient.xyz/letterxpress';