@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/CHANGELOG.md ADDED
@@ -0,0 +1,116 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here. The format is based on
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.1] - Unreleased
8
+
9
+ ### Added
10
+
11
+ - The npm package now ships `docs/*.md`, `CHANGELOG.md` and `llms.txt`, so
12
+ coding agents can read docs that match the installed version from
13
+ `node_modules/@vllnt/convex-suppression/`. `llms.txt` links to bundled files
14
+ with `./` paths. A test fails when a required file is missing from the
15
+ tarball.
16
+
17
+ ### Changed
18
+
19
+ - Removed the `by_hash` index; it was unused and a prefix of `by_hash_channel`.
20
+ One less index entry written per suppression and less index storage. No
21
+ migration is needed; the next deploy drops the index.
22
+ - Release automation: pinned actions, least-privilege permissions, npm trusted
23
+ publishing with provenance; `@latest` is published only from a `vX.Y.Z` tag on
24
+ `main`.
25
+ - Every push to `main` that touches the package or its shipped docs publishes a
26
+ `@canary` build; the opt-in repository-variable gate is removed.
27
+ - The README install command now installs the stable release.
28
+
29
+ ### Fixed
30
+
31
+ - `suppress` and `recordOptIn` now throw
32
+ `ConvexError({ code: "INVALID_ARGUMENT", field })` for an empty `contactHash`,
33
+ `channel`, `listKey` or `source`. `isEligible` previously answered `true` for
34
+ an empty `contactHash` or `channel`; it now answers `false`, so the send gate
35
+ fails closed. Documented that keys are matched exactly (no case, whitespace or
36
+ plus-address normalization; the host normalizes). **Upgrade note:** a
37
+ `suppress` or `recordOptIn` call that passed an empty string for one of these
38
+ fields succeeded in 0.1.0 and now throws; check for empty values before
39
+ calling. Omitting `channel` or `listKey` (global entry) is unaffected.
40
+ - The `./test` entry now type-checks for consumers using
41
+ `moduleResolution: nodenext` (relative imports use `.js`; Vite client types
42
+ are referenced). The README documents the `convex-test` and `vitest`
43
+ requirement.
44
+ - `register(t)` from `./test` now accepts the host app's
45
+ `convexTest(hostSchema)`; it was typed against the component's own schema, so
46
+ any host schema with its own tables failed with TS2345. Types only; no runtime
47
+ change.
48
+ - The `proofValidator` example in the `Suppression` JSDoc passed
49
+ `v.object(...).parse`, which Convex validators do not have; it now shows a
50
+ host parser `(unknown) => TProof`.
51
+
52
+ ### Documentation
53
+
54
+ - README rewritten in the shared @vllnt layout: For coding agents, When to use,
55
+ Install, Quick start, API (one row per export), Common tasks, Errors and
56
+ fixes, Limits and gotchas, Compatibility, Testing, Security, Related
57
+ packages, Contributing, Links, License and the vllnt footer. Badges moved to
58
+ the end.
59
+ - `docs/API.md` checked against the code: one section per export and per
60
+ `Suppression` method, the tables and indexes, and newly documented behavior:
61
+ `"*"` as a `channel` or `listKey` targets the global entry, `reason:
62
+ "global"` does not make an entry global, recording an opt-in again without
63
+ `proof` removes the stored proof, the `proofValidator` return value is what
64
+ is stored, an empty `channel` in `isSuppressed` checks only the global
65
+ entry, and a `proofValidator` error from `recordOptIn` is a
66
+ synchronous throw, not a rejected promise.
67
+ - `llms.txt` now has the package summary, When to use, a link to the errors
68
+ table and the shared Ecosystem block.
69
+ - New `package.json` description and keywords, shared by the README and
70
+ `llms.txt`.
71
+ - TSDoc summaries on every public export, and
72
+ `@see https://oss.vllnt.com/packages/convex-suppression` on `Suppression`.
73
+ Comment-only: `dist` changes only in comments and source maps.
74
+ - `pnpm test:package` now runs a docs contract test
75
+ (`scripts/check-documentation.mjs`) on the installed tarball, and type-checks
76
+ every README and `docs/API.md` TypeScript example against it; the README test
77
+ example runs under Vitest.
78
+
79
+ ## [0.1.0] - 2026-09-01
80
+
81
+ ### Added
82
+
83
+ - First release of `@vllnt/convex-suppression` — the hash-keyed do-not-contact
84
+ suppression list + opt-in proof (GDPR opt-out / CAN-SPAM).
85
+ - `suppress(contactHash, reason, { channel? })` adds a `(contactHash, channel)`
86
+ anti-membership tombstone; `reason` is `unsubscribe`/`bounce`/`complaint`/
87
+ `manual`/`global`. Omitting `channel` marks a global all-channel suppression.
88
+ - `unsuppress(contactHash, channel?)` removes an entry (a rare, audited
89
+ re-subscribe); returns whether an entry was removed.
90
+ - `isSuppressed(contactHash, channel?)` returns the matching suppression (a
91
+ global tombstone matches every channel and wins) or `null`.
92
+ - `recordOptIn(contactHash, { listKey?, source, proof? })` records an opt-in
93
+ proof; `getOptInProof(contactHash, listKey?)` fetches it.
94
+ - `isEligible(contactHash, { channel?, listKey?, requireOptIn? })` — the single
95
+ send gate: `¬suppressed [∧ confirmed]`. Suppression always blocks; the opt-in
96
+ requirement is per call.
97
+ - Hash-keyed: the component stores only the host's opaque `contactHash`, never
98
+ raw PII, so a suppression survives erasure of the subject.
99
+ - Idempotent writes: re-suppressing or re-recording an opt-in on its key tuple
100
+ updates in place — a replayed bounce/complaint/confirmation webhook never
101
+ duplicates a row.
102
+ - Typed generics: `Suppression<TProof>` with an optional `proofValidator` host
103
+ parser narrowing the opaque stored opt-in `proof` at the client boundary on
104
+ write and read — no `v.any()` dump, no unchecked cast.
105
+ - Server-sourced time: every handler stamps `createdAt`/`confirmedAt` from
106
+ `Date.now()` inside the mutation — no caller-supplied clock.
107
+ - Mount-safe: correct under multiple `app.use(component, { name })` mounts —
108
+ each instance is a sandboxed, independent do-not-contact list.
109
+
110
+ ### Changed
111
+
112
+ - Treat Convex `_generated` output as CLI-owned, exclude it from formatting, and
113
+ expose a dedicated codegen script.
114
+ - Refresh all direct dependencies to their latest compatible releases for canary
115
+ validation.
116
+ - Require `convex@^1.45.0` and update `convex-test` to `^0.0.56`.