mailery 0.3.2 → 0.5.1

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.
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RunnerContext, N as NormalizedEvent, C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult, c as Mailer, T as TemplateDoc, d as SuppressionScope, F as FlowStep, e as SegmentFilter, P as Predicate } from './null-CGaNDDlQ.cjs';
2
- export { f as AuditLogDoc, B as BroadcastDoc, g as BroadcastStatus, h as CircuitBreakerThresholds, i as Collections, j as ContactTagDoc, E as EventDoc, k as FlowDoc, l as FlowGoal, m as FlowRunDoc, n as FlowRunStatus, o as FlowVersionDoc, H as HealthDoc, p as HealthStatus, L as LeadDoc, q as MailerConfig, r as NullProvider, O as OutboxDoc, s as RedisOptions, t as SegmentDefinition, u as SendDoc, v as SendStatus, w as SenderDomainConfig, x as SenderDomainRegistry, y as SenderDomainValidation, z as SubscriptionDoc, D as SubscriptionStatus, G as SuppressionDoc, I as SuppressionReason, J as TemplateKind, K as TemplateVersionDoc, W as WebhookEventDoc, Q as ensureIndexes, U as getCollections, V as validateSenderDomain } from './null-CGaNDDlQ.cjs';
1
+ import { R as RunnerContext, N as NormalizedEvent, C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult, c as MailTesterFeedback, d as Mailer, T as TemplateDoc, e as SuppressionScope, F as FlowStep, f as SegmentFilter, P as Predicate } from './null-BYB6v4Iv.cjs';
2
+ export { g as AuditLogDoc, B as BroadcastDoc, h as BroadcastStatus, i as CircuitBreakerThresholds, j as Collections, k as ContactTagDoc, E as EventDoc, l as FlowDoc, m as FlowGoal, n as FlowRunDoc, o as FlowRunStatus, p as FlowVersionDoc, H as HealthDoc, q as HealthStatus, L as LeadDoc, r as MailerConfig, s as NullProvider, O as OutboxDoc, t as RedisOptions, u as SegmentDefinition, v as SendDoc, w as SendStatus, x as SenderDomainConfig, y as SenderDomainRegistry, z as SenderDomainValidation, D as SubscriptionDoc, G as SubscriptionStatus, I as SuppressionDoc, J as SuppressionReason, K as TemplateKind, Q as TemplateVersionDoc, W as WebhookEventDoc, U as ensureIndexes, V as getCollections, X as validateSenderDomain } from './null-BYB6v4Iv.cjs';
3
3
  import { ObjectId, Db, Filter } from 'mongodb';
4
4
  import { Request, Router } from 'express';
5
5
  import Handlebars from 'handlebars';
@@ -140,6 +140,37 @@ declare class SendGridProvider implements MailProvider {
140
140
  parseWebhookEvents(payload: unknown): NormalizedEvent[];
141
141
  }
142
142
 
143
+ /**
144
+ * Mail-Tester deliverability check.
145
+ *
146
+ * 1. Operator clicks "Run deliverability check" in the template editor.
147
+ * 2. Mailery provisions a check (gets a unique test address from Mail-Tester).
148
+ * 3. Mailery sends the rendered draft to that address via the operator's
149
+ * default provider.
150
+ * 4. Mailery polls Mail-Tester for the score (typically arrives 10-30s after
151
+ * receipt) and caches it keyed on a content fingerprint.
152
+ * 5. If the score is below `minScore` the publish endpoint refuses unless
153
+ * the operator passes `bypassMailTester: true` in the publish request.
154
+ *
155
+ * The client interface is pluggable so tests inject a stub. Real
156
+ * implementation hits https://mail-tester.com/api/.
157
+ */
158
+
159
+ interface ProvisionedCheck {
160
+ checkId: string;
161
+ emailAddress: string;
162
+ }
163
+ interface MailTesterResult {
164
+ ready: boolean;
165
+ score: number;
166
+ feedback: MailTesterFeedback[];
167
+ rawSummary: string | null;
168
+ }
169
+ interface MailTesterClient {
170
+ provisionCheck(): Promise<ProvisionedCheck>;
171
+ fetchResult(checkId: string): Promise<MailTesterResult>;
172
+ }
173
+
143
174
  /**
144
175
  * Admin router — serves the prebuilt React SPA + REST endpoints the SPA
145
176
  * consumes. Mount inside a host Express app, gated by host auth.
@@ -154,6 +185,11 @@ interface AdminRouterOptions {
154
185
  spaDir?: string;
155
186
  /** Resolve actor metadata from a Request. Defaults to `human:${req.user?.email || 'anonymous'}`. */
156
187
  getActor?: (req: Request) => string;
188
+ /**
189
+ * Inject a Mail-Tester client (tests use a stub). When omitted, a real
190
+ * client is created from `mailer.config.mailTester`.
191
+ */
192
+ mailTesterClient?: MailTesterClient;
157
193
  }
158
194
  declare function createAdminRouter(mailer: Mailer, opts?: AdminRouterOptions): Router;
159
195
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RunnerContext, N as NormalizedEvent, C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult, c as Mailer, T as TemplateDoc, d as SuppressionScope, F as FlowStep, e as SegmentFilter, P as Predicate } from './null-CGaNDDlQ.js';
2
- export { f as AuditLogDoc, B as BroadcastDoc, g as BroadcastStatus, h as CircuitBreakerThresholds, i as Collections, j as ContactTagDoc, E as EventDoc, k as FlowDoc, l as FlowGoal, m as FlowRunDoc, n as FlowRunStatus, o as FlowVersionDoc, H as HealthDoc, p as HealthStatus, L as LeadDoc, q as MailerConfig, r as NullProvider, O as OutboxDoc, s as RedisOptions, t as SegmentDefinition, u as SendDoc, v as SendStatus, w as SenderDomainConfig, x as SenderDomainRegistry, y as SenderDomainValidation, z as SubscriptionDoc, D as SubscriptionStatus, G as SuppressionDoc, I as SuppressionReason, J as TemplateKind, K as TemplateVersionDoc, W as WebhookEventDoc, Q as ensureIndexes, U as getCollections, V as validateSenderDomain } from './null-CGaNDDlQ.js';
1
+ import { R as RunnerContext, N as NormalizedEvent, C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult, c as MailTesterFeedback, d as Mailer, T as TemplateDoc, e as SuppressionScope, F as FlowStep, f as SegmentFilter, P as Predicate } from './null-BYB6v4Iv.js';
2
+ export { g as AuditLogDoc, B as BroadcastDoc, h as BroadcastStatus, i as CircuitBreakerThresholds, j as Collections, k as ContactTagDoc, E as EventDoc, l as FlowDoc, m as FlowGoal, n as FlowRunDoc, o as FlowRunStatus, p as FlowVersionDoc, H as HealthDoc, q as HealthStatus, L as LeadDoc, r as MailerConfig, s as NullProvider, O as OutboxDoc, t as RedisOptions, u as SegmentDefinition, v as SendDoc, w as SendStatus, x as SenderDomainConfig, y as SenderDomainRegistry, z as SenderDomainValidation, D as SubscriptionDoc, G as SubscriptionStatus, I as SuppressionDoc, J as SuppressionReason, K as TemplateKind, Q as TemplateVersionDoc, W as WebhookEventDoc, U as ensureIndexes, V as getCollections, X as validateSenderDomain } from './null-BYB6v4Iv.js';
3
3
  import { ObjectId, Db, Filter } from 'mongodb';
4
4
  import { Request, Router } from 'express';
5
5
  import Handlebars from 'handlebars';
@@ -140,6 +140,37 @@ declare class SendGridProvider implements MailProvider {
140
140
  parseWebhookEvents(payload: unknown): NormalizedEvent[];
141
141
  }
142
142
 
143
+ /**
144
+ * Mail-Tester deliverability check.
145
+ *
146
+ * 1. Operator clicks "Run deliverability check" in the template editor.
147
+ * 2. Mailery provisions a check (gets a unique test address from Mail-Tester).
148
+ * 3. Mailery sends the rendered draft to that address via the operator's
149
+ * default provider.
150
+ * 4. Mailery polls Mail-Tester for the score (typically arrives 10-30s after
151
+ * receipt) and caches it keyed on a content fingerprint.
152
+ * 5. If the score is below `minScore` the publish endpoint refuses unless
153
+ * the operator passes `bypassMailTester: true` in the publish request.
154
+ *
155
+ * The client interface is pluggable so tests inject a stub. Real
156
+ * implementation hits https://mail-tester.com/api/.
157
+ */
158
+
159
+ interface ProvisionedCheck {
160
+ checkId: string;
161
+ emailAddress: string;
162
+ }
163
+ interface MailTesterResult {
164
+ ready: boolean;
165
+ score: number;
166
+ feedback: MailTesterFeedback[];
167
+ rawSummary: string | null;
168
+ }
169
+ interface MailTesterClient {
170
+ provisionCheck(): Promise<ProvisionedCheck>;
171
+ fetchResult(checkId: string): Promise<MailTesterResult>;
172
+ }
173
+
143
174
  /**
144
175
  * Admin router — serves the prebuilt React SPA + REST endpoints the SPA
145
176
  * consumes. Mount inside a host Express app, gated by host auth.
@@ -154,6 +185,11 @@ interface AdminRouterOptions {
154
185
  spaDir?: string;
155
186
  /** Resolve actor metadata from a Request. Defaults to `human:${req.user?.email || 'anonymous'}`. */
156
187
  getActor?: (req: Request) => string;
188
+ /**
189
+ * Inject a Mail-Tester client (tests use a stub). When omitted, a real
190
+ * client is created from `mailer.config.mailTester`.
191
+ */
192
+ mailTesterClient?: MailTesterClient;
157
193
  }
158
194
  declare function createAdminRouter(mailer: Mailer, opts?: AdminRouterOptions): Router;
159
195