@serve.zone/interfaces 21.0.0 → 22.0.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.
@@ -10,7 +10,7 @@
10
10
  export type TCoreMailSha256 = `sha256:${string}`;
11
11
 
12
12
  export type TCoreMailCapability = 'outbound' | 'inbound';
13
- export type TCoreMailBindingState = 'active' | 'disabled';
13
+ export type TCoreMailBindingState = 'active' | 'draining' | 'disabled';
14
14
  export type TCoreMailCredentialState = 'current' | 'retiring';
15
15
  export type TCoreMailCredentialVerifierFormat = 'argon2id-v1';
16
16
  export type TCoreMailPartKind = 'text' | 'html' | 'attachment';
@@ -30,6 +30,16 @@ export type TCoreMailInboundDeliveryState = 'pending' | 'fetching' | 'fetched' |
30
30
  export type TCoreMailInboundAckOutcome = 'processed' | 'discarded';
31
31
  export type TCoreMailRecipientAction = 'accept' | 'reject' | 'defer';
32
32
  export type TCoreMailReconciliationState = 'applying' | 'ready' | 'failed';
33
+ export type TCoreMailWorkloadOperation =
34
+ | 'coreMailPrepareOutboundSubmission'
35
+ | 'coreMailPrepareOutboundPartUpload'
36
+ | 'coreMailCompleteOutboundPartUpload'
37
+ | 'coreMailFinalizeOutboundSubmission'
38
+ | 'coreMailGetOutboundSubmission'
39
+ | 'coreMailListInboundDeliveries'
40
+ | 'coreMailPrepareInboundFetch'
41
+ | 'coreMailCompleteInboundFetch'
42
+ | 'coreMailAcknowledgeInboundDelivery';
33
43
 
34
44
  export type TCoreMailErrorCode =
35
45
  | 'AUTHENTICATION_FAILED'
@@ -43,6 +53,7 @@ export type TCoreMailErrorCode =
43
53
  | 'INVALID_RECIPIENT'
44
54
  | 'INVALID_HEADER'
45
55
  | 'PAYLOAD_LIMIT_EXCEEDED'
56
+ | 'QUOTA_EXCEEDED'
46
57
  | 'IDEMPOTENCY_CONFLICT'
47
58
  | 'STATE_CONFLICT'
48
59
  | 'TRANSFER_GRANT_EXPIRED'
@@ -52,6 +63,9 @@ export type TCoreMailErrorCode =
52
63
  | 'TRANSFER_ENCODING_UNSUPPORTED'
53
64
  | 'OBJECT_INTEGRITY_CONFLICT'
54
65
  | 'DELIVERY_NOT_FETCHED'
66
+ | 'DELIVERY_DEFERRED'
67
+ | 'DELIVERY_FAILED'
68
+ | 'DELIVERY_DEAD_LETTERED'
55
69
  | 'GATEWAY_UNAVAILABLE'
56
70
  | 'RECONCILIATION_FENCE_MISMATCH';
57
71
 
@@ -111,6 +125,7 @@ export interface ICoreMailTransferGrant {
111
125
  sha256: TCoreMailSha256;
112
126
  lengthBytes: number;
113
127
  contentType: string;
128
+ issuedAt: number;
114
129
  expiresAt: number;
115
130
  }
116
131
 
@@ -138,8 +153,10 @@ export interface ICoreMailSubmission {
138
153
  transportMessageId?: string;
139
154
  attempts: number;
140
155
  nextAttemptAt?: number;
156
+ error?: ICoreMailErrorData;
141
157
  acceptedAt?: number;
142
158
  deliveredAt?: number;
159
+ terminalAt?: number;
143
160
  createdAt: number;
144
161
  updatedAt: number;
145
162
  }
@@ -158,6 +175,13 @@ export interface ICoreMailInboundDelivery {
158
175
  subject?: string;
159
176
  receivedAt: number;
160
177
  updatedAt: number;
178
+ acknowledgedAt?: number;
179
+ acknowledgedOutcome?: TCoreMailInboundAckOutcome;
180
+ }
181
+
182
+ export interface ICoreMailInboundDeliveryPage {
183
+ deliveries: ICoreMailInboundDelivery[];
184
+ nextCursor?: string;
161
185
  }
162
186
 
163
187
  export interface ICoreMailBindingCredentialVerifier {
@@ -172,7 +196,7 @@ export interface ICoreMailBindingCredentialVerifier {
172
196
  }
173
197
 
174
198
  export interface ICoreMailBindingDesiredState {
175
- schemaVersion: 1;
199
+ schemaVersion: 2;
176
200
  bindingId: string;
177
201
  serviceId: string;
178
202
  tenantId: string;
@@ -183,15 +207,17 @@ export interface ICoreMailBindingDesiredState {
183
207
  allowedSenders: string[];
184
208
  inboundRecipients: string[];
185
209
  defaultSender?: string;
186
- limits?: {
187
- messagesPerMinute?: number;
188
- messagesPerDay?: number;
189
- maxPendingInbound?: number;
210
+ limits: {
211
+ messagesPerMinute: number;
212
+ messagesPerDay: number;
213
+ maxPendingInbound: number;
190
214
  };
191
215
  }
192
216
 
193
217
  export interface ICoreMailGatewayDesiredState {
194
218
  endpointUrl: string;
219
+ /** Canonical CoreMail HTTPS origin authorized for path-only transfer grants. */
220
+ coreMailTransferOrigin: string;
195
221
  credentialId: string;
196
222
  credentialVersion: number;
197
223
  /** Key in CoreMail's resolved runtime secret material, never a plaintext value. */
@@ -220,11 +246,21 @@ export interface ICoreMailGatewayPeerDesiredState {
220
246
  credentials: ICoreMailBindingCredentialVerifier[];
221
247
  }
222
248
 
249
+ export interface ICoreMailRuntimeKeyReference {
250
+ keyId: string;
251
+ version: number;
252
+ state: TCoreMailCredentialState;
253
+ /** Key in CoreMail's resolved runtime secret material, never a plaintext value. */
254
+ secretKey: string;
255
+ acceptUntil?: number;
256
+ }
257
+
223
258
  export interface ICoreMailDesiredState {
224
- schemaVersion: 1;
259
+ schemaVersion: 2;
225
260
  configEpoch: number;
226
261
  bindings: ICoreMailBindingDesiredState[];
227
262
  gateway: ICoreMailGatewayDesiredState;
263
+ cursorKeys: ICoreMailRuntimeKeyReference[];
228
264
  }
229
265
 
230
266
  export interface ICoreMailReplicaIdentity {
@@ -239,7 +275,9 @@ export interface ICoreMailBindingReconciliationStatus {
239
275
  bindingId: string;
240
276
  revision: number;
241
277
  state: TCoreMailBindingState;
242
- activeSessionsByCredentialVersion: Array<{
278
+ pendingInboundCount: number;
279
+ activeSessionsByCredential: Array<{
280
+ credentialId: string;
243
281
  version: number;
244
282
  count: number;
245
283
  }>;
@@ -281,7 +319,10 @@ export interface ICoreMailGatewayOutboundStatus {
281
319
  >;
282
320
  attempts: number;
283
321
  nextAttemptAt?: number;
322
+ error?: ICoreMailErrorData;
284
323
  smtpCode?: number;
324
+ deliveredAt?: number;
325
+ terminalAt?: number;
285
326
  updatedAt: number;
286
327
  }
287
328
 
@@ -295,12 +336,83 @@ export const coreMailLimits = Object.freeze({
295
336
  aggregateAttachmentBytes: 17 * 1024 * 1024,
296
337
  mimeFramingBytes: 512 * 1024,
297
338
  serializedMimeBytes: 30 * 1024 * 1024,
339
+ recipientCount: 100,
340
+ inboundPageSize: 100,
341
+ inboundPageBytes: 56 * 1024,
342
+ cursorBytes: 1_024,
343
+ cursorMinimumDecodedBytes: 32,
344
+ routingHandleTtlMs: 5 * 60 * 1000,
298
345
  transferGrantTtlMs: 5 * 60 * 1000,
299
346
  transferHeaderTimeoutMs: 10 * 1000,
300
347
  transferIdleTimeoutMs: 15 * 1000,
301
348
  transferOverallTimeoutMs: 2 * 60 * 1000,
302
349
  } as const);
303
350
 
351
+ export const coreMailTransferTokenPolicy = Object.freeze({
352
+ format: 'base64url-256' as const,
353
+ decodedBytes: 32,
354
+ encodedCharacters: 43,
355
+ });
356
+
357
+ export const coreMailWorkloadOperationPolicy = Object.freeze({
358
+ active: Object.freeze({
359
+ outbound: Object.freeze([
360
+ 'coreMailPrepareOutboundSubmission',
361
+ 'coreMailPrepareOutboundPartUpload',
362
+ 'coreMailCompleteOutboundPartUpload',
363
+ 'coreMailFinalizeOutboundSubmission',
364
+ 'coreMailGetOutboundSubmission',
365
+ ] satisfies TCoreMailWorkloadOperation[]),
366
+ inbound: Object.freeze([
367
+ 'coreMailListInboundDeliveries',
368
+ 'coreMailPrepareInboundFetch',
369
+ 'coreMailCompleteInboundFetch',
370
+ 'coreMailAcknowledgeInboundDelivery',
371
+ ] satisfies TCoreMailWorkloadOperation[]),
372
+ }),
373
+ draining: Object.freeze({
374
+ outbound: Object.freeze([
375
+ 'coreMailGetOutboundSubmission',
376
+ ] satisfies TCoreMailWorkloadOperation[]),
377
+ inbound: Object.freeze([
378
+ 'coreMailListInboundDeliveries',
379
+ 'coreMailPrepareInboundFetch',
380
+ 'coreMailCompleteInboundFetch',
381
+ 'coreMailAcknowledgeInboundDelivery',
382
+ ] satisfies TCoreMailWorkloadOperation[]),
383
+ }),
384
+ disabled: Object.freeze({
385
+ outbound: Object.freeze([] satisfies TCoreMailWorkloadOperation[]),
386
+ inbound: Object.freeze([] satisfies TCoreMailWorkloadOperation[]),
387
+ }),
388
+ });
389
+
390
+ export const coreMailRetentionPolicy = Object.freeze({
391
+ terminalOutboundMs: 30 * 24 * 60 * 60 * 1000,
392
+ acknowledgedInboundMs: 30 * 24 * 60 * 60 * 1000,
393
+ idempotencyReceiptMs: 30 * 24 * 60 * 60 * 1000,
394
+ expiredCapabilityMs: 24 * 60 * 60 * 1000,
395
+ pendingInboundAgePurge: false as const,
396
+ });
397
+
398
+ export const coreMailQuotaPolicy = Object.freeze({
399
+ windows: 'fixed-utc-minute-and-day' as const,
400
+ outboundUnit: 'first-durable-idempotency-insert' as const,
401
+ outboundReplayConsumesUnit: false as const,
402
+ pendingInboundStates: ['pending', 'fetching', 'fetched'] as const,
403
+ inboundAcknowledgementReleasesUnit: true as const,
404
+ });
405
+
406
+ export const coreMailTransferProtocol = Object.freeze({
407
+ pathPrefix: '/transfers/',
408
+ authorizationScheme: 'Bearer',
409
+ putSuccessStatus: 204,
410
+ getSuccessStatus: 200,
411
+ requireContentLength: true,
412
+ requireContentType: true,
413
+ integritySource: 'grant-metadata-and-completion' as const,
414
+ });
415
+
304
416
  export const coreMailCredentialVerifierPolicy = Object.freeze({
305
417
  format: 'argon2id-v1' as const,
306
418
  version: 19,
@@ -1,6 +1,7 @@
1
1
  import type * as plugins from '../plugins.js';
2
2
  import type {
3
3
  ICoreMailEnvelope,
4
+ ICoreMailInboundDeliveryPage,
4
5
  ICoreMailDownloadGrant,
5
6
  ICoreMailGatewayMessageDescriptor,
6
7
  ICoreMailGatewayOutboundStatus,
@@ -13,6 +14,7 @@ import type {
13
14
  ICoreMailUploadGrant,
14
15
  TCoreMailInboundAckOutcome,
15
16
  TCoreMailSha256,
17
+ TCoreMailWorkloadOperation,
16
18
  } from '../data/coremail.js';
17
19
  import type { IMailConnectionInfo } from '../data/mail.js';
18
20
 
@@ -29,8 +31,13 @@ export interface IReq_CoreMailAuthenticateWorkload extends plugins.typedrequestI
29
31
  };
30
32
  response: {
31
33
  authenticated: true;
34
+ credentialId: string;
32
35
  credentialVersion: number;
36
+ bindingState: 'active' | 'draining';
33
37
  capabilities: Array<'outbound' | 'inbound'>;
38
+ allowedOperations: TCoreMailWorkloadOperation[];
39
+ /** Authenticated CoreMail HTTPS origin for path-only transfer grants. */
40
+ coreMailTransferOrigin: string;
34
41
  };
35
42
  }
36
43
 
@@ -113,12 +120,11 @@ export interface IReq_CoreMailListInboundDeliveries extends plugins.typedrequest
113
120
  > {
114
121
  method: 'coreMailListInboundDeliveries';
115
122
  request: {
116
- afterDeliveryId?: string;
123
+ /** Opaque CoreMail-owned composite cursor. */
124
+ cursor?: string;
117
125
  limit: number;
118
126
  };
119
- response: {
120
- deliveries: ICoreMailInboundDelivery[];
121
- };
127
+ response: ICoreMailInboundDeliveryPage;
122
128
  }
123
129
 
124
130
  export interface IReq_CoreMailPrepareInboundFetch extends plugins.typedrequestInterfaces.implementsTR<
@@ -177,6 +183,8 @@ export interface IReq_CoreMailAuthenticateControl extends plugins.typedrequestIn
177
183
  };
178
184
  response: {
179
185
  authenticated: true;
186
+ credentialId: string;
187
+ credentialVersion: number;
180
188
  replica: ICoreMailReplicaIdentity;
181
189
  };
182
190
  }
@@ -241,6 +249,7 @@ export interface IReq_CoreMailGatewayAuthenticate extends plugins.typedrequestIn
241
249
  };
242
250
  response: {
243
251
  authenticated: true;
252
+ credentialId: string;
244
253
  credentialVersion: number;
245
254
  /** dcrouter's authoritative, control-plane-bound origin for CoreMail transfer paths. */
246
255
  coreMailTransferOrigin: string;
@@ -2,6 +2,16 @@ import * as plugins from '../plugins.js';
2
2
  import * as serviceInterfaces from '../data/service.js';
3
3
  import * as userInterfaces from '../data/user.js';
4
4
 
5
+ type TReportReconciliationRolloutIdentity =
6
+ | {
7
+ rolloutId: string;
8
+ rolloutGeneration: number;
9
+ }
10
+ | {
11
+ rolloutId?: never;
12
+ rolloutGeneration?: never;
13
+ };
14
+
5
15
  /**
6
16
  * a status update dashboard
7
17
  */
@@ -23,17 +33,19 @@ export interface IRequest_Coreflow_Cloudly_ReportReconciliationStatus
23
33
  IRequest_Coreflow_Cloudly_ReportReconciliationStatus
24
34
  > {
25
35
  method: 'reportReconciliationStatus';
26
- request: {
27
- identity: userInterfaces.IIdentity;
28
- serviceId: string;
29
- serviceName?: string;
30
- stage: string;
31
- stageKey?: string;
32
- status: serviceInterfaces.TServiceReconciliationStatus;
33
- domainName?: string;
34
- message?: string;
35
- errorText?: string;
36
- reportedAt?: number;
37
- };
36
+ request:
37
+ & {
38
+ identity: userInterfaces.IIdentity;
39
+ serviceId: string;
40
+ serviceName?: string;
41
+ stage: string;
42
+ stageKey?: string;
43
+ status: serviceInterfaces.TServiceReconciliationStatus;
44
+ domainName?: string;
45
+ message?: string;
46
+ errorText?: string;
47
+ reportedAt?: number;
48
+ }
49
+ & TReportReconciliationRolloutIdentity;
38
50
  response: {};
39
51
  }