@vllnt/convex-reactions 0.2.0-canary.8abd47a → 0.2.0

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.
package/CHANGELOG.md CHANGED
@@ -4,16 +4,19 @@ All notable changes to this project are documented here. The format is based on
4
4
  [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this project
5
5
  adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
- ## [0.2.0] - Unreleased
7
+ ## [0.2.0] - 2026-11-28
8
8
 
9
9
  **Breaking:** `react` and `unreact` now throw `ConvexError` `INVALID_REF` for an
10
10
  empty `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`.
11
+
11
12
  **Breaking:** when `react` adds an edge, it throws `INVALID_REF` for an
12
13
  `authorRef` or `resourceRef` over 512 UTF-16 code units and `INVALID_KIND` for a
13
14
  `kind` over 128 UTF-16 code units (JavaScript string length; most emoji count as
14
15
  2). Removing an edge is never size-checked. See Upgrading for rows stored before
15
16
  0.2.0.
16
17
 
18
+ **Breaking:** `engines.node` is now `>=20.0.0` (was `>=18`).
19
+
17
20
  ### Upgrading
18
21
 
19
22
  - Downgrading to 0.1.0 is not supported once 0.2.0 has written `reactionCounts`
@@ -32,15 +35,54 @@ empty `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`.
32
35
  over-limit edge returns `false`). Once removed, they cannot be added again
33
36
  (`react` throws `INVALID_REF` or `INVALID_KIND`). No migration runs.
34
37
 
38
+ ### Added
39
+
40
+ - The npm package ships `docs/API.md`, `CHANGELOG.md`, and `llms.txt` next to
41
+ `README.md`, so the docs under `node_modules/@vllnt/convex-reactions/` match
42
+ the installed version. `llms.txt` links shipped files relatively and
43
+ repository-only files by URL.
44
+
45
+ ### Changed
46
+
47
+ - `react` and `unreact` throw `ConvexError` `INVALID_REF` for an empty
48
+ `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`; 0.1.0
49
+ stored an edge no real subject, resource, or kind could address. What to do:
50
+ pass non-empty refs and kind, and delete existing empty-key rows as described
51
+ in Upgrading.
52
+ - `react` rejects a new edge whose `authorRef` or `resourceRef` is over 512 or
53
+ whose `kind` is over 128 UTF-16 code units (`INVALID_REF` or `INVALID_KIND`),
54
+ so one write cannot store an unbounded key in the component's indexes. What to
55
+ do: pass a shorter ref (a row id, or a hash of a long key) and a shorter kind;
56
+ existing over-limit edges stay readable and removable.
57
+ - `engines.node` raised from `>=18` to `>=20.0.0`, the floor the lowest
58
+ supported `convex` (1.45) declares. What to do: run on Node.js 20 or later
59
+ (convex 1.49 and newer need Node.js 22). The `convex` peer range stays
60
+ `^1.45.0`.
61
+ - `counts` reads one `reactionCounts` tally row per kind instead of every edge
62
+ on the resource: O(kinds) reads instead of O(edges). A resource starts a tally
63
+ on its next reaction once it holds no edges (new resources, or older ones
64
+ after all their edges are removed); until then `counts` scans its edges (no
65
+ migration, and writes never scan legacy edges). A tally row is deleted when
66
+ its count reaches zero.
67
+ - `myReactions` returns kinds sorted by `kind` instead of in the order they were
68
+ added: it reads the `by_author_resource_kind` prefix, and the redundant
69
+ `by_author_resource` index is removed (one less index write per
70
+ `react`/`unreact`). What to do: sort on the host if you relied on the old
71
+ order.
72
+ - README rewritten for coding agents (when to use, a complete quick start, an
73
+ API table of every export, common tasks, errors and fixes, limits and gotchas,
74
+ compatibility, a self-contained `register` testing example); `docs/API.md` has
75
+ one heading per export and lists every entry point, table, and error code;
76
+ `llms.txt` gains the same summary. The `reactors` docs state the limit as
77
+ `numItems` 1 to 1000: with an `endCursor`, Convex returns the whole range
78
+ between the cursors and ignores `maximumRowsRead`. The npm `homepage` points
79
+ to <https://oss.vllnt.com/packages/convex-reactions>. Behavior is unchanged.
80
+ - Internal: pnpm through Corepack, newer dev dependencies, more lint checks, a
81
+ packed-tarball test on `convex` 1.45.0, stable releases from a `vX.Y.Z` tag,
82
+ and a `canary` build on every push to `main`.
83
+
35
84
  ### Fixed
36
85
 
37
- - `react` now rejects a new edge whose `authorRef` or `resourceRef` is over 512
38
- or whose `kind` is over 128 UTF-16 code units, so one write cannot store an
39
- unbounded key in the component's indexes.
40
- - `react` and `unreact` now throw `ConvexError` `INVALID_REF` for an empty
41
- `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`, instead
42
- of storing an edge no real subject, resource, or kind can address. Previously
43
- accepted input that could never be valid.
44
86
  - `@vllnt/convex-reactions/test` now type-checks for consumers using
45
87
  `moduleResolution` `nodenext` as well as `bundler` (explicit `.js` relative
46
88
  imports, Vite client types reference).
@@ -49,66 +91,6 @@ empty `authorRef` or `resourceRef` and `INVALID_KIND` for an empty `kind`.
49
91
  component's schema only, so a host schema with its own tables failed to
50
92
  type-check (TS2345). No runtime change.
51
93
 
52
- ### Changed
53
-
54
- - `counts` reads one `reactionCounts` tally row per kind instead of every edge
55
- on the resource: O(kinds) reads instead of O(edges). Tallies cover every
56
- resource whose first reaction came after upgrade; a resource with earlier
57
- edges keeps the edge scan (no migration, and writes never scan legacy edges).
58
- A tally row is deleted when its count reaches zero.
59
- - `myReactions` uses the `by_author_resource_kind` prefix; the redundant
60
- `by_author_resource` index is removed (one less index write per
61
- `react`/`unreact`).
62
- - Development and test toolchain: pnpm 10 with a seven-day release-age gate,
63
- `convex` 1.51, `convex-test` 0.0.73, Vitest 5.1.1, ESLint 10, and
64
- `@vllnt/typescript` 3 (stricter type-check flags for this repo's own build;
65
- emitted JavaScript and `.d.ts` files are identical to a build with the 2.0.0
66
- flags). The `convex` peer range stays `^1.45.0`.
67
- - Pin GitHub Actions to commit SHAs, scope workflow permissions, and publish
68
- `@latest` only from a `vX.Y.Z` tag on `main` through npm trusted publishing
69
- with provenance. CI now also type-checks the component and every test file and
70
- checks formatting.
71
- - `engines.node` raised from `>=18` to `>=20.0.0`, the floor the lowest
72
- supported `convex` (1.45) declares.
73
- - The seven-day release-age gate moved from the `package.json` `pnpm` field,
74
- which pnpm 10 ignores, to `pnpm-workspace.yaml`, so installs (including the
75
- package test's consumer) now enforce it, except for `@vllnt/*`. Dependency
76
- updates are a manual pass under that gate; there is no version-update bot.
77
- - Internal: CI and publish set up pnpm through Corepack from `packageManager`
78
- (no third-party setup action), the package test's temporary consumer uses the
79
- same pnpm version, CI cancels only superseded pull-request runs (never a run
80
- on `main`), the Privacy Guard actions are pinned to commit SHAs, and every
81
- push to `main` publishes a canary.
82
-
83
- ### Documentation
84
-
85
- - README rewritten for coding agents with fixed sections: when to use (and when
86
- not to), install, a complete quick start, an API table of every export, common
87
- tasks, an errors-and-fixes table, limits and gotchas, and compatibility.
88
- `docs/API.md` has one heading per export and method; `llms.txt` gains the same
89
- summary, when-to-use list and an Ecosystem block. The `package.json`
90
- description and keywords now name the problem and the stack. `pnpm lint` runs
91
- `scripts/check-documentation.mjs`, and the new `pnpm test:package` installs
92
- the packed tarball, imports its runtime entry points, type-checks all of them,
93
- and type-checks every README and `docs/API.md` example against it on `convex`
94
- 1.45.0. Behavior is unchanged.
95
- - The npm package now ships `docs/API.md`, `CHANGELOG.md`, and `llms.txt` next
96
- to `README.md`, so the docs under `node_modules/@vllnt/convex-reactions/`
97
- match the installed version. `llms.txt` links shipped files relatively and
98
- repository-only files by URL; `docs/API.md` lists every entry point and the
99
- component's tables. `pnpm lint` fails when a required doc is missing from the
100
- tarball, a contributor file, internal doc, or test ships, or an `llms.txt`
101
- link points outside it.
102
- - `reactors` docs no longer claim the 1000-row `maximumRowsRead` cap covers
103
- reactive cursor ranges: with an `endCursor`, Convex returns the whole range
104
- between the cursors and ignores `maximumRowsRead` (only its transaction read
105
- limits apply), so the README states the limit as `numItems` 1 to 1000.
106
- Behavior is unchanged.
107
- - README `## Testing` section gains a self-contained `register` example; the
108
- error table lists the new codes.
109
- - The npm `homepage` now points to
110
- <https://oss.vllnt.com/packages/convex-reactions>.
111
-
112
94
  ## [0.1.0] - 2026-09-01
113
95
 
114
96
  ### Added
@@ -79,13 +79,18 @@ export declare class Reactions {
79
79
  * Toggle a subject's reaction on a resource. Adds the
80
80
  * `(authorRef, resourceRef, kind)` edge if absent, removes it if present, in
81
81
  * one transaction. Returns whether the edge now exists and which side ran.
82
- * Throws if `kind` is outside the configured allowlist.
82
+ * Throws a plain `Error` if `kind` is outside the configured allowlist
83
+ * (checked first), and the component's `ConvexError` `INVALID_REF` /
84
+ * `INVALID_KIND` for an empty ref or kind, or, when adding, a ref over 512 or
85
+ * a kind over 128 UTF-16 code units.
83
86
  */
84
87
  react(ctx: RunMutationCtx, authorRef: string, resourceRef: string, kind: string): Promise<ReactResult>;
85
88
  /**
86
89
  * Remove a subject's reaction edge. Idempotent — removing an edge that does
87
- * not exist returns `false`; a real removal returns `true`. Throws if `kind`
88
- * is outside the configured allowlist.
90
+ * not exist returns `false`; a real removal returns `true`. Throws a plain
91
+ * `Error` if `kind` is outside the configured allowlist (checked first), and
92
+ * the component's `ConvexError` `INVALID_REF` / `INVALID_KIND` for an empty
93
+ * ref or kind (no length cap on removal).
89
94
  */
90
95
  unreact(ctx: RunMutationCtx, authorRef: string, resourceRef: string, kind: string): Promise<boolean>;
91
96
  /**
@@ -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,EAClB,iBAAiB,EACjB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,SAAS,EACT,WAAW,EACX,YAAY,EACZ,gBAAgB,EACjB,MAAM,YAAY,CAAC;AAEpB;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,SAAS,EAAE;QACT,KAAK,EAAE,iBAAiB,CACtB,UAAU,EACV,UAAU,EACV;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,EACxD,WAAW,CACZ,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;YAAE,S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AAC,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"}
@@ -43,7 +43,10 @@ export class Reactions {
43
43
  * Toggle a subject's reaction on a resource. Adds the
44
44
  * `(authorRef, resourceRef, kind)` edge if absent, removes it if present, in
45
45
  * one transaction. Returns whether the edge now exists and which side ran.
46
- * Throws if `kind` is outside the configured allowlist.
46
+ * Throws a plain `Error` if `kind` is outside the configured allowlist
47
+ * (checked first), and the component's `ConvexError` `INVALID_REF` /
48
+ * `INVALID_KIND` for an empty ref or kind, or, when adding, a ref over 512 or
49
+ * a kind over 128 UTF-16 code units.
47
50
  */
48
51
  react(ctx, authorRef, resourceRef, kind) {
49
52
  this.assertKind(kind);
@@ -55,8 +58,10 @@ export class Reactions {
55
58
  }
56
59
  /**
57
60
  * Remove a subject's reaction edge. Idempotent — removing an edge that does
58
- * not exist returns `false`; a real removal returns `true`. Throws if `kind`
59
- * is outside the configured allowlist.
61
+ * not exist returns `false`; a real removal returns `true`. Throws a plain
62
+ * `Error` if `kind` is outside the configured allowlist (checked first), and
63
+ * the component's `ConvexError` `INVALID_REF` / `INVALID_KIND` for an empty
64
+ * ref or kind (no length cap on removal).
60
65
  */
61
66
  unreact(ctx, authorRef, resourceRef, kind) {
62
67
  this.assertKind(kind);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;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,C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,EAChB,SAAiB,EACjB,WAAmB;QAEnB,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,WAAW,EAAE;YACtD,SAAS;YACT,WAAW;SACZ,CAAC,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,QAAQ,CACN,GAAgB,EAChB,WAAmB,EACnB,IAAY,EACZ,cAAiC;QAEjC,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,QAAQ,EAAE;YACnD,WAAW;YACX,IAAI;YACJ,cAAc;SACf,CAAC,CAAC;IACL,CAAC;CACF"}
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Reactions per `kind` on one resource, sorted by `kind`. Reads the stored
3
+ * `reactionCounts` tally rows, or counts edges for a resource written before
4
+ * tallies existed.
5
+ */
1
6
  export declare const counts: import("convex/server").RegisteredQuery<"public", {
2
7
  resourceRef: string;
3
8
  }, Promise<{
@@ -17,7 +22,8 @@ export declare const hasReacted: import("convex/server").RegisteredQuery<"public
17
22
  /**
18
23
  * Every reaction kind a subject placed on one resource (their own reaction
19
24
  * state across kinds), via the `by_author_resource_kind` prefix. Returns the
20
- * list of `kind` strings; empty when the subject has not reacted to the resource.
25
+ * list of `kind` strings sorted by `kind`; empty when the subject has not reacted
26
+ * to the resource.
21
27
  */
22
28
  export declare const myReactions: import("convex/server").RegisteredQuery<"public", {
23
29
  authorRef: string;
@@ -1 +1 @@
1
- {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAqDA,eAAO,MAAM,MAAM;;;;;KAyBjB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;oBAmBrB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;qBAYtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;GA8BnB,CAAC"}
1
+ {"version":3,"file":"queries.d.ts","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAqDA;;;;GAIG;AACH,eAAO,MAAM,MAAM;;;;;KAyBjB,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,UAAU;;;;oBAmBrB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,WAAW;;;qBAYtB,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;GA8BnB,CAAC"}
@@ -38,6 +38,11 @@ function view(row) {
38
38
  createdAt: row.createdAt,
39
39
  };
40
40
  }
41
+ /**
42
+ * Reactions per `kind` on one resource, sorted by `kind`. Reads the stored
43
+ * `reactionCounts` tally rows, or counts edges for a resource written before
44
+ * tallies existed.
45
+ */
41
46
  export const counts = query({
42
47
  args: { resourceRef: v.string() },
43
48
  returns: v.array(kindCount),
@@ -85,7 +90,8 @@ export const hasReacted = query({
85
90
  /**
86
91
  * Every reaction kind a subject placed on one resource (their own reaction
87
92
  * state across kinds), via the `by_author_resource_kind` prefix. Returns the
88
- * list of `kind` strings; empty when the subject has not reacted to the resource.
93
+ * list of `kind` strings sorted by `kind`; empty when the subject has not reacted
94
+ * to the resource.
89
95
  */
90
96
  export const myReactions = query({
91
97
  args: { authorRef: v.string(), resourceRef: v.string() },
@@ -1 +1 @@
1
- {"version":3,"file":"queries.js","sourceRoot":"","sources":["../../src/component/queries.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAE,uBAAuB,EAAE,MAAM,eAAe,CAAC;AAExD,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG1D,MAAM,aAAa,GAAG,IAAI,CAAC;AAE3B,SAAS,wBAA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CAAC,EAAE,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,CAC5D;aACA,KAAK,CAAC,KAAK,CAAC;aACZ,QAAQ,CAAC,cAAc,CAAC,CAAC;QAC5B,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IACpD,CAAC;CACF,CAAC,CAAC"}
package/docs/API.md CHANGED
@@ -105,8 +105,8 @@ toggle state the host renders next to a reaction control.
105
105
 
106
106
  `myReactions(ctx, authorRef, resourceRef): Promise<string[]>`
107
107
 
108
- Every reaction `kind` a subject placed on one resource. Empty when the subject
109
- has not reacted to the resource.
108
+ Every reaction `kind` a subject placed on one resource, sorted by `kind`. Empty
109
+ when the subject has not reacted to the resource.
110
110
 
111
111
  ### `reactors`
112
112
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vllnt/convex-reactions",
3
- "version": "0.2.0-canary.8abd47a",
3
+ "version": "0.2.0",
4
4
  "description": "TypeScript Convex component for emoji reactions, up/down votes and likes on any resource: toggle a reaction, count per kind, page who reacted.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -66,8 +66,8 @@
66
66
  "@edge-runtime/vm": "^5.0.0",
67
67
  "@typescript/native": "npm:typescript@7.0.2",
68
68
  "@vitest/coverage-v8": "^5.1.1",
69
- "@vllnt/eslint-config": "2.1.0",
70
- "@vllnt/typescript": "3.0.0",
69
+ "@vllnt/eslint-config": "2.2.0",
70
+ "@vllnt/typescript": "3.0.1",
71
71
  "convex": "^1.51.0",
72
72
  "convex-test": "^0.0.73",
73
73
  "eslint": "^10.15.0",
@@ -125,7 +125,10 @@ export class Reactions {
125
125
  * Toggle a subject's reaction on a resource. Adds the
126
126
  * `(authorRef, resourceRef, kind)` edge if absent, removes it if present, in
127
127
  * one transaction. Returns whether the edge now exists and which side ran.
128
- * Throws if `kind` is outside the configured allowlist.
128
+ * Throws a plain `Error` if `kind` is outside the configured allowlist
129
+ * (checked first), and the component's `ConvexError` `INVALID_REF` /
130
+ * `INVALID_KIND` for an empty ref or kind, or, when adding, a ref over 512 or
131
+ * a kind over 128 UTF-16 code units.
129
132
  */
130
133
  react(
131
134
  ctx: RunMutationCtx,
@@ -143,8 +146,10 @@ export class Reactions {
143
146
 
144
147
  /**
145
148
  * Remove a subject's reaction edge. Idempotent — removing an edge that does
146
- * not exist returns `false`; a real removal returns `true`. Throws if `kind`
147
- * is outside the configured allowlist.
149
+ * not exist returns `false`; a real removal returns `true`. Throws a plain
150
+ * `Error` if `kind` is outside the configured allowlist (checked first), and
151
+ * the component's `ConvexError` `INVALID_REF` / `INVALID_KIND` for an empty
152
+ * ref or kind (no length cap on removal).
148
153
  */
149
154
  unreact(
150
155
  ctx: RunMutationCtx,
@@ -51,6 +51,11 @@ function view(row: Doc<"reactions">) {
51
51
  };
52
52
  }
53
53
 
54
+ /**
55
+ * Reactions per `kind` on one resource, sorted by `kind`. Reads the stored
56
+ * `reactionCounts` tally rows, or counts edges for a resource written before
57
+ * tallies existed.
58
+ */
54
59
  export const counts = query({
55
60
  args: { resourceRef: v.string() },
56
61
  returns: v.array(kindCount),
@@ -107,7 +112,8 @@ export const hasReacted = query({
107
112
  /**
108
113
  * Every reaction kind a subject placed on one resource (their own reaction
109
114
  * state across kinds), via the `by_author_resource_kind` prefix. Returns the
110
- * list of `kind` strings; empty when the subject has not reacted to the resource.
115
+ * list of `kind` strings sorted by `kind`; empty when the subject has not reacted
116
+ * to the resource.
111
117
  */
112
118
  export const myReactions = query({
113
119
  args: { authorRef: v.string(), resourceRef: v.string() },