@serve.zone/dcrouter 16.4.1 → 16.5.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.
Files changed (59) hide show
  1. package/deno.json +1 -1
  2. package/dist_serve/bundle.js +852 -852
  3. package/dist_ts/00_commitinfo_data.js +1 -1
  4. package/dist_ts/classes.dcrouter.d.ts +2 -1
  5. package/dist_ts/classes.dcrouter.js +20 -4
  6. package/dist_ts/db/documents/classes.dns-record.doc.d.ts +4 -0
  7. package/dist_ts/db/documents/classes.dns-record.doc.js +33 -2
  8. package/dist_ts/db/documents/classes.email-domain.doc.d.ts +5 -1
  9. package/dist_ts/db/documents/classes.email-domain.doc.js +26 -2
  10. package/dist_ts/dns/manager.dns.d.ts +6 -0
  11. package/dist_ts/dns/manager.dns.js +81 -32
  12. package/dist_ts/dns/providers/cloudflare.provider.d.ts +2 -0
  13. package/dist_ts/dns/providers/cloudflare.provider.js +45 -28
  14. package/dist_ts/email/classes.email-domain.manager.d.ts +43 -38
  15. package/dist_ts/email/classes.email-domain.manager.js +391 -324
  16. package/dist_ts/email/classes.mail-dns-sync.d.ts +58 -17
  17. package/dist_ts/email/classes.mail-dns-sync.js +857 -141
  18. package/dist_ts/email/classes.mail-edge-eligibility.d.ts +55 -0
  19. package/dist_ts/email/classes.mail-edge-eligibility.js +168 -0
  20. package/dist_ts/email/classes.mail-egress-coordinator.d.ts +3 -1
  21. package/dist_ts/email/classes.mail-egress-coordinator.js +43 -22
  22. package/dist_ts/email/classes.workapp-mail-manager.d.ts +3 -0
  23. package/dist_ts/email/classes.workapp-mail-manager.js +58 -12
  24. package/dist_ts/email/index.d.ts +1 -0
  25. package/dist_ts/email/index.js +2 -1
  26. package/dist_ts/opsserver/handlers/email-domain.handler.d.ts +1 -0
  27. package/dist_ts/opsserver/handlers/email-domain.handler.js +138 -22
  28. package/dist_ts/remoteingress/classes.hub-lifecycle.js +2 -1
  29. package/dist_ts/remoteingress/classes.tunnel-manager.d.ts +6 -0
  30. package/dist_ts/remoteingress/classes.tunnel-manager.js +40 -2
  31. package/dist_ts_interfaces/data/dns-record.d.ts +6 -0
  32. package/dist_ts_interfaces/data/email-domain.d.ts +81 -0
  33. package/dist_ts_interfaces/requests/email-domains.d.ts +25 -17
  34. package/dist_ts_migrations/index.js +152 -9
  35. package/dist_ts_web/00_commitinfo_data.js +1 -1
  36. package/dist_ts_web/appstate/email-domains.d.ts +16 -0
  37. package/dist_ts_web/appstate/email-domains.js +140 -19
  38. package/dist_ts_web/elements/email/ops-view-email-domains.d.ts +1 -0
  39. package/dist_ts_web/elements/email/ops-view-email-domains.js +36 -13
  40. package/package.json +3 -3
  41. package/readme.md +13 -1
  42. package/ts/00_commitinfo_data.ts +1 -1
  43. package/ts/classes.dcrouter.ts +22 -3
  44. package/ts/db/documents/classes.dns-record.doc.ts +20 -0
  45. package/ts/db/documents/classes.email-domain.doc.ts +14 -0
  46. package/ts/dns/manager.dns.ts +89 -29
  47. package/ts/dns/providers/cloudflare.provider.ts +46 -27
  48. package/ts/email/classes.email-domain.manager.ts +416 -368
  49. package/ts/email/classes.mail-dns-sync.ts +913 -146
  50. package/ts/email/classes.mail-edge-eligibility.ts +205 -0
  51. package/ts/email/classes.mail-egress-coordinator.ts +46 -23
  52. package/ts/email/classes.workapp-mail-manager.ts +69 -13
  53. package/ts/email/index.ts +1 -0
  54. package/ts/opsserver/handlers/email-domain.handler.ts +154 -21
  55. package/ts/remoteingress/classes.hub-lifecycle.ts +1 -0
  56. package/ts/remoteingress/classes.tunnel-manager.ts +53 -7
  57. package/ts_web/00_commitinfo_data.ts +1 -1
  58. package/ts_web/appstate/email-domains.ts +187 -18
  59. package/ts_web/elements/email/ops-view-email-domains.ts +44 -12
@@ -1,27 +1,68 @@
1
1
  import type { DcRouter } from '../classes.dcrouter.js';
2
- export declare const MAIL_DNS_SYNC_CREATED_BY = "mail-edge-sync";
2
+ import type { IEmailDnsRecordIntent, IEmailDomainEdgeIdentity } from '../../dist_ts_interfaces/data/email-domain.js';
3
+ import { MailEdgeEligibility } from './classes.mail-edge-eligibility.js';
4
+ export declare const MAIL_DNS_SYNC_CREATED_BY = "mail-dns-reconciler";
5
+ export declare const MAIL_DNS_MANAGED_BY = "mail-dns-reconciler";
6
+ export declare const MAIL_DNS_RETRY_INTERVAL_MS: number;
7
+ export interface IMailDnsVerificationResult {
8
+ valid: boolean;
9
+ reason?: string;
10
+ }
11
+ export interface IMailDnsVerifier {
12
+ verifyRecord(intent: IEmailDnsRecordIntent): Promise<IMailDnsVerificationResult>;
13
+ verifyMxSet?(intents: IEmailDnsRecordIntent[]): Promise<IMailDnsVerificationResult>;
14
+ verifyForwardConfirmedIdentity(identity: IEmailDomainEdgeIdentity): Promise<IMailDnsVerificationResult>;
15
+ destroy?(): void;
16
+ }
17
+ export declare function toReverseDnsName(address: string): string;
18
+ export declare class SmartDnsMailVerifier implements IMailDnsVerifier {
19
+ private client?;
20
+ private getClient;
21
+ verifyRecord(intent: IEmailDnsRecordIntent): Promise<IMailDnsVerificationResult>;
22
+ verifyMxSet(intents: IEmailDnsRecordIntent[]): Promise<IMailDnsVerificationResult>;
23
+ verifyForwardConfirmedIdentity(identity: IEmailDomainEdgeIdentity): Promise<IMailDnsVerificationResult>;
24
+ destroy(): void;
25
+ }
3
26
  /**
4
- * Reconciles the mail-facing A/AAAA records that make edges — never the hub —
5
- * the public identity of the mail platform:
6
- * (a) shared mail hostname → publicIp/publicIpV6 of every enabled mail edge,
7
- * (b) each edge's mailHostname → that edge's IPs (FCrDNS for outbound EHLO),
8
- * (c) mx.<domain> → the pinned edges' IPs for every pinned email domain.
9
- * Records are DB-backed DnsRecordDoc rows owned via createdBy 'mail-edge-sync';
10
- * provider-hosted zones (e.g. Cloudflare) are written through DnsManager's
11
- * provider path, dcrouter-authoritative zones serve immediately.
27
+ * Sole owner of managed mail DNS. API, topology, timer, and startup events only
28
+ * mark this globally serialized reconciler dirty.
12
29
  */
13
30
  export declare class MailDnsSync {
14
31
  private dcRouterRef;
15
- private syncInFlight?;
16
- private resyncQueued;
17
- constructor(dcRouterRef: DcRouter);
18
- /** Fire-and-forget trigger for CRUD hooks; failures are logged, not thrown. */
32
+ private verifier;
33
+ private started;
34
+ private stopped;
35
+ private dirty;
36
+ private runPromise?;
37
+ private retryTimer?;
38
+ private edgeEligibility;
39
+ constructor(dcRouterRef: DcRouter, edgeEligibility?: MailEdgeEligibility, verifier?: IMailDnsVerifier);
40
+ start(): Promise<void>;
41
+ stop(): Promise<void>;
19
42
  requestSync(reason: string): void;
20
- /** Coalescing entry point: concurrent triggers fold into one follow-up pass. */
43
+ /** Coalescing entry point used by API actions that need the durable outcome. */
21
44
  sync(reason: string): Promise<void>;
45
+ private kick;
46
+ private runLoop;
22
47
  private reconcile;
23
- private computeDesiredRecords;
24
- private getSharedMailHostname;
25
- /** Longest-suffix zone match: 'mx.gated.one' → zone 'gated.one'. */
48
+ private buildPlan;
49
+ private getActiveDkim;
50
+ private buildDkimIntent;
51
+ private intentForName;
52
+ private toDomainEdgeIdentity;
53
+ private allocateMxSlots;
54
+ private buildSpfValue;
55
+ private persistDesiredPlan;
56
+ private persistDeletingAttempt;
57
+ private reconcileZones;
58
+ private sortIntents;
59
+ private reconcileIntent;
60
+ private valuesEqual;
61
+ private isRelevantUnmanagedTxt;
62
+ private validateAndActivate;
63
+ private promotePendingDkim;
64
+ private statusForIntent;
65
+ private cleanupStaleManagedRecords;
66
+ private finalizeDeletingDomains;
26
67
  private findZoneForName;
27
68
  }