@serve.zone/dcrouter 34.6.0 → 34.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8,6 +8,7 @@ import * as interfaces from '../../ts_interfaces/index.js';
8
8
  import { McpManager } from './classes.mcpmanager.js';
9
9
  import { createLogStreamAuthorizationAdapter } from './helpers/logstream-auth.js';
10
10
  import { WorkloadMailServer } from './classes.workload-mail-server.js';
11
+ import { CoreMailGatewayServer } from './classes.coremail-gateway-server.js';
11
12
  import type { IListeningSocket } from '../config/helpers.listeners.js';
12
13
 
13
14
  export class OpsServer {
@@ -58,6 +59,8 @@ export class OpsServer {
58
59
  // Detach the edges start() adds to the dcRouter's main typedrouter, which outlives this server.
59
60
  private dcRouterEdgeDisposers: Array<() => void> = [];
60
61
  private workloadMailServer?: WorkloadMailServer;
62
+ /** The CoreMail gateway listener (wire 9) while it runs; absent unless configured. */
63
+ public coreMailGatewayServer?: CoreMailGatewayServer;
61
64
  /** The port the Ops server listens on from its completed start until its stop begins. */
62
65
  private listeningPort?: number;
63
66
 
@@ -67,8 +70,8 @@ export class OpsServer {
67
70
 
68
71
  /**
69
72
  * The Ops server's socket once its start completed: typedserver binds every address (`0.0.0.0`)
70
- * and refuses `start()` on an address another socket holds. The workload mail listener binds
71
- * 127.0.0.1 only and is never public, so it is not listed.
73
+ * and refuses `start()` on an address another socket holds. The workload mail and CoreMail
74
+ * gateway listeners bind 127.0.0.1 only and are never public, so they are not listed.
72
75
  */
73
76
  public getListeningSockets(): IListeningSocket[] {
74
77
  return this.listeningPort === undefined
@@ -107,6 +110,13 @@ export class OpsServer {
107
110
  );
108
111
  await this.workloadMailServer.start();
109
112
  }
113
+ if (this.dcRouterRef.options.coreMailGatewayServer) {
114
+ this.coreMailGatewayServer = new CoreMailGatewayServer(
115
+ this.dcRouterRef.options.coreMailGatewayServer,
116
+ this.dcRouterRef.coreMailGatewayManager,
117
+ );
118
+ await this.coreMailGatewayServer.start();
119
+ }
110
120
  } catch (startError) {
111
121
  // Nobody stops a server whose start failed (ServiceManager rolls back only the services that
112
122
  // started), so undo this start here and keep its error first.
@@ -241,6 +251,10 @@ export class OpsServer {
241
251
  await this.workloadMailServer?.stop();
242
252
  this.workloadMailServer = undefined;
243
253
  }),
254
+ attempt(async () => {
255
+ await this.coreMailGatewayServer?.stop();
256
+ this.coreMailGatewayServer = undefined;
257
+ }),
244
258
  attempt(() => this.server?.stop()),
245
259
  attempt(() => this.logsHandler?.cleanup()),
246
260
  ]);
package/ts/plugins.ts CHANGED
@@ -55,6 +55,18 @@ export {
55
55
  typedsocket,
56
56
  }
57
57
 
58
+ // The CoreMail gateway listener's wire (Linus ruling 70, L1 and L2): TypedServer 16 with its
59
+ // TypedSocket 10 (wire major 9) and the TypedRequest 9 copy that TypedServer resolves, under aliases
60
+ // only `CoreMailGatewayServer` and the gateway handlers it serves use. Everything else stays on the
61
+ // TypedSocket 8 packages above.
62
+ import * as typedrequestCoreMail from '@api.global/typedrequest-coremail';
63
+ import * as typedserverCoreMail from '@api.global/typedserver-coremail';
64
+
65
+ export {
66
+ typedrequestCoreMail,
67
+ typedserverCoreMail,
68
+ }
69
+
58
70
  // @idp.global scope
59
71
  import * as idpSdkServer from '@idp.global/sdk/server';
60
72
 
@@ -3,6 +3,6 @@
3
3
  */
4
4
  export const commitinfo = {
5
5
  name: '@serve.zone/dcrouter',
6
- version: '34.6.0',
6
+ version: '34.7.0',
7
7
  description: 'A multifaceted routing service handling mail and SMS delivery functions.'
8
8
  }