@serve.zone/interfaces 30.12.0 → 30.14.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.
@@ -1,3 +1,4 @@
1
+ import type { TServiceMailSubmissionTlsMode } from './mail.js';
1
2
  import type { ISystemSecretOwner, TSecretManagementScope } from './secret.js';
2
3
 
3
4
  export interface ICloudlyS3BackupTargetDescriptor {
@@ -42,6 +43,23 @@ export interface ICloudlySettings {
42
43
  dcrouterMailSubmissionTlsMode?: 'plain' | 'starttls' | 'implicitTls';
43
44
  dcrouterMailForwardTargetHost?: string;
44
45
  dcrouterMailForwardTargetHostsByNode?: Record<string, string>;
46
+ /** Whether this Cloudly reconciles a CoreMail workload at all. */
47
+ coreMailEnabled?: boolean;
48
+ coreMailServiceId?: string;
49
+ /** Canonical CoreMail control socket URL, `https://host/socket`. */
50
+ coreMailControlEndpointUrl?: string;
51
+ /** Canonical CoreMail HTTPS transfer origin, an origin without a path. */
52
+ coreMailTransferOrigin?: string;
53
+ /** Canonical `wss://` URL of dcrouter's CoreMail gateway socket. */
54
+ coreMailGatewayEndpointUrl?: string;
55
+ coreMailControlCredentialId?: string;
56
+ coreMailControlCredentialVersion?: number;
57
+ coreMailSmtpHost?: string;
58
+ coreMailSmtpPort?: number;
59
+ coreMailSmtpTlsMode?: TServiceMailSubmissionTlsMode;
60
+ coreMailDefaultMessagesPerMinute?: number;
61
+ coreMailDefaultMessagesPerDay?: number;
62
+ coreMailDefaultMaxPendingInbound?: number;
45
63
  corebuildWorkerUrl?: string;
46
64
  corebuildWorkerUrls?: string[];
47
65
  }
@@ -81,4 +99,13 @@ export const cloudlySystemSecretKeys = Object.freeze({
81
99
  scalewayAccessKey: 'SCALEWAY_ACCESS_KEY',
82
100
  scalewaySecretKey: 'SCALEWAY_SECRET_KEY',
83
101
  scalewayOrganizationId: 'SCALEWAY_ORGANIZATION_ID',
102
+ coreMailControlCredentialSecret: 'COREMAIL_CONTROL_CREDENTIAL_SECRET',
103
+ coreMailGatewayCredentialSecret: 'COREMAIL_GATEWAY_CREDENTIAL_SECRET',
104
+ /**
105
+ * Operator-supplied PEM material for the CoreMail submission listener in v1.
106
+ * Automatic certificate issuance for the listener is a later workstream; until
107
+ * it ships, the operator provisions and rotates this material.
108
+ */
109
+ coreMailSmtpTlsCertificatePem: 'COREMAIL_SMTP_TLS_CERTIFICATE_PEM',
110
+ coreMailSmtpTlsPrivateKeyPem: 'COREMAIL_SMTP_TLS_PRIVATE_KEY_PEM',
84
111
  } as const);
@@ -0,0 +1,83 @@
1
+ import type * as plugins from '../plugins.js';
2
+ import type {
3
+ ICoreMailReconciliationStatus,
4
+ ICoreMailServiceMailStatistics,
5
+ TCoreMailSha256,
6
+ } from '../data/coremail.js';
7
+ import type { IServiceMailTargetSummary } from '../data/mail.js';
8
+ import type { IIdentity } from '../data/user.js';
9
+
10
+ /**
11
+ * Operator-facing CoreMail requests served by Cloudly. Authority comes from the
12
+ * caller identity, exactly like the other admin mail requests; the CoreMail
13
+ * control session itself is never exposed to an operator client.
14
+ */
15
+ export interface IReq_GetCoreMailServiceMailStatistics extends plugins.typedrequestInterfaces.implementsTR<
16
+ plugins.typedrequestInterfaces.ITypedRequest,
17
+ IReq_GetCoreMailServiceMailStatistics
18
+ > {
19
+ method: 'getCoreMailServiceMailStatistics';
20
+ request: {
21
+ identity: IIdentity;
22
+ /** Optional service filter. Omitted means every service this identity may read. */
23
+ serviceId?: string;
24
+ /** Inclusive first UTC calendar day, `YYYY-MM-DD`. */
25
+ fromDayUtc: string;
26
+ /** Inclusive last UTC calendar day, `YYYY-MM-DD`. */
27
+ toDayUtc: string;
28
+ /** Opaque Cloudly-owned cursor. */
29
+ cursor?: string;
30
+ limit: number;
31
+ };
32
+ response: {
33
+ statistics: ICoreMailServiceMailStatistics[];
34
+ nextCursor?: string;
35
+ };
36
+ }
37
+
38
+ /**
39
+ * Current CoreMail control-plane state as Cloudly sees it. `enabled` is false
40
+ * when no CoreMail workload is configured, in which case every other field is
41
+ * absent rather than defaulted.
42
+ */
43
+ export interface IReq_GetCoreMailControlStatus extends plugins.typedrequestInterfaces.implementsTR<
44
+ plugins.typedrequestInterfaces.ITypedRequest,
45
+ IReq_GetCoreMailControlStatus
46
+ > {
47
+ method: 'getCoreMailControlStatus';
48
+ request: {
49
+ identity: IIdentity;
50
+ };
51
+ response: {
52
+ enabled: boolean;
53
+ coreMailServiceId?: string;
54
+ appliedConfigEpoch?: number;
55
+ appliedDesiredStateDigest?: TCoreMailSha256;
56
+ reconciliation?: ICoreMailReconciliationStatus;
57
+ lastError?: string;
58
+ updatedAt?: number;
59
+ };
60
+ }
61
+
62
+ /**
63
+ * Operator inventory of every service mail target: which addresses exist, where
64
+ * inbound mail is delivered, whether outbound submission is configured, and the
65
+ * CoreMail binding a service is bound to.
66
+ */
67
+ export interface IReq_ListServiceMailTargets extends plugins.typedrequestInterfaces.implementsTR<
68
+ plugins.typedrequestInterfaces.ITypedRequest,
69
+ IReq_ListServiceMailTargets
70
+ > {
71
+ method: 'listServiceMailTargets';
72
+ request: {
73
+ identity: IIdentity;
74
+ organizationId?: string;
75
+ /** Opaque Cloudly-owned cursor. */
76
+ cursor?: string;
77
+ limit: number;
78
+ };
79
+ response: {
80
+ services: IServiceMailTargetSummary[];
81
+ nextCursor?: string;
82
+ };
83
+ }
@@ -10,6 +10,7 @@ import type {
10
10
  ICoreMailRecipientResolution,
11
11
  ICoreMailReconciliationStatus,
12
12
  ICoreMailReplicaIdentity,
13
+ ICoreMailServiceMailStatistics,
13
14
  ICoreMailSubmission,
14
15
  ICoreMailUploadGrant,
15
16
  TCoreMailInboundAckOutcome,
@@ -237,6 +238,33 @@ export interface IReq_CoreMailGetReconciliationStatus extends plugins.typedreque
237
238
  };
238
239
  }
239
240
 
241
+ /**
242
+ * Control-session read of per-service mail counters. Authority comes from the
243
+ * authenticated control session; the request carries no tenant or binding
244
+ * authority of its own.
245
+ */
246
+ export interface IReq_CoreMailGetServiceMailStatistics extends plugins.typedrequestInterfaces.implementsTR<
247
+ plugins.typedrequestInterfaces.ITypedRequest,
248
+ IReq_CoreMailGetServiceMailStatistics
249
+ > {
250
+ method: 'coreMailGetServiceMailStatistics';
251
+ request: {
252
+ /** Inclusive first UTC calendar day, `YYYY-MM-DD`. */
253
+ fromDayUtc: string;
254
+ /** Inclusive last UTC calendar day, `YYYY-MM-DD`. */
255
+ toDayUtc: string;
256
+ /** Optional service filter. Omitted means every service known to this CoreMail. */
257
+ serviceIds?: string[];
258
+ /** Opaque CoreMail-owned composite cursor. */
259
+ cursor?: string;
260
+ limit: number;
261
+ };
262
+ response: {
263
+ statistics: ICoreMailServiceMailStatistics[];
264
+ nextCursor?: string;
265
+ };
266
+ }
267
+
240
268
  export interface IReq_CoreMailGatewayAuthenticate extends plugins.typedrequestInterfaces.implementsTR<
241
269
  plugins.typedrequestInterfaces.ITypedRequest,
242
270
  IReq_CoreMailGatewayAuthenticate
@@ -256,6 +284,13 @@ export interface IReq_CoreMailGatewayAuthenticate extends plugins.typedrequestIn
256
284
  };
257
285
  }
258
286
 
287
+ /**
288
+ * CoreMail binds every issued routing handle to a digest of the exact
289
+ * normalized `envelope` and `source` sent here. The following
290
+ * `coreMailGatewayPrepareInboundHandoff` call must therefore resend
291
+ * byte-identical values: the full `rcptTo` set in the same order, the same
292
+ * `mailFrom`, and the same connection source fields.
293
+ */
259
294
  export interface IReq_CoreMailGatewayResolveRecipients extends plugins.typedrequestInterfaces.implementsTR<
260
295
  plugins.typedrequestInterfaces.ITypedRequest,
261
296
  IReq_CoreMailGatewayResolveRecipients
@@ -271,6 +306,13 @@ export interface IReq_CoreMailGatewayResolveRecipients extends plugins.typedrequ
271
306
  };
272
307
  }
273
308
 
309
+ /**
310
+ * The handoff is validated against the routing handles issued by
311
+ * `coreMailGatewayResolveRecipients`. `message.envelope` and `source` must be
312
+ * byte-identical to the resolve-time values, including the full `rcptTo` set in
313
+ * the same order, because CoreMail recomputes the envelope digest the handles
314
+ * are bound to.
315
+ */
274
316
  export interface IReq_CoreMailGatewayPrepareInboundHandoff extends plugins.typedrequestInterfaces.implementsTR<
275
317
  plugins.typedrequestInterfaces.ITypedRequest,
276
318
  IReq_CoreMailGatewayPrepareInboundHandoff
@@ -343,6 +385,12 @@ export interface IReq_CoreMailGatewayCompleteOutboundHandoff extends plugins.typ
343
385
  };
344
386
  }
345
387
 
388
+ /**
389
+ * Status polling for one accepted transport message. `status.updatedAt` must be
390
+ * monotonic per `transportMessageId`. A `transportMessageId` that is
391
+ * permanently unknown to the gateway must be answered with a terminal `failed`
392
+ * status rather than an error, because CoreMail retries errors indefinitely.
393
+ */
346
394
  export interface IReq_CoreMailGatewayGetOutboundStatus extends plugins.typedrequestInterfaces.implementsTR<
347
395
  plugins.typedrequestInterfaces.ITypedRequest,
348
396
  IReq_CoreMailGatewayGetOutboundStatus
@@ -9,6 +9,7 @@ import * as certificateRequests from './certificate.js';
9
9
  import * as clusterRequests from './cluster.js';
10
10
  import * as configRequests from './config.js';
11
11
  import * as coreMailRequests from './coremail.js';
12
+ import * as coreMailAdminRequests from './coremail.admin.js';
12
13
  import * as corestoreRequests from './corestore.js';
13
14
  import * as deploymentRequests from './deployment.js';
14
15
  import * as dnsRequests from './dns.js';
@@ -47,6 +48,7 @@ export {
47
48
  clusterRequests as cluster,
48
49
  configRequests as config,
49
50
  coreMailRequests as coremail,
51
+ coreMailAdminRequests as coremailAdmin,
50
52
  corestoreRequests as corestore,
51
53
  deploymentRequests as deployment,
52
54
  dnsRequests as dns,
@@ -1,4 +1,5 @@
1
1
  import * as plugins from '../plugins.js';
2
+ import type { ICoreMailGatewayPeerDesiredState } from '../data/coremail.js';
2
3
  import type { IIdentity } from '../data/user.js';
3
4
  import type {
4
5
  IMailAddressBinding,
@@ -144,6 +145,67 @@ export interface IReq_DeleteMailAddressBinding extends plugins.typedrequestInter
144
145
  };
145
146
  }
146
147
 
148
+ /**
149
+ * dcrouter-owned CoreMail gateway peer state.
150
+ *
151
+ * `peer.transferOrigin` must equal the `gateway.coreMailTransferOrigin` carried
152
+ * in that CoreMail service's own desired state. The producer (Cloudly or
153
+ * Onebox) is the single owner of that string: dcrouter never infers it from a
154
+ * socket, Host header, TypedSocket tag, or peer input.
155
+ */
156
+ export interface IReq_ListCoreMailGatewayPeers extends plugins.typedrequestInterfaces.implementsTR<
157
+ plugins.typedrequestInterfaces.ITypedRequest,
158
+ IReq_ListCoreMailGatewayPeers
159
+ > {
160
+ method: 'listCoreMailGatewayPeers';
161
+ request: {
162
+ auth: IMailControlRequestAuth;
163
+ owner: IMailResourceOwner;
164
+ };
165
+ response: {
166
+ peers: ICoreMailGatewayPeerDesiredState[];
167
+ };
168
+ }
169
+
170
+ /**
171
+ * Creates or replaces one CoreMail gateway peer. On success the accepted peer is
172
+ * returned in its stored form so the producer can compare the exact applied
173
+ * state. `owner` is required (not partial) because a peer is producer-owned
174
+ * provisioning state, never a filtered listing.
175
+ */
176
+ export interface IReq_SyncCoreMailGatewayPeer extends plugins.typedrequestInterfaces.implementsTR<
177
+ plugins.typedrequestInterfaces.ITypedRequest,
178
+ IReq_SyncCoreMailGatewayPeer
179
+ > {
180
+ method: 'syncCoreMailGatewayPeer';
181
+ request: {
182
+ auth: IMailControlRequestAuth;
183
+ owner: IMailResourceOwner;
184
+ peer: ICoreMailGatewayPeerDesiredState;
185
+ };
186
+ response: {
187
+ success: boolean;
188
+ peer?: ICoreMailGatewayPeerDesiredState;
189
+ message?: string;
190
+ };
191
+ }
192
+
193
+ export interface IReq_DeleteCoreMailGatewayPeer extends plugins.typedrequestInterfaces.implementsTR<
194
+ plugins.typedrequestInterfaces.ITypedRequest,
195
+ IReq_DeleteCoreMailGatewayPeer
196
+ > {
197
+ method: 'deleteCoreMailGatewayPeer';
198
+ request: {
199
+ auth: IMailControlRequestAuth;
200
+ owner: IMailResourceOwner;
201
+ coreMailServiceId: string;
202
+ };
203
+ response: {
204
+ success: boolean;
205
+ message?: string;
206
+ };
207
+ }
208
+
147
209
  export interface IReq_ListWorkAppMailBindings extends plugins.typedrequestInterfaces.implementsTR<
148
210
  plugins.typedrequestInterfaces.ITypedRequest,
149
211
  IReq_ListWorkAppMailBindings