@vllnt/convex-reactions 0.1.0-canary.ef756ee

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 (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/client/index.d.ts +105 -0
  4. package/dist/client/index.d.ts.map +1 -0
  5. package/dist/client/index.js +101 -0
  6. package/dist/client/index.js.map +1 -0
  7. package/dist/client/types.d.ts +37 -0
  8. package/dist/client/types.d.ts.map +1 -0
  9. package/dist/client/types.js +3 -0
  10. package/dist/client/types.js.map +1 -0
  11. package/dist/component/_generated/api.d.ts +38 -0
  12. package/dist/component/_generated/api.d.ts.map +1 -0
  13. package/dist/component/_generated/api.js +31 -0
  14. package/dist/component/_generated/api.js.map +1 -0
  15. package/dist/component/_generated/component.d.ts +78 -0
  16. package/dist/component/_generated/component.d.ts.map +1 -0
  17. package/dist/component/_generated/component.js +11 -0
  18. package/dist/component/_generated/component.js.map +1 -0
  19. package/dist/component/_generated/dataModel.d.ts +46 -0
  20. package/dist/component/_generated/dataModel.d.ts.map +1 -0
  21. package/dist/component/_generated/dataModel.js +11 -0
  22. package/dist/component/_generated/dataModel.js.map +1 -0
  23. package/dist/component/_generated/server.d.ts +121 -0
  24. package/dist/component/_generated/server.d.ts.map +1 -0
  25. package/dist/component/_generated/server.js +78 -0
  26. package/dist/component/_generated/server.js.map +1 -0
  27. package/dist/component/convex.config.d.ts +3 -0
  28. package/dist/component/convex.config.d.ts.map +1 -0
  29. package/dist/component/convex.config.js +7 -0
  30. package/dist/component/convex.config.js.map +1 -0
  31. package/dist/component/mutations.d.ts +35 -0
  32. package/dist/component/mutations.d.ts.map +1 -0
  33. package/dist/component/mutations.js +72 -0
  34. package/dist/component/mutations.js.map +1 -0
  35. package/dist/component/queries.d.ts +62 -0
  36. package/dist/component/queries.d.ts.map +1 -0
  37. package/dist/component/queries.js +107 -0
  38. package/dist/component/queries.js.map +1 -0
  39. package/dist/component/schema.d.ts +35 -0
  40. package/dist/component/schema.d.ts.map +1 -0
  41. package/dist/component/schema.js +30 -0
  42. package/dist/component/schema.js.map +1 -0
  43. package/dist/component/validators.d.ts +41 -0
  44. package/dist/component/validators.d.ts.map +1 -0
  45. package/dist/component/validators.js +31 -0
  46. package/dist/component/validators.js.map +1 -0
  47. package/dist/shared.d.ts +8 -0
  48. package/dist/shared.d.ts.map +1 -0
  49. package/dist/shared.js +8 -0
  50. package/dist/shared.js.map +1 -0
  51. package/package.json +98 -0
  52. package/src/client/index.ts +213 -0
  53. package/src/client/types.ts +40 -0
  54. package/src/component/_generated/api.ts +54 -0
  55. package/src/component/_generated/component.ts +94 -0
  56. package/src/component/_generated/dataModel.ts +60 -0
  57. package/src/component/_generated/server.ts +156 -0
  58. package/src/component/convex.config.ts +9 -0
  59. package/src/component/mutations.ts +79 -0
  60. package/src/component/queries.ts +124 -0
  61. package/src/component/schema.ts +30 -0
  62. package/src/component/validators.ts +33 -0
  63. package/src/shared.ts +8 -0
  64. package/src/test.ts +16 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 bntvllnt
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
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
+ # @vllnt/convex-reactions
8
+
9
+ Reactions, votes, and likes on any resource, as a Convex component.
10
+
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
+ ```
17
+
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.
22
+
23
+ ## Features
24
+
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. Reactive in a Convex query.
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.
33
+
34
+ ## Installation
35
+
36
+ ```bash
37
+ pnpm add @vllnt/convex-reactions
38
+ ```
39
+
40
+ Peer dependency: `convex@^1.41.0`.
41
+
42
+ ## Usage
43
+
44
+ ```ts
45
+ // convex/convex.config.ts
46
+ import { defineApp } from "convex/server";
47
+ import reactions from "@vllnt/convex-reactions/convex.config";
48
+
49
+ const app = defineApp();
50
+ app.use(reactions);
51
+ export default app;
52
+ ```
53
+
54
+ ```ts
55
+ // convex/reactions.ts — host owns auth; pass opaque refs in.
56
+ import { components } from "./_generated/api";
57
+ 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
+
62
+ const reactions = new Reactions(components.reactions, {
63
+ allowedKinds: ["up", "down"], // pin the vocabulary (optional)
64
+ });
65
+
66
+ export const vote = mutation({
67
+ args: { postId: v.string(), kind: v.string() },
68
+ handler: async (ctx, { postId, kind }) => {
69
+ const userId = await requireUser(ctx); // host auth
70
+ return reactions.react(ctx, userId, postId, kind);
71
+ },
72
+ });
73
+
74
+ export const tally = query({
75
+ args: { postId: v.string() },
76
+ handler: (ctx, { postId }) => reactions.counts(ctx, postId),
77
+ });
78
+ ```
79
+
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>` |
90
+
91
+ Full reference: [docs/API.md](docs/API.md).
92
+
93
+ ## React
94
+
95
+ 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.
96
+
97
+ ## Security
98
+
99
+ - Auth-agnostic — the host resolves identity and decides who may react.
100
+ - Tables sandboxed — reached only through the exported functions; never touches host or sibling tables.
101
+ - Uniqueness is transactional + time is server-sourced; refs and `kind` stay opaque to the component.
102
+
103
+ See [docs/API.md](docs/API.md).
104
+
105
+ ## Testing
106
+
107
+ ```bash
108
+ pnpm test # single run
109
+ pnpm test:coverage # enforced 100% on covered files
110
+ ```
111
+
112
+ Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
113
+
114
+ ## Contributing
115
+
116
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
117
+
118
+ ## Author
119
+
120
+ Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
121
+
122
+ Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
123
+
124
+ If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
125
+
126
+ ## License
127
+
128
+ MIT — see [LICENSE](LICENSE).
@@ -0,0 +1,105 @@
1
+ import type { FunctionArgs, FunctionReference, FunctionReturnType, PaginationOptions, PaginationResult } from "convex/server";
2
+ import type { KindCount, ReactResult, ReactionView, ReactionsOptions } from "./types.js";
3
+ /**
4
+ * The reactions component's function references, as exposed on the host via
5
+ * `components.reactions`. The opaque host refs (`authorRef`/`resourceRef`) and
6
+ * the `kind` are plain strings here; the host owns their meaning.
7
+ */
8
+ export interface ReactionsComponent {
9
+ mutations: {
10
+ react: FunctionReference<"mutation", "internal", {
11
+ authorRef: string;
12
+ resourceRef: string;
13
+ kind: string;
14
+ }, ReactResult>;
15
+ unreact: FunctionReference<"mutation", "internal", {
16
+ authorRef: string;
17
+ resourceRef: string;
18
+ kind: string;
19
+ }, boolean>;
20
+ };
21
+ queries: {
22
+ counts: FunctionReference<"query", "internal", {
23
+ resourceRef: string;
24
+ }, KindCount[]>;
25
+ hasReacted: FunctionReference<"query", "internal", {
26
+ authorRef: string;
27
+ resourceRef: string;
28
+ kind: string;
29
+ }, boolean>;
30
+ myReactions: FunctionReference<"query", "internal", {
31
+ authorRef: string;
32
+ resourceRef: string;
33
+ }, string[]>;
34
+ reactors: FunctionReference<"query", "internal", {
35
+ resourceRef: string;
36
+ kind: string;
37
+ paginationOpts: PaginationOptions;
38
+ }, PaginationResult<ReactionView>>;
39
+ };
40
+ }
41
+ interface RunQueryCtx {
42
+ runQuery<Q extends FunctionReference<"query", "internal">>(reference: Q, args: FunctionArgs<Q>): Promise<FunctionReturnType<Q>>;
43
+ }
44
+ interface RunMutationCtx {
45
+ runMutation<M extends FunctionReference<"mutation", "internal">>(reference: M, args: FunctionArgs<M>): Promise<FunctionReturnType<M>>;
46
+ }
47
+ /**
48
+ * Consumer-facing client for reactions / votes / likes on any resource. A
49
+ * reaction is the opaque edge `(authorRef, resourceRef, kind)`: a host subject
50
+ * reacted to a host resource with one reaction kind. One edge per subject per
51
+ * kind per resource is enforced inside the mutation transaction, so `react`
52
+ * toggles (add if absent, remove if present) and counts stay correct under
53
+ * concurrent toggles.
54
+ *
55
+ * The host owns meaning and auth — it resolves identity, decides who may react,
56
+ * and passes opaque `authorRef` / `resourceRef` strings and a `kind`. Pin the
57
+ * reaction vocabulary with `allowedKinds` to reject unknown kinds at the
58
+ * boundary; omit it to accept freeform kinds.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * const reactions = new Reactions(components.reactions, {
63
+ * allowedKinds: ["up", "down"],
64
+ * });
65
+ * await reactions.react(ctx, userId, postId, "up"); // toggle a vote
66
+ * const tally = await reactions.counts(ctx, postId); // [{ kind: "up", count: 1 }]
67
+ * const mine = await reactions.myReactions(ctx, userId, postId); // ["up"]
68
+ * ```
69
+ */
70
+ export declare class Reactions {
71
+ private readonly component;
72
+ private readonly allowedKinds;
73
+ constructor(component: ReactionsComponent, options?: ReactionsOptions);
74
+ /** Reject a `kind` outside the configured allowlist (no-op when unset). */
75
+ private assertKind;
76
+ /**
77
+ * Toggle a subject's reaction on a resource. Adds the
78
+ * `(authorRef, resourceRef, kind)` edge if absent, removes it if present, in
79
+ * one transaction. Returns whether the edge now exists and which side ran.
80
+ * Throws if `kind` is outside the configured allowlist.
81
+ */
82
+ react(ctx: RunMutationCtx, authorRef: string, resourceRef: string, kind: string): Promise<ReactResult>;
83
+ /**
84
+ * Remove a subject's reaction edge. Idempotent — removing an edge that does
85
+ * not exist returns `false`; a real removal returns `true`. Throws if `kind`
86
+ * is outside the configured allowlist.
87
+ */
88
+ unreact(ctx: RunMutationCtx, authorRef: string, resourceRef: string, kind: string): Promise<boolean>;
89
+ /**
90
+ * Tally reactions per `kind` on a resource — `[{ kind, count }, ...]` sorted
91
+ * by `kind`. Empty when the resource has no reactions.
92
+ */
93
+ counts(ctx: RunQueryCtx, resourceRef: string): Promise<KindCount[]>;
94
+ /** Whether a subject holds a `(authorRef, resourceRef, kind)` reaction edge. */
95
+ hasReacted(ctx: RunQueryCtx, authorRef: string, resourceRef: string, kind: string): Promise<boolean>;
96
+ /** Every reaction `kind` a subject placed on one resource (their own state). */
97
+ myReactions(ctx: RunQueryCtx, authorRef: string, resourceRef: string): Promise<string[]>;
98
+ /**
99
+ * Page the subjects who reacted to a resource with one `kind`, oldest first.
100
+ * Returns the standard Convex pagination envelope.
101
+ */
102
+ reactors(ctx: RunQueryCtx, resourceRef: string, kind: string, paginationOpts: PaginationOptions): Promise<PaginationResult<ReactionView>>;
103
+ }
104
+ export type { KindCount, ReactResult, ReactionView, ReactionsOptions };
105
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"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"}
@@ -0,0 +1,101 @@
1
+ /**
2
+ * Consumer-facing client for reactions / votes / likes on any resource. A
3
+ * reaction is the opaque edge `(authorRef, resourceRef, kind)`: a host subject
4
+ * reacted to a host resource with one reaction kind. One edge per subject per
5
+ * kind per resource is enforced inside the mutation transaction, so `react`
6
+ * toggles (add if absent, remove if present) and counts stay correct under
7
+ * concurrent toggles.
8
+ *
9
+ * The host owns meaning and auth — it resolves identity, decides who may react,
10
+ * and passes opaque `authorRef` / `resourceRef` strings and a `kind`. Pin the
11
+ * reaction vocabulary with `allowedKinds` to reject unknown kinds at the
12
+ * boundary; omit it to accept freeform kinds.
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const reactions = new Reactions(components.reactions, {
17
+ * allowedKinds: ["up", "down"],
18
+ * });
19
+ * await reactions.react(ctx, userId, postId, "up"); // toggle a vote
20
+ * const tally = await reactions.counts(ctx, postId); // [{ kind: "up", count: 1 }]
21
+ * const mine = await reactions.myReactions(ctx, userId, postId); // ["up"]
22
+ * ```
23
+ */
24
+ export class Reactions {
25
+ component;
26
+ allowedKinds;
27
+ constructor(component, options = {}) {
28
+ this.component = component;
29
+ this.allowedKinds =
30
+ options.allowedKinds === undefined
31
+ ? undefined
32
+ : new Set(options.allowedKinds);
33
+ }
34
+ /** Reject a `kind` outside the configured allowlist (no-op when unset). */
35
+ assertKind(kind) {
36
+ if (this.allowedKinds !== undefined && !this.allowedKinds.has(kind)) {
37
+ throw new Error(`invalid reaction kind "${kind}": not in the configured allowlist`);
38
+ }
39
+ }
40
+ /**
41
+ * Toggle a subject's reaction on a resource. Adds the
42
+ * `(authorRef, resourceRef, kind)` edge if absent, removes it if present, in
43
+ * one transaction. Returns whether the edge now exists and which side ran.
44
+ * Throws if `kind` is outside the configured allowlist.
45
+ */
46
+ react(ctx, authorRef, resourceRef, kind) {
47
+ this.assertKind(kind);
48
+ return ctx.runMutation(this.component.mutations.react, {
49
+ authorRef,
50
+ resourceRef,
51
+ kind,
52
+ });
53
+ }
54
+ /**
55
+ * Remove a subject's reaction edge. Idempotent — removing an edge that does
56
+ * not exist returns `false`; a real removal returns `true`. Throws if `kind`
57
+ * is outside the configured allowlist.
58
+ */
59
+ unreact(ctx, authorRef, resourceRef, kind) {
60
+ this.assertKind(kind);
61
+ return ctx.runMutation(this.component.mutations.unreact, {
62
+ authorRef,
63
+ resourceRef,
64
+ kind,
65
+ });
66
+ }
67
+ /**
68
+ * Tally reactions per `kind` on a resource — `[{ kind, count }, ...]` sorted
69
+ * by `kind`. Empty when the resource has no reactions.
70
+ */
71
+ counts(ctx, resourceRef) {
72
+ return ctx.runQuery(this.component.queries.counts, { resourceRef });
73
+ }
74
+ /** Whether a subject holds a `(authorRef, resourceRef, kind)` reaction edge. */
75
+ hasReacted(ctx, authorRef, resourceRef, kind) {
76
+ return ctx.runQuery(this.component.queries.hasReacted, {
77
+ authorRef,
78
+ resourceRef,
79
+ kind,
80
+ });
81
+ }
82
+ /** Every reaction `kind` a subject placed on one resource (their own state). */
83
+ myReactions(ctx, authorRef, resourceRef) {
84
+ return ctx.runQuery(this.component.queries.myReactions, {
85
+ authorRef,
86
+ resourceRef,
87
+ });
88
+ }
89
+ /**
90
+ * Page the subjects who reacted to a resource with one `kind`, oldest first.
91
+ * Returns the standard Convex pagination envelope.
92
+ */
93
+ reactors(ctx, resourceRef, kind, paginationOpts) {
94
+ return ctx.runQuery(this.component.queries.reactors, {
95
+ resourceRef,
96
+ kind,
97
+ paginationOpts,
98
+ });
99
+ }
100
+ }
101
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AA4EA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,SAAS;IAID;IAHF,YAAY,CAAkC;IAE/D,YACmB,SAA6B,EAC9C,UAA4B,EAAE;QADb,cAAS,GAAT,SAAS,CAAoB;QAG9C,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,CAAC;IACL,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,GAAgB,EAAE,WAAmB;QAC1C,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,WAAW,EAAE,CAAC,CAAC;IACtE,CAAC;IAED,gFAAgF;IAChF,UAAU,CACR,GAAgB,EAChB,SAAiB,EACjB,WAAmB,EACnB,IAAY;QAEZ,OAAO,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,EAAE;YACrD,SAAS;YACT,WAAW;YACX,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,gFAAgF;IAChF,WAAW,CACT,GAAgB,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"}
@@ -0,0 +1,37 @@
1
+ /** Public TypeScript surface for the reactions client. */
2
+ /** A single reaction edge as returned by {@link Reactions.reactors}. */
3
+ export interface ReactionView {
4
+ /** The opaque host subject reference that placed the reaction. */
5
+ authorRef: string;
6
+ /** The opaque host resource reference the reaction is on. */
7
+ resourceRef: string;
8
+ /** The reaction kind (host-defined: an emoji, `"up"`/`"down"`, `"like"`). */
9
+ kind: string;
10
+ /** Absolute ms timestamp the edge was created (server clock). */
11
+ createdAt: number;
12
+ }
13
+ /** A per-kind tally returned by {@link Reactions.counts}. */
14
+ export interface KindCount {
15
+ /** The reaction kind. */
16
+ kind: string;
17
+ /** The number of distinct subjects that reacted with this kind. */
18
+ count: number;
19
+ }
20
+ /** The outcome of a toggle {@link Reactions.react} call. */
21
+ export interface ReactResult {
22
+ /** Whether the subject now holds the edge (true after add, false after remove). */
23
+ reacted: boolean;
24
+ /** Which side of the toggle ran. */
25
+ action: "added" | "removed";
26
+ }
27
+ /** Construction options for the {@link Reactions} client. */
28
+ export interface ReactionsOptions {
29
+ /**
30
+ * Optional allowlist of permitted reaction `kind` values. When set, `react`
31
+ * and `unreact` throw before calling the component if `kind` is not in the
32
+ * list — the host pins its reaction vocabulary (e.g. `["up", "down"]` or a
33
+ * fixed emoji set). Omit to accept any freeform `kind`.
34
+ */
35
+ allowedKinds?: readonly string[];
36
+ }
37
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAE1D,wEAAwE;AACxE,MAAM,WAAW,YAAY;IAC3B,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,WAAW,EAAE,MAAM,CAAC;IACpB,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,iEAAiE;IACjE,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,6DAA6D;AAC7D,MAAM,WAAW,SAAS;IACxB,yBAAyB;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,mEAAmE;IACnE,KAAK,EAAE,MAAM,CAAC;CACf;AAED,4DAA4D;AAC5D,MAAM,WAAW,WAAW;IAC1B,mFAAmF;IACnF,OAAO,EAAE,OAAO,CAAC;IACjB,oCAAoC;IACpC,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;CAC7B;AAED,6DAA6D;AAC7D,MAAM,WAAW,gBAAgB;IAC/B;;;;;OAKG;IACH,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CAClC"}
@@ -0,0 +1,3 @@
1
+ /** Public TypeScript surface for the reactions client. */
2
+ export {};
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/client/types.ts"],"names":[],"mappings":"AAAA,0DAA0D"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Generated `api` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type * as mutations from "../mutations.js";
10
+ import type * as queries from "../queries.js";
11
+ import type * as validators from "../validators.js";
12
+ import type { ApiFromModules, FilterApi, FunctionReference } from "convex/server";
13
+ declare const fullApi: ApiFromModules<{
14
+ mutations: typeof mutations;
15
+ queries: typeof queries;
16
+ validators: typeof validators;
17
+ }>;
18
+ /**
19
+ * A utility for referencing Convex functions in your app's public API.
20
+ *
21
+ * Usage:
22
+ * ```js
23
+ * const myFunctionReference = api.myModule.myFunction;
24
+ * ```
25
+ */
26
+ export declare const api: FilterApi<typeof fullApi, FunctionReference<any, "public">>;
27
+ /**
28
+ * A utility for referencing Convex functions in your app's internal API.
29
+ *
30
+ * Usage:
31
+ * ```js
32
+ * const myFunctionReference = internal.myModule.myFunction;
33
+ * ```
34
+ */
35
+ export declare const internal: FilterApi<typeof fullApi, FunctionReference<any, "internal">>;
36
+ export declare const components: {};
37
+ export {};
38
+ //# sourceMappingURL=api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,KAAK,OAAO,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,KAAK,UAAU,MAAM,kBAAkB,CAAC;AAEpD,OAAO,KAAK,EACV,cAAc,EACd,SAAS,EACT,iBAAiB,EAClB,MAAM,eAAe,CAAC;AAGvB,QAAA,MAAM,OAAO,EAAE,cAAc,CAAC;IAC5B,SAAS,EAAE,OAAO,SAAS,CAAC;IAC5B,OAAO,EAAE,OAAO,OAAO,CAAC;IACxB,UAAU,EAAE,OAAO,UAAU,CAAC;CAC/B,CAAiB,CAAC;AAEnB;;;;;;;GAOG;AACH,eAAO,MAAM,GAAG,EAAE,SAAS,CACzB,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,QAAQ,CAAC,CACjB,CAAC;AAElB;;;;;;;GAOG;AACH,eAAO,MAAM,QAAQ,EAAE,SAAS,CAC9B,OAAO,OAAO,EACd,iBAAiB,CAAC,GAAG,EAAE,UAAU,CAAC,CACnB,CAAC;AAElB,eAAO,MAAM,UAAU,EAAqC,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `api` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ import { anyApi, componentsGeneric } from "convex/server";
11
+ const fullApi = anyApi;
12
+ /**
13
+ * A utility for referencing Convex functions in your app's public API.
14
+ *
15
+ * Usage:
16
+ * ```js
17
+ * const myFunctionReference = api.myModule.myFunction;
18
+ * ```
19
+ */
20
+ export const api = anyApi;
21
+ /**
22
+ * A utility for referencing Convex functions in your app's internal API.
23
+ *
24
+ * Usage:
25
+ * ```js
26
+ * const myFunctionReference = internal.myModule.myFunction;
27
+ * ```
28
+ */
29
+ export const internal = anyApi;
30
+ export const components = componentsGeneric();
31
+ //# sourceMappingURL=api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api.js","sourceRoot":"","sources":["../../../src/component/_generated/api.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG;AAWH,OAAO,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAE1D,MAAM,OAAO,GAIR,MAAa,CAAC;AAEnB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,GAAG,GAGZ,MAAa,CAAC;AAElB;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,QAAQ,GAGjB,MAAa,CAAC;AAElB,MAAM,CAAC,MAAM,UAAU,GAAG,iBAAiB,EAAmB,CAAC"}
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Generated `ComponentApi` utility.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { FunctionReference } from "convex/server";
10
+ /**
11
+ * A utility for referencing a Convex component's exposed API.
12
+ *
13
+ * Useful when expecting a parameter like `components.myComponent`.
14
+ * Usage:
15
+ * ```ts
16
+ * async function myFunction(ctx: QueryCtx, component: ComponentApi) {
17
+ * return ctx.runQuery(component.someFile.someQuery, { ...args });
18
+ * }
19
+ * ```
20
+ */
21
+ export type ComponentApi<Name extends string | undefined = string | undefined> = {
22
+ mutations: {
23
+ react: FunctionReference<"mutation", "internal", {
24
+ authorRef: string;
25
+ kind: string;
26
+ resourceRef: string;
27
+ }, {
28
+ action: "added" | "removed";
29
+ reacted: boolean;
30
+ }, Name>;
31
+ unreact: FunctionReference<"mutation", "internal", {
32
+ authorRef: string;
33
+ kind: string;
34
+ resourceRef: string;
35
+ }, boolean, Name>;
36
+ };
37
+ queries: {
38
+ counts: FunctionReference<"query", "internal", {
39
+ resourceRef: string;
40
+ }, Array<{
41
+ count: number;
42
+ kind: string;
43
+ }>, Name>;
44
+ hasReacted: FunctionReference<"query", "internal", {
45
+ authorRef: string;
46
+ kind: string;
47
+ resourceRef: string;
48
+ }, boolean, Name>;
49
+ myReactions: FunctionReference<"query", "internal", {
50
+ authorRef: string;
51
+ resourceRef: string;
52
+ }, Array<string>, Name>;
53
+ reactors: FunctionReference<"query", "internal", {
54
+ kind: string;
55
+ paginationOpts: {
56
+ cursor: string | null;
57
+ endCursor?: string | null;
58
+ id?: number;
59
+ maximumBytesRead?: number;
60
+ maximumRowsRead?: number;
61
+ numItems: number;
62
+ };
63
+ resourceRef: string;
64
+ }, {
65
+ continueCursor: string;
66
+ isDone: boolean;
67
+ page: Array<{
68
+ authorRef: string;
69
+ createdAt: number;
70
+ kind: string;
71
+ resourceRef: string;
72
+ }>;
73
+ pageStatus?: "SplitRecommended" | "SplitRequired" | null;
74
+ splitCursor?: string | null;
75
+ }, Name>;
76
+ };
77
+ };
78
+ //# sourceMappingURL=component.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAEvD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,YAAY,CAAC,IAAI,SAAS,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,IAC3E;IACE,SAAS,EAAE;QACT,KAAK,EAAE,iBAAiB,CACtB,UAAU,EACV,UAAU,EACV;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,EACxD;YAAE,MAAM,EAAE,OAAO,GAAG,SAAS,CAAC;YAAC,OAAO,EAAE,OAAO,CAAA;SAAE,EACjD,IAAI,CACL,CAAC;QACF,OAAO,EAAE,iBAAiB,CACxB,UAAU,EACV,UAAU,EACV;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,EACxD,OAAO,EACP,IAAI,CACL,CAAC;KACH,CAAC;IACF,OAAO,EAAE;QACP,MAAM,EAAE,iBAAiB,CACvB,OAAO,EACP,UAAU,EACV;YAAE,WAAW,EAAE,MAAM,CAAA;SAAE,EACvB,KAAK,CAAC;YAAE,KAAK,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAA;SAAE,CAAC,EACtC,IAAI,CACL,CAAC;QACF,UAAU,EAAE,iBAAiB,CAC3B,OAAO,EACP,UAAU,EACV;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,IAAI,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,EACxD,OAAO,EACP,IAAI,CACL,CAAC;QACF,WAAW,EAAE,iBAAiB,CAC5B,OAAO,EACP,UAAU,EACV;YAAE,SAAS,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,EAC1C,KAAK,CAAC,MAAM,CAAC,EACb,IAAI,CACL,CAAC;QACF,QAAQ,EAAE,iBAAiB,CACzB,OAAO,EACP,UAAU,EACV;YACE,IAAI,EAAE,MAAM,CAAC;YACb,cAAc,EAAE;gBACd,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;gBACtB,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;gBAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;gBACZ,gBAAgB,CAAC,EAAE,MAAM,CAAC;gBAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;gBACzB,QAAQ,EAAE,MAAM,CAAC;aAClB,CAAC;YACF,WAAW,EAAE,MAAM,CAAC;SACrB,EACD;YACE,cAAc,EAAE,MAAM,CAAC;YACvB,MAAM,EAAE,OAAO,CAAC;YAChB,IAAI,EAAE,KAAK,CAAC;gBACV,SAAS,EAAE,MAAM,CAAC;gBAClB,SAAS,EAAE,MAAM,CAAC;gBAClB,IAAI,EAAE,MAAM,CAAC;gBACb,WAAW,EAAE,MAAM,CAAC;aACrB,CAAC,CAAC;YACH,UAAU,CAAC,EAAE,kBAAkB,GAAG,eAAe,GAAG,IAAI,CAAC;YACzD,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;SAC7B,EACD,IAAI,CACL,CAAC;KACH,CAAC;CACH,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated `ComponentApi` utility.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=component.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.js","sourceRoot":"","sources":["../../../src/component/_generated/component.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB;;;;;;;GAOG"}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Generated data model types.
3
+ *
4
+ * THIS CODE IS AUTOMATICALLY GENERATED.
5
+ *
6
+ * To regenerate, run `npx convex dev`.
7
+ * @module
8
+ */
9
+ import type { DataModelFromSchemaDefinition, DocumentByName, TableNamesInDataModel, SystemTableNames } from "convex/server";
10
+ import type { GenericId } from "convex/values";
11
+ import schema from "../schema.js";
12
+ /**
13
+ * The names of all of your Convex tables.
14
+ */
15
+ export type TableNames = TableNamesInDataModel<DataModel>;
16
+ /**
17
+ * The type of a document stored in Convex.
18
+ *
19
+ * @typeParam TableName - A string literal type of the table name (like "users").
20
+ */
21
+ export type Doc<TableName extends TableNames> = DocumentByName<DataModel, TableName>;
22
+ /**
23
+ * An identifier for a document in Convex.
24
+ *
25
+ * Convex documents are uniquely identified by their `Id`, which is accessible
26
+ * on the `_id` field. To learn more, see [Document IDs](https://docs.convex.dev/using/document-ids).
27
+ *
28
+ * Documents can be loaded using `db.get(tableName, id)` in query and mutation functions.
29
+ *
30
+ * IDs are just strings at runtime, but this type can be used to distinguish them from other
31
+ * strings when type checking.
32
+ *
33
+ * @typeParam TableName - A string literal type of the table name (like "users").
34
+ */
35
+ export type Id<TableName extends TableNames | SystemTableNames> = GenericId<TableName>;
36
+ /**
37
+ * A type describing your Convex data model.
38
+ *
39
+ * This type includes information about what tables you have, the type of
40
+ * documents stored in those tables, and the indexes defined on them.
41
+ *
42
+ * This type is used to parameterize methods like `queryGeneric` and
43
+ * `mutationGeneric` to make them type-safe.
44
+ */
45
+ export type DataModel = DataModelFromSchemaDefinition<typeof schema>;
46
+ //# sourceMappingURL=dataModel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataModel.d.ts","sourceRoot":"","sources":["../../../src/component/_generated/dataModel.ts"],"names":[],"mappings":"AACA;;;;;;;GAOG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,cAAc,EACd,qBAAqB,EACrB,gBAAgB,EACjB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,MAAM,MAAM,cAAc,CAAC;AAElC;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,qBAAqB,CAAC,SAAS,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,MAAM,GAAG,CAAC,SAAS,SAAS,UAAU,IAAI,cAAc,CAC5D,SAAS,EACT,SAAS,CACV,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,EAAE,CAAC,SAAS,SAAS,UAAU,GAAG,gBAAgB,IAC5D,SAAS,CAAC,SAAS,CAAC,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,MAAM,SAAS,GAAG,6BAA6B,CAAC,OAAO,MAAM,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /* eslint-disable */
2
+ /**
3
+ * Generated data model types.
4
+ *
5
+ * THIS CODE IS AUTOMATICALLY GENERATED.
6
+ *
7
+ * To regenerate, run `npx convex dev`.
8
+ * @module
9
+ */
10
+ export {};
11
+ //# sourceMappingURL=dataModel.js.map