@pithy-sh/email 0.8.1 → 0.9.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 (44) hide show
  1. package/README.md +2 -0
  2. package/dist/bounce/handler.d.ts +22 -2
  3. package/dist/bounce/handler.d.ts.map +1 -1
  4. package/dist/bounce/handler.js +60 -17
  5. package/dist/capability.d.ts +12 -0
  6. package/dist/capability.d.ts.map +1 -1
  7. package/dist/capability.js +25 -15
  8. package/dist/http/routes.d.ts.map +1 -1
  9. package/dist/http/routes.js +7 -1
  10. package/dist/http/schemas.d.ts +9 -0
  11. package/dist/http/schemas.d.ts.map +1 -1
  12. package/dist/http/schemas.js +5 -2
  13. package/dist/jobs/read.d.ts +12 -9
  14. package/dist/jobs/read.d.ts.map +1 -1
  15. package/dist/jobs/read.js +6 -5
  16. package/dist/migrations/0002_job_filters.d.ts +15 -0
  17. package/dist/migrations/0002_job_filters.d.ts.map +1 -0
  18. package/dist/migrations/0002_job_filters.js +25 -0
  19. package/dist/send/enqueue.d.ts +26 -3
  20. package/dist/send/enqueue.d.ts.map +1 -1
  21. package/dist/send/enqueue.js +25 -2
  22. package/dist/send/errorMapping.d.ts +15 -20
  23. package/dist/send/errorMapping.d.ts.map +1 -1
  24. package/dist/send/errorMapping.js +33 -27
  25. package/dist/send/runSend.d.ts +2 -2
  26. package/dist/send/runSend.d.ts.map +1 -1
  27. package/dist/send/runSend.js +1 -1
  28. package/dist/send/suppression.d.ts +4 -0
  29. package/dist/send/suppression.d.ts.map +1 -1
  30. package/dist/send/suppression.js +4 -0
  31. package/dist/version.generated.d.ts +1 -1
  32. package/dist/version.generated.js +1 -1
  33. package/package.json +3 -3
  34. package/src/bounce/handler.ts +84 -32
  35. package/src/capability.ts +47 -27
  36. package/src/http/routes.ts +4 -1
  37. package/src/http/schemas.ts +21 -2
  38. package/src/jobs/read.ts +14 -9
  39. package/src/migrations/0002_job_filters.ts +35 -0
  40. package/src/send/enqueue.ts +52 -5
  41. package/src/send/errorMapping.ts +45 -38
  42. package/src/send/runSend.ts +6 -7
  43. package/src/send/suppression.ts +13 -0
  44. package/src/version.generated.ts +1 -1
package/README.md CHANGED
@@ -10,6 +10,8 @@ pithy add email
10
10
 
11
11
  **Documentation: [pithy.sh/docs/capabilities/email](https://pithy.sh/docs/capabilities/email).** Overview, adding it, using it, and the reference: the job model, send modes, templates.
12
12
 
13
+ **A per-message sender.** `enqueue` sends every message as `fromAddress` and `fromName`, and refuses a `from` with `email/invalid_payload`. `enqueueAs(addresses)` is how a capability declares the addresses it sends as: bound once, at compose, it accepts `from: { address, name? }` for those addresses and refuses any other. It is a convention that keeps a capability to its own addresses, not a security boundary: any code in the Worker can call it, and what limits sending is Cloudflare, which sends only from domains onboarded onto Email Service. The sender is stored on the job. A send Email Service refuses because the domain is not onboarded or not verified fails the job with the domain named in `error`, and is never retried as another sender.
14
+
13
15
  _Everything else is on the site. `pithy.sh/docs` is canonical — new prose goes there, not here._
14
16
 
15
17
  ## Consent
@@ -20,6 +20,15 @@ export interface InboundOutcome {
20
20
  jobId?: string;
21
21
  /** Whether the address was added to the suppression list. */
22
22
  suppressed: boolean;
23
+ /** Each part left undone because the database it writes to was not given, in the order they were reached. */
24
+ skipped: InboundSkip[];
25
+ }
26
+ /** One part of applying a classification that did not run, and the binding it needed. */
27
+ export interface InboundSkip {
28
+ /** `job` is the job lookup, its bounce marking and its event; `suppression` is the suppression-list write. */
29
+ part: "job" | "suppression";
30
+ /** The Worker binding that part writes through. */
31
+ binding: "DB" | "EMAIL_SUPPRESSIONS";
23
32
  }
24
33
  /**
25
34
  * Apply a classification's side effects. Suppression is written to the **shared** suppression database
@@ -27,8 +36,19 @@ export interface InboundOutcome {
27
36
  * database. Pure of any MIME parsing — unit-testable. Note the single inbound worker only reaches its
28
37
  * own app DB, so a job-row update is best-effort (the originating job may live in another environment),
29
38
  * whereas the suppression — the safety-critical part — is always global.
39
+ *
40
+ * Each part runs on the database it needs and no other: a missing app database skips the job, a missing
41
+ * suppression database skips the suppression, and each skip is reported in `skipped` rather than thrown.
42
+ */
43
+ export declare function applyInbound(db: EmailDatabase | undefined, suppressionDb: EmailSuppressionDatabase | undefined, c: InboundClassification, now: Date, environment?: string): Promise<InboundOutcome>;
44
+ /**
45
+ * Build the inbound-email handler for the `Capability.email` seam. Reads `DB` + `EMAIL_SUPPRESSIONS` from env.
46
+ *
47
+ * It never throws. `createEntrypoint` runs every capability's handler in turn, so a throw here would stop the ones
48
+ * after it, and a throw out of `email()` is a delivery failure the sender sees. A failure is logged with its error
49
+ * and the handler returns. It classifies before it touches a binding: a message it will not act on needs neither
50
+ * database, and each part of a bounce runs on the binding it needs, with a part whose binding is missing logged at
51
+ * warn rather than thrown.
30
52
  */
31
- export declare function applyInbound(db: EmailDatabase, suppressionDb: EmailSuppressionDatabase, c: InboundClassification, now: Date, environment?: string): Promise<InboundOutcome>;
32
- /** Build the inbound-email handler for the `Capability.email` seam. Reads `DB` + `EMAIL_SUPPRESSIONS` from env. */
33
53
  export declare function createBounceHandler(): CapabilityEmailHandler;
34
54
  //# sourceMappingURL=handler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"handler.d.ts","sourceRoot":"","sources":["../../src/bounce/handler.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAGvF,OAAO,EACL,KAAK,aAAa,EAClB,KAAK,wBAAwB,EAG9B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAmB,KAAK,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAEzE;;;;;;GAMG;AAEH,sDAAsD;AACtD,MAAM,WAAW,cAAc;IAC7B,2EAA2E;IAC3E,KAAK,EAAE,OAAO,CAAC;IACf,+BAA+B;IAC/B,IAAI,EAAE,qBAAqB,CAAC,MAAM,CAAC,CAAC;IACpC,yDAAyD;IACzD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,UAAU,EAA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M,GACnB,OAAO,CAAC,cAAc,CAAC,CAiEzB;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,IAAI,sBAAsB,CAyC5D"}
@@ -6,6 +6,7 @@ import { suppress } from "../send/suppression.js";
6
6
  import { classifyInbound } from "./classify.js";
7
7
  import { normalizeAddress } from "@pithy-sh/core/src/address/address";
8
8
  import { SQLiteDate } from "@pithy-sh/core/src/data/codecs";
9
+ import { createWorkerLogger } from "@pithy-sh/core/src/logger/worker";
9
10
  import PostalMime from "postal-mime";
10
11
  //#region src/bounce/handler.ts
11
12
  /**
@@ -14,14 +15,23 @@ import PostalMime from "postal-mime";
14
15
  * database. Pure of any MIME parsing — unit-testable. Note the single inbound worker only reaches its
15
16
  * own app DB, so a job-row update is best-effort (the originating job may live in another environment),
16
17
  * whereas the suppression — the safety-critical part — is always global.
18
+ *
19
+ * Each part runs on the database it needs and no other: a missing app database skips the job, a missing
20
+ * suppression database skips the suppression, and each skip is reported in `skipped` rather than thrown.
17
21
  */
18
22
  async function applyInbound(db, suppressionDb, c, now, environment) {
19
23
  if (c.type === "ignore" || c.type === "auto_reply") return {
20
24
  acted: false,
21
25
  type: c.type,
22
- suppressed: false
26
+ suppressed: false,
27
+ skipped: []
23
28
  };
24
- const job = c.originalMessageId ? await db.selectFrom("pithyEmailJobs").select([
29
+ const skipped = [];
30
+ if (db === void 0) skipped.push({
31
+ part: "job",
32
+ binding: "DB"
33
+ });
34
+ const job = c.originalMessageId && db ? await db.selectFrom("pithyEmailJobs").select([
25
35
  "id",
26
36
  "toAddress",
27
37
  "status",
@@ -30,7 +40,11 @@ async function applyInbound(db, suppressionDb, c, now, environment) {
30
40
  const recipient = c.recipient ? normalizeAddress(c.recipient) : job ? normalizeAddress(job.toAddress) : void 0;
31
41
  const isSuppressing = c.type === "hard" || c.type === "complaint";
32
42
  let suppressed = false;
33
- if (recipient && isSuppressing) {
43
+ if (recipient && isSuppressing && suppressionDb === void 0) skipped.push({
44
+ part: "suppression",
45
+ binding: "EMAIL_SUPPRESSIONS"
46
+ });
47
+ else if (recipient && isSuppressing && suppressionDb) {
34
48
  await suppress(suppressionDb, {
35
49
  email: recipient,
36
50
  reason: c.type === "complaint" ? "complaint" : "hard_bounce",
@@ -40,7 +54,7 @@ async function applyInbound(db, suppressionDb, c, now, environment) {
40
54
  }, now);
41
55
  suppressed = true;
42
56
  }
43
- if (job) {
57
+ if (job && db) {
44
58
  await db.updateTable("pithyEmailJobs").set({
45
59
  bounceCode: c.code ?? null,
46
60
  bounceType: c.type,
@@ -59,25 +73,54 @@ async function applyInbound(db, suppressionDb, c, now, environment) {
59
73
  acted: suppressed || Boolean(job),
60
74
  type: c.type,
61
75
  jobId: job?.id,
62
- suppressed
76
+ suppressed,
77
+ skipped
63
78
  };
64
79
  }
65
- /** Build the inbound-email handler for the `Capability.email` seam. Reads `DB` + `EMAIL_SUPPRESSIONS` from env. */
80
+ /**
81
+ * Build the inbound-email handler for the `Capability.email` seam. Reads `DB` + `EMAIL_SUPPRESSIONS` from env.
82
+ *
83
+ * It never throws. `createEntrypoint` runs every capability's handler in turn, so a throw here would stop the ones
84
+ * after it, and a throw out of `email()` is a delivery failure the sender sees. A failure is logged with its error
85
+ * and the handler returns. It classifies before it touches a binding: a message it will not act on needs neither
86
+ * database, and each part of a bounce runs on the binding it needs, with a part whose binding is missing logged at
87
+ * warn rather than thrown.
88
+ */
66
89
  function createBounceHandler() {
67
90
  return async (message, env) => {
68
- const raw = await new Response(message.raw).text();
69
- const parsed = await PostalMime.parse(raw);
70
- const headers = {};
71
- for (const header of parsed.headers) headers[header.key.toLowerCase()] = header.value;
72
- const classification = classifyInbound({
73
- contentType: headers["content-type"],
74
- autoSubmitted: headers["auto-submitted"],
75
- autoReplyHeader: "x-autoreply" in headers || "x-autorespond" in headers,
76
- raw
91
+ const environment = typeof env.ENVIRONMENT === "string" ? env.ENVIRONMENT : void 0;
92
+ const log = createWorkerLogger({
93
+ name: "email",
94
+ fields: { env: environment ?? "unknown" }
77
95
  });
78
- const bindings = env;
79
- await applyInbound(emailDatabase(bindings.DB), emailSuppressionDatabase(bindings.EMAIL_SUPPRESSIONS), classification, /* @__PURE__ */ new Date(), bindings.ENVIRONMENT);
96
+ try {
97
+ const raw = await new Response(message.raw).text();
98
+ const parsed = await PostalMime.parse(raw);
99
+ const headers = {};
100
+ for (const header of parsed.headers) headers[header.key.toLowerCase()] = header.value;
101
+ const classification = classifyInbound({
102
+ contentType: headers["content-type"],
103
+ autoSubmitted: headers["auto-submitted"],
104
+ autoReplyHeader: "x-autoreply" in headers || "x-autorespond" in headers,
105
+ raw
106
+ });
107
+ if (classification.type === "ignore" || classification.type === "auto_reply") return;
108
+ const { DB: db, EMAIL_SUPPRESSIONS: suppressions } = env;
109
+ const outcome = await applyInbound(isD1(db) ? emailDatabase(db) : void 0, isD1(suppressions) ? emailSuppressionDatabase(suppressions) : void 0, classification, /* @__PURE__ */ new Date(), environment);
110
+ for (const { part, binding } of outcome.skipped) log.warn(`email ${part === "job" ? "bounce not recorded on its job" : "address not suppressed"} — no ${binding} binding`, {
111
+ binding,
112
+ skipped: part,
113
+ type: classification.type,
114
+ action: `Bind \`${binding}\` in this Worker's wrangler.jsonc.`
115
+ });
116
+ } catch (error) {
117
+ log.error("email inbound handling failed", { error });
118
+ }
80
119
  };
81
120
  }
121
+ /** Whether a binding is there to open: a D1 binding is an object, and an absent one is `undefined`. */
122
+ function isD1(binding) {
123
+ return typeof binding === "object" && binding !== null;
124
+ }
82
125
  //#endregion
83
126
  export { applyInbound, createBounceHandler };
@@ -118,6 +118,18 @@ export interface EmailCapability extends Capability {
118
118
  * `EnqueueDeps` or name the email bindings themselves.
119
119
  */
120
120
  enqueue: (env: EmailEnqueueEnv, input: EnqueueInput) => Promise<EnqueueResult>;
121
+ /**
122
+ * `enqueue`, able to send as the addresses a composing capability declares and no others.
123
+ *
124
+ * The one way a per-message `from` is accepted. `enqueue` declares none, so an override passed to it is
125
+ * refused; a capability that receives mail at its own addresses binds this once, at compose, with exactly
126
+ * those addresses, and an override outside them is refused at enqueue. `@pithy-sh/support` binds its
127
+ * `inboundAddresses` and `reply.replyToAddress`.
128
+ *
129
+ * A convention that keeps each capability to its own addresses, not a security boundary: trusted Worker code
130
+ * can call this with any list. What limits sending is Cloudflare, which sends only from onboarded domains.
131
+ */
132
+ enqueueAs: (claimed: readonly string[]) => (env: EmailEnqueueEnv, input: EnqueueInput) => Promise<EnqueueResult>;
121
133
  /**
122
134
  * The suppression list, from a request env — **it is the adopter's database, and this is how they open
123
135
  * it**.
@@ -1 +1 @@
1
- {"version":3,"file":"capability.d.ts","sourceRoot":"","sources":["../src/capability.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,EAAE,KAAK,UAAU,EAAoB,MAAM,0CAA0C,CAAC;AAK7F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EACL,KAAK,wBAAwB,EAM9B,MAAM,eAAe,CAAC;AAOvB,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAI1D,OAAO,EAAE,KAAK,YAAY,EAAE,KAAK,aAAa,EAAgB,MAAM,gBAAgB,CAAC;AACrF,OAAO,EAAE,KAAK,cAAc,EAAsB,MAAM,sBAAsB,CAAC;AAE/E,OAAO,EAAe,KAAK,UAAU,EAAgB,MAAM,mBAAmB,CAAC;AAI/E;;;;;;;;;;GAUG;AACH,MAAM,WAAW,eAAgB,SAAQ,cAAc;IACrD,EAAE,EAAE,UAAU,CAAC;IACf;;;;;;;OAOG;IACH,kBAAkB,CAAC,EAAE,UAAU,CAAC;CACjC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,MAAM,CAAC;AAEzC,kGAAkG;AAClG,eAAO,MAAM,kCAAkC,MAAM,CAAC;AAEtD;;;;;;;GAOG;AACH,eAAO,MAAM,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AC;IACjC;;;;;OAKG;IACH,OAAO,EAAE,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IAC/E;;;;;;;;;;OAUG;IACH,SAAS,EAAE,CAAC,OAAO,EAAE,SAAS,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,eAAe,EAAE,KAAK,EAAE,YAAY,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC;IACjH;;;;;;;;;;;;;OAaG;IACH,YAAY,EAAE,CAAC,GAAG,EAAE,eAAe,KAAK,wBAAwB,CAAC;IACjE;;;;;;;;;;;OAWG;IACH,YAAY,EAAE,MAAM,cAAc,CAAC;CACpC;AAED;;;;;;GAMG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,gBAAgB,GAAG,eAAe,CAiQ/D;AAED,kFAAkF;AAClF,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,UAAU,GAAG,UAAU,IAAI,eAAe,CAEvF"}
@@ -12,6 +12,7 @@ import { emailSenderBinding } from "./send/senderBinding.js";
12
12
  import { registerEmailAdminRoutes } from "./http/routes.js";
13
13
  import { email_0001_init } from "./migrations/0001_init.js";
14
14
  import { email_0001_suppressions } from "./migrations/0001_suppressions.js";
15
+ import { email_0002_job_filters } from "./migrations/0002_job_filters.js";
15
16
  import { EMAIL_PROCESSING } from "./processing/activities.js";
16
17
  import { DevMailDelivery } from "./provision/devDelivery.js";
17
18
  import { emailHostCatalogs } from "./provision/hostCatalogs.js";
@@ -140,7 +141,7 @@ function email(config) {
140
141
  if (Array.isArray(locales)) supportedLocales = locales.filter((tag) => typeof tag === "string");
141
142
  }
142
143
  },
143
- ciPermissions: ["email:routing"],
144
+ inboundRouting: { addresses: [] },
144
145
  requiredBindings: [
145
146
  {
146
147
  type: "d1",
@@ -160,7 +161,10 @@ function email(config) {
160
161
  binding: "DB",
161
162
  tables: emailTables,
162
163
  migrationOrder: 200,
163
- migrations: { "0001_init": email_0001_init }
164
+ migrations: {
165
+ "0001_init": email_0001_init,
166
+ "0002_job_filters": email_0002_job_filters
167
+ }
164
168
  },
165
169
  emailSuppressions: {
166
170
  binding: "EMAIL_SUPPRESSIONS",
@@ -264,19 +268,24 @@ function email(config) {
264
268
  if (composed === void 0) return void 0;
265
269
  return (charge) => composed.charge(env, charge);
266
270
  };
267
- const enqueue = (env, input) => enqueueEmail({
268
- db: emailDatabase(env.DB),
269
- fromAddress: resolved.fromAddress,
270
- fromName: resolved.fromName,
271
- theme,
272
- layersFor: (locale) => layersFor(locale),
273
- sender: emailSenderBinding(env),
274
- suppressionDb: env.EMAIL_SUPPRESSIONS ? emailSuppressionDatabase(env.EMAIL_SUPPRESSIONS) : void 0,
275
- meter: chargeFor(env),
276
- consent: composedConsent(composition, env),
277
- now: /* @__PURE__ */ new Date(),
278
- newId: () => crypto.randomUUID()
279
- }, input);
271
+ const enqueueAs = (claimed) => {
272
+ const claimedFrom = Object.freeze([...claimed]);
273
+ return (env, input) => enqueueEmail({
274
+ db: emailDatabase(env.DB),
275
+ fromAddress: resolved.fromAddress,
276
+ fromName: resolved.fromName,
277
+ claimedFrom,
278
+ theme,
279
+ layersFor: (locale) => layersFor(locale),
280
+ sender: emailSenderBinding(env),
281
+ suppressionDb: env.EMAIL_SUPPRESSIONS ? emailSuppressionDatabase(env.EMAIL_SUPPRESSIONS) : void 0,
282
+ meter: chargeFor(env),
283
+ consent: composedConsent(composition, env),
284
+ now: /* @__PURE__ */ new Date(),
285
+ newId: () => crypto.randomUUID()
286
+ }, input);
287
+ };
288
+ const enqueue = enqueueAs([]);
280
289
  return Object.assign(capability, {
281
290
  emailConfig: {
282
291
  fromAddress: resolved.fromAddress,
@@ -287,6 +296,7 @@ function email(config) {
287
296
  theme
288
297
  },
289
298
  enqueue,
299
+ enqueueAs,
290
300
  suppressions,
291
301
  hostCatalogs: () => emailHostCatalogs(supportedLocales, (locale) => layersFor(locale))
292
302
  });
@@ -1 +1 @@
1
- {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAKrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AA+B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,yGAAyG;AACzG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,qBAAqB,EAY9D,CAAC;AAaF,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAiDD,yFAAyF;AACzF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,uBAAuB,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CA+T5G"}
1
+ {"version":3,"file":"routes.d.ts","sourceRoot":"","sources":["../../src/http/routes.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0CAA0C,CAAC;AAG7E,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAKrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,sCAAsC,CAAC;AAEjF,OAAO,KAAK,EAAW,IAAI,EAAE,MAAM,MAAM,CAAC;AA+B1C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,yGAAyG;AACzG,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,MAAM,EAAE,KAAK,GAAG,MAAM,CAAC;IAChC,oEAAoE;IACpE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,oBAAoB,CAAC;IACxC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,iBAAiB,CAAC;CACnC;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,kBAAkB,EAAE,SAAS,qBAAqB,EAY9D,CAAC;AAaF,oDAAoD;AACpD,MAAM,WAAW,uBAAuB;IACtC;;;;;;;OAOG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB,4EAA4E;IAC5E,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAiDD,yFAAyF;AACzF,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,uBAAuB,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,YAAY,CAAC,KAAK,IAAI,CAkU5G"}
@@ -126,6 +126,8 @@ function registerEmailAdminRoutes(options) {
126
126
  metadata: {
127
127
  connectionId: who.connectionId,
128
128
  status: query.status ?? null,
129
+ template: query.template ?? null,
130
+ category: query.category ?? null,
129
131
  returned: page.items.length,
130
132
  paged: Boolean(query.cursor)
131
133
  }
@@ -210,7 +212,10 @@ function registerEmailAdminRoutes(options) {
210
212
  const query = c.req.valid("query");
211
213
  const who = caller(c);
212
214
  const now = clock();
213
- const page = await listSuppressions(suppressions(c), query);
215
+ const page = await listSuppressions(suppressions(c), {
216
+ ...query,
217
+ now
218
+ });
214
219
  await c.var.emit({
215
220
  action: EmailAuditActions.suppressionsRead,
216
221
  outcome: "success",
@@ -222,6 +227,7 @@ function registerEmailAdminRoutes(options) {
222
227
  connectionId: who.connectionId,
223
228
  reason: query.reason ?? null,
224
229
  lookup: Boolean(query.email),
230
+ active: query.active ?? null,
225
231
  returned: page.items.length,
226
232
  paged: Boolean(query.cursor)
227
233
  }
@@ -44,6 +44,11 @@ export declare const JobsQuery: z.ZodObject<{
44
44
  suppressed: "suppressed";
45
45
  undispatched: "undispatched";
46
46
  }>>;
47
+ template: z.ZodOptional<z.ZodString>;
48
+ category: z.ZodOptional<z.ZodEnum<{
49
+ marketing: "marketing";
50
+ transactional: "transactional";
51
+ }>>;
47
52
  cursor: z.ZodOptional<z.ZodString>;
48
53
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
49
54
  }, z.core.$strip>;
@@ -64,6 +69,10 @@ export declare const SuppressionsQuery: z.ZodObject<{
64
69
  unsubscribe: "unsubscribe";
65
70
  }>>;
66
71
  email: z.ZodOptional<z.ZodString>;
72
+ active: z.ZodOptional<z.ZodPipe<z.ZodEnum<{
73
+ false: "false";
74
+ true: "true";
75
+ }>, z.ZodTransform<boolean, "false" | "true">>>;
67
76
  cursor: z.ZodOptional<z.ZodString>;
68
77
  limit: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
69
78
  }, z.core.$strip>;
@@ -1 +1 @@
1
- {"version":3,"file":"schemas.d.ts","sourceRoot":"","sources":["../../src/http/schemas.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AA0BxB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB;;iBASoD,CAAC;AACpF,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAErE;;;;GAIG;AACH,eAAO,MAAM,gBAAgB;;iBAQqD,CAAC;AACnF,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAoDjE;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU;;iBAS2C,CAAC;AACnE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,MAAM,CA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;AACzG,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,SAAS,CAAC,CAAC;AAEnD;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;iBAmB8E,CAAC;AAC7G,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe;;;;iBAgBqD,CAAC;AAClF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,eAAe,CAAC,CAAC;AAE/D,wGAAwG;AACxG,eAAO,MAAM,iBAAiB;;iBAI+D,CAAC;AAC9F,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  // SPDX-FileCopyrightText: 2026 Pithy
2
2
  // SPDX-License-Identifier: MIT
3
- import { EmailJobStatus, SuppressionReason } from "../data/enums.js";
3
+ import { EmailJobStatus, SuppressionReason, TemplateCategory } from "../data/enums.js";
4
4
  import { z } from "zod";
5
5
  import { MAX_PAGE_SIZE } from "@pithy-sh/core/src/data/cursor";
6
6
  /**
@@ -55,9 +55,11 @@ const JobIdParam = z.object({ id: z.string().min(1).max(128).regex(/^[A-Za-z0-9.
55
55
  /** The job log query. */
56
56
  const JobsQuery = z.object({
57
57
  status: EmailJobStatus.optional().describe("Filter to one lifecycle state — `failed` is the pane this capability exists for. Absent lists every state."),
58
+ template: z.string().min(1).max(128).optional().describe("Filter to one template id, exactly (`magicLink`, `newsletter`). A shape check only: the template set is the project's, and one nothing has sent is an empty page."),
59
+ category: TemplateCategory.optional().describe("Filter to one category: `transactional` or `marketing`. Absent lists both."),
58
60
  cursor: Cursor,
59
61
  limit: Limit
60
- }).describe("The send-log query: which state to filter by, and where to resume.");
62
+ }).describe("The send-log query: which state, template and category to filter by, and where to resume.");
61
63
  /**
62
64
  * The suppression list query.
63
65
  *
@@ -69,6 +71,7 @@ const JobsQuery = z.object({
69
71
  const SuppressionsQuery = z.object({
70
72
  reason: SuppressionReason.optional().describe("Filter to one reason — hard bounce, complaint, unsubscribe, manual."),
71
73
  email: AddressFilter.optional().describe("Look one address up, exactly. Answers `is this person blocked` without disclosing anybody else."),
74
+ active: z.enum(["true", "false"]).describe("`true` or `false`.").transform((value) => value === "true").optional().describe("`true` for the blocks in force now, `false` for the ones whose expiry has passed. Judged as each row's `active` is. Both when absent."),
72
75
  cursor: Cursor,
73
76
  limit: Limit
74
77
  }).describe("The suppression-list query: what to filter by, which address to look up, and where to resume.");
@@ -2,7 +2,7 @@
2
2
  // SPDX-License-Identifier: MIT
3
3
  import type { z } from "zod";
4
4
  import { EmailJob } from "../data/emailJob";
5
- import type { EmailJobStatus } from "../data/enums";
5
+ import type { EmailJobStatus, TemplateCategory } from "../data/enums";
6
6
  import type { EmailDatabase } from "../data/tables";
7
7
  /**
8
8
  * Reading the send log: the queries behind the two `email:jobs:read` routes, and `sentSince` below.
@@ -31,6 +31,10 @@ import type { EmailDatabase } from "../data/tables";
31
31
  export interface JobListFilter {
32
32
  /** One lifecycle state, or every state when absent. */
33
33
  status?: EmailJobStatus;
34
+ /** One template id, exactly, or every template when absent. */
35
+ template?: string;
36
+ /** One category, or both when absent. */
37
+ category?: TemplateCategory;
34
38
  /** The previous page's `nextCursor`. A malformed one is a first page. */
35
39
  cursor?: string;
36
40
  /** How many rows to return, clamped into range. */
@@ -43,7 +47,7 @@ export interface JobPage {
43
47
  /** Where the next page starts, or null at the end of the list. */
44
48
  nextCursor: string | null;
45
49
  }
46
- /** One page of jobs, newest first, optionally filtered to one status. */
50
+ /** One page of jobs, newest first, optionally filtered to one status, template and category. */
47
51
  export declare function listJobs(db: EmailDatabase, filter: JobListFilter): Promise<JobPage>;
48
52
  /** One job by id, or undefined. The caller decides what a miss means. */
49
53
  export declare function getJob(db: EmailDatabase, jobId: string): Promise<EmailJob | undefined>;
@@ -59,8 +63,7 @@ export declare function getJob(db: EmailDatabase, jobId: string): Promise<EmailJ
59
63
  *
60
64
  * ## Two axes, because a template is not always one message
61
65
  *
62
- * It was `(to, template)` alone, and that could not finish its only intended consumer (pithy-sh/pithy#382).
63
- * Six account notices ride one `operationalNotice` to the same addresses, so the template id does not
66
+ * `(to, template)` alone cannot answer every send decision. Six account notices ride one `operationalNotice` to the same addresses, so the template id does not
64
67
  * separate them; `correlation` is the enqueue-side discriminator that does. See {@link SentSubject} for
65
68
  * why the two are a union and not three optional fields.
66
69
  *
@@ -83,8 +86,8 @@ export declare function getJob(db: EmailDatabase, jobId: string): Promise<EmailJ
83
86
  * - **`subject`.** Rendered content, and the temptation is specific: it is the only per-row string that
84
87
  * distinguishes two messages sharing a template, so a caller needing that discrimination would match
85
88
  * on it. That match breaks on a copy edit, silently, in the direction of sending again. Discriminating
86
- * two notices was the enqueue side's problem and now has an enqueue-side answer — `correlation`
87
- * (#382) — rather than a rendered string exported to be string-matched.
89
+ * two notices is the enqueue side's problem and has an enqueue-side answer, `correlation`, rather than
90
+ * a rendered string exported to be string-matched.
88
91
  * - **`messageId`, `error`, `bounceCode`.** The provider's own words. A provider error routinely embeds
89
92
  * the recipient, which is why the list view carries `failed` rather than the text.
90
93
  *
@@ -126,11 +129,11 @@ export type SentSummary = z.output<typeof SentSummary>;
126
129
  * Which messages are being asked about — one of the two indexed axes, and the type admits no third
127
130
  * answer.
128
131
  *
129
- * **`(to, template)`** is the original question: has this template already gone to this person. It runs
132
+ * **`(to, template)`** is the plain question: has this template already gone to this person. It runs
130
133
  * on `(recipientKey, template, createdAt)`.
131
134
  *
132
- * **`correlation`** is the question a template carrying more than one kind of message needs
133
- * (pithy-sh/pithy#382): has *this thing* already been said. Six account notices ride one
135
+ * **`correlation`** is the question a template carrying more than one kind of message needs:
136
+ * has *this thing* already been said. Six account notices ride one
134
137
  * `operationalNotice` to the same addresses, so the template id cannot separate them and the address is
135
138
  * a proxy for the account only while one person belongs to one account. It runs on
136
139
  * `(correlation, createdAt)`.
@@ -1 +1 @@
1
- {"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../src/jobs/read.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,0CAA0C;AAC1C,MAAM,WAAW,aAAa;IAC5B,uDAAuD;IACvD,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,yEAAyE;IACzE,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mDAAmD;IACnD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,gCAAgC;AAChC,MAAM,WAAW,OAAO;IACtB,8BAA8B;IAC9B,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,kEAAkE;IAClE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAgBD,yEAAyE;AACzE,wBAAsB,QAAQ,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CAuBzF;AAED,yEAAyE;AACzE,wBAAsB,MAAM,CAAC,EAAE,EAAE,aAAa,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,GAAG,SAAS,CAAC,CAG5F;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkDG;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;iBAEvB,CAAC;AACF,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,WAAW,CAAC,CAAC;AAEvD;;;;;;;;;;;;;;;;;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AC,WAAW,EAAE,MAAM,CAAC;IAC7B,+DAA+D;IAC/D,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEN,iGAAiG;AACjG,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG;IACrC;;;;;;;OAOG;IACH,QAAQ,CAAC,KAAK,EAAE,IAAI,CAAC;IACrB,uFAAuF;IACvF,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,iEAAiE;AACjE,MAAM,WAAW,OAAO;IACtB,kEAAkE;IAClE,KAAK,EAAE,WAAW,EAAE,CAAC;IACrB,+GAA+G;IAC/G,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAsB,SAAS,CAAC,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,OAAO,CAAC,CAqCvF"}
package/dist/jobs/read.js CHANGED
@@ -21,12 +21,14 @@ function jobCursor(raw) {
21
21
  id: String(cursor.id)
22
22
  };
23
23
  }
24
- /** One page of jobs, newest first, optionally filtered to one status. */
24
+ /** One page of jobs, newest first, optionally filtered to one status, template and category. */
25
25
  async function listJobs(db, filter) {
26
26
  const limit = pageLimit(filter.limit);
27
27
  const after = jobCursor(filter.cursor);
28
28
  let query = db.selectFrom("pithyEmailJobs").selectAll().orderBy("createdAt", "desc").orderBy("id", "desc").limit(limit + 1);
29
29
  if (filter.status) query = query.where("status", "=", filter.status);
30
+ if (filter.template !== void 0) query = query.where("template", "=", filter.template);
31
+ if (filter.category !== void 0) query = query.where("category", "=", filter.category);
30
32
  if (after) query = query.where((eb) => eb.or([eb("createdAt", "<", after.sort), eb.and([eb("createdAt", "=", after.sort), eb("id", "<", after.id)])]));
31
33
  const jobs = (await query.execute()).map((row) => EmailJob.parse(row));
32
34
  return toPage(jobs, limit, (job) => ({
@@ -51,8 +53,7 @@ async function getJob(db, jobId) {
51
53
  *
52
54
  * ## Two axes, because a template is not always one message
53
55
  *
54
- * It was `(to, template)` alone, and that could not finish its only intended consumer (pithy-sh/pithy#382).
55
- * Six account notices ride one `operationalNotice` to the same addresses, so the template id does not
56
+ * `(to, template)` alone cannot answer every send decision. Six account notices ride one `operationalNotice` to the same addresses, so the template id does not
56
57
  * separate them; `correlation` is the enqueue-side discriminator that does. See {@link SentSubject} for
57
58
  * why the two are a union and not three optional fields.
58
59
  *
@@ -75,8 +76,8 @@ async function getJob(db, jobId) {
75
76
  * - **`subject`.** Rendered content, and the temptation is specific: it is the only per-row string that
76
77
  * distinguishes two messages sharing a template, so a caller needing that discrimination would match
77
78
  * on it. That match breaks on a copy edit, silently, in the direction of sending again. Discriminating
78
- * two notices was the enqueue side's problem and now has an enqueue-side answer — `correlation`
79
- * (#382) — rather than a rendered string exported to be string-matched.
79
+ * two notices is the enqueue side's problem and has an enqueue-side answer, `correlation`, rather than
80
+ * a rendered string exported to be string-matched.
80
81
  * - **`messageId`, `error`, `bounceCode`.** The provider's own words. A provider error routinely embeds
81
82
  * the recipient, which is why the list view carries `failed` rather than the text.
82
83
  *
@@ -0,0 +1,15 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { Migration } from "kysely/migration";
4
+ /**
5
+ * The send log filtered by template or by category, newest first.
6
+ *
7
+ * `GET {base}/jobs?template=…` and `?category=…` page `pithy_email_jobs` on `(createdAt, id)` under one equality.
8
+ * Without an index led by the filtered column, SQLite walks `pithyEmailJobsCreatedIdx` and tests every job the
9
+ * project ever queued, and a template nobody has sent in a year is the whole table. `createdAt` second, so the
10
+ * filtered page is read in order and stops at the limit.
11
+ *
12
+ * **Appended, never folded into `0001`.** The email capability has shipped, so its table is history.
13
+ */
14
+ export declare const email_0002_job_filters: Migration;
15
+ //# sourceMappingURL=0002_job_filters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"0002_job_filters.d.ts","sourceRoot":"","sources":["../../src/migrations/0002_job_filters.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAElD;;;;;;;;;GASG;AACH,eAAO,MAAM,sBAAsB,EAAE,SAkBpC,CAAC"}
@@ -0,0 +1,25 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ //#region src/migrations/0002_job_filters.ts
4
+ /**
5
+ * The send log filtered by template or by category, newest first.
6
+ *
7
+ * `GET {base}/jobs?template=…` and `?category=…` page `pithy_email_jobs` on `(createdAt, id)` under one equality.
8
+ * Without an index led by the filtered column, SQLite walks `pithyEmailJobsCreatedIdx` and tests every job the
9
+ * project ever queued, and a template nobody has sent in a year is the whole table. `createdAt` second, so the
10
+ * filtered page is read in order and stops at the limit.
11
+ *
12
+ * **Appended, never folded into `0001`.** The email capability has shipped, so its table is history.
13
+ */
14
+ const email_0002_job_filters = {
15
+ up: async (db) => {
16
+ await db.schema.createIndex("pithyEmailJobsTemplateCreatedIdx").on("pithyEmailJobs").columns(["template", "createdAt"]).execute();
17
+ await db.schema.createIndex("pithyEmailJobsCategoryCreatedIdx").on("pithyEmailJobs").columns(["category", "createdAt"]).execute();
18
+ },
19
+ down: async (db) => {
20
+ await db.schema.dropIndex("pithyEmailJobsCategoryCreatedIdx").execute();
21
+ await db.schema.dropIndex("pithyEmailJobsTemplateCreatedIdx").execute();
22
+ }
23
+ };
24
+ //#endregion
25
+ export { email_0002_job_filters };
@@ -99,11 +99,22 @@ export interface EnqueueInput {
99
99
  /**
100
100
  * The address a recipient's answer should go to, when it is not `fromAddress`.
101
101
  *
102
- * `@pithy-sh/support` is what this is for: a reply is sent as the adopter's onboarded sending
103
- * identity (Cloudflare validates the `From` domain against exactly what was onboarded) while the
104
- * conversation has to come back to the support inbox, which is usually a different subdomain.
102
+ * `@pithy-sh/support` sets it on every reply, so the customer's answer comes back to the support inbox
103
+ * whichever address the reply was sent {@link from}.
105
104
  */
106
105
  replyTo?: string;
106
+ /**
107
+ * The sender of this one message, when it is not the capability's `fromAddress` and `fromName`.
108
+ *
109
+ * Refused unless `address` is one the composing capability declared: {@link EnqueueDeps.claimedFrom}, which
110
+ * only {@link import("../capability").EmailCapability.enqueueAs} fills, and the plain `enqueue` leaves empty.
111
+ * That keeps a capability to the addresses it declared; it is not a boundary against Worker code, which can
112
+ * call `enqueueAs` itself. Cloudflare sends only from onboarded domains. `name` falls back to `fromName`.
113
+ *
114
+ * The job is sent from exactly this address. A domain Email Service cannot send from fails the job with
115
+ * the domain named; no other sender is tried.
116
+ */
117
+ from?: EnqueueFrom;
107
118
  /**
108
119
  * The `Message-ID` this job answers, angle brackets included — the `In-Reply-To` header.
109
120
  *
@@ -133,11 +144,23 @@ export interface EnqueueInput {
133
144
  */
134
145
  consentSubject?: ConsentSubject;
135
146
  }
147
+ /** A per-message sender: an address the composing capability claims, and an optional display name. */
148
+ export interface EnqueueFrom {
149
+ /** The address the message is sent from. Must be on {@link EnqueueDeps.claimedFrom}. */
150
+ address: string;
151
+ /** The display name. Absent sends under the capability's `fromName`. */
152
+ name?: string;
153
+ }
136
154
  /** Dependencies enqueue needs: the database, the from identity, optional send-Workflow binding, time, ids. */
137
155
  export interface EnqueueDeps {
138
156
  db: EmailDatabase;
139
157
  fromAddress: string;
140
158
  fromName: string;
159
+ /**
160
+ * The addresses a per-message {@link EnqueueInput.from} may name, supplied by the capability composing the
161
+ * call. Absent or empty refuses every override.
162
+ */
163
+ claimedFrom?: readonly string[];
141
164
  theme: EmailTheme;
142
165
  /**
143
166
  * Where the words for a locale come from — the composed project's catalogs.
@@ -1 +1 @@
1
- {"version":3,"file":"enqueue.d.ts","sourceRoot":"","sources":["../../src/send/enqueue.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,KAAK,EAAE,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