mailery 0.1.1 → 0.1.2
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/admin/spa/{index-DnPQRmZe.js → index-DlhleV6M.js} +2 -2
- package/dist/admin/spa/{index-DnPQRmZe.js.map → index-DlhleV6M.js.map} +1 -1
- package/dist/admin/spa/index.html +1 -1
- package/dist/admin/spa/{template-editor-DFGyqPn3.js → template-editor-DUZfzI5F.js} +65 -65
- package/dist/admin/spa/{template-editor-DFGyqPn3.js.map → template-editor-DUZfzI5F.js.map} +1 -1
- package/dist/index.cjs +7 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +58 -4
- package/dist/index.d.ts +58 -4
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{null-sygex0Ru.d.cts → null-OzIqP7A8.d.cts} +1 -1
- package/dist/{null-sygex0Ru.d.ts → null-OzIqP7A8.d.ts} +1 -1
- package/dist/testing.d.cts +1 -1
- package/dist/testing.d.ts +1 -1
- package/package.json +5 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,59 @@
|
|
|
1
|
-
import { C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult,
|
|
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,
|
|
3
|
-
import { Db, Filter } from 'mongodb';
|
|
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-OzIqP7A8.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 SubscriptionDoc, x as SubscriptionStatus, y as SuppressionDoc, z as SuppressionReason, D as TemplateKind, G as TemplateVersionDoc, W as WebhookEventDoc, I as ensureIndexes, J as getCollections } from './null-OzIqP7A8.cjs';
|
|
3
|
+
import { ObjectId, Db, Filter } from 'mongodb';
|
|
4
4
|
import { Request, Router } from 'express';
|
|
5
5
|
import Handlebars from 'handlebars';
|
|
6
6
|
import 'ioredis';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The mailer:tick handler. Orchestrates all the periodic work that doesn't
|
|
11
|
+
* fit a delayed-job model: event-trigger scanning, recovery sweep,
|
|
12
|
+
* scheduled-broadcast dispatch, outbox draining, rollups.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare function runTick(ctx: RunnerContext): Promise<void>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Flow_run state machine. One step transition per `processOneRunStep` call.
|
|
19
|
+
* Idempotent — optimistic concurrency on `currentStepIndex` means two workers
|
|
20
|
+
* racing on the same run advance exactly once.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare function processOneRunStep(runId: ObjectId, ctx: RunnerContext): Promise<void>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Send pipeline. `handleSend` is called by the runner state machine; it creates
|
|
27
|
+
* the Send document and enqueues a mailer:send job. `dispatchSend` is the
|
|
28
|
+
* worker — re-checks suppression + circuit breaker, applies tracking, calls
|
|
29
|
+
* the provider, updates the Send row.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
declare function dispatchSend(sendId: ObjectId, ctx: RunnerContext): Promise<void>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Event-trigger scan. Finds new event firings since each flow's
|
|
36
|
+
* lastTriggerScanAt watermark, creates flow_runs for matching contacts,
|
|
37
|
+
* enqueues immediate-advance jobs.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
declare function processNewlyFiredEventTriggers(ctx: RunnerContext): Promise<void>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Recovery sweep: finds active flow_runs whose `nextActionAt` has passed but
|
|
44
|
+
* weren't woken by their delayed `mailer:advance` job (worker restart, BullMQ
|
|
45
|
+
* data loss). Processes each one inline.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
declare function sweepStrandedFlowRuns(ctx: RunnerContext): Promise<void>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Apply a normalized provider event to the corresponding Send + cascading
|
|
52
|
+
* suppression / subscription updates. Called from the webhook worker.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
declare function applyWebhookEvent(event: NormalizedEvent, ctx: RunnerContext): Promise<void>;
|
|
56
|
+
|
|
9
57
|
/**
|
|
10
58
|
* MongoContactAdapter — reads contacts directly from the host's `users`
|
|
11
59
|
* collection (read-mostly; optional narrow tag writes). Mailer never
|
|
@@ -157,6 +205,12 @@ interface CompileResult {
|
|
|
157
205
|
}
|
|
158
206
|
/** Compile MJML → HTML, then derive plain text. Called at template publish time. */
|
|
159
207
|
declare function compileTemplate(mjml: string): Promise<CompileResult>;
|
|
208
|
+
/**
|
|
209
|
+
* Compile Maily editor JSON (Tiptap-shape) → HTML via `@maily-to/render`, then
|
|
210
|
+
* derive plain text. Called at template publish time when the template was
|
|
211
|
+
* authored via the WYSIWYG editor.
|
|
212
|
+
*/
|
|
213
|
+
declare function compileMailyTemplate(content: unknown): Promise<CompileResult>;
|
|
160
214
|
/** Auto-derive plain text from compiled HTML. */
|
|
161
215
|
declare function derivePlaintext(html: string): string;
|
|
162
216
|
interface RenderContext {
|
|
@@ -288,4 +342,4 @@ declare const DEDUPE_POLICIES: readonly DedupePolicyOption[];
|
|
|
288
342
|
*/
|
|
289
343
|
declare const VERSION = "0.1.0";
|
|
290
344
|
|
|
291
|
-
export { AdapterFilter, type AdminRouterOptions, Contact, ContactAdapter, DEDUPE_POLICIES, type DedupePolicyOption, FLOW_STEP_KINDS, FlowStep, type FlowStepKindOption, MailProvider, Mailer, MongoContactAdapter, type MongoContactAdapterOptions, NormalizedEvent, PREDICATE_KINDS, Predicate, type PredicateKind, type PredicateKindOption, type PublicRouterOptions, SEGMENT_FILTER_KINDS, SegmentFilter, type SegmentFilterKind, type SegmentFilterKindOption, SendArgs, SendGridProvider, type SendGridProviderOptions, SendResult, SuppressionScope, TemplateDoc, VERSION, applyTracking, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, predicateKind, renderTemplate, sha256Hex, signUnsubscribeToken, verifyUnsubscribeToken };
|
|
345
|
+
export { AdapterFilter, type AdminRouterOptions, Contact, ContactAdapter, DEDUPE_POLICIES, type DedupePolicyOption, FLOW_STEP_KINDS, FlowStep, type FlowStepKindOption, MailProvider, Mailer, MongoContactAdapter, type MongoContactAdapterOptions, NormalizedEvent, PREDICATE_KINDS, Predicate, type PredicateKind, type PredicateKindOption, type PublicRouterOptions, SEGMENT_FILTER_KINDS, SegmentFilter, type SegmentFilterKind, type SegmentFilterKindOption, SendArgs, SendGridProvider, type SendGridProviderOptions, SendResult, SuppressionScope, TemplateDoc, VERSION, applyTracking, applyWebhookEvent, compileMailyTemplate, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, dispatchSend, predicateKind, processNewlyFiredEventTriggers, processOneRunStep, renderTemplate, runTick, sha256Hex, signUnsubscribeToken, sweepStrandedFlowRuns, verifyUnsubscribeToken };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,11 +1,59 @@
|
|
|
1
|
-
import { C as ContactAdapter, a as Contact, A as AdapterFilter, M as MailProvider, S as SendArgs, b as SendResult,
|
|
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,
|
|
3
|
-
import { Db, Filter } from 'mongodb';
|
|
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-OzIqP7A8.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 SubscriptionDoc, x as SubscriptionStatus, y as SuppressionDoc, z as SuppressionReason, D as TemplateKind, G as TemplateVersionDoc, W as WebhookEventDoc, I as ensureIndexes, J as getCollections } from './null-OzIqP7A8.js';
|
|
3
|
+
import { ObjectId, Db, Filter } from 'mongodb';
|
|
4
4
|
import { Request, Router } from 'express';
|
|
5
5
|
import Handlebars from 'handlebars';
|
|
6
6
|
import 'ioredis';
|
|
7
7
|
import 'zod';
|
|
8
8
|
|
|
9
|
+
/**
|
|
10
|
+
* The mailer:tick handler. Orchestrates all the periodic work that doesn't
|
|
11
|
+
* fit a delayed-job model: event-trigger scanning, recovery sweep,
|
|
12
|
+
* scheduled-broadcast dispatch, outbox draining, rollups.
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
declare function runTick(ctx: RunnerContext): Promise<void>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Flow_run state machine. One step transition per `processOneRunStep` call.
|
|
19
|
+
* Idempotent — optimistic concurrency on `currentStepIndex` means two workers
|
|
20
|
+
* racing on the same run advance exactly once.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
declare function processOneRunStep(runId: ObjectId, ctx: RunnerContext): Promise<void>;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Send pipeline. `handleSend` is called by the runner state machine; it creates
|
|
27
|
+
* the Send document and enqueues a mailer:send job. `dispatchSend` is the
|
|
28
|
+
* worker — re-checks suppression + circuit breaker, applies tracking, calls
|
|
29
|
+
* the provider, updates the Send row.
|
|
30
|
+
*/
|
|
31
|
+
|
|
32
|
+
declare function dispatchSend(sendId: ObjectId, ctx: RunnerContext): Promise<void>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Event-trigger scan. Finds new event firings since each flow's
|
|
36
|
+
* lastTriggerScanAt watermark, creates flow_runs for matching contacts,
|
|
37
|
+
* enqueues immediate-advance jobs.
|
|
38
|
+
*/
|
|
39
|
+
|
|
40
|
+
declare function processNewlyFiredEventTriggers(ctx: RunnerContext): Promise<void>;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Recovery sweep: finds active flow_runs whose `nextActionAt` has passed but
|
|
44
|
+
* weren't woken by their delayed `mailer:advance` job (worker restart, BullMQ
|
|
45
|
+
* data loss). Processes each one inline.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
declare function sweepStrandedFlowRuns(ctx: RunnerContext): Promise<void>;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Apply a normalized provider event to the corresponding Send + cascading
|
|
52
|
+
* suppression / subscription updates. Called from the webhook worker.
|
|
53
|
+
*/
|
|
54
|
+
|
|
55
|
+
declare function applyWebhookEvent(event: NormalizedEvent, ctx: RunnerContext): Promise<void>;
|
|
56
|
+
|
|
9
57
|
/**
|
|
10
58
|
* MongoContactAdapter — reads contacts directly from the host's `users`
|
|
11
59
|
* collection (read-mostly; optional narrow tag writes). Mailer never
|
|
@@ -157,6 +205,12 @@ interface CompileResult {
|
|
|
157
205
|
}
|
|
158
206
|
/** Compile MJML → HTML, then derive plain text. Called at template publish time. */
|
|
159
207
|
declare function compileTemplate(mjml: string): Promise<CompileResult>;
|
|
208
|
+
/**
|
|
209
|
+
* Compile Maily editor JSON (Tiptap-shape) → HTML via `@maily-to/render`, then
|
|
210
|
+
* derive plain text. Called at template publish time when the template was
|
|
211
|
+
* authored via the WYSIWYG editor.
|
|
212
|
+
*/
|
|
213
|
+
declare function compileMailyTemplate(content: unknown): Promise<CompileResult>;
|
|
160
214
|
/** Auto-derive plain text from compiled HTML. */
|
|
161
215
|
declare function derivePlaintext(html: string): string;
|
|
162
216
|
interface RenderContext {
|
|
@@ -288,4 +342,4 @@ declare const DEDUPE_POLICIES: readonly DedupePolicyOption[];
|
|
|
288
342
|
*/
|
|
289
343
|
declare const VERSION = "0.1.0";
|
|
290
344
|
|
|
291
|
-
export { AdapterFilter, type AdminRouterOptions, Contact, ContactAdapter, DEDUPE_POLICIES, type DedupePolicyOption, FLOW_STEP_KINDS, FlowStep, type FlowStepKindOption, MailProvider, Mailer, MongoContactAdapter, type MongoContactAdapterOptions, NormalizedEvent, PREDICATE_KINDS, Predicate, type PredicateKind, type PredicateKindOption, type PublicRouterOptions, SEGMENT_FILTER_KINDS, SegmentFilter, type SegmentFilterKind, type SegmentFilterKindOption, SendArgs, SendGridProvider, type SendGridProviderOptions, SendResult, SuppressionScope, TemplateDoc, VERSION, applyTracking, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, predicateKind, renderTemplate, sha256Hex, signUnsubscribeToken, verifyUnsubscribeToken };
|
|
345
|
+
export { AdapterFilter, type AdminRouterOptions, Contact, ContactAdapter, DEDUPE_POLICIES, type DedupePolicyOption, FLOW_STEP_KINDS, FlowStep, type FlowStepKindOption, MailProvider, Mailer, MongoContactAdapter, type MongoContactAdapterOptions, NormalizedEvent, PREDICATE_KINDS, Predicate, type PredicateKind, type PredicateKindOption, type PublicRouterOptions, SEGMENT_FILTER_KINDS, SegmentFilter, type SegmentFilterKind, type SegmentFilterKindOption, SendArgs, SendGridProvider, type SendGridProviderOptions, SendResult, SuppressionScope, TemplateDoc, VERSION, applyTracking, applyWebhookEvent, compileMailyTemplate, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, dispatchSend, predicateKind, processNewlyFiredEventTriggers, processOneRunStep, renderTemplate, runTick, sha256Hex, signUnsubscribeToken, sweepStrandedFlowRuns, verifyUnsubscribeToken };
|
package/dist/index.js
CHANGED
|
@@ -3817,6 +3817,6 @@ var DEDUPE_POLICIES = [
|
|
|
3817
3817
|
// src/server/index.ts
|
|
3818
3818
|
var VERSION = "0.1.0";
|
|
3819
3819
|
|
|
3820
|
-
export { DEDUPE_POLICIES, FLOW_STEP_KINDS, Mailer, MongoContactAdapter, NullProvider, PREDICATE_KINDS, SEGMENT_FILTER_KINDS, SendGridProvider, VERSION, applyTracking, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, ensureIndexes, getCollections, predicateKind, renderTemplate, sha256Hex, signUnsubscribeToken, verifyUnsubscribeToken };
|
|
3820
|
+
export { DEDUPE_POLICIES, FLOW_STEP_KINDS, Mailer, MongoContactAdapter, NullProvider, PREDICATE_KINDS, SEGMENT_FILTER_KINDS, SendGridProvider, VERSION, applyTracking, applyWebhookEvent, compileMailyTemplate, compileTemplate, createAdminRouter, createPublicRouter, defaultFlowStep, defaultPredicate, defaultSegmentFilter, derivePlaintext, dispatchSend, ensureIndexes, getCollections, predicateKind, processNewlyFiredEventTriggers, processOneRunStep, renderTemplate, runTick, sha256Hex, signUnsubscribeToken, sweepStrandedFlowRuns, verifyUnsubscribeToken };
|
|
3821
3821
|
//# sourceMappingURL=index.js.map
|
|
3822
3822
|
//# sourceMappingURL=index.js.map
|