@pithy-sh/email 0.1.2 → 0.1.4

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 (176) hide show
  1. package/dist/analytics.d.ts +21 -0
  2. package/dist/analytics.d.ts.map +1 -0
  3. package/dist/analytics.js +15 -0
  4. package/dist/audit/actions.d.ts +47 -0
  5. package/dist/audit/actions.d.ts.map +1 -0
  6. package/dist/audit/actions.js +47 -0
  7. package/dist/bounce/classify.d.ts +40 -0
  8. package/dist/bounce/classify.d.ts.map +1 -0
  9. package/dist/bounce/classify.js +48 -0
  10. package/dist/bounce/handler.d.ts +34 -0
  11. package/dist/bounce/handler.d.ts.map +1 -0
  12. package/dist/bounce/handler.js +83 -0
  13. package/dist/capability.d.ts +160 -0
  14. package/dist/capability.d.ts.map +1 -0
  15. package/dist/capability.js +257 -0
  16. package/dist/crypto/signingKey.d.ts +38 -0
  17. package/dist/crypto/signingKey.d.ts.map +1 -0
  18. package/dist/crypto/signingKey.js +38 -0
  19. package/dist/crypto/token.d.ts +49 -0
  20. package/dist/crypto/token.d.ts.map +1 -0
  21. package/dist/crypto/token.js +101 -0
  22. package/dist/data/emailEvent.d.ts +30 -0
  23. package/dist/data/emailEvent.d.ts.map +1 -0
  24. package/dist/data/emailEvent.js +24 -0
  25. package/dist/data/emailJob.d.ts +78 -0
  26. package/dist/data/emailJob.d.ts.map +1 -0
  27. package/dist/data/emailJob.js +64 -0
  28. package/dist/data/emailSuppression.d.ts +25 -0
  29. package/dist/data/emailSuppression.d.ts.map +1 -0
  30. package/dist/data/emailSuppression.js +23 -0
  31. package/dist/data/enums.d.ts +78 -0
  32. package/dist/data/enums.d.ts.map +1 -0
  33. package/dist/data/enums.js +67 -0
  34. package/dist/data/tables.d.ts +116 -0
  35. package/dist/data/tables.d.ts.map +1 -0
  36. package/dist/data/tables.js +32 -0
  37. package/dist/error/errors.d.ts +62 -0
  38. package/dist/error/errors.d.ts.map +1 -0
  39. package/dist/error/errors.js +84 -0
  40. package/dist/http/callbacks.d.ts +23 -0
  41. package/dist/http/callbacks.d.ts.map +1 -0
  42. package/dist/http/callbacks.js +112 -0
  43. package/dist/http/guards.d.ts +101 -0
  44. package/dist/http/guards.d.ts.map +1 -0
  45. package/dist/http/guards.js +146 -0
  46. package/dist/http/responses.d.ts +297 -0
  47. package/dist/http/responses.d.ts.map +1 -0
  48. package/dist/http/responses.js +117 -0
  49. package/dist/http/routes.d.ts +73 -0
  50. package/dist/http/routes.d.ts.map +1 -0
  51. package/dist/http/routes.js +294 -0
  52. package/dist/http/schemas.d.ts +92 -0
  53. package/dist/http/schemas.d.ts.map +1 -0
  54. package/dist/http/schemas.js +93 -0
  55. package/dist/http/view.d.ts +80 -0
  56. package/dist/http/view.d.ts.map +1 -0
  57. package/dist/http/view.js +132 -0
  58. package/dist/index.d.ts +48 -0
  59. package/dist/index.d.ts.map +1 -0
  60. package/dist/index.js +13 -0
  61. package/dist/jobs/read.d.ts +193 -0
  62. package/dist/jobs/read.d.ts.map +1 -0
  63. package/dist/jobs/read.js +145 -0
  64. package/dist/jobs/retry.d.ts +101 -0
  65. package/dist/jobs/retry.d.ts.map +1 -0
  66. package/dist/jobs/retry.js +69 -0
  67. package/dist/migrations/0001_init.d.ts +34 -0
  68. package/dist/migrations/0001_init.d.ts.map +1 -0
  69. package/dist/migrations/0001_init.js +62 -0
  70. package/dist/migrations/0001_suppressions.d.ts +12 -0
  71. package/dist/migrations/0001_suppressions.d.ts.map +1 -0
  72. package/dist/migrations/0001_suppressions.js +22 -0
  73. package/dist/provision/devDelivery.d.ts +34 -0
  74. package/dist/provision/devDelivery.d.ts.map +1 -0
  75. package/dist/provision/devDelivery.js +39 -0
  76. package/dist/provision/hostCatalogs.d.ts +12 -0
  77. package/dist/provision/hostCatalogs.d.ts.map +1 -0
  78. package/dist/provision/hostCatalogs.js +80 -0
  79. package/dist/provision/provisionEmail.d.ts +145 -0
  80. package/dist/provision/provisionEmail.d.ts.map +1 -0
  81. package/dist/provision/provisionEmail.js +120 -0
  82. package/dist/provision/resolveEmailConfig.d.ts +124 -0
  83. package/dist/provision/resolveEmailConfig.d.ts.map +1 -0
  84. package/dist/provision/resolveEmailConfig.js +126 -0
  85. package/dist/provision/settingsCheck.d.ts +42 -0
  86. package/dist/provision/settingsCheck.d.ts.map +1 -0
  87. package/dist/provision/settingsCheck.js +140 -0
  88. package/dist/send/batchIdentity.d.ts +44 -0
  89. package/dist/send/batchIdentity.d.ts.map +1 -0
  90. package/dist/send/batchIdentity.js +48 -0
  91. package/dist/send/enqueue.d.ts +218 -0
  92. package/dist/send/enqueue.d.ts.map +1 -0
  93. package/dist/send/enqueue.js +155 -0
  94. package/dist/send/errorMapping.d.ts +29 -0
  95. package/dist/send/errorMapping.d.ts.map +1 -0
  96. package/dist/send/errorMapping.js +54 -0
  97. package/dist/send/events.d.ts +17 -0
  98. package/dist/send/events.d.ts.map +1 -0
  99. package/dist/send/events.js +19 -0
  100. package/dist/send/fromComposition.d.ts +49 -0
  101. package/dist/send/fromComposition.d.ts.map +1 -0
  102. package/dist/send/fromComposition.js +55 -0
  103. package/dist/send/retryPolicy.d.ts +34 -0
  104. package/dist/send/retryPolicy.d.ts.map +1 -0
  105. package/dist/send/retryPolicy.js +41 -0
  106. package/dist/send/runSend.d.ts +108 -0
  107. package/dist/send/runSend.d.ts.map +1 -0
  108. package/dist/send/runSend.js +220 -0
  109. package/dist/send/sendAt.d.ts +8 -0
  110. package/dist/send/sendAt.d.ts.map +1 -0
  111. package/dist/send/sendAt.js +64 -0
  112. package/dist/send/sender.d.ts +44 -0
  113. package/dist/send/sender.d.ts.map +1 -0
  114. package/dist/send/sender.js +2 -0
  115. package/dist/send/senderBinding.d.ts +46 -0
  116. package/dist/send/senderBinding.d.ts.map +1 -0
  117. package/dist/send/senderBinding.js +23 -0
  118. package/dist/send/suppression.d.ts +95 -0
  119. package/dist/send/suppression.d.ts.map +1 -0
  120. package/dist/send/suppression.js +134 -0
  121. package/dist/templates/engine.d.ts +111 -0
  122. package/dist/templates/engine.d.ts.map +1 -0
  123. package/dist/templates/engine.js +260 -0
  124. package/dist/templates/messages.d.ts +96 -0
  125. package/dist/templates/messages.d.ts.map +1 -0
  126. package/dist/templates/messages.es.d.ts +31 -0
  127. package/dist/templates/messages.es.d.ts.map +1 -0
  128. package/dist/templates/messages.es.js +84 -0
  129. package/dist/templates/messages.js +268 -0
  130. package/dist/templates/partials.d.ts +7 -0
  131. package/dist/templates/partials.d.ts.map +1 -0
  132. package/dist/templates/partials.js +61 -0
  133. package/dist/templates/precompiled.generated.d.ts +268 -0
  134. package/dist/templates/precompiled.generated.d.ts.map +1 -0
  135. package/dist/templates/precompiled.generated.js +4041 -0
  136. package/dist/templates/registry.d.ts +120 -0
  137. package/dist/templates/registry.d.ts.map +1 -0
  138. package/dist/templates/registry.js +325 -0
  139. package/dist/templates/samples.d.ts +9 -0
  140. package/dist/templates/samples.d.ts.map +1 -0
  141. package/dist/templates/samples.js +100 -0
  142. package/dist/templates/severity.d.ts +42 -0
  143. package/dist/templates/severity.d.ts.map +1 -0
  144. package/dist/templates/severity.js +83 -0
  145. package/dist/templates/theme.d.ts +195 -0
  146. package/dist/templates/theme.d.ts.map +1 -0
  147. package/dist/templates/theme.js +170 -0
  148. package/dist/version.generated.d.ts +7 -0
  149. package/dist/version.generated.d.ts.map +1 -0
  150. package/dist/version.generated.js +9 -0
  151. package/dist/workflows/hostApp.d.ts +35 -0
  152. package/dist/workflows/hostApp.d.ts.map +1 -0
  153. package/dist/workflows/hostApp.js +21 -0
  154. package/dist/workflows/hostEnv.d.ts +131 -0
  155. package/dist/workflows/hostEnv.d.ts.map +1 -0
  156. package/dist/workflows/hostEnv.js +149 -0
  157. package/dist/workflows/instanceLiveness.d.ts +5 -0
  158. package/dist/workflows/instanceLiveness.d.ts.map +1 -0
  159. package/dist/workflows/instanceLiveness.js +39 -0
  160. package/dist/workflows/instances.d.ts +20 -0
  161. package/dist/workflows/instances.d.ts.map +1 -0
  162. package/dist/workflows/instances.js +2 -0
  163. package/dist/workflows/params.d.ts +25 -0
  164. package/dist/workflows/params.d.ts.map +1 -0
  165. package/dist/workflows/params.js +23 -0
  166. package/dist/workflows/scheduler.d.ts +84 -0
  167. package/dist/workflows/scheduler.d.ts.map +1 -0
  168. package/dist/workflows/scheduler.js +113 -0
  169. package/dist/workflows/sendBatch.d.ts +87 -0
  170. package/dist/workflows/sendBatch.d.ts.map +1 -0
  171. package/dist/workflows/sendBatch.js +52 -0
  172. package/dist/workflows/worker.d.ts +102 -0
  173. package/dist/workflows/worker.d.ts.map +1 -0
  174. package/dist/workflows/worker.js +119 -0
  175. package/package.json +22 -11
  176. package/src/version.generated.ts +1 -1
@@ -0,0 +1,112 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { emailDatabase, emailSuppressionDatabase } from "../data/tables.js";
4
+ import { recordEvent } from "../send/events.js";
5
+ import { suppress } from "../send/suppression.js";
6
+ import { resolveSigningKeys } from "../crypto/signingKey.js";
7
+ import { EmailInvalidTokenError } from "../error/errors.js";
8
+ import { verifyToken } from "../crypto/token.js";
9
+ import { CALLBACK_BASE } from "../templates/engine.js";
10
+ import { CallbackTokenParam, UnsubscribeQuery } from "./schemas.js";
11
+ import { normalizeAddress } from "@pithy-sh/core/src/address/address";
12
+ import { zValidator } from "@hono/zod-validator";
13
+ import { validationHook } from "@pithy-sh/core/src/http/validation";
14
+ //#region src/http/callbacks.ts
15
+ /** A 1×1 transparent PNG — the open-tracking pixel body. */
16
+ const PIXEL = Uint8Array.from(atob("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+P+/HgAFhAJ/wlseKgAAAABJRU5ErkJggg=="), (c) => c.charCodeAt(0));
17
+ /** Verify a token and assert its kind, or throw `email/invalid_token`. */
18
+ async function verify(keys, token, expected, now) {
19
+ const claims = await verifyToken(token, keys, now);
20
+ if (claims.kind !== expected) throw new EmailInvalidTokenError({ detail: `token kind '${claims.kind}' does not match callback '${expected}'` });
21
+ return claims;
22
+ }
23
+ /** Handle a click: record it, then 302-redirect to the signed http(s) destination. */
24
+ async function handleClick(db, keys, token, now) {
25
+ const claims = await verify(keys, token, "click", now);
26
+ const destination = claims.destination ?? "";
27
+ if (!/^https?:\/\//i.test(destination)) throw new EmailInvalidTokenError({ detail: "click token has no http(s) destination" });
28
+ await recordEvent(db, {
29
+ jobId: claims.jobId,
30
+ recipient: normalizeAddress(claims.recipient),
31
+ type: "click",
32
+ linkLabel: claims.linkLabel ?? null,
33
+ linkUrl: destination,
34
+ campaignId: claims.campaignId ?? null
35
+ }, now);
36
+ return new Response(null, {
37
+ status: 302,
38
+ headers: { location: destination }
39
+ });
40
+ }
41
+ /** Handle an open: record it, return the 1×1 pixel. */
42
+ async function handleOpen(db, keys, token, now) {
43
+ const claims = await verify(keys, token.replace(/\.png$/i, ""), "open", now);
44
+ await recordEvent(db, {
45
+ jobId: claims.jobId,
46
+ recipient: normalizeAddress(claims.recipient),
47
+ type: "open",
48
+ campaignId: claims.campaignId ?? null
49
+ }, now);
50
+ return new Response(PIXEL, {
51
+ status: 200,
52
+ headers: {
53
+ "content-type": "image/png",
54
+ "cache-control": "no-store, max-age=0"
55
+ }
56
+ });
57
+ }
58
+ /**
59
+ * Handle an unsubscribe: suppress the address (shared DB), record the opt-out event (app DB), confirm.
60
+ * An optional `reason` — supplied by the app's own unsubscribe/preferences flow via the `?reason=` query
61
+ * param — is stored on the suppression `detail` and the event, so a project can capture *why* someone
62
+ * opted out using its own logic. It is length-bounded so the link can't be used to stuff the column.
63
+ */
64
+ async function handleUnsubscribe(db, suppressionDb, keys, token, now, reason, environment) {
65
+ const claims = await verify(keys, token, "unsubscribe", now);
66
+ const recipient = normalizeAddress(claims.recipient);
67
+ const detail = reason ? reason.slice(0, 200) : "unsubscribe link";
68
+ await suppress(suppressionDb, {
69
+ email: recipient,
70
+ reason: "unsubscribe",
71
+ jobId: claims.jobId,
72
+ environment,
73
+ detail
74
+ }, now);
75
+ await recordEvent(db, {
76
+ jobId: claims.jobId,
77
+ recipient,
78
+ type: "unsubscribe",
79
+ campaignId: claims.campaignId ?? null,
80
+ detail
81
+ }, now);
82
+ return new Response("<p>You've been unsubscribed. Messages you ask for — a sign-in link, a security notice — still arrive. Nothing else will.</p>", {
83
+ status: 200,
84
+ headers: { "content-type": "text/html; charset=utf-8" }
85
+ });
86
+ }
87
+ /** Mount the click/open/unsubscribe callback routes under `${CALLBACK_BASE}` on the app's Hono router. */
88
+ function registerCallbacks(app) {
89
+ const setup = async (env) => {
90
+ const keys = await resolveSigningKeys(env);
91
+ return {
92
+ db: emailDatabase(env.DB),
93
+ suppressionDb: emailSuppressionDatabase(env.EMAIL_SUPPRESSIONS),
94
+ keys: { versions: keys.versions }
95
+ };
96
+ };
97
+ app.get(`${CALLBACK_BASE}/c/:token`, zValidator("param", CallbackTokenParam, validationHook), async (c) => {
98
+ const { db, keys } = await setup(c.env);
99
+ return handleClick(db, keys, c.req.valid("param").token, /* @__PURE__ */ new Date());
100
+ });
101
+ app.get(`${CALLBACK_BASE}/o/:token`, zValidator("param", CallbackTokenParam, validationHook), async (c) => {
102
+ const { db, keys } = await setup(c.env);
103
+ return handleOpen(db, keys, c.req.valid("param").token, /* @__PURE__ */ new Date());
104
+ });
105
+ app.on(["GET", "POST"], `${CALLBACK_BASE}/u/:token`, zValidator("param", CallbackTokenParam, validationHook), zValidator("query", UnsubscribeQuery, validationHook), async (c) => {
106
+ const env = c.env;
107
+ const { db, suppressionDb, keys } = await setup(env);
108
+ return handleUnsubscribe(db, suppressionDb, keys, c.req.valid("param").token, /* @__PURE__ */ new Date(), c.req.valid("query").reason, env.ENVIRONMENT);
109
+ });
110
+ }
111
+ //#endregion
112
+ export { handleClick, handleOpen, handleUnsubscribe, registerCallbacks };
@@ -0,0 +1,101 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import type { AdminRoute } from "@pithy-sh/core/src/controlPlane/discovery/adminRoute";
4
+ import type { ControlPlaneScope } from "@pithy-sh/core/src/controlPlane/scope/scope";
5
+ /**
6
+ * Email's control-plane scopes, and the admin surface a manifest advertises.
7
+ *
8
+ * ## There is no `requireAuth` in this file, and that is deliberate
9
+ *
10
+ * Every other capability copies a local `requireAuth()` because it has an end-user surface to gate.
11
+ * Email has none: the three callback routes are public-plus-signed-token (a recipient tapping a
12
+ * tracking link has no session and must not need one), and everything below is `control-plane`. There
13
+ * is nothing here for an authenticated user to call, so there is no gate to copy.
14
+ *
15
+ * The seam's gate is **imported** from `@pithy-sh/core/src/controlPlane/http/guard` rather than copied.
16
+ * That is not the opposite of the copy rule; it is the same rule. The rule is never to import
17
+ * authorization from a package that might be absent — `@pithy-sh/auth` is optional, so its gate is
18
+ * copied. Core is a hard dependency of every capability there is, so importing its gate cannot leave a
19
+ * deployment without one, and with the seam uncomposed `requireControlPlane` raises
20
+ * `controlplane/not_connected` rather than passing. Both halves fail closed.
21
+ *
22
+ * **`requireAuth()` must never sit on one of these routes.** The seam deliberately leaves `c.var.auth`
23
+ * null so that a management credential cannot satisfy an ordinary `requireAuth()` anywhere in the tree.
24
+ * An auth gate on an admin route would therefore deny every legitimate management call, permanently,
25
+ * and no credential could fix it.
26
+ *
27
+ * ## Five scopes, because these are five different blast radii
28
+ *
29
+ * The temptation is one `email:admin` flag. It is wrong on the merits, and email is the capability
30
+ * where it is most obviously wrong, because the five operations here fail in five unrelated directions:
31
+ *
32
+ * - **Reading jobs** discloses who the adopter mailed and when. A privacy incident.
33
+ * - **Retrying a job** sends real mail to a real person under the adopter's domain and DKIM. Reach
34
+ * outside the adopter's own systems, from a credential that was only ever meant to look.
35
+ * - **Reading suppressions** discloses, in one list, every address in the whole project that ever
36
+ * bounced, complained, or unsubscribed — across every environment, since that database is global.
37
+ * - **Adding a suppression** is a silent, targeted denial of service: block one address and that
38
+ * person never receives another magic link, and nothing anywhere reports an error.
39
+ * - **Removing a suppression** re-opens sending to somebody who reported spam or asked to be left
40
+ * alone. That is a deliverability incident, a reputation hit on the sending domain, and depending on
41
+ * the jurisdiction a compliance one.
42
+ *
43
+ * A tool that retries stuck receipts needs `email:jobs:read` and `email:jobs:retry` and must never
44
+ * hold either suppression write. A deliverability dashboard needs `email:suppressions:read` and
45
+ * nothing else. One flag makes each of those the other. `scopeCovers` matches exactly, with no prefix
46
+ * and no wildcard rule, so holding one of these confers nothing about the rest — `email:jobs:read`
47
+ * does not imply `email:jobs:retry`, and `email:suppressions:write` does not imply the delete.
48
+ *
49
+ * The names are constants rather than config: a configurable scope name is a way to misconfigure a
50
+ * default-denied gate into a differently-named one, and they are the join key with what
51
+ * `pithy dashboard connect` offers an adopter to grant.
52
+ */
53
+ /**
54
+ * Read the job log — the list and one job in full.
55
+ *
56
+ * The list projects a masked recipient and the detail projects the whole address, which is a bulk-harvest
57
+ * control rather than two permissions: see `view.ts`. Both are the same scope because both are reads of
58
+ * the same table, and splitting them would only produce a credential that could page the log but never
59
+ * diagnose a single row in it.
60
+ */
61
+ export declare const EMAIL_JOBS_READ_SCOPE: ControlPlaneScope;
62
+ /**
63
+ * Put a failed job back in the queue. The only operation in this capability that causes mail to be
64
+ * sent, which is why it is granted separately from reading the log it is chosen from.
65
+ */
66
+ export declare const EMAIL_JOBS_RETRY_SCOPE: ControlPlaneScope;
67
+ /**
68
+ * Read the global suppression list. Its own scope, and not folded into `email:jobs:read`, because that
69
+ * database is shared by every environment: a staging connection reading it sees production's bounces.
70
+ */
71
+ export declare const EMAIL_SUPPRESSIONS_READ_SCOPE: ControlPlaneScope;
72
+ /** Block an address by hand. Silent to the recipient and effective on the project's next send. */
73
+ export declare const EMAIL_SUPPRESSIONS_WRITE_SCOPE: ControlPlaneScope;
74
+ /**
75
+ * Unblock an address. The most dangerous of the five: it undoes a hard bounce, a spam complaint, or a
76
+ * recipient's own opt-out, and the consequences land on the adopter's sending reputation rather than
77
+ * in a response body.
78
+ */
79
+ export declare const EMAIL_SUPPRESSIONS_DELETE_SCOPE: ControlPlaneScope;
80
+ /**
81
+ * Every control-plane scope email defines — what `pithy dashboard connect` offers for this capability,
82
+ * and the list a manifest or a doc quotes rather than re-typing.
83
+ */
84
+ export declare const EMAIL_CONTROL_PLANE_SCOPES: readonly ControlPlaneScope[];
85
+ /**
86
+ * Email's management surface, as `GET /control-plane/manifest` reports it.
87
+ *
88
+ * Declared beside the scopes so the scope a route demands and the scope a manifest advertises are the
89
+ * same constant, read from one place. `basePath` is a parameter and never a default: an adopter who
90
+ * mounted email at `/mail` must get a manifest naming `/mail/jobs`, or a management client composing
91
+ * its calls from it would 404 against exactly the adopters who customized anything.
92
+ *
93
+ * The callback routes are **not** here. They are a recipient's tracking and unsubscribe links, mounted
94
+ * at a fixed prefix and gated by a signature; they are not management surface and a dashboard has no
95
+ * business calling them.
96
+ *
97
+ * The summaries say what the operation is *for*. A client renders these next to a button somebody is
98
+ * about to press on a real person's mail.
99
+ */
100
+ export declare function emailAdminRoutes(basePath: string): AdminRoute[];
101
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/http/guards.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sDAAsD,CAAC;AACvF,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAErF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AAEH;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,EAAE,iBAAqC,CAAC;AAE1E;;;GAGG;AACH,eAAO,MAAM,sBAAsB,EAAE,iBAAsC,CAAC;AAE5E;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,iBAA6C,CAAC;AAE1F,kGAAkG;AAClG,eAAO,MAAM,8BAA8B,EAAE,iBAA8C,CAAC;AAE5F;;;;GAIG;AACH,eAAO,MAAM,+BAA+B,EAAE,iBAA+C,CAAC;AAE9F;;;GAGG;AACH,eAAO,MAAM,0BAA0B,EAAE,SAAS,iBAAiB,EAMlE,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,EAAE,CAuC/D"}
@@ -0,0 +1,146 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ //#region src/http/guards.ts
4
+ /**
5
+ * Email's control-plane scopes, and the admin surface a manifest advertises.
6
+ *
7
+ * ## There is no `requireAuth` in this file, and that is deliberate
8
+ *
9
+ * Every other capability copies a local `requireAuth()` because it has an end-user surface to gate.
10
+ * Email has none: the three callback routes are public-plus-signed-token (a recipient tapping a
11
+ * tracking link has no session and must not need one), and everything below is `control-plane`. There
12
+ * is nothing here for an authenticated user to call, so there is no gate to copy.
13
+ *
14
+ * The seam's gate is **imported** from `@pithy-sh/core/src/controlPlane/http/guard` rather than copied.
15
+ * That is not the opposite of the copy rule; it is the same rule. The rule is never to import
16
+ * authorization from a package that might be absent — `@pithy-sh/auth` is optional, so its gate is
17
+ * copied. Core is a hard dependency of every capability there is, so importing its gate cannot leave a
18
+ * deployment without one, and with the seam uncomposed `requireControlPlane` raises
19
+ * `controlplane/not_connected` rather than passing. Both halves fail closed.
20
+ *
21
+ * **`requireAuth()` must never sit on one of these routes.** The seam deliberately leaves `c.var.auth`
22
+ * null so that a management credential cannot satisfy an ordinary `requireAuth()` anywhere in the tree.
23
+ * An auth gate on an admin route would therefore deny every legitimate management call, permanently,
24
+ * and no credential could fix it.
25
+ *
26
+ * ## Five scopes, because these are five different blast radii
27
+ *
28
+ * The temptation is one `email:admin` flag. It is wrong on the merits, and email is the capability
29
+ * where it is most obviously wrong, because the five operations here fail in five unrelated directions:
30
+ *
31
+ * - **Reading jobs** discloses who the adopter mailed and when. A privacy incident.
32
+ * - **Retrying a job** sends real mail to a real person under the adopter's domain and DKIM. Reach
33
+ * outside the adopter's own systems, from a credential that was only ever meant to look.
34
+ * - **Reading suppressions** discloses, in one list, every address in the whole project that ever
35
+ * bounced, complained, or unsubscribed — across every environment, since that database is global.
36
+ * - **Adding a suppression** is a silent, targeted denial of service: block one address and that
37
+ * person never receives another magic link, and nothing anywhere reports an error.
38
+ * - **Removing a suppression** re-opens sending to somebody who reported spam or asked to be left
39
+ * alone. That is a deliverability incident, a reputation hit on the sending domain, and depending on
40
+ * the jurisdiction a compliance one.
41
+ *
42
+ * A tool that retries stuck receipts needs `email:jobs:read` and `email:jobs:retry` and must never
43
+ * hold either suppression write. A deliverability dashboard needs `email:suppressions:read` and
44
+ * nothing else. One flag makes each of those the other. `scopeCovers` matches exactly, with no prefix
45
+ * and no wildcard rule, so holding one of these confers nothing about the rest — `email:jobs:read`
46
+ * does not imply `email:jobs:retry`, and `email:suppressions:write` does not imply the delete.
47
+ *
48
+ * The names are constants rather than config: a configurable scope name is a way to misconfigure a
49
+ * default-denied gate into a differently-named one, and they are the join key with what
50
+ * `pithy dashboard connect` offers an adopter to grant.
51
+ */
52
+ /**
53
+ * Read the job log — the list and one job in full.
54
+ *
55
+ * The list projects a masked recipient and the detail projects the whole address, which is a bulk-harvest
56
+ * control rather than two permissions: see `view.ts`. Both are the same scope because both are reads of
57
+ * the same table, and splitting them would only produce a credential that could page the log but never
58
+ * diagnose a single row in it.
59
+ */
60
+ const EMAIL_JOBS_READ_SCOPE = "email:jobs:read";
61
+ /**
62
+ * Put a failed job back in the queue. The only operation in this capability that causes mail to be
63
+ * sent, which is why it is granted separately from reading the log it is chosen from.
64
+ */
65
+ const EMAIL_JOBS_RETRY_SCOPE = "email:jobs:retry";
66
+ /**
67
+ * Read the global suppression list. Its own scope, and not folded into `email:jobs:read`, because that
68
+ * database is shared by every environment: a staging connection reading it sees production's bounces.
69
+ */
70
+ const EMAIL_SUPPRESSIONS_READ_SCOPE = "email:suppressions:read";
71
+ /** Block an address by hand. Silent to the recipient and effective on the project's next send. */
72
+ const EMAIL_SUPPRESSIONS_WRITE_SCOPE = "email:suppressions:write";
73
+ /**
74
+ * Unblock an address. The most dangerous of the five: it undoes a hard bounce, a spam complaint, or a
75
+ * recipient's own opt-out, and the consequences land on the adopter's sending reputation rather than
76
+ * in a response body.
77
+ */
78
+ const EMAIL_SUPPRESSIONS_DELETE_SCOPE = "email:suppressions:delete";
79
+ /**
80
+ * Every control-plane scope email defines — what `pithy dashboard connect` offers for this capability,
81
+ * and the list a manifest or a doc quotes rather than re-typing.
82
+ */
83
+ const EMAIL_CONTROL_PLANE_SCOPES = [
84
+ EMAIL_JOBS_READ_SCOPE,
85
+ EMAIL_JOBS_RETRY_SCOPE,
86
+ EMAIL_SUPPRESSIONS_READ_SCOPE,
87
+ EMAIL_SUPPRESSIONS_WRITE_SCOPE,
88
+ EMAIL_SUPPRESSIONS_DELETE_SCOPE
89
+ ];
90
+ /**
91
+ * Email's management surface, as `GET /control-plane/manifest` reports it.
92
+ *
93
+ * Declared beside the scopes so the scope a route demands and the scope a manifest advertises are the
94
+ * same constant, read from one place. `basePath` is a parameter and never a default: an adopter who
95
+ * mounted email at `/mail` must get a manifest naming `/mail/jobs`, or a management client composing
96
+ * its calls from it would 404 against exactly the adopters who customized anything.
97
+ *
98
+ * The callback routes are **not** here. They are a recipient's tracking and unsubscribe links, mounted
99
+ * at a fixed prefix and gated by a signature; they are not management surface and a dashboard has no
100
+ * business calling them.
101
+ *
102
+ * The summaries say what the operation is *for*. A client renders these next to a button somebody is
103
+ * about to press on a real person's mail.
104
+ */
105
+ function emailAdminRoutes(basePath) {
106
+ return [
107
+ {
108
+ method: "GET",
109
+ path: `${basePath}/jobs`,
110
+ scope: EMAIL_JOBS_READ_SCOPE,
111
+ summary: "The send log, newest first, filtered by status. Recipients are masked in the list."
112
+ },
113
+ {
114
+ method: "GET",
115
+ path: `${basePath}/jobs/:id`,
116
+ scope: EMAIL_JOBS_READ_SCOPE,
117
+ summary: "One job in full — the recipient, the subject, and why it failed. Never the template variables."
118
+ },
119
+ {
120
+ method: "POST",
121
+ path: `${basePath}/jobs/:id/retry`,
122
+ scope: EMAIL_JOBS_RETRY_SCOPE,
123
+ summary: "Queue a failed job again with a fresh attempt budget. Sends real mail."
124
+ },
125
+ {
126
+ method: "GET",
127
+ path: `${basePath}/suppressions`,
128
+ scope: EMAIL_SUPPRESSIONS_READ_SCOPE,
129
+ summary: "Addresses this project will not send to, and why. Global — every environment shares it."
130
+ },
131
+ {
132
+ method: "POST",
133
+ path: `${basePath}/suppressions`,
134
+ scope: EMAIL_SUPPRESSIONS_WRITE_SCOPE,
135
+ summary: "Block an address by hand, permanently or until a date. Recorded as a manual block."
136
+ },
137
+ {
138
+ method: "POST",
139
+ path: `${basePath}/suppressions/remove`,
140
+ scope: EMAIL_SUPPRESSIONS_DELETE_SCOPE,
141
+ summary: "Unblock an address. Re-opens sending to somebody who bounced, complained, or opted out."
142
+ }
143
+ ];
144
+ }
145
+ //#endregion
146
+ export { EMAIL_CONTROL_PLANE_SCOPES, EMAIL_JOBS_READ_SCOPE, EMAIL_JOBS_RETRY_SCOPE, EMAIL_SUPPRESSIONS_DELETE_SCOPE, EMAIL_SUPPRESSIONS_READ_SCOPE, EMAIL_SUPPRESSIONS_WRITE_SCOPE, emailAdminRoutes };
@@ -0,0 +1,297 @@
1
+ // SPDX-FileCopyrightText: 2026 Pithy
2
+ // SPDX-License-Identifier: MIT
3
+ import { z } from "zod";
4
+ /** One job as the list shows it: enough to scan, not enough to harvest. */
5
+ export declare const EmailJobListItem: z.ZodObject<{
6
+ id: z.ZodString;
7
+ recipient: z.ZodString;
8
+ template: z.ZodString;
9
+ category: z.ZodEnum<{
10
+ marketing: "marketing";
11
+ transactional: "transactional";
12
+ }>;
13
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ status: z.ZodEnum<{
15
+ bounced: "bounced";
16
+ canceled: "canceled";
17
+ failed: "failed";
18
+ pending: "pending";
19
+ scheduled: "scheduled";
20
+ sending: "sending";
21
+ sent: "sent";
22
+ suppressed: "suppressed";
23
+ undispatched: "undispatched";
24
+ }>;
25
+ mode: z.ZodEnum<{
26
+ immediate: "immediate";
27
+ scheduled: "scheduled";
28
+ timezone: "timezone";
29
+ }>;
30
+ attempts: z.ZodNumber;
31
+ campaignId: z.ZodNullable<z.ZodString>;
32
+ bounceType: z.ZodNullable<z.ZodString>;
33
+ failed: z.ZodBoolean;
34
+ sendAt: z.ZodISODateTime;
35
+ createdAt: z.ZodISODateTime;
36
+ sentAt: z.ZodNullable<z.ZodISODateTime>;
37
+ }, z.core.$strip>;
38
+ export type EmailJobListItem = z.output<typeof EmailJobListItem>;
39
+ /**
40
+ * One job in full.
41
+ *
42
+ * Re-described after `.omit()`/`.extend()`: each builds a new schema, and a description does not
43
+ * follow it.
44
+ *
45
+ * `locale` is **not** re-declared below. It is on the list item, so the detail inherits it and there is
46
+ * one sentence describing the tag rather than two free to drift — and the fact the detail's own copy
47
+ * used to carry, that null means nobody chose, is the fact the list needs most.
48
+ */
49
+ export declare const EmailJobDetail: z.ZodObject<{
50
+ id: z.ZodString;
51
+ template: z.ZodString;
52
+ category: z.ZodEnum<{
53
+ marketing: "marketing";
54
+ transactional: "transactional";
55
+ }>;
56
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ status: z.ZodEnum<{
58
+ bounced: "bounced";
59
+ canceled: "canceled";
60
+ failed: "failed";
61
+ pending: "pending";
62
+ scheduled: "scheduled";
63
+ sending: "sending";
64
+ sent: "sent";
65
+ suppressed: "suppressed";
66
+ undispatched: "undispatched";
67
+ }>;
68
+ mode: z.ZodEnum<{
69
+ immediate: "immediate";
70
+ scheduled: "scheduled";
71
+ timezone: "timezone";
72
+ }>;
73
+ attempts: z.ZodNumber;
74
+ campaignId: z.ZodNullable<z.ZodString>;
75
+ bounceType: z.ZodNullable<z.ZodString>;
76
+ sendAt: z.ZodISODateTime;
77
+ createdAt: z.ZodISODateTime;
78
+ sentAt: z.ZodNullable<z.ZodISODateTime>;
79
+ toAddress: z.ZodString;
80
+ subject: z.ZodString;
81
+ fromAddress: z.ZodString;
82
+ fromName: z.ZodString;
83
+ messageId: z.ZodNullable<z.ZodString>;
84
+ error: z.ZodNullable<z.ZodString>;
85
+ bounceCode: z.ZodNullable<z.ZodString>;
86
+ timezone: z.ZodNullable<z.ZodString>;
87
+ localTime: z.ZodNullable<z.ZodString>;
88
+ openTracking: z.ZodBoolean;
89
+ clickTracking: z.ZodBoolean;
90
+ updatedAt: z.ZodISODateTime;
91
+ }, z.core.$strip>;
92
+ export type EmailJobDetail = z.output<typeof EmailJobDetail>;
93
+ /** One suppressed address, as a management client sees it. */
94
+ export declare const EmailSuppressionView: z.ZodObject<{
95
+ id: z.ZodNumber;
96
+ email: z.ZodString;
97
+ reason: z.ZodEnum<{
98
+ complaint: "complaint";
99
+ hard_bounce: "hard_bounce";
100
+ manual: "manual";
101
+ unsubscribe: "unsubscribe";
102
+ }>;
103
+ environment: z.ZodNullable<z.ZodString>;
104
+ jobId: z.ZodNullable<z.ZodString>;
105
+ detail: z.ZodNullable<z.ZodString>;
106
+ createdAt: z.ZodISODateTime;
107
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
108
+ active: z.ZodBoolean;
109
+ }, z.core.$strip>;
110
+ export type EmailSuppressionView = z.output<typeof EmailSuppressionView>;
111
+ /** `GET {base}/jobs`. */
112
+ export declare const EmailJobsResponse: z.ZodObject<{
113
+ jobs: z.ZodArray<z.ZodObject<{
114
+ id: z.ZodString;
115
+ recipient: z.ZodString;
116
+ template: z.ZodString;
117
+ category: z.ZodEnum<{
118
+ marketing: "marketing";
119
+ transactional: "transactional";
120
+ }>;
121
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
122
+ status: z.ZodEnum<{
123
+ bounced: "bounced";
124
+ canceled: "canceled";
125
+ failed: "failed";
126
+ pending: "pending";
127
+ scheduled: "scheduled";
128
+ sending: "sending";
129
+ sent: "sent";
130
+ suppressed: "suppressed";
131
+ undispatched: "undispatched";
132
+ }>;
133
+ mode: z.ZodEnum<{
134
+ immediate: "immediate";
135
+ scheduled: "scheduled";
136
+ timezone: "timezone";
137
+ }>;
138
+ attempts: z.ZodNumber;
139
+ campaignId: z.ZodNullable<z.ZodString>;
140
+ bounceType: z.ZodNullable<z.ZodString>;
141
+ failed: z.ZodBoolean;
142
+ sendAt: z.ZodISODateTime;
143
+ createdAt: z.ZodISODateTime;
144
+ sentAt: z.ZodNullable<z.ZodISODateTime>;
145
+ }, z.core.$strip>>;
146
+ nextCursor: z.ZodNullable<z.ZodString>;
147
+ }, z.core.$strip>;
148
+ export type EmailJobsResponse = z.output<typeof EmailJobsResponse>;
149
+ /** `GET {base}/jobs/:id`. */
150
+ export declare const EmailJobResponse: z.ZodObject<{
151
+ job: z.ZodObject<{
152
+ id: z.ZodString;
153
+ template: z.ZodString;
154
+ category: z.ZodEnum<{
155
+ marketing: "marketing";
156
+ transactional: "transactional";
157
+ }>;
158
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
159
+ status: z.ZodEnum<{
160
+ bounced: "bounced";
161
+ canceled: "canceled";
162
+ failed: "failed";
163
+ pending: "pending";
164
+ scheduled: "scheduled";
165
+ sending: "sending";
166
+ sent: "sent";
167
+ suppressed: "suppressed";
168
+ undispatched: "undispatched";
169
+ }>;
170
+ mode: z.ZodEnum<{
171
+ immediate: "immediate";
172
+ scheduled: "scheduled";
173
+ timezone: "timezone";
174
+ }>;
175
+ attempts: z.ZodNumber;
176
+ campaignId: z.ZodNullable<z.ZodString>;
177
+ bounceType: z.ZodNullable<z.ZodString>;
178
+ sendAt: z.ZodISODateTime;
179
+ createdAt: z.ZodISODateTime;
180
+ sentAt: z.ZodNullable<z.ZodISODateTime>;
181
+ toAddress: z.ZodString;
182
+ subject: z.ZodString;
183
+ fromAddress: z.ZodString;
184
+ fromName: z.ZodString;
185
+ messageId: z.ZodNullable<z.ZodString>;
186
+ error: z.ZodNullable<z.ZodString>;
187
+ bounceCode: z.ZodNullable<z.ZodString>;
188
+ timezone: z.ZodNullable<z.ZodString>;
189
+ localTime: z.ZodNullable<z.ZodString>;
190
+ openTracking: z.ZodBoolean;
191
+ clickTracking: z.ZodBoolean;
192
+ updatedAt: z.ZodISODateTime;
193
+ }, z.core.$strip>;
194
+ }, z.core.$strip>;
195
+ export type EmailJobResponse = z.output<typeof EmailJobResponse>;
196
+ /** `POST {base}/jobs/:id/retry`. */
197
+ export declare const EmailJobRetryResponse: z.ZodObject<{
198
+ job: z.ZodObject<{
199
+ id: z.ZodString;
200
+ template: z.ZodString;
201
+ category: z.ZodEnum<{
202
+ marketing: "marketing";
203
+ transactional: "transactional";
204
+ }>;
205
+ locale: z.ZodOptional<z.ZodNullable<z.ZodString>>;
206
+ status: z.ZodEnum<{
207
+ bounced: "bounced";
208
+ canceled: "canceled";
209
+ failed: "failed";
210
+ pending: "pending";
211
+ scheduled: "scheduled";
212
+ sending: "sending";
213
+ sent: "sent";
214
+ suppressed: "suppressed";
215
+ undispatched: "undispatched";
216
+ }>;
217
+ mode: z.ZodEnum<{
218
+ immediate: "immediate";
219
+ scheduled: "scheduled";
220
+ timezone: "timezone";
221
+ }>;
222
+ attempts: z.ZodNumber;
223
+ campaignId: z.ZodNullable<z.ZodString>;
224
+ bounceType: z.ZodNullable<z.ZodString>;
225
+ sendAt: z.ZodISODateTime;
226
+ createdAt: z.ZodISODateTime;
227
+ sentAt: z.ZodNullable<z.ZodISODateTime>;
228
+ toAddress: z.ZodString;
229
+ subject: z.ZodString;
230
+ fromAddress: z.ZodString;
231
+ fromName: z.ZodString;
232
+ messageId: z.ZodNullable<z.ZodString>;
233
+ error: z.ZodNullable<z.ZodString>;
234
+ bounceCode: z.ZodNullable<z.ZodString>;
235
+ timezone: z.ZodNullable<z.ZodString>;
236
+ localTime: z.ZodNullable<z.ZodString>;
237
+ openTracking: z.ZodBoolean;
238
+ clickTracking: z.ZodBoolean;
239
+ updatedAt: z.ZodISODateTime;
240
+ }, z.core.$strip>;
241
+ dispatched: z.ZodBoolean;
242
+ }, z.core.$strip>;
243
+ export type EmailJobRetryResponse = z.output<typeof EmailJobRetryResponse>;
244
+ /** `GET {base}/suppressions`. */
245
+ export declare const EmailSuppressionsResponse: z.ZodObject<{
246
+ suppressions: z.ZodArray<z.ZodObject<{
247
+ id: z.ZodNumber;
248
+ email: z.ZodString;
249
+ reason: z.ZodEnum<{
250
+ complaint: "complaint";
251
+ hard_bounce: "hard_bounce";
252
+ manual: "manual";
253
+ unsubscribe: "unsubscribe";
254
+ }>;
255
+ environment: z.ZodNullable<z.ZodString>;
256
+ jobId: z.ZodNullable<z.ZodString>;
257
+ detail: z.ZodNullable<z.ZodString>;
258
+ createdAt: z.ZodISODateTime;
259
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
260
+ active: z.ZodBoolean;
261
+ }, z.core.$strip>>;
262
+ nextCursor: z.ZodNullable<z.ZodString>;
263
+ }, z.core.$strip>;
264
+ export type EmailSuppressionsResponse = z.output<typeof EmailSuppressionsResponse>;
265
+ /** `POST {base}/suppressions`. */
266
+ export declare const EmailSuppressResponse: z.ZodObject<{
267
+ suppression: z.ZodNullable<z.ZodObject<{
268
+ id: z.ZodNumber;
269
+ email: z.ZodString;
270
+ reason: z.ZodEnum<{
271
+ complaint: "complaint";
272
+ hard_bounce: "hard_bounce";
273
+ manual: "manual";
274
+ unsubscribe: "unsubscribe";
275
+ }>;
276
+ environment: z.ZodNullable<z.ZodString>;
277
+ jobId: z.ZodNullable<z.ZodString>;
278
+ detail: z.ZodNullable<z.ZodString>;
279
+ createdAt: z.ZodISODateTime;
280
+ expiresAt: z.ZodNullable<z.ZodISODateTime>;
281
+ active: z.ZodBoolean;
282
+ }, z.core.$strip>>;
283
+ }, z.core.$strip>;
284
+ export type EmailSuppressResponse = z.output<typeof EmailSuppressResponse>;
285
+ /**
286
+ * `POST {base}/suppressions/remove`.
287
+ *
288
+ * The address is echoed because the caller sent it, normalized so the client learns which row was
289
+ * addressed rather than guessing at the lowercasing. Nothing about the block that was lifted appears:
290
+ * that is in the audit trail, where reading it needs its own grant.
291
+ */
292
+ export declare const EmailUnsuppressResponse: z.ZodObject<{
293
+ email: z.ZodString;
294
+ removed: z.ZodBoolean;
295
+ }, z.core.$strip>;
296
+ export type EmailUnsuppressResponse = z.output<typeof EmailUnsuppressResponse>;
297
+ //# sourceMappingURL=responses.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/http/responses.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAgCxB,2EAA2E;AAC3E,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAuCkF,CAAC;AAChH,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE;;;;;;;;;GASG;AACH,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAiB6E,CAAC;AACzG,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,cAAc,CAAC,CAAC;AAE7D,8DAA8D;AAC9D,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;iBAmB6D,CAAC;AAC/F,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEzE,yBAAyB;AACzB,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAKQ,CAAC;AACvC,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAEnE,6BAA6B;AAC7B,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAEQ,CAAC;AACtC,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEjE,oCAAoC;AACpC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBASkC,CAAC;AACrE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E,iCAAiC;AACjC,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;iBAKQ,CAAC;AAC/C,MAAM,MAAM,yBAAyB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,yBAAyB,CAAC,CAAC;AAEnF,kCAAkC;AAClC,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;iBAM8B,CAAC;AACjE,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAE3E;;;;;;GAMG;AACH,eAAO,MAAM,uBAAuB;;;iBAKkD,CAAC;AACvF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC,OAAO,uBAAuB,CAAC,CAAC"}