@vllnt/convex-suppression 0.1.0 → 0.1.1-canary.14d41a6

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 (43) hide show
  1. package/CHANGELOG.md +116 -0
  2. package/README.md +433 -81
  3. package/dist/client/index.d.ts +18 -9
  4. package/dist/client/index.d.ts.map +1 -1
  5. package/dist/client/index.js +18 -9
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/client/types.d.ts +4 -3
  8. package/dist/client/types.d.ts.map +1 -1
  9. package/dist/component/convex.config.d.ts +1 -0
  10. package/dist/component/convex.config.d.ts.map +1 -1
  11. package/dist/component/convex.config.js +1 -0
  12. package/dist/component/convex.config.js.map +1 -1
  13. package/dist/component/mutations.d.ts +4 -2
  14. package/dist/component/mutations.d.ts.map +1 -1
  15. package/dist/component/mutations.js +15 -5
  16. package/dist/component/mutations.js.map +1 -1
  17. package/dist/component/queries.d.ts +2 -1
  18. package/dist/component/queries.d.ts.map +1 -1
  19. package/dist/component/queries.js +11 -4
  20. package/dist/component/queries.js.map +1 -1
  21. package/dist/component/schema.d.ts +1 -2
  22. package/dist/component/schema.js +2 -3
  23. package/dist/component/schema.js.map +1 -1
  24. package/dist/component/validators.d.ts +7 -0
  25. package/dist/component/validators.d.ts.map +1 -1
  26. package/dist/component/validators.js +12 -1
  27. package/dist/component/validators.js.map +1 -1
  28. package/dist/shared.d.ts +1 -0
  29. package/dist/shared.d.ts.map +1 -1
  30. package/dist/shared.js +1 -0
  31. package/dist/shared.js.map +1 -1
  32. package/docs/API.md +293 -0
  33. package/llms.txt +87 -0
  34. package/package.json +43 -24
  35. package/src/client/index.ts +18 -9
  36. package/src/client/types.ts +4 -3
  37. package/src/component/convex.config.ts +1 -0
  38. package/src/component/mutations.ts +15 -5
  39. package/src/component/queries.ts +12 -5
  40. package/src/component/schema.ts +2 -3
  41. package/src/component/validators.ts +13 -1
  42. package/src/shared.ts +1 -0
  43. package/src/test.ts +7 -3
package/README.md CHANGED
@@ -1,50 +1,42 @@
1
- <!-- Badges -->
2
- [![convex-component](https://img.shields.io/badge/convex-component-EE342F.svg)](https://www.convex.dev/components)
3
- [![npm](https://img.shields.io/npm/v/@vllnt/convex-suppression.svg)](https://www.npmjs.com/package/@vllnt/convex-suppression)
4
- [![CI](https://github.com/vllnt/convex-suppression/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-suppression/actions/workflows/ci.yml)
5
- [![license](https://img.shields.io/npm/l/@vllnt/convex-suppression.svg)](./LICENSE)
6
-
7
1
  # @vllnt/convex-suppression
8
2
 
9
- The do-not-contact suppression list + opt-in proof, as a Convex component.
3
+ TypeScript Convex component for a do-not-contact suppression list (GDPR, CAN-SPAM): unsubscribes, bounces and complaints by contact hash, plus opt-in proof.
10
4
 
11
- ```ts
12
- const dnc = new Suppression(components.suppression);
13
- await dnc.suppress(ctx, contactHash, "complaint", { channel: "email" });
14
- const canSend = await dnc.isEligible(ctx, contactHash, { channel: "email" });
15
- ```
5
+ ## For coding agents
16
6
 
17
- The GDPR opt-out / CAN-SPAM primitive: a global do-not-contact list keyed by an
18
- opaque **`contactHash`** (never raw PII, so it survives erasure) plus an opt-in
19
- proof ledger. Before every send the host asks `isEligible`; an unsubscribe / bounce
20
- / complaint calls `suppress`; a double-opt-in confirmation calls `recordOptIn`.
21
- Domain-neutral — channels and reasons are the host's.
7
+ Docs for the installed version are in `node_modules/@vllnt/convex-suppression/`:
8
+ `docs/API.md`, `llms.txt`, `CHANGELOG.md` and the TypeScript `src/`. Read them
9
+ before writing code against this package.
22
10
 
23
- ## Features
11
+ ## When to use
24
12
 
25
- - **Hash-keyed, erasure-surviving** — stores only the opaque `contactHash`, never raw PII, so a tombstone outlives erasure of the subject.
26
- - **Channel-aware** — scope a suppression to one channel (`"email"`/`"sms"`/`"push"`), or omit `channel` for a global all-channel tombstone.
27
- - **One send gate** — `isEligible` answers `¬suppressed [∧ confirmed]` in one call; suppression always blocks, opt-in is per call.
28
- - **Opt-in proof ledger** — `recordOptIn` / `getOptInProof` store legal proof-of-consent per list, kept separate from any authz store.
29
- - **Idempotent** — re-suppressing / re-recording on its key tuple updates in place, so a replayed webhook never duplicates a row.
30
- - **Typed, opaque proof** — `Suppression<TProof>` with an optional `proofValidator` narrows the stored evidence at the boundary.
31
- - **Server-sourced time** — `createdAt`/`confirmedAt` are stamped from the server clock; a caller can never supply a timestamp.
32
- - **Mount-safe** — correct under multiple named `app.use` mounts (e.g. marketing vs. transactional lists), each an isolated sandbox.
13
+ - Use it when every email, SMS or push send must first check that the contact
14
+ did not unsubscribe, bounce or complain.
15
+ - Use it when the do-not-contact entry must outlive erasure of the person's
16
+ data: the component stores only a hash you compute.
17
+ - Use it when a marketing send must also find a recorded opt-in proof for the
18
+ list.
19
+ - Do not use it when you need consent to processing per purpose, with withdrawal
20
+ and full history: use
21
+ [`@vllnt/convex-consent`](https://oss.vllnt.com/packages/convex-consent).
22
+ - Do not use it when you need to know who is on a subscriber list: use
23
+ [`@vllnt/convex-memberships`](https://oss.vllnt.com/packages/convex-memberships).
24
+ - Do not use it when you need to queue and send the email: use
25
+ [`@vllnt/convex-email`](https://oss.vllnt.com/packages/convex-email), and call
26
+ `isEligible` here first.
33
27
 
34
- ## Installation
28
+ ## Install
35
29
 
36
30
  ```bash
37
31
  pnpm add @vllnt/convex-suppression
38
32
  ```
39
33
 
40
- Peer dependency: `convex@^1.41.0`.
41
-
42
- ## Usage
34
+ ## Quick start
43
35
 
44
36
  ```ts
45
37
  // convex/convex.config.ts
46
- import { defineApp } from "convex/server";
47
38
  import suppression from "@vllnt/convex-suppression/convex.config";
39
+ import { defineApp } from "convex/server";
48
40
 
49
41
  const app = defineApp();
50
42
  app.use(suppression);
@@ -52,87 +44,447 @@ export default app;
52
44
  ```
53
45
 
54
46
  ```ts
55
- // convex/email.ts — host owns auth + hashing; pass an opaque contactHash in.
47
+ // convex/email.ts
48
+ import { Suppression } from "@vllnt/convex-suppression";
49
+ import { v } from "convex/values";
50
+
56
51
  import { components } from "./_generated/api";
57
- import { mutation, query } from "./_generated/server";
52
+ import { internalMutation, internalQuery } from "./_generated/server";
53
+
54
+ const dnc = new Suppression(components.suppression);
55
+
56
+ // The send gate: call it before every newsletter email.
57
+ export const canEmail = internalQuery({
58
+ args: { contactHash: v.string() },
59
+ returns: v.boolean(),
60
+ handler: (ctx, { contactHash }) =>
61
+ dnc.isEligible(ctx, contactHash, {
62
+ channel: "email",
63
+ listKey: "newsletter",
64
+ requireOptIn: true,
65
+ }),
66
+ });
67
+
68
+ // Your provider's complaint webhook, after you verify it.
69
+ export const onComplaint = internalMutation({
70
+ args: { contactHash: v.string() },
71
+ returns: v.null(),
72
+ handler: (ctx, { contactHash }) =>
73
+ dnc.suppress(ctx, contactHash, "complaint", { channel: "email" }),
74
+ });
75
+
76
+ // Your double opt-in confirmation link, after you check its token.
77
+ export const confirmOptIn = internalMutation({
78
+ args: { contactHash: v.string() },
79
+ returns: v.null(),
80
+ handler: (ctx, { contactHash }) =>
81
+ dnc.recordOptIn(ctx, contactHash, {
82
+ listKey: "newsletter",
83
+ source: "double-opt-in",
84
+ }),
85
+ });
86
+ ```
87
+
88
+ Run `npx convex dev` once to generate `components.suppression`. The component
89
+ never reads auth and never sees a raw email or phone number: your code
90
+ normalizes and hashes the contact (see [Common tasks](#common-tasks)), checks
91
+ who may call, and passes the opaque `contactHash`.
92
+
93
+ ## API
94
+
95
+ Full reference: [docs/API.md](docs/API.md).
96
+
97
+ | Export | Import from | What it does |
98
+ | ------------------------------------------------------------------------ | ------------------------------------------------ | ----------------------------------------------------------------------------------- |
99
+ | [`Suppression`](docs/API.md#suppression) | `@vllnt/convex-suppression` | Host client: `new Suppression<TProof>(components.suppression, { proofValidator? })` |
100
+ | [`suppress(ctx, contactHash, reason, opts?)`](docs/API.md#suppress) | `Suppression` method, mutation | Add `(contactHash, channel)` to the list; returns `null` |
101
+ | [`unsuppress(ctx, contactHash, channel?)`](docs/API.md#unsuppress) | `Suppression` method, mutation | Remove that exact entry; returns `true` if one was removed |
102
+ | [`isSuppressed(ctx, contactHash, channel?)`](docs/API.md#issuppressed) | `Suppression` method, query | The matching entry (global first) or `null` |
103
+ | [`recordOptIn(ctx, contactHash, opts)`](docs/API.md#recordoptin) | `Suppression` method, mutation | Store the latest opt-in proof for `(contactHash, listKey)`; returns `null` |
104
+ | [`getOptInProof(ctx, contactHash, listKey?)`](docs/API.md#getoptinproof) | `Suppression` method, query | The stored opt-in proof or `null` |
105
+ | [`isEligible(ctx, contactHash, opts?)`](docs/API.md#iseligible) | `Suppression` method, query | Send gate: not suppressed, and opted in when `requireOptIn`; returns `boolean` |
106
+ | [`SuppressionComponent`](docs/API.md#suppressioncomponent) | `@vllnt/convex-suppression` (type) | Type of `components.suppression` the client accepts |
107
+ | [`SuppressionOptions`](docs/API.md#suppressionoptions) | `@vllnt/convex-suppression` (type) | `{ proofValidator? }` |
108
+ | [`SuppressOptions`](docs/API.md#suppressoptions) | `@vllnt/convex-suppression` (type) | `{ channel? }` |
109
+ | [`RecordOptInOptions`](docs/API.md#recordoptinoptions) | `@vllnt/convex-suppression` (type) | `{ listKey?, source, proof? }` |
110
+ | [`IsEligibleOptions`](docs/API.md#iseligibleoptions) | `@vllnt/convex-suppression` (type) | `{ channel?, listKey?, requireOptIn? }` |
111
+ | [`SuppressionView`](docs/API.md#suppressionview) | `@vllnt/convex-suppression` (type) | Result of `isSuppressed` |
112
+ | [`OptInProofView`](docs/API.md#optinproofview) | `@vllnt/convex-suppression` (type) | Result of `getOptInProof` |
113
+ | [`SuppressionReason`](docs/API.md#suppressionreason) | `@vllnt/convex-suppression` (type) | `"unsubscribe" \| "bounce" \| "complaint" \| "manual" \| "global"` |
114
+ | [`Parser`](docs/API.md#parser) | `@vllnt/convex-suppression` (type) | `(value: unknown) => T`, the `proofValidator` shape |
115
+ | [`default` (component config)](docs/API.md#convexconfig) | `@vllnt/convex-suppression/convex.config` | Pass to `app.use(...)` |
116
+ | [`register`](docs/API.md#register) | `@vllnt/convex-suppression/test` | Mount the component in `convex-test` |
117
+ | [`ComponentApi`](docs/API.md#componentapi) | `@vllnt/convex-suppression/_generated/component` | Generated type of the mounted component |
118
+
119
+ `GLOBAL_CHANNEL` (`"*"`) and the other constants in `src/shared.ts` are internal
120
+ and not importable.
121
+
122
+ ## Common tasks
123
+
124
+ Gate a transactional email (no opt-in needed) and a marketing email (opt-in
125
+ needed) for the same contact. Always pass the channel you send on:
126
+
127
+ ```ts
128
+ // convex/gates.ts
129
+ import { Suppression } from "@vllnt/convex-suppression";
58
130
  import { v } from "convex/values";
131
+
132
+ import { components } from "./_generated/api";
133
+ import { internalQuery } from "./_generated/server";
134
+
135
+ const dnc = new Suppression(components.suppression);
136
+
137
+ export const canSendReceipt = internalQuery({
138
+ args: { contactHash: v.string() },
139
+ returns: v.boolean(),
140
+ handler: (ctx, { contactHash }) =>
141
+ dnc.isEligible(ctx, contactHash, { channel: "email" }),
142
+ });
143
+
144
+ export const canSendPromo = internalQuery({
145
+ args: { contactHash: v.string() },
146
+ returns: v.boolean(),
147
+ handler: (ctx, { contactHash }) =>
148
+ dnc.isEligible(ctx, contactHash, {
149
+ channel: "email",
150
+ listKey: "promotions",
151
+ requireOptIn: true,
152
+ }),
153
+ });
154
+ ```
155
+
156
+ Suppress one channel, or every channel, and undo it later. A global entry is the
157
+ one with no channel; `unsuppress` removes only the exact entry you name:
158
+
159
+ ```ts
160
+ // convex/lists.ts
161
+ import { Suppression } from "@vllnt/convex-suppression";
162
+ import { v } from "convex/values";
163
+
164
+ import { components } from "./_generated/api";
165
+ import { internalMutation } from "./_generated/server";
166
+
167
+ const dnc = new Suppression(components.suppression);
168
+
169
+ export const onBounce = internalMutation({
170
+ args: { contactHash: v.string() },
171
+ returns: v.null(),
172
+ handler: (ctx, { contactHash }) =>
173
+ dnc.suppress(ctx, contactHash, "bounce", { channel: "email" }),
174
+ });
175
+
176
+ export const blockEverywhere = internalMutation({
177
+ args: { contactHash: v.string() },
178
+ returns: v.null(),
179
+ handler: (ctx, { contactHash }) => dnc.suppress(ctx, contactHash, "manual"),
180
+ });
181
+
182
+ export const resubscribeEmail = internalMutation({
183
+ args: { contactHash: v.string() },
184
+ returns: v.boolean(),
185
+ handler: async (ctx, { contactHash }) => {
186
+ const removedEmail = await dnc.unsuppress(ctx, contactHash, "email");
187
+ const removedGlobal = await dnc.unsuppress(ctx, contactHash);
188
+ return removedEmail || removedGlobal;
189
+ },
190
+ });
191
+ ```
192
+
193
+ Store typed opt-in evidence. `proofValidator` checks `proof` before it is stored
194
+ and again when `getOptInProof` reads it; it must return the value or throw:
195
+
196
+ ```ts
197
+ // convex/optIn.ts
59
198
  import { Suppression } from "@vllnt/convex-suppression";
199
+ import { v } from "convex/values";
60
200
 
61
- const dnc = new Suppression<{ ip: string }>(components.suppression, {
62
- proofValidator: v.object({ ip: v.string() }).parse,
201
+ import { components } from "./_generated/api";
202
+ import { internalMutation, internalQuery } from "./_generated/server";
203
+
204
+ type Evidence = { ip: string };
205
+
206
+ const dnc = new Suppression<Evidence>(components.suppression, {
207
+ proofValidator: (value) => {
208
+ if (
209
+ typeof value !== "object" ||
210
+ value === null ||
211
+ !("ip" in value) ||
212
+ typeof value.ip !== "string"
213
+ ) {
214
+ throw new Error("Expected { ip: string }");
215
+ }
216
+ return { ip: value.ip };
217
+ },
63
218
  });
64
- const hash = (email: string) => myHash(email.trim().toLowerCase()); // host's hashing + salt policy
65
219
 
66
- // The send gate — call before every send.
67
- export const canEmail = query({
68
- args: { email: v.string() },
69
- handler: (ctx, { email }) =>
70
- dnc.isEligible(ctx, hash(email), { channel: "email", listKey: "newsletter", requireOptIn: true }),
220
+ export const confirm = internalMutation({
221
+ args: { contactHash: v.string(), ip: v.string() },
222
+ returns: v.null(),
223
+ handler: (ctx, { contactHash, ip }) =>
224
+ dnc.recordOptIn(ctx, contactHash, {
225
+ listKey: "newsletter",
226
+ source: "double-opt-in",
227
+ proof: { ip },
228
+ }),
71
229
  });
72
230
 
73
- // A provider webhook suppresses on complaint; a confirmed double opt-in records proof.
74
- export const onComplaint = mutation({
75
- args: { email: v.string() },
76
- handler: (ctx, { email }) => dnc.suppress(ctx, hash(email), "complaint", { channel: "email" }),
231
+ export const evidence = internalQuery({
232
+ args: { contactHash: v.string() },
233
+ returns: v.union(v.null(), v.string()),
234
+ handler: async (ctx, { contactHash }) => {
235
+ const proof = await dnc.getOptInProof(ctx, contactHash, "newsletter");
236
+ return proof?.proof?.ip ?? null;
237
+ },
77
238
  });
78
- export const confirmOptIn = mutation({
79
- args: { email: v.string(), ip: v.string() },
80
- handler: (ctx, { email, ip }) =>
81
- dnc.recordOptIn(ctx, hash(email), { listKey: "newsletter", source: "double-opt-in", proof: { ip } }),
239
+ ```
240
+
241
+ Read why and when a contact was suppressed, for an audit or support screen:
242
+
243
+ ```ts
244
+ // convex/audit.ts
245
+ import { Suppression } from "@vllnt/convex-suppression";
246
+ import { v } from "convex/values";
247
+
248
+ import { components } from "./_generated/api";
249
+ import { internalQuery } from "./_generated/server";
250
+
251
+ const dnc = new Suppression(components.suppression);
252
+
253
+ export const why = internalQuery({
254
+ args: { contactHash: v.string(), channel: v.string() },
255
+ returns: v.union(
256
+ v.null(),
257
+ v.object({ reason: v.string(), since: v.number() }),
258
+ ),
259
+ handler: async (ctx, { contactHash, channel }) => {
260
+ const entry = await dnc.isSuppressed(ctx, contactHash, channel);
261
+ return entry === null
262
+ ? null
263
+ : { reason: entry.reason, since: entry.createdAt };
264
+ },
82
265
  });
83
266
  ```
84
267
 
85
- Client options: `new Suppression(component, { proofValidator? })`. Omitting `channel`/`listKey` targets the global entry.
268
+ Keep separate lists, for example marketing and transactional. Each named mount
269
+ has its own tables:
86
270
 
87
- ## API Reference
271
+ ```ts
272
+ // convex/convex.config.ts
273
+ import suppression from "@vllnt/convex-suppression/convex.config";
274
+ import { defineApp } from "convex/server";
88
275
 
89
- | Method | Kind | Result |
90
- |--------|------|--------|
91
- | `suppress(ctx, contactHash, reason, opts?)` | mutation | `null` (`reason`: `"unsubscribe" \| "bounce" \| "complaint" \| "manual" \| "global"`; `opts`: `{ channel? }`) |
92
- | `unsuppress(ctx, contactHash, channel?)` | mutation | `boolean` (`true` if an entry was removed) |
93
- | `recordOptIn(ctx, contactHash, opts)` | mutation | `null` (`opts`: `{ listKey?; source; proof? }`) |
94
- | `isSuppressed(ctx, contactHash, channel?)` | query | `SuppressionView \| null` |
95
- | `getOptInProof(ctx, contactHash, listKey?)` | query | `OptInProofView \| null` |
96
- | `isEligible(ctx, contactHash, opts?)` | query | `boolean` (`opts`: `{ channel?; listKey?; requireOptIn? }`) |
276
+ const app = defineApp();
277
+ app.use(suppression, { name: "marketingDnc" });
278
+ app.use(suppression, { name: "transactionalDnc" });
279
+ export default app;
280
+ ```
97
281
 
98
- Full reference: [docs/API.md](docs/API.md).
282
+ ```ts
283
+ // convex/clients.ts
284
+ import { Suppression } from "@vllnt/convex-suppression";
99
285
 
100
- ## React
286
+ import { components } from "./_generated/api";
101
287
 
102
- Backend-only — no `./react` entry. The consumer surface is a server-side
103
- `isEligible` gate and webhook-driven `suppress` writes; a reactive do-not-contact
104
- badge, if ever needed, is an ordinary `useQuery` over the host's re-exported
105
- `isSuppressed` ref.
288
+ export const marketing = new Suppression(components.marketingDnc);
289
+ export const transactional = new Suppression(components.transactionalDnc);
290
+ ```
106
291
 
107
- ## Security
292
+ Hash a contact before you call the component. The package does not do this for
293
+ you. A keyed hash (HMAC) stops anyone who reads the table from hashing guessed
294
+ emails to find a match. Keep the secret on the server, for example in a Convex
295
+ environment variable:
108
296
 
109
- - **Auth-agnostic** — the host authenticates the caller, decides who may suppress/query a hash, and passes an opaque `contactHash`; tables are sandboxed.
110
- - **Hash-keyed, never raw PII** — the host hashes and normalizes the contact and owns the salt policy; a suppression survives erasure of the subject.
111
- - **Server-sourced time** — `createdAt`/`confirmedAt` come from `Date.now()` in each handler, never the caller; the opt-in `proof` is opaque, narrowed by the host validator.
297
+ ```ts
298
+ // convex/contactHash.ts
299
+ /** HMAC-SHA-256 of the trimmed, lowercased email, as hex. */
300
+ export async function contactHash(
301
+ email: string,
302
+ secret: string,
303
+ ): Promise<string> {
304
+ const encoder = new TextEncoder();
305
+ const key = await crypto.subtle.importKey(
306
+ "raw",
307
+ encoder.encode(secret),
308
+ { name: "HMAC", hash: "SHA-256" },
309
+ false,
310
+ ["sign"],
311
+ );
312
+ const signature = await crypto.subtle.sign(
313
+ "HMAC",
314
+ key,
315
+ encoder.encode(email.trim().toLowerCase()),
316
+ );
317
+ return Array.from(new Uint8Array(signature), (byte) =>
318
+ byte.toString(16).padStart(2, "0"),
319
+ ).join("");
320
+ }
321
+ ```
112
322
 
113
- See [docs/API.md](docs/API.md).
323
+ ## Errors and fixes
324
+
325
+ The component throws one coded error: a `ConvexError` whose `data` is
326
+ `{ code, field }`. Catch it in the host with `error instanceof ConvexError` and
327
+ read `error.data.code` and `error.data.field`.
328
+
329
+ | Code or message | Thrown by | Cause | Fix |
330
+ | -------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------- |
331
+ | `INVALID_ARGUMENT` | `suppress`, `recordOptIn` | `field` names the empty string: `contactHash` or `channel` (`suppress`); `contactHash`, `listKey` or `source` (`recordOptIn`) | Check the value before calling. Omit `channel` or `listKey` for the global entry instead of passing `""` |
332
+ | Convex argument validation error | any method | An argument has the wrong type, or `reason` is not one of the five `SuppressionReason` values | Pass a `SuppressionReason`; TypeScript catches this at compile time |
333
+ | The error your `proofValidator` throws | `recordOptIn` (before the write), `getOptInProof` (on read) | Your parser rejected `proof`. From `recordOptIn` it is a synchronous throw, not a rejected promise: a try/catch around the call catches it (with or without `await`), and a `.catch()` on the returned promise never runs | Fix the proof, or let the parser accept every shape you have stored before |
334
+
335
+ These never throw `INVALID_ARGUMENT`: `isEligible` returns `false` for an empty
336
+ `contactHash` or `channel`. `isSuppressed` returns `null` for an empty
337
+ `contactHash`; with an empty `channel` it checks only the global entry (it
338
+ returns that entry if one exists, otherwise `null`). `getOptInProof` returns
339
+ `null` for an empty key and `unsuppress` returns `false`. A missing entry is
340
+ `null` or `false`, never an error, and a repeated write updates in place.
341
+
342
+ ## Limits and gotchas
343
+
344
+ - Omitting `channel` in `isEligible` or `isSuppressed` checks only the global
345
+ entry, not the channel entries. Always pass the channel you send on.
346
+ - A channel check also matches the global entry, and the global entry wins:
347
+ `isSuppressed` returns it first.
348
+ - Omitting `channel` (or passing `"*"`) makes an entry global; `reason:
349
+ "global"` with another channel still blocks only that channel. `reason` never
350
+ changes the effect.
351
+ - `"*"` is the stored value for "global". Passing `"*"` as a `channel` or
352
+ `listKey` targets the global entry.
353
+ - `isEligible` checks opt-in only when `requireOptIn: true`; the default is
354
+ `false`, and `listKey` is ignored without it.
355
+ - Opt-in `listKey` is matched exactly. A global opt-in (no `listKey`) does not
356
+ satisfy a check for a named list.
357
+ - `recordOptIn` does not remove any suppression. `unsuppress` removes one exact
358
+ entry: clearing the global entry leaves channel entries, and the reverse.
359
+ - One proof per `(contactHash, listKey)`, the latest. Recording again replaces
360
+ `source`, `proof` and `confirmedAt`; recording again without `proof` removes
361
+ the stored proof. There is no history.
362
+ - `proofValidator` runs only when `proof` is set, and its return value is what
363
+ gets stored. `isEligible` does not run it.
364
+ - Keys are matched exactly, with no trimming, case folding or plus-address
365
+ folding: `"Email"` is not `"email"`. Normalize contacts, channels and list
366
+ keys the same way everywhere.
367
+ - Changing your normalization or hash secret changes every hash, so old entries
368
+ stop matching. Keep the old secret, or re-suppress under the new hashes.
369
+ - An empty `contactHash` or `channel` makes `isEligible` return `false`. For
370
+ `isSuppressed`, an empty `contactHash` returns `null` (not suppressed), and an
371
+ empty `channel` checks only the global entry. Use `isEligible` as the gate.
372
+ - No expiry, TTL or cron. Entries stay until `unsuppress`; proofs stay until
373
+ replaced. There is no method to list entries, export them or delete a proof.
374
+ - `proof` is stored as any Convex value (no functions or class instances) and
375
+ counts toward Convex's 1 MiB document limit. Hashes and proof can still be
376
+ personal data; store only what you need.
377
+ - Writes need a context with `runMutation` (a mutation or action); reads need
378
+ `runQuery` (a query, mutation or action).
379
+ - This package is not a legal-compliance guarantee. Your app owns the legal
380
+ basis, consent checks, retention and data minimization.
381
+
382
+ ## Compatibility
383
+
384
+ - Peer dependency: `convex@^1.45.0`. CI runs the tests and the packed-package
385
+ test on the locked convex version (1.51.0); 1.45.0 is not tested in CI.
386
+ - Node.js: `engines` says `>=18`, but convex needs Node.js 20 or later
387
+ (1.45–1.48) and Node.js 22 or later (1.49 and newer). ES modules only.
388
+ - The component runs in the default Convex runtime; it needs no `"use node"`.
389
+ - `@vllnt/convex-suppression/test` is TypeScript source and needs `convex-test`,
390
+ `vitest`, `vite` and `@edge-runtime/vm`, with the Vitest config shown under
391
+ Testing.
392
+ - React: not applicable. The package is backend-only and has no `./react` entry;
393
+ to show a status in the UI, call `isSuppressed` from your own query and read
394
+ it with `useQuery`.
114
395
 
115
396
  ## Testing
116
397
 
117
- ```bash
118
- pnpm test # single run
119
- pnpm test:coverage # enforced 100% on covered files
398
+ Mount the component in your own `convex-test` suite with `register`. Use the
399
+ Vitest settings `convex-test` recommends (edge runtime, `convex-test` inlined):
400
+
401
+ ```ts
402
+ // vitest.config.mts
403
+ import { defineConfig } from "vitest/config";
404
+
405
+ export default defineConfig({
406
+ test: {
407
+ environment: "edge-runtime",
408
+ server: { deps: { inline: ["convex-test"] } },
409
+ },
410
+ });
120
411
  ```
121
412
 
122
- Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
413
+ This test uses the Quick start functions and your app's `convex/schema.ts`; if
414
+ you have none, `export default defineSchema({})` from `convex/server` is enough:
123
415
 
124
- ## Contributing
416
+ ```ts
417
+ // convex/email.test.ts
418
+ /// <reference types="vite/client" />
419
+ import { register } from "@vllnt/convex-suppression/test";
420
+ import { convexTest } from "convex-test";
421
+ import { expect, test } from "vitest";
422
+
423
+ import { internal } from "./_generated/api";
424
+ import schema from "./schema";
425
+
426
+ test("a complaint blocks the newsletter", async () => {
427
+ const t = convexTest(schema, import.meta.glob("./**/*.ts"));
428
+ register(t);
429
+ const contactHash = "hash-of-a-test-contact";
430
+ const canEmail = () => t.query(internal.email.canEmail, { contactHash });
431
+
432
+ expect(await canEmail()).toBe(false);
433
+ await t.mutation(internal.email.confirmOptIn, { contactHash });
434
+ expect(await canEmail()).toBe(true);
435
+ await t.mutation(internal.email.onComplaint, { contactHash });
436
+ expect(await canEmail()).toBe(false);
437
+ });
438
+ ```
439
+
440
+ `register(t, name)` takes the mount name when you used
441
+ `app.use(suppression, { name })`; the default is `"suppression"`.
442
+
443
+ This repository's own tests run on the simulated `convex-test` runtime, not
444
+ mocks (`pnpm test:coverage`, 100% coverage enforced).
445
+
446
+ ## Security
447
+
448
+ - The component does not authenticate. Your app decides who may suppress,
449
+ unsuppress or read a hash. Keep these calls in internal functions, or check
450
+ auth before them; never take a `contactHash` from an unauthenticated client.
451
+ - Its tables are sandboxed: they are reachable only through the component's
452
+ functions, and the component reads no host table.
453
+ - Time is set by the server: `createdAt` and `confirmedAt` come from
454
+ `Date.now()` inside each handler; no method accepts a timestamp.
455
+ - Verify provider webhooks before calling `suppress`, and verify the opt-in
456
+ (token, checkbox) before calling `recordOptIn`.
125
457
 
126
- See [CONTRIBUTING.md](CONTRIBUTING.md).
458
+ Report vulnerabilities as described in
459
+ [SECURITY.md](https://github.com/vllnt/convex-suppression/blob/main/SECURITY.md).
127
460
 
128
- ## Author
461
+ ## Related packages
129
462
 
130
- Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
463
+ None. This package has no dependency, shared test or example with another
464
+ package. For packages that solve nearby problems, see
465
+ [When to use](#when-to-use).
131
466
 
132
- Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
467
+ ## Contributing
468
+
469
+ See
470
+ [CONTRIBUTING.md](https://github.com/vllnt/convex-suppression/blob/main/CONTRIBUTING.md).
471
+
472
+ ## Links
133
473
 
134
- If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
474
+ - Docs and changelog: [oss.vllnt.com/packages/convex-suppression](https://oss.vllnt.com/packages/convex-suppression) · [release feed](https://oss.vllnt.com/packages/convex-suppression/rss.xml)
475
+ - All @vllnt packages: [oss.vllnt.com](https://oss.vllnt.com) · [search packages and docs on index.vllnt.com](https://index.vllnt.com)
476
+ - Source and issues: [GitHub](https://github.com/vllnt/convex-suppression) · [issues](https://github.com/vllnt/convex-suppression/issues) · [npm](https://www.npmjs.com/package/@vllnt/convex-suppression)
477
+ - Questions and updates: [Discord](https://bntvllnt.com/discord) · [X @bntvllnt](https://x.com/bntvllnt)
478
+ - Company and author: [vllnt.com](https://vllnt.com) · [bntvllnt.com](https://bntvllnt.com) · [GitHub @bntvllnt](https://github.com/bntvllnt) · [LinkedIn](https://linkedin.com/in/bntvllnt)
479
+ - Sponsor: [GitHub Sponsors](https://github.com/sponsors/bntvllnt)
135
480
 
136
481
  ## License
137
482
 
138
- MIT — see [LICENSE](LICENSE).
483
+ MIT. See [LICENSE](LICENSE).
484
+
485
+ [![npm version of @vllnt/convex-suppression](https://img.shields.io/npm/v/@vllnt/convex-suppression.svg)](https://www.npmjs.com/package/@vllnt/convex-suppression)
486
+ [![CI status](https://github.com/vllnt/convex-suppression/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-suppression/actions/workflows/ci.yml)
487
+
488
+ ---
489
+
490
+ Part of [vllnt open source](https://oss.vllnt.com) · [Package page](https://oss.vllnt.com/packages/convex-suppression) · [vllnt.com](https://vllnt.com) · Built by [bntvllnt](https://bntvllnt.com)
@@ -67,27 +67,36 @@ interface RunMutationCtx {
67
67
  * bounce / complaint webhook calls `suppress`; a double-opt-in confirmation calls
68
68
  * `recordOptIn`. The host owns meaning and auth — it resolves identity, hashes the
69
69
  * contact, and decides the channel/list semantics. Pass `proofValidator` to narrow
70
- * the opaque opt-in evidence to `TProof` at the boundary — there is no unchecked
71
- * cast.
70
+ * the opaque opt-in evidence to `TProof` at the boundary; without it, `proof` is
71
+ * typed `TProof` but not checked.
72
72
  *
73
73
  * @typeParam TProof - The host's opt-in proof evidence type (defaults to `unknown`).
74
74
  *
75
75
  * @example
76
76
  * ```ts
77
- * const dnc = new Suppression(components.suppression, {
78
- * proofValidator: v.object({ ip: v.string() }).parse,
77
+ * const dnc = new Suppression<{ ip: string }>(components.suppression, {
78
+ * proofValidator: (value) => parseIpProof(value), // your parser: (unknown) => { ip: string }
79
79
  * });
80
- * // a webhook suppresses on complaint:
80
+ * // a verified complaint webhook suppresses the email channel:
81
81
  * await dnc.suppress(ctx, contactHash, "complaint", { channel: "email" });
82
- * // a sender gates a marketing send:
83
- * if (await dnc.isEligible(ctx, contactHash, { channel: "email", listKey: "news", requireOptIn: true })) {
84
- * // ...send
85
- * }
82
+ * // a marketing send checks the gate first:
83
+ * const mayEmail = await dnc.isEligible(ctx, contactHash, {
84
+ * channel: "email",
85
+ * listKey: "news",
86
+ * requireOptIn: true,
87
+ * });
86
88
  * ```
89
+ *
90
+ * @see https://oss.vllnt.com/packages/convex-suppression
87
91
  */
88
92
  export declare class Suppression<TProof = unknown> {
89
93
  private readonly component;
90
94
  private readonly proofValidator;
95
+ /**
96
+ * @param component - The mounted component, `components.suppression` (or the
97
+ * name given to `app.use`).
98
+ * @param options - Optional `proofValidator`; defaults to `{}`.
99
+ */
91
100
  constructor(component: SuppressionComponent, options?: SuppressionOptions<TProof>);
92
101
  /** Narrow an opaque value through a host parser; pass `undefined` and unset parsers through. */
93
102
  private parse;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,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WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAKjC;IAED;;;;;OAKG;IACH,WAAW,CACT,GAAG,EAAE,cAAc,EACnB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,kBAAkB,CAAC,MAAM,CAAC,GAC/B,OAAO,CAAC,IAAI,CAAC,CAOf;IAED;;;;OAIG;IACG,aAAa,CACjB,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,MAAM,GACf,OAAO,CAAC,cAAc,CAAC,MAAM,CAAC,GAAG,IAAI,CAAC,CAexC;IAED;;;;;OAKG;IACH,UAAU,CACR,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,GAAE,iBAAsB,GAC3B,OAAO,CAAC,OAAO,CAAC,CAOlB;CACF;AAED,YAAY,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,GAChB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,YAAY,EACZ,iBAAiB,EACjB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,iBAAiB,EACjB,cAAc,EACd,MAAM,EACN,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,eAAe,EAChB,MAAM,YAAY,CAAC;AAGpB;;;;GAIG;AACH,KAAK,YAAY,GAAG;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AAC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