@vllnt/convex-reactions 0.1.0 → 0.1.1-canary.47e5fd0

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 (40) hide show
  1. package/CHANGELOG.md +119 -0
  2. package/README.md +353 -70
  3. package/dist/client/index.d.ts +2 -0
  4. package/dist/client/index.d.ts.map +1 -1
  5. package/dist/client/index.js +2 -0
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/component/_generated/api.d.ts +2 -0
  8. package/dist/component/_generated/api.d.ts.map +1 -1
  9. package/dist/component/_generated/api.js.map +1 -1
  10. package/dist/component/convex.config.d.ts +5 -0
  11. package/dist/component/convex.config.d.ts.map +1 -1
  12. package/dist/component/convex.config.js +5 -0
  13. package/dist/component/convex.config.js.map +1 -1
  14. package/dist/component/mutations.d.ts +6 -1
  15. package/dist/component/mutations.d.ts.map +1 -1
  16. package/dist/component/mutations.js +33 -4
  17. package/dist/component/mutations.js.map +1 -1
  18. package/dist/component/queries.d.ts +2 -9
  19. package/dist/component/queries.d.ts.map +1 -1
  20. package/dist/component/queries.js +16 -20
  21. package/dist/component/queries.js.map +1 -1
  22. package/dist/component/schema.d.ts +11 -3
  23. package/dist/component/schema.d.ts.map +1 -1
  24. package/dist/component/schema.js +6 -4
  25. package/dist/component/schema.js.map +1 -1
  26. package/dist/component/tally.d.ts +4 -0
  27. package/dist/component/tally.d.ts.map +1 -0
  28. package/dist/component/tally.js +44 -0
  29. package/dist/component/tally.js.map +1 -0
  30. package/docs/API.md +202 -0
  31. package/llms.txt +49 -0
  32. package/package.json +46 -23
  33. package/src/client/index.ts +2 -0
  34. package/src/component/_generated/api.ts +2 -0
  35. package/src/component/convex.config.ts +5 -0
  36. package/src/component/mutations.ts +38 -4
  37. package/src/component/queries.ts +25 -23
  38. package/src/component/schema.ts +6 -4
  39. package/src/component/tally.ts +58 -0
  40. package/src/test.ts +13 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,119 @@
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
+ ### Upgrading
10
+
11
+ - Downgrading to 0.1.0 is not supported once 0.1.1 has written `reactionCounts`
12
+ tally rows: 0.1.0 writes edges without updating tallies, so upgrading again
13
+ would leave stale counts.
14
+ - Edges with an empty `authorRef`, `resourceRef`, or `kind` stored under 0.1.0
15
+ can no longer be removed through `react` or `unreact` (they now throw
16
+ `INVALID_REF` or `INVALID_KIND` first), and the host cannot write component
17
+ tables from code. To remove them, select the component in the Convex
18
+ dashboard's component dropdown, open its `reactions` table in the data view,
19
+ and delete the rows. A resource that holds one keeps counting from edges until
20
+ all its edges are removed.
21
+
22
+ ### Fixed
23
+
24
+ - `react` and `unreact` now throw `ConvexError` `INVALID_REF` for an empty
25
+ `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`, instead
26
+ of storing an edge no real subject, resource, or kind can address. Previously
27
+ accepted input that could never be valid.
28
+ - `@vllnt/convex-reactions/test` now type-checks for consumers using
29
+ `moduleResolution` `nodenext` as well as `bundler` (explicit `.js` relative
30
+ imports, Vite client types reference).
31
+ - `register(t)` from `@vllnt/convex-reactions/test` accepts a `convexTest`
32
+ instance built from the host app's own schema; it was typed for the
33
+ component's schema only, so a host schema with its own tables failed to
34
+ type-check (TS2345). No runtime change.
35
+
36
+ ### Changed
37
+
38
+ - `counts` reads one `reactionCounts` tally row per kind instead of every edge
39
+ on the resource: O(kinds) reads instead of O(edges). Tallies cover every
40
+ resource whose first reaction came after upgrade; a resource with earlier
41
+ edges keeps the edge scan (no migration, and writes never scan legacy edges).
42
+ A tally row is deleted when its count reaches zero.
43
+ - `myReactions` uses the `by_author_resource_kind` prefix; the redundant
44
+ `by_author_resource` index is removed (one less index write per
45
+ `react`/`unreact`).
46
+ - Development and test toolchain: pnpm 10 with a seven-day release-age gate,
47
+ `convex` 1.51, `convex-test` 0.0.73, Vitest 5.1.1, ESLint 10, and
48
+ `@vllnt/typescript` 3 (stricter type-check flags for this repo's own build;
49
+ emitted JavaScript and `.d.ts` files are identical to a build with the 2.0.0
50
+ flags). The `convex` peer range stays `^1.45.0`.
51
+ - Pin GitHub Actions to commit SHAs, scope workflow permissions, and publish
52
+ `@latest` only from a `vX.Y.Z` tag on `main` through npm trusted publishing
53
+ with provenance. CI now also type-checks the component and every test file and
54
+ checks formatting.
55
+ - `engines.node` raised from `>=18` to `>=20.0.0`, the floor the lowest
56
+ supported `convex` (1.45) declares.
57
+ - The seven-day release-age gate moved from the `package.json` `pnpm` field,
58
+ which pnpm 10 ignores, to `pnpm-workspace.yaml`, so installs (including the
59
+ package test's consumer) now enforce it; Renovate waits seven days too, except
60
+ for `@vllnt/*`.
61
+
62
+ ### Documentation
63
+
64
+ - README rewritten for coding agents with fixed sections: when to use (and when
65
+ not to), install, a complete quick start, an API table of every export, common
66
+ tasks, an errors-and-fixes table, limits and gotchas, and compatibility.
67
+ `docs/API.md` has one heading per export and method; `llms.txt` gains the same
68
+ summary, when-to-use list and an Ecosystem block. The `package.json`
69
+ description and keywords now name the problem and the stack. `pnpm lint` runs
70
+ `scripts/check-documentation.mjs`, and the new `pnpm test:package` installs
71
+ the packed tarball, imports its runtime entry points, type-checks all of them,
72
+ and type-checks every README and `docs/API.md` example against it on `convex`
73
+ 1.45.0. Behavior is unchanged.
74
+ - The npm package now ships `docs/API.md`, `CHANGELOG.md`, and `llms.txt` next
75
+ to `README.md`, so the docs under `node_modules/@vllnt/convex-reactions/`
76
+ match the installed version. `llms.txt` links shipped files relatively and
77
+ repository-only files by URL; `docs/API.md` lists every entry point and the
78
+ component's tables. `pnpm lint` fails when a required doc is missing from the
79
+ tarball, a contributor file, internal doc, or test ships, or an `llms.txt`
80
+ link points outside it.
81
+ - `reactors` docs no longer claim the 1000-row `maximumRowsRead` cap covers
82
+ reactive cursor ranges: with an `endCursor`, Convex returns the whole range
83
+ between the cursors and ignores `maximumRowsRead` (only its transaction read
84
+ limits apply), so the README states the limit as `numItems` 1 to 1000.
85
+ Behavior is unchanged.
86
+ - README `## Testing` section gains a self-contained `register` example; the
87
+ error table lists the new codes.
88
+ - The npm `homepage` now points to
89
+ <https://oss.vllnt.com/packages/convex-reactions>.
90
+
91
+ ## [0.1.0] - 2026-09-01
92
+
93
+ ### Added
94
+
95
+ - First release of `@vllnt/convex-reactions` — reactions, votes, and likes on
96
+ any resource, modeled as the opaque edge `(authorRef, resourceRef, kind)`.
97
+ - `react(authorRef, resourceRef, kind)` toggles the edge in one transaction (add
98
+ if absent, remove if present), returning `{ reacted, action }`. One edge per
99
+ subject per kind per resource is enforced inside the mutation transaction.
100
+ - `unreact(authorRef, resourceRef, kind)` removes the edge; removing one that
101
+ does not exist is an idempotent no-op returning `false`.
102
+ - `counts(resourceRef)` tallies edges per kind (sorted by kind);
103
+ `reactors( resourceRef, kind, paginationOpts)` pages the subjects who reacted
104
+ oldest-first via the standard Convex pagination envelope.
105
+ - `hasReacted(authorRef, resourceRef, kind)` and
106
+ `myReactions(authorRef, resourceRef)` expose a subject's own reaction state.
107
+ - Configurable reaction vocabulary: `new Reactions(component, { allowedKinds })`
108
+ rejects an unknown `kind` at the client boundary before the component is
109
+ called.
110
+ - Server-sourced time: `createdAt` is stamped from `Date.now()` inside the
111
+ mutation — no caller-supplied clock.
112
+ - Opaque refs: `authorRef`, `resourceRef`, and `kind` are plain strings the
113
+ component never de-references; it never reads host or sibling tables.
114
+ - Mount-safe: correct under multiple `app.use(component, { name })` mounts —
115
+ each instance is sandboxed.
116
+ - `reactors` bounds pagination: `numItems` must be an integer from 1 through
117
+ 1000 (otherwise it throws `ConvexError` `INVALID_PAGE_SIZE`), and
118
+ `maximumRowsRead` is validated and capped at 1000 for reactive cursor ranges.
119
+ - Requires `convex@^1.45.0`.
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-reactions.svg)](https://www.npmjs.com/package/@vllnt/convex-reactions)
4
- [![CI](https://github.com/vllnt/convex-reactions/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-reactions/actions/workflows/ci.yml)
5
- [![license](https://img.shields.io/npm/l/@vllnt/convex-reactions.svg)](./LICENSE)
6
-
7
1
  # @vllnt/convex-reactions
8
2
 
9
- Reactions, votes, and likes on any resource, as a Convex component.
3
+ TypeScript Convex component for emoji reactions, up/down votes and likes on any
4
+ resource: toggle a reaction, count per kind, page who reacted.
10
5
 
11
- ```ts
12
- const reactions = new Reactions(components.reactions);
13
- await reactions.react(ctx, authorRef, resourceRef, "up"); // toggle the edge in one transaction
14
- await reactions.counts(ctx, resourceRef); // [{ kind, count }], reactive
15
- await reactions.hasReacted(ctx, authorRef, resourceRef, "up");
16
- ```
6
+ ## For coding agents
17
7
 
18
- A reaction is the opaque edge `(authorRef, resourceRef, kind)`. `react` toggles it (add if absent,
19
- remove if present); `counts` tallies a resource per kind; `reactors` pages who reacted. One edge per
20
- subject per kind per resource is enforced in the mutation transaction, so toggles and counts stay
21
- correct under concurrency.
8
+ Docs for the installed version are in `node_modules/@vllnt/convex-reactions/`:
9
+ `docs/API.md`, `llms.txt`, `CHANGELOG.md` and the TypeScript `src/`. Read them
10
+ before writing code against this package.
22
11
 
23
- ## Features
12
+ ## When to use
24
13
 
25
- - **Toggle** — `react(authorRef, resourceRef, kind)` adds the edge if absent and removes it if present in one transaction, returning `{ reacted, action }`.
26
- - **Idempotent remove** — `unreact(authorRef, resourceRef, kind)` deletes the edge; removing an absent one is a safe no-op (`false`).
27
- - **Count by kind** — `counts(resourceRef)` returns `[{ kind, count }, ...]` sorted by kind; no reactions returns `[]`.
28
- - **List reactors** — `reactors(resourceRef, kind, paginationOpts)` pages who reacted with one kind, oldest first. `numItems` must be an integer from 1 through 1000 and `maximumRowsRead` is capped at 1000, including reactive cursor ranges.
29
- - **Per-subject state** — `hasReacted` and `myReactions` give the host the subject's own reaction state for rendering controls.
30
- - **Configurable vocabulary** — `allowedKinds` pins the reaction set (`["up", "down"]`, a fixed emoji list); an unknown kind is rejected at the boundary. Omit for freeform.
31
- - **Server-sourced time** — `createdAt` is stamped from the server clock; a caller can't supply a timestamp.
32
- - **Mount-safe** — correct under multiple named `app.use` mounts; each instance is an isolated sandbox.
14
+ - Use it when users toggle a reaction (emoji, like, up/down vote) on a post,
15
+ comment or any other record.
16
+ - Use it when you show per-kind counts and whether the current user reacted.
17
+ - Use it when you list who reacted with one kind, page by page.
18
+ - Do not use it when a reaction carries data (a comment, a star rating, a note):
19
+ store it in your own table with `defineTable`.
20
+ - Do not use it when one resource gets a very high rate of reactions: each write
21
+ updates one tally row per resource and kind; use `@convex-dev/sharded-counter`.
22
+ - Do not use it when you need to sort or rank resources by their reaction count:
23
+ `counts` reads one resource at a time; use `@convex-dev/aggregate`.
33
24
 
34
- ## Installation
25
+ ## Install
35
26
 
36
27
  ```bash
37
28
  pnpm add @vllnt/convex-reactions
38
29
  ```
39
30
 
40
- Peer dependency: `convex@^1.45.0`.
31
+ Peer dependency: `convex@^1.45.0`. `@vllnt/convex-reactions@canary` installs the
32
+ newest build from `main`.
41
33
 
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 reactions from "@vllnt/convex-reactions/convex.config";
39
+ import { defineApp } from "convex/server";
48
40
 
49
41
  const app = defineApp();
50
42
  app.use(reactions);
@@ -52,79 +44,370 @@ export default app;
52
44
  ```
53
45
 
54
46
  ```ts
55
- // convex/reactions.ts — host owns auth; pass opaque refs in.
47
+ // convex/reactions.ts
48
+ import { Reactions } from "@vllnt/convex-reactions";
49
+ import { ConvexError, v } from "convex/values";
50
+
56
51
  import { components } from "./_generated/api";
57
52
  import { mutation, query } from "./_generated/server";
58
- import { paginationOptsValidator } from "convex/server";
59
- import { v } from "convex/values";
60
- import { Reactions } from "@vllnt/convex-reactions";
61
53
 
62
54
  const reactions = new Reactions(components.reactions, {
63
- allowedKinds: ["up", "down"], // pin the vocabulary (optional)
55
+ allowedKinds: ["like", "love", "laugh"],
64
56
  });
65
57
 
66
- export const vote = mutation({
67
- args: { postId: v.string(), kind: v.string() },
58
+ export const toggle = mutation({
59
+ args: { postId: v.id("posts"), kind: v.string() },
60
+ returns: v.object({
61
+ reacted: v.boolean(),
62
+ action: v.union(v.literal("added"), v.literal("removed")),
63
+ }),
68
64
  handler: async (ctx, { postId, kind }) => {
69
- const userId = await requireUser(ctx); // host auth
70
- return reactions.react(ctx, userId, postId, kind);
65
+ const user = await ctx.auth.getUserIdentity();
66
+ if (user === null) throw new ConvexError("not signed in");
67
+ return reactions.react(ctx, user.tokenIdentifier, postId, kind);
71
68
  },
72
69
  });
73
70
 
74
- export const tally = query({
75
- args: { postId: v.string() },
71
+ export const counts = query({
72
+ args: { postId: v.id("posts") },
73
+ returns: v.array(v.object({ kind: v.string(), count: v.number() })),
76
74
  handler: (ctx, { postId }) => reactions.counts(ctx, postId),
77
75
  });
78
76
  ```
79
77
 
80
- ## API Reference
81
-
82
- | Method | Kind | Result |
83
- |--------|------|--------|
84
- | `react(ctx, authorRef, resourceRef, kind)` | mutation | `{ reacted, action }` (`action`: `"added" \| "removed"`) |
85
- | `unreact(ctx, authorRef, resourceRef, kind)` | mutation | `boolean` (true if an edge was removed) |
86
- | `counts(ctx, resourceRef)` | query | `{ kind, count }[]` (sorted by kind) |
87
- | `hasReacted(ctx, authorRef, resourceRef, kind)` | query | `boolean` |
88
- | `myReactions(ctx, authorRef, resourceRef)` | query | `string[]` (kinds the subject placed) |
89
- | `reactors(ctx, resourceRef, kind, paginationOpts)` | query | `PaginationResult<ReactionView>`; bounded to 1000 rows read |
78
+ Run `npx convex dev` once to generate `components.reactions`. The component
79
+ never reads auth: the host derives `authorRef` (here the user's
80
+ `tokenIdentifier`), decides who may react, and passes the resource id as an
81
+ opaque string.
90
82
 
91
- Invalid numeric pagination options throw `INVALID_PAGE_SIZE`.
83
+ ## API
92
84
 
93
85
  Full reference: [docs/API.md](docs/API.md).
94
86
 
95
- ## React
87
+ | Export | Import from | What it does |
88
+ | -------------------------------------------------------------------------- | ---------------------------------------------- | -------------------------------------------------------------------- |
89
+ | [`Reactions`](docs/API.md#reactions) | `@vllnt/convex-reactions` | Host client: `new Reactions(components.reactions, { allowedKinds })` |
90
+ | [`react(ctx, authorRef, resourceRef, kind)`](docs/API.md#react) | `Reactions` method, mutation | Toggle the edge: add if absent, remove if present; `ReactResult` |
91
+ | [`unreact(ctx, authorRef, resourceRef, kind)`](docs/API.md#unreact) | `Reactions` method, mutation | Remove the edge if present; `true` if one was removed |
92
+ | [`counts(ctx, resourceRef)`](docs/API.md#counts) | `Reactions` method, query | `{ kind, count }[]` for one resource, sorted by kind |
93
+ | [`hasReacted(ctx, authorRef, resourceRef, kind)`](docs/API.md#hasreacted) | `Reactions` method, query | Whether the subject holds that edge |
94
+ | [`myReactions(ctx, authorRef, resourceRef)`](docs/API.md#myreactions) | `Reactions` method, query | Kinds the subject placed on one resource |
95
+ | [`reactors(ctx, resourceRef, kind, paginationOpts)`](docs/API.md#reactors) | `Reactions` method, query | One page of `ReactionView`, oldest first; `numItems` 1 to 1000 |
96
+ | [`ReactionsComponent`](docs/API.md#reactionscomponent) | `@vllnt/convex-reactions` (type) | Type of `components.reactions` the client accepts |
97
+ | [`ReactionsOptions`](docs/API.md#reactionsoptions) | `@vllnt/convex-reactions` (type) | `{ allowedKinds? }` |
98
+ | [`ReactResult`](docs/API.md#reactresult) | `@vllnt/convex-reactions` (type) | `{ reacted, action: "added" \| "removed" }` |
99
+ | [`KindCount`](docs/API.md#kindcount) | `@vllnt/convex-reactions` (type) | `{ kind, count }` |
100
+ | [`ReactionView`](docs/API.md#reactionview) | `@vllnt/convex-reactions` (type) | `{ authorRef, resourceRef, kind, createdAt }` |
101
+ | [`default` (component config)](docs/API.md#convexconfig) | `@vllnt/convex-reactions/convex.config` | Pass to `app.use(...)` |
102
+ | [`register`](docs/API.md#register) | `@vllnt/convex-reactions/test` | Mount the component in a `convex-test` instance |
103
+ | [`ComponentApi`](docs/API.md#componentapi) | `@vllnt/convex-reactions/_generated/component` | Generated type of the mounted component |
104
+
105
+ ## Common tasks
106
+
107
+ Render a reaction bar: per-kind counts plus the kinds the signed-in user placed.
96
108
 
97
- Backend-only — no `./react` entry. A reaction tally or reactor list is an ordinary reactive `useQuery` over the host's own re-exported `counts` / `reactors` refs.
109
+ ```ts
110
+ // convex/reactionBar.ts
111
+ import { Reactions } from "@vllnt/convex-reactions";
112
+ import { v } from "convex/values";
98
113
 
99
- ## Security
114
+ import { components } from "./_generated/api";
115
+ import { query } from "./_generated/server";
116
+
117
+ const reactions = new Reactions(components.reactions);
100
118
 
101
- - Auth-agnostic — the host resolves identity and decides who may react.
102
- - Tables sandboxed — reached only through the exported functions; never touches host or sibling tables.
103
- - Uniqueness is transactional + time is server-sourced; refs and `kind` stay opaque to the component.
119
+ export const reactionBar = query({
120
+ args: { postId: v.id("posts") },
121
+ returns: v.object({
122
+ counts: v.array(v.object({ kind: v.string(), count: v.number() })),
123
+ mine: v.array(v.string()),
124
+ }),
125
+ handler: async (ctx, { postId }) => {
126
+ const user = await ctx.auth.getUserIdentity();
127
+ const counts = await reactions.counts(ctx, postId);
128
+ const mine =
129
+ user === null
130
+ ? []
131
+ : await reactions.myReactions(ctx, user.tokenIdentifier, postId);
132
+ return { counts, mine };
133
+ },
134
+ });
135
+ ```
104
136
 
105
- See [docs/API.md](docs/API.md).
137
+ Up/down votes where a new vote replaces the opposite one. `react` toggles, so
138
+ voting the same way twice removes the vote; `unreact` is a no-op when there is
139
+ nothing to remove. Both calls run in the host mutation's transaction.
140
+
141
+ ```ts
142
+ // convex/votes.ts
143
+ import { Reactions } from "@vllnt/convex-reactions";
144
+ import { ConvexError, v } from "convex/values";
145
+
146
+ import { components } from "./_generated/api";
147
+ import { mutation } from "./_generated/server";
148
+
149
+ const votes = new Reactions(components.reactions, {
150
+ allowedKinds: ["up", "down"],
151
+ });
152
+
153
+ export const vote = mutation({
154
+ args: {
155
+ postId: v.id("posts"),
156
+ direction: v.union(v.literal("up"), v.literal("down")),
157
+ },
158
+ returns: v.boolean(),
159
+ handler: async (ctx, { postId, direction }) => {
160
+ const user = await ctx.auth.getUserIdentity();
161
+ if (user === null) throw new ConvexError("not signed in");
162
+ const opposite = direction === "up" ? "down" : "up";
163
+ await votes.unreact(ctx, user.tokenIdentifier, postId, opposite);
164
+ const result = await votes.react(
165
+ ctx,
166
+ user.tokenIdentifier,
167
+ postId,
168
+ direction,
169
+ );
170
+ return result.reacted;
171
+ },
172
+ });
173
+ ```
174
+
175
+ List who reacted with one kind, page by page (use it with `usePaginatedQuery`):
176
+
177
+ ```ts
178
+ // convex/reactors.ts
179
+ import { Reactions } from "@vllnt/convex-reactions";
180
+ import {
181
+ paginationOptsValidator,
182
+ paginationResultValidator,
183
+ } from "convex/server";
184
+ import { v } from "convex/values";
185
+
186
+ import { components } from "./_generated/api";
187
+ import { query } from "./_generated/server";
188
+
189
+ const reactions = new Reactions(components.reactions);
190
+
191
+ export const whoReacted = query({
192
+ args: {
193
+ postId: v.id("posts"),
194
+ kind: v.string(),
195
+ paginationOpts: paginationOptsValidator,
196
+ },
197
+ returns: paginationResultValidator(
198
+ v.object({
199
+ authorRef: v.string(),
200
+ resourceRef: v.string(),
201
+ kind: v.string(),
202
+ createdAt: v.number(),
203
+ }),
204
+ ),
205
+ handler: (ctx, { postId, kind, paginationOpts }) =>
206
+ reactions.reactors(ctx, postId, kind, paginationOpts),
207
+ });
208
+ ```
209
+
210
+ Keep two vocabularies apart with two named mounts. Each mount has its own
211
+ tables; nothing is shared between them.
212
+
213
+ ```ts
214
+ // convex/convex.config.ts
215
+ import reactions from "@vllnt/convex-reactions/convex.config";
216
+ import { defineApp } from "convex/server";
217
+
218
+ const app = defineApp();
219
+ app.use(reactions, { name: "emoji" });
220
+ app.use(reactions, { name: "votes" });
221
+ export default app;
222
+ ```
223
+
224
+ ```ts
225
+ // convex/clients.ts
226
+ import { Reactions } from "@vllnt/convex-reactions";
227
+
228
+ import { components } from "./_generated/api";
229
+
230
+ export const emoji = new Reactions(components.emoji);
231
+ export const votes = new Reactions(components.votes, {
232
+ allowedKinds: ["up", "down"],
233
+ });
234
+ ```
235
+
236
+ ## Errors and fixes
237
+
238
+ `react` and `unreact` throw a `ConvexError` whose `data` is `{ code, message }`
239
+ for an invalid edge key; `reactors` does the same for invalid pagination
240
+ options. Catch it in the host with `error instanceof ConvexError` and read
241
+ `error.data.code`.
242
+
243
+ | Error | Thrown by | Cause | Fix |
244
+ | -------------------------------------------------------------------------- | -------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
245
+ | `INVALID_REF` | `react`, `unreact` | `authorRef` or `resourceRef` is the empty string | Pass a non-empty ref (a user id, a row id, a namespaced key) |
246
+ | `INVALID_KIND` | `react`, `unreact` | `kind` is the empty string | Pass a non-empty kind |
247
+ | `INVALID_PAGE_SIZE` | `reactors` | `paginationOpts.numItems` is not an integer from 1 to 1000, or `maximumRowsRead` is not a positive integer | Keep `numItems` in 1..1000; omit `maximumRowsRead` or pass a positive integer |
248
+ | `Error`: `invalid reaction kind "<kind>": not in the configured allowlist` | `react`, `unreact` on a client with `allowedKinds` | `kind` is not in `allowedKinds`; thrown by the client before the component is called; a plain `Error`, not a `ConvexError` | Pass a listed kind or add it to `allowedKinds`; validate user input in the host first |
249
+
250
+ Arguments of the wrong type (for example a number `kind`) are rejected by Convex
251
+ argument validation before the component runs. Queries do not validate refs or
252
+ kinds and do not throw on empty strings.
253
+
254
+ ## Limits and gotchas
255
+
256
+ - `reactors` takes `numItems` from 1 to 1000. `maximumRowsRead` is capped at
257
+ 1000 on the first run of a page. A reactive re-run with an `endCursor` returns
258
+ the whole range between its cursors, and Convex ignores `maximumRowsRead`
259
+ there; only Convex transaction read limits apply. `usePaginatedQuery` sends
260
+ `endCursor` when it splits a loaded page that grew (on `SplitRecommended` or
261
+ `SplitRequired`, or once a page holds more than twice `initialNumItems`), so
262
+ the two halves stay free of gaps and overlaps. Only a caller that does not
263
+ use `usePaginatedQuery` or other reactive pagination should drop `endCursor`
264
+ from `paginationOpts` in its own wrapper before calling `reactors`; with
265
+ reactive pagination, dropping it on a split page can show duplicate or
266
+ missing rows.
267
+ - `react` is a toggle, not an idempotent retry operation: calling it twice with
268
+ the same arguments removes the edge again. Use `unreact` for "ensure absent",
269
+ and `hasReacted` before `react` for "ensure present".
270
+ - `allowedKinds` is enforced only in the `Reactions` client, and only for
271
+ `react` and `unreact`. Queries accept any kind, and a direct call to the
272
+ component's functions skips the check. `allowedKinds: []` rejects every write.
273
+ - `counts` reads stored tally rows, one per kind. A resource whose reactions
274
+ were written by 0.1.0 (before tallies existed) has no tally rows; `counts`
275
+ counts its edges instead, one read per edge, until all its edges are removed.
276
+ - After 0.1.1 has written tally rows, downgrading to 0.1.0 is not supported:
277
+ 0.1.0 writes edges without updating tallies, so counts go stale.
278
+ - Edges with an empty `authorRef`, `resourceRef` or `kind` written by 0.1.0
279
+ cannot be removed through the API (`react` and `unreact` now throw). The host
280
+ cannot write component tables from code; delete those rows in the Convex
281
+ dashboard: select the component in the dashboard's component dropdown, open
282
+ its `reactions` table in the data view, select the rows and delete them.
283
+ - There is no bulk erase. Deleting a resource or a user in your app leaves its
284
+ reactions. Remove them with `unreact`, finding them through `counts` and
285
+ `reactors`; there is no query that lists one subject's reactions across all
286
+ resources.
287
+ - Every write on a resource updates its `(resource, kind)` tally row, so many
288
+ concurrent writes on one resource and kind conflict and Convex retries them.
289
+ - Refs and kinds are opaque strings with no length limit in the component;
290
+ Convex's own value size limits apply.
291
+
292
+ ## Compatibility
293
+
294
+ - Peer dependency: `convex@^1.45.0`. The repository's tests run on the locked
295
+ convex version (1.51); `pnpm test:package` type-checks and runs the packed
296
+ package against convex 1.45.0.
297
+ - Node.js 20 or later (`engines.node` `>=20.0.0`). convex 1.49 and newer need
298
+ Node.js 22 or later. CI runs Node.js 24.
299
+ - ES modules only. Call the client from host Convex queries and mutations; the
300
+ component's functions run in the default Convex runtime.
301
+ - React: not applicable. The package is backend-only and has no `./react`
302
+ entry; call your own host queries with `useQuery`.
303
+ - `@vllnt/convex-reactions/test` is TypeScript source. It needs `convex-test`,
304
+ `vitest`, `vite` and `@edge-runtime/vm` in the consuming app: it references
305
+ `vite/client` types and calls `import.meta.glob`, so add `vite` as a direct
306
+ dev dependency.
106
307
 
107
308
  ## Testing
108
309
 
109
- ```bash
110
- pnpm test # single run
111
- pnpm test:coverage # enforced 100% on covered files
310
+ Mount the component in your own `convex-test` suite with `register`. Run the
311
+ tests on the Node.js version your Vitest requires (Vitest 5 needs Node.js
312
+ `^22.12.0`, `^24.0.0` or `>=26.0.0`). Use the Vitest settings from the
313
+ `convex-test` docs (edge runtime, `convex-test` inlined):
314
+
315
+ ```ts
316
+ // vitest.config.mts
317
+ import { defineConfig } from "vitest/config";
318
+
319
+ export default defineConfig({
320
+ test: {
321
+ environment: "edge-runtime",
322
+ server: { deps: { inline: ["convex-test"] } },
323
+ },
324
+ });
112
325
  ```
113
326
 
114
- Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
327
+ ```ts
328
+ // convex/schema.ts
329
+ import { defineSchema, defineTable } from "convex/server";
330
+ import { v } from "convex/values";
115
331
 
116
- ## Contributing
332
+ export default defineSchema({
333
+ posts: defineTable({ title: v.string() }),
334
+ });
335
+ ```
117
336
 
118
- See [CONTRIBUTING.md](CONTRIBUTING.md).
337
+ ```ts
338
+ // convex/reactions.test.ts
339
+ /// <reference types="vite/client" />
340
+ import { register } from "@vllnt/convex-reactions/test";
341
+ import { convexTest } from "convex-test";
342
+ import { expect, test } from "vitest";
343
+
344
+ import { api } from "./_generated/api";
345
+ import schema from "./schema";
346
+
347
+ test("a second toggle removes the reaction", async () => {
348
+ const t = convexTest(schema, import.meta.glob("./**/*.ts"));
349
+ register(t);
350
+ const postId = await t.run((ctx) => ctx.db.insert("posts", { title: "Hi" }));
351
+ const user = t.withIdentity({ tokenIdentifier: "user-1" });
352
+ await user.mutation(api.reactions.toggle, { postId, kind: "like" });
353
+ expect(await t.query(api.reactions.counts, { postId })).toEqual([
354
+ { kind: "like", count: 1 },
355
+ ]);
356
+ const again = await user.mutation(api.reactions.toggle, {
357
+ postId,
358
+ kind: "like",
359
+ });
360
+ expect(again).toEqual({ reacted: false, action: "removed" });
361
+ });
362
+ ```
119
363
 
120
- ## Author
364
+ `register(t, name)` takes the mount name when you used
365
+ `app.use(reactions, { name })`.
121
366
 
122
- Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
367
+ This repository's own tests use the simulated `convex-test` runtime
368
+ (`pnpm test:coverage`, 100% coverage enforced). `pnpm test:package` installs
369
+ the packed tarball in a temporary app, type-checks every example in this README
370
+ and `docs/API.md` against it and runs the test above.
123
371
 
124
- Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
372
+ ## Security
125
373
 
126
- If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
374
+ - The component does not authenticate. The host must authorize every call and
375
+ derive `authorRef` itself (for example from `ctx.auth`); never accept an
376
+ `authorRef` from client arguments.
377
+ - Its tables are reachable only through the component's functions; it never
378
+ reads host tables or de-references the refs.
379
+ - One edge per `(authorRef, resourceRef, kind)` is enforced inside the mutation
380
+ transaction, and `createdAt` comes from the server clock.
381
+
382
+ Report vulnerabilities as described in
383
+ [SECURITY.md](https://github.com/vllnt/convex-reactions/blob/main/SECURITY.md).
384
+
385
+ ## Related packages
386
+
387
+ None. This package has no runtime or peer dependency, shared test or example
388
+ with another @vllnt package.
389
+
390
+ ## Contributing
391
+
392
+ See
393
+ [CONTRIBUTING.md](https://github.com/vllnt/convex-reactions/blob/main/CONTRIBUTING.md).
394
+
395
+ ## Links
396
+
397
+ - Docs and changelog: [oss.vllnt.com/packages/convex-reactions](https://oss.vllnt.com/packages/convex-reactions) · [release feed](https://oss.vllnt.com/packages/convex-reactions/rss.xml)
398
+ - All @vllnt packages: [oss.vllnt.com](https://oss.vllnt.com) · [search packages and docs on index.vllnt.com](https://index.vllnt.com)
399
+ - Source and issues: [GitHub](https://github.com/vllnt/convex-reactions) · [issues](https://github.com/vllnt/convex-reactions/issues) · [npm](https://www.npmjs.com/package/@vllnt/convex-reactions)
400
+ - Questions and updates: [Discord](https://bntvllnt.com/discord) · [X @bntvllnt](https://x.com/bntvllnt)
401
+ - 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)
402
+ - Sponsor: [GitHub Sponsors](https://github.com/sponsors/bntvllnt)
127
403
 
128
404
  ## License
129
405
 
130
- MIT — see [LICENSE](LICENSE).
406
+ MIT. See [LICENSE](LICENSE).
407
+
408
+ [![npm version](https://img.shields.io/npm/v/@vllnt/convex-reactions.svg)](https://www.npmjs.com/package/@vllnt/convex-reactions)
409
+ [![CI status](https://github.com/vllnt/convex-reactions/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-reactions/actions/workflows/ci.yml)
410
+
411
+ ---
412
+
413
+ Part of [vllnt open source](https://oss.vllnt.com) · [Package page](https://oss.vllnt.com/packages/convex-reactions) · [vllnt.com](https://vllnt.com) · Built by [bntvllnt](https://bntvllnt.com)
@@ -66,6 +66,8 @@ interface RunMutationCtx {
66
66
  * const tally = await reactions.counts(ctx, postId); // [{ kind: "up", count: 1 }]
67
67
  * const mine = await reactions.myReactions(ctx, userId, postId); // ["up"]
68
68
  * ```
69
+ *
70
+ * @see https://oss.vllnt.com/packages/convex-reactions
69
71
  */
70
72
  export declare class Reactions {
71
73
  private readonly component;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d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AAkC;IAE/D,YACmB,SAAS,EAAE,kBAAkB,EAC9C,OAAO,GAAE,gBAAqB,EAM/B;IAED,2EAA2E;IAC3E,OAAO,CAAC,UAAU;IAQlB;;;;;OAKG;IACH,KAAK,CACH,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,WAAW,CAAC,CAOtB;IAED;;;;OAIG;IACH,OAAO,CACL,GAAG,EAAE,cAAc,EACnB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAOlB;IAED;;;OAGG;IACH,MAAM,CAAC,GAAG,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAElE;IAED,gFAAgF;IAChF,UAAU,CACR,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,OAAO,CAAC,CAMlB;IAED,gFAAgF;IAChF,WAAW,CACT,GAAG,EAAE,WAAW,EAChB,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GAClB,OAAO,CAAC,MAAM,EAAE,CAAC,CAKnB;IAED;;;OAGG;IACH,QAAQ,CACN,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,cAAc,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC,YAAY,CAAC,CAAC,CAMzC;CACF;AAED,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
@@ -20,6 +20,8 @@
20
20
  * const tally = await reactions.counts(ctx, postId); // [{ kind: "up", count: 1 }]
21
21
  * const mine = await reactions.myReactions(ctx, userId, postId); // ["up"]
22
22
  * ```
23
+ *
24
+ * @see https://oss.vllnt.com/packages/convex-reactions
23
25
  */
24
26
  export class Reactions {
25
27
  component;
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,SAAS;IAID,SAAS;IAHX,YAAY,CAAkC;IAE/D,YACmB,SAA6B,EAC9C,OAAO,GAAqB,EAAE;yBADb,SAAS;QAG1B,IAAI,CAAC,YAAY;YACf,OAAO,CAAC,YAAY,KAAK,SAAS;gBAChC,CAAC,CAAC,SAAS;gBACX,CAAC,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,CAAC;IAED,2EAA2E;IACnE,UAAU,CAAC,IAAY;QAC7B,IAAI,IAAI,CAAC,YAAY,KAAK,SAAS,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACpE,MAAM,IAAI,KAAK,CACb,0BAA0B,IAAI,oCAAoC,CACnE,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,KAAK,CACH,GAAmB,EACnB,SAAiB,EACjB,WAAmB,EACnB,IAAY;QAEZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,EAAE;YACrD,SAAS;YACT,WAAW;YACX,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED;;;;OAIG;IACH,OAAO,CACL,GAAmB,EACnB,SAAiB,EACjB,WAAmB,EACnB,IAAY;QAEZ,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;QACtB,OAAO,GAAG,CAAC,WAAW,CAAC,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,OAAO,EAAE;YACvD,SAAS;YACT,WAAW;YACX,IAAI;SACL,CAAC,CA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