@pithy-sh/email 0.1.2 → 0.1.3

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