@vllnt/convex-invitations 0.1.0 → 0.1.1-canary.1aa2276

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 (44) hide show
  1. package/CHANGELOG.md +98 -0
  2. package/README.md +156 -50
  3. package/dist/client/index.d.ts +5 -2
  4. package/dist/client/index.d.ts.map +1 -1
  5. package/dist/client/index.js +5 -2
  6. package/dist/client/index.js.map +1 -1
  7. package/dist/client/types.d.ts +7 -4
  8. package/dist/client/types.d.ts.map +1 -1
  9. package/dist/component/crons.js +1 -1
  10. package/dist/component/crons.js.map +1 -1
  11. package/dist/component/guards.d.ts +7 -0
  12. package/dist/component/guards.d.ts.map +1 -0
  13. package/dist/component/guards.js +23 -0
  14. package/dist/component/guards.js.map +1 -0
  15. package/dist/component/legacyToken.d.ts +2 -2
  16. package/dist/component/legacyToken.d.ts.map +1 -1
  17. package/dist/component/mutations.d.ts +3 -3
  18. package/dist/component/mutations.d.ts.map +1 -1
  19. package/dist/component/mutations.js +29 -10
  20. package/dist/component/mutations.js.map +1 -1
  21. package/dist/component/queries.d.ts +1 -1
  22. package/dist/component/queries.d.ts.map +1 -1
  23. package/dist/component/queries.js +9 -6
  24. package/dist/component/queries.js.map +1 -1
  25. package/dist/component/schema.js +1 -1
  26. package/dist/component/schema.js.map +1 -1
  27. package/dist/component/token.d.ts +1 -0
  28. package/dist/component/token.d.ts.map +1 -1
  29. package/dist/component/token.js +4 -1
  30. package/dist/component/token.js.map +1 -1
  31. package/docs/API.md +206 -0
  32. package/llms.txt +36 -0
  33. package/package.json +40 -21
  34. package/src/client/index.ts +5 -2
  35. package/src/client/types.ts +7 -4
  36. package/src/component/crons.ts +1 -1
  37. package/src/component/guards.ts +26 -0
  38. package/src/component/legacyToken.ts +2 -2
  39. package/src/component/mutations.ts +25 -10
  40. package/src/component/queries.ts +9 -7
  41. package/src/component/schema.ts +1 -1
  42. package/src/component/token.ts +5 -1
  43. package/src/test.ts +2 -1
  44. package/src/component/migration.test.ts +0 -110
package/CHANGELOG.md ADDED
@@ -0,0 +1,98 @@
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 adheres to
5
+ [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ ## [0.1.1] - Unreleased
8
+
9
+ ### Fixed
10
+
11
+ - `issue` rejects an `expiresAt` that is `NaN`, infinite or not in the future (so a `NaN`,
12
+ infinite, zero or negative `ttlMs`) with `ConvexError({ code: "INVALID_ARGUMENT" })`. Previously a
13
+ non-finite expiry produced an invitation that never expired.
14
+ - `issue` rejects an empty `resourceRef`, `inviterRef` or `inviteeRef`, and `accept` an empty
15
+ `acceptedBy`, with `INVALID_ARGUMENT`.
16
+ - `prune` rejects a `NaN` `before` / `retentionBefore` cutoff instead of sweeping every invitation.
17
+ - `getByToken` returns `null` for an empty or over-long token instead of throwing, so reactive UIs
18
+ can call it with a placeholder. Mutations still throw `INVALID_TOKEN`.
19
+ - The published tarball no longer includes the test file.
20
+ - `@vllnt/convex-invitations/test` now type-checks under `moduleResolution: nodenext` (explicit `.js`
21
+ relative imports, Vite client types referenced).
22
+ - The `Parser` and `Invitations` doc comments no longer suggest a Convex `v.*` validator's `.parse`,
23
+ which does not exist; they show a plain `(value: unknown) => T` function.
24
+
25
+ ### Changed
26
+
27
+ - Adopt pnpm 10 with a release-age gate; releases are published only from CI with npm trusted
28
+ publishing and provenance. Pin the deepmerge-ts override to 8.0.2.
29
+ - Document the component error codes and how to use `/test` in a consuming app.
30
+ - The npm package now ships `docs/API.md`, `CHANGELOG.md` and `llms.txt`, so the docs under
31
+ `node_modules/@vllnt/convex-invitations/` match the installed version. `llms.txt` links shipped
32
+ files relatively. `pnpm test:package` (run by `pnpm lint`) fails when a required file is missing
33
+ from the tarball.
34
+ - `docs/API.md` lists the package entry points; the README adds a note for coding agents and a
35
+ related-packages section; `homepage` points at https://oss.vllnt.com/packages/convex-invitations.
36
+ - Canary releases publish on every push to `main` that touches the package or its shipped docs,
37
+ with no repository-variable gate. Canaries use the `canary` dist-tag only and never move `latest`.
38
+
39
+ ## [0.1.0] - 2026-09-01
40
+
41
+ ### Added
42
+
43
+ - First release of `@vllnt/convex-invitations` — the invite → accept → expire
44
+ flow as a Convex component.
45
+ - `issue(resourceRef, { role?, inviterRef?, inviteeRef?, payload?, ttlMs?,
46
+ expiresAt? })` records a `pending` invitation and returns its single-use
47
+ `token` (to deliver out of band) plus its absolute `expiresAt`; the token must
48
+ be unique.
49
+ - `accept(token, acceptedBy)` consumes the invite (single-use, `pending →
50
+ accepted`) and returns the grant (`resourceRef` + opaque `role`/`payload`) the
51
+ host applies; two racing accepts yield exactly one winner.
52
+ - `revoke(token)` cancels a still-`pending` invite; `peek(token)` reads with
53
+ read-time TTL enforcement (flips a stale pending invite to `expired`);
54
+ `getByToken(token)` is a pure reactive read; `listPending(resourceRef,
55
+ paginationOpts)` and `listByResourceState` page an org's invites.
56
+ - Single-use + terminal states are final: accepting or revoking an `accepted`/
57
+ `revoked`/`expired` invite is rejected with a coded `ConvexError`, so a replayed
58
+ link can never double-grant.
59
+ - TTL enforced on read: accepting a past-`expiresAt` invite is rejected with
60
+ `EXPIRED` (a thrown accept does not persist a flip — `peek`/the cron sweep
61
+ `pending → expired` instead).
62
+ - Server-sourced time: every handler stamps `createdAt`/`acceptedAt`/`revokedAt`
63
+ from `Date.now()` inside the mutation — no caller-supplied clock.
64
+ - Typed generics: `Invitations<TRole, TPayload>` with optional `roleValidator` /
65
+ `payloadValidator` host parsers narrowing the opaque stored `role`/`payload` at
66
+ the client boundary on write and read — no `v.any()` dump, no unchecked cast.
67
+ Configurable `ttlMs` and `generateToken`.
68
+ - Bounded, self-rescheduling `prune` (retention delete of terminal invites +
69
+ TTL sweep of stale pending invites) plus a built-in daily prune cron
70
+ (`crons.ts`); idempotent. Default TTL 7 days, default retention 30 days.
71
+ - Mount-safe: correct under multiple `app.use(component, { name })` mounts — each
72
+ instance is sandboxed, the cron is registered per instance.
73
+ - Minimal stage: the invite (including its token) is modelled self-contained; a
74
+ later version delegates the hashed token to `@vllnt/convex-tokens` and the
75
+ granted membership to `@vllnt/convex-memberships`.
76
+
77
+ ### Breaking
78
+
79
+ - Pending/history list pages now return token-free `InvitationMetadata` projections. Consumers that
80
+ previously read `page[].token` must retain the one-time `issue()` result for delivery and use
81
+ `peek(token)` / `getByToken(token)` for direct token lookup.
82
+
83
+ ### Fixed
84
+
85
+ - Apply the documented 30-day default retention window to terminal invitations instead of
86
+ deleting them on the next daily sweep.
87
+ - Reject invalid prune batch sizes to prevent infinite self-scheduling and oversized transactions.
88
+ - Store only SHA-256 invitation-token digests and remove bearer tokens from pending/history list
89
+ projections; raw tokens are returned only when issued and accepted only for direct lookup.
90
+ - Migrate pre-upgrade raw bearer tokens opportunistically on mutation and through a bounded daily
91
+ backfill while preserving direct lookup and duplicate detection during the transition.
92
+
93
+ ### Changed
94
+
95
+ - Treat Convex `_generated` output as CLI-owned, exclude it from formatting, and expose a
96
+ dedicated codegen script.
97
+ - Refresh all direct dependencies to their latest compatible releases for canary validation.
98
+ - Require `convex@^1.45.0` and update `convex-test` to `^0.0.56`.
package/README.md CHANGED
@@ -1,4 +1,5 @@
1
1
  <!-- Badges -->
2
+
2
3
  [![convex-component](https://img.shields.io/badge/convex-component-EE342F.svg)](https://www.convex.dev/components)
3
4
  [![npm](https://img.shields.io/npm/v/@vllnt/convex-invitations.svg)](https://www.npmjs.com/package/@vllnt/convex-invitations)
4
5
  [![CI](https://github.com/vllnt/convex-invitations/actions/workflows/ci.yml/badge.svg)](https://github.com/vllnt/convex-invitations/actions/workflows/ci.yml)
@@ -14,31 +15,45 @@ const { token } = await invites.issue(ctx, orgId, { role: "member" }); // host d
14
15
  const grant = await invites.accept(ctx, token, userId); // single-use; host applies grant
15
16
  ```
16
17
 
17
- A host mutation issues a single-use, expiring invitation to an opaque resource and
18
- gets back a token to deliver out of band; the invitee redeems it with `accept`,
19
- which consumes the invite and returns the grant the host applies. Domain-neutral: a
20
- game guild invite, a SaaS workspace invite, a publication contributor invite.
18
+ A host mutation issues a single-use, expiring invitation to an opaque resource
19
+ and gets back a token to deliver out of band; the invitee redeems it with
20
+ `accept`, which consumes the invite and returns the grant the host applies.
21
+ Domain-neutral: a game guild invite, a SaaS workspace invite, a publication
22
+ contributor invite.
21
23
 
22
24
  ## Features
23
25
 
24
- - **Issue-and-deliver** — `issue` inserts a `pending` invite, returns a single-use `token` + `expiresAt`; the host delivers it (never sends email).
25
- - **Single-use accept** — `accept` consumes the invite and returns the grant (`resourceRef` + opaque `role`/`payload`) the host applies.
26
- - **Terminal states are final** — `accepted`/`revoked`/`expired` are terminal; a replayed link can never double-grant.
27
- - **TTL + expiry** — every invite carries an `expiresAt`; accepting past-TTL is rejected; a daily cron and `peek` sweep stale invites.
28
- - **Revoke** — `revoke` cancels a still-`pending` invite; a revoke racing an accept yields exactly one winner.
29
- - **Poll or subscribe** — `getByToken`, `listPending`, and `listByResourceState` page invites reactively in Convex.
30
- - **Typed, opaque host data** — `Invitations<TRole, TPayload>` with optional `roleValidator`/`payloadValidator` at the boundary; server-sourced time.
31
- - **Bounded prune + cron, mount-safe** — a daily cron expires + prunes in idempotent batches; correct under multiple named mounts.
26
+ - **Issue-and-deliver** — `issue` inserts a `pending` invite, returns a
27
+ single-use `token` + `expiresAt`; the host delivers it (never sends email).
28
+ - **Single-use accept** — `accept` consumes the invite and returns the grant
29
+ (`resourceRef` + opaque `role`/`payload`) the host applies.
30
+ - **Terminal states are final** — `accepted`/`revoked`/`expired` are terminal; a
31
+ replayed link can never double-grant.
32
+ - **TTL + expiry** — every invite carries an `expiresAt`; accepting past-TTL is
33
+ rejected; a daily cron and `peek` sweep stale invites.
34
+ - **Revoke** — `revoke` cancels a still-`pending` invite; a revoke racing an
35
+ accept yields exactly one winner.
36
+ - **Poll or subscribe** — `getByToken` reads one invite; `listPending` and
37
+ `listByResourceState` page token-free metadata reactively.
38
+ - **Typed, opaque host data** — `Invitations<TRole, TPayload>` with optional
39
+ `roleValidator`/`payloadValidator` at the boundary; server-sourced time.
40
+ - **Bounded prune + cron, mount-safe** — a daily cron expires + prunes in
41
+ idempotent batches; correct under multiple named mounts.
32
42
 
33
43
  ## Installation
34
44
 
35
45
  ```bash
36
- pnpm add @vllnt/convex-invitations
46
+ pnpm add @vllnt/convex-invitations convex@^1.45.0
37
47
  ```
38
48
 
39
- Peer dependency: `convex@^1.41.0`.
49
+ Peer dependency: `convex@^1.45.0`. The `canary` dist-tag tracks `main`.
50
+
51
+ ## Quick start
40
52
 
41
- ## Usage
53
+ After mounting, run `pnpm exec convex dev` to generate `components.invitations`.
54
+ These internal functions are for trusted server callers. Public wrappers must
55
+ authorize issuance, resolve the accepting identity, and apply the returned grant
56
+ in the same host mutation.
42
57
 
43
58
  ```ts
44
59
  // convex/convex.config.ts
@@ -53,53 +68,90 @@ export default app;
53
68
  ```ts
54
69
  // convex/invites.ts — host owns auth, the resource meaning, and delivery.
55
70
  import { components } from "./_generated/api";
56
- import { mutation } from "./_generated/server";
71
+ import { internalMutation } from "./_generated/server";
57
72
  import { v } from "convex/values";
58
73
  import { Invitations } from "@vllnt/convex-invitations";
59
74
 
60
- const invites = new Invitations<"admin" | "member", never>(components.invitations, {
61
- ttlMs: 1000 * 60 * 60 * 24 * 3, // 3-day links
62
- roleValidator: v.union(v.literal("admin"), v.literal("member")).parse,
63
- });
75
+ const invites = new Invitations<"admin" | "member", never>(
76
+ components.invitations,
77
+ {
78
+ ttlMs: 1000 * 60 * 60 * 24 * 3, // 3-day links
79
+ roleValidator: (value) => {
80
+ if (value !== "admin" && value !== "member")
81
+ throw new Error("Invalid role");
82
+ return value;
83
+ },
84
+ },
85
+ );
64
86
 
65
87
  // Issue: record the invite, return the token to deliver.
66
- export const invite = mutation({
67
- args: { orgId: v.string(), role: v.union(v.literal("admin"), v.literal("member")) },
88
+ export const invite = internalMutation({
89
+ args: {
90
+ orgId: v.string(),
91
+ role: v.union(v.literal("admin"), v.literal("member")),
92
+ },
68
93
  handler: async (ctx, { orgId, role }) => {
69
94
  const { token } = await invites.issue(ctx, orgId, { role }); // host gates the caller first
70
95
  return { token }; // host emails `https://app/join?token=${token}`
71
96
  },
72
97
  });
73
98
 
74
- // Accept: consume the invite, apply the grant (write your own membership).
75
- export const join = mutation({
76
- args: { token: v.string() },
77
- handler: async (ctx, { token }) => {
78
- const me = await currentUser(ctx); // host resolves identity
79
- const grant = await invites.accept(ctx, token, me);
80
- await ctx.db.insert("memberships", { orgId: grant.resourceRef, userId: me, role: grant.role });
81
- },
99
+ // Accept: return the grant to a trusted host mutation, which writes its membership.
100
+ export const accept = internalMutation({
101
+ args: { token: v.string(), acceptedBy: v.string() },
102
+ handler: (ctx, { token, acceptedBy }) =>
103
+ invites.accept(ctx, token, acceptedBy),
82
104
  });
83
105
  ```
84
106
 
85
- Client options: `new Invitations(component, { ttlMs?, generateToken?, roleValidator?, payloadValidator? })`.
107
+ Client options:
108
+ `new Invitations(component, { ttlMs?, generateToken?, roleValidator?, payloadValidator? })`.
86
109
 
87
110
  ## API Reference
88
111
 
89
- | Method | Kind | Result |
90
- |--------|------|--------|
91
- | `issue(ctx, resourceRef, opts?)` | mutation | `{ token, expiresAt }` (`opts`: `{ role?; inviterRef?; inviteeRef?; payload?; ttlMs?; expiresAt? }`) |
92
- | `accept(ctx, token, acceptedBy)` | mutation | `InvitationGrant` (`{ resourceRef; role?; payload? }`) |
93
- | `revoke(ctx, token)` | mutation | `null` |
94
- | `peek(ctx, token)` | mutation | `InvitationView \| null` (read-time TTL enforcement) |
95
- | `getByToken(ctx, token)` | query | `InvitationView \| null` (pure reactive read) |
96
- | `listPending(ctx, resourceRef, paginationOpts)` | query | `PaginationResult<InvitationView>` |
97
- | `listByResourceState(ctx, resourceRef, state, paginationOpts)` | query | `PaginationResult<InvitationView>` |
98
- | `prune(ctx, opts?)` | mutation | `number` (invites touched in the first bounded pass) |
112
+ | Method | Kind | Result |
113
+ | -------------------------------------------------------------- | -------- | ---------------------------------------------------------------------------------------------------- |
114
+ | `issue(ctx, resourceRef, opts?)` | mutation | `{ token, expiresAt }` (`opts`: `{ role?; inviterRef?; inviteeRef?; payload?; ttlMs?; expiresAt? }`) |
115
+ | `accept(ctx, token, acceptedBy)` | mutation | `InvitationGrant` (`{ resourceRef; role?; payload? }`) |
116
+ | `revoke(ctx, token)` | mutation | `null` |
117
+ | `peek(ctx, token)` | mutation | `InvitationView \| null` (read-time TTL enforcement) |
118
+ | `getByToken(ctx, token)` | query | `InvitationView \| null` (pure reactive read) |
119
+ | `listPending(ctx, resourceRef, paginationOpts)` | query | `PaginationResult<InvitationMetadata>` (no token) |
120
+ | `listByResourceState(ctx, resourceRef, state, paginationOpts)` | query | `PaginationResult<InvitationMetadata>` (no token) |
121
+ | `migrateLegacyTokens(ctx, batch?)` | mutation | `number` (rows migrated in the first pass) |
122
+ | `prune(ctx, opts?)` | mutation | `number` (invites touched in the first bounded pass) |
99
123
 
100
124
  Full reference: [docs/API.md](docs/API.md).
101
125
 
102
- ## React
126
+ ## Options and limitations
127
+
128
+ - Constructor options are `ttlMs` (default 7 days), `generateToken` (default
129
+ `crypto.randomUUID`), and host parsers `roleValidator`/`payloadValidator`.
130
+ Parsers return typed values or throw; Convex `v.*` validators do not have
131
+ `.parse`.
132
+ - New rows store only a SHA-256 token digest. `issue` returns the raw token;
133
+ `peek`/`getByToken` echo the token already supplied by the caller. Lists
134
+ expose neither raw token nor digest and cannot recover a token for
135
+ resend/revoke.
136
+ - Upgrading legacy storage: call `invites.migrateLegacyTokens(ctx)` from a
137
+ trusted host mutation to hash/remove old raw tokens. Batch defaults to 50
138
+ (integer 1–100), self-reschedules, and also runs daily; lookups remain
139
+ compatible during migration.
140
+ - `getByToken` and list queries report stored state; expired links can still
141
+ appear pending until `peek` or the cron expires them. `accept` rejects expiry
142
+ without persisting a state change.
143
+ - `issue` rejects an empty `resourceRef`/`inviterRef`/`inviteeRef`, and an
144
+ `expiresAt` that is not finite or not in the future (`INVALID_ARGUMENT`);
145
+ `accept` rejects an empty `acceptedBy`. `getByToken` returns `null` for an
146
+ empty or over-long token.
147
+ - `inviteeRef` is metadata, not an enforced recipient binding. The host must
148
+ check recipient identity and resource permissions before acceptance.
149
+ - Terminal retention defaults to 30 days from `createdAt`, not acceptance time.
150
+ Custom prune calls do not reconfigure the daily cron.
151
+ - Mount separately with `app.use(invitations, { name: "guestInvites" })` and
152
+ `new Invitations(components.guestInvites)`.
153
+
154
+ ## Integrations
103
155
 
104
156
  Backend-only — no `./react` entry. An invite-management surface is an ordinary
105
157
  reactive `useQuery` over the host's own re-exported `getByToken` / `listPending`
@@ -107,9 +159,16 @@ refs; the token is delivered by the host, never revealed in a client component.
107
159
 
108
160
  ## Security
109
161
 
110
- - **Auth-agnostic** — the host authenticates the caller, decides who may issue/accept/revoke, and owns token delivery; tables are sandboxed.
111
- - **Single-use + server-sourced time** — terminal states are final (no double-grant); TTL is enforced on read; timestamps come from `Date.now()`, never the caller.
112
- - **Opaque host data** — `resourceRef`/`role`/`payload` are opaque, narrowed only by the optional host validators at the client boundary.
162
+ - **Auth-agnostic** — the host authenticates the caller, decides who may
163
+ issue/accept/revoke, and owns token delivery; tables are sandboxed.
164
+ - **Single-use + server-sourced time** — terminal states are final (no
165
+ double-grant); TTL is enforced on read; timestamps come from `Date.now()`,
166
+ never the caller.
167
+ - **Bearer tokens** — keep tokens out of logs and analytics, use secure
168
+ delivery, and keep custom generators unpredictable. Hashing at rest does not
169
+ protect a leaked link.
170
+ - **Opaque host data** — `resourceRef`/`role`/`payload` are opaque, narrowed
171
+ only by the optional host validators at the client boundary.
113
172
 
114
173
  See [docs/API.md](docs/API.md).
115
174
 
@@ -120,20 +179,67 @@ pnpm test # single run
120
179
  pnpm test:coverage # enforced 100% on covered files
121
180
  ```
122
181
 
123
- Tests run against the real component runtime via `convex-test` (`@edge-runtime/vm`), not mocks.
182
+ Tests run against the real component runtime via `convex-test`
183
+ (`@edge-runtime/vm`), not mocks.
184
+
185
+ ### Testing your app
186
+
187
+ `@vllnt/convex-invitations/test` exports `register(t, name = "invitations")` to
188
+ mount the component in a `convex-test` instance. It needs `convex-test` and
189
+ `vitest` (with Vite's `import.meta.glob`) in the consuming app:
190
+
191
+ ```ts
192
+ /// <reference types="vite/client" />
193
+ import { convexTest } from "convex-test";
194
+ import { register } from "@vllnt/convex-invitations/test";
195
+ import schema from "./schema";
196
+
197
+ const t = convexTest(schema, import.meta.glob("./**/*.ts"));
198
+ register(t);
199
+ ```
200
+
201
+ ## Documentation
202
+
203
+ [API reference](docs/API.md) · [LLM index](llms.txt) · [Changelog](CHANGELOG.md)
204
+ ·
205
+ [Security policy](https://github.com/vllnt/convex-invitations/blob/main/SECURITY.md)
206
+
207
+ ### For coding agents
208
+
209
+ The npm package bundles its docs at
210
+ `node_modules/@vllnt/convex-invitations/docs/`, next to `llms.txt`, `README.md`,
211
+ `CHANGELOG.md` and the TypeScript source in `src/`. They match the installed
212
+ version. Read them before writing code against this package.
213
+
214
+ ## Related packages
215
+
216
+ - [`@vllnt/convex-memberships`](https://www.npmjs.com/package/@vllnt/convex-memberships)
217
+ — a membership and relationship graph. Use it to persist the grant `accept`
218
+ returns; this component holds no membership.
219
+ - [`@vllnt/convex-permissions`](https://www.npmjs.com/package/@vllnt/convex-permissions)
220
+ — role-based access control. Use it to decide who may issue, accept or revoke
221
+ an invite.
222
+ - [`@vllnt/convex-tokens`](https://www.npmjs.com/package/@vllnt/convex-tokens) —
223
+ hashed secret tokens with mint-once, TTL, revoke and scope. Use it for a
224
+ standalone secret; use this package when the secret is an invitation to a
225
+ resource that is accepted once.
124
226
 
125
227
  ## Contributing
126
228
 
127
- See [CONTRIBUTING.md](CONTRIBUTING.md).
229
+ See
230
+ [CONTRIBUTING.md](https://github.com/vllnt/convex-invitations/blob/main/CONTRIBUTING.md).
128
231
 
129
232
  ## Author
130
233
 
131
- Built by [bntvllnt](https://github.com/bntvllnt) · [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
132
-
133
- Part of the [@vllnt](https://github.com/vllnt) Convex component fleet — [vllnt.com](https://vllnt.com)
234
+ Built by [bntvllnt](https://github.com/bntvllnt) ·
235
+ [bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
134
236
 
135
237
  If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
136
238
 
137
239
  ## License
138
240
 
139
241
  MIT — see [LICENSE](LICENSE).
242
+
243
+ ---
244
+
245
+ Part of vllnt oss: https://oss.vllnt.com
@@ -114,7 +114,10 @@ interface RunMutationCtx {
114
114
  * ```ts
115
115
  * const invites = new Invitations(components.invitations, {
116
116
  * ttlMs: 1000 * 60 * 60 * 24 * 3, // 3-day links
117
- * roleValidator: v.union(v.literal("admin"), v.literal("member")).parse,
117
+ * roleValidator: (value) => {
118
+ * if (value !== "admin" && value !== "member") throw new Error("Invalid role");
119
+ * return value;
120
+ * },
118
121
  * });
119
122
  * const { token } = await invites.issue(ctx, "org_42", { role: "member", inviterRef: me });
120
123
  * // ... invitee later redeems the link:
@@ -184,7 +187,7 @@ export declare class Invitations<TRole = unknown, TPayload = unknown> {
184
187
  /**
185
188
  * The current view of one invitation by its `token`, or `null` — a pure
186
189
  * reactive read (no write). Reports the stored `state` as-is, so a past-TTL
187
- * invite may still read `pending` until a `peek`/`accept`/cron sweep flips it;
190
+ * invite may still read `pending` until a `peek`/cron sweep flips it;
188
191
  * compare `expiresAt` against the clock, or use {@link peek} for read-time TTL.
189
192
  */
190
193
  getByToken(ctx: RunQueryCtx, token: string): Promise<InvitationView<TRole, TPayload> | null>;
@@ -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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AAQ,CAAC,GAAG,IAAI,CAAC,CAGjD;IAED;;;;OAIG;IACG,WAAW,CACf,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,cAAc,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAMhE;IAED;;;;OAIG;IACG,mBAAmB,CACvB,GAAG,EAAE,WAAW,EAChB,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,eAAe,EACtB,cAAc,EAAE,iBAAiB,GAChC,OAAO,CAAC,gBAAgB,CAAC,kBAAkB,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,CAMhE;CACF;AAED,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,YAAY,EACZ,MAAM,GACP,CAAC"}
@@ -26,7 +26,10 @@ import { DEFAULT_PRUNE_BATCH, DEFAULT_TTL_MS } from "../shared.js";
26
26
  * ```ts
27
27
  * const invites = new Invitations(components.invitations, {
28
28
  * ttlMs: 1000 * 60 * 60 * 24 * 3, // 3-day links
29
- * roleValidator: v.union(v.literal("admin"), v.literal("member")).parse,
29
+ * roleValidator: (value) => {
30
+ * if (value !== "admin" && value !== "member") throw new Error("Invalid role");
31
+ * return value;
32
+ * },
30
33
  * });
31
34
  * const { token } = await invites.issue(ctx, "org_42", { role: "member", inviterRef: me });
32
35
  * // ... invitee later redeems the link:
@@ -156,7 +159,7 @@ export class Invitations {
156
159
  /**
157
160
  * The current view of one invitation by its `token`, or `null` — a pure
158
161
  * reactive read (no write). Reports the stored `state` as-is, so a past-TTL
159
- * invite may still read `pending` until a `peek`/`accept`/cron sweep flips it;
162
+ * invite may still read `pending` until a `peek`/cron sweep flips it;
160
163
  * compare `expiresAt` against the clock, or use {@link peek} for read-time TTL.
161
164
  */
162
165
  async getByToken(ctx, token) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","s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,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,mBAAmB,EAC1C,EAAE,WAAW,EAAE,KAAK,EAAE,cAAc,EAAE,CACvC,CAAC;QACF,OAAO,EAAE,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;IAC3E,CAAC;CACF"}
@@ -4,8 +4,9 @@ export type InvitationState = "pending" | "accepted" | "revoked" | "expired";
4
4
  /**
5
5
  * Validates and narrows an opaque stored value to a host type `T` at the client
6
6
  * boundary. Receives the raw value the component returned (`unknown`) and MUST
7
- * return a typed `T` or throw. A `convex/values` validator's `.parse` (or a Zod
8
- * `.parse`) fits directly; omit it to keep the value unvalidated.
7
+ * return a typed `T` or throw. A Zod schema's `.parse` fits directly; Convex
8
+ * `v.*` validators have no `.parse`, so wrap a check in a function instead. Omit
9
+ * it to keep the value unvalidated.
9
10
  *
10
11
  * @typeParam T - The host's stored type (invitation `role` or `payload`).
11
12
  */
@@ -82,12 +83,14 @@ export interface InvitationsOptions<TRole, TPayload> {
82
83
  /**
83
84
  * Validates/narrows a stored `role` to `TRole` at the boundary — applied to the
84
85
  * `role` passed into `issue` (before storage) and the `role` returned by
85
- * `getByToken`/`accept`. Throws on a mismatch. Omit to leave roles unvalidated.
86
+ * `accept`/`peek`/`getByToken`/`listPending`/`listByResourceState`. Throws on a
87
+ * mismatch. Omit to leave roles unvalidated.
86
88
  */
87
89
  roleValidator?: Parser<TRole>;
88
90
  /**
89
91
  * Validates/narrows a stored `payload` to `TPayload` at the boundary — applied
90
- * to the `payload` passed into `issue` and returned by `getByToken`/`accept`.
92
+ * to the `payload` passed into `issue` and returned by
93
+ * `accept`/`peek`/`getByToken`/`listPending`/`listByResourceState`.
91
94
  * Throws on a mismatch. Omit to leave payloads unvalidated.
92
95
  */
93
96
  payloadValidator?: Parser<TPayload>;
@@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IACnB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wFAAwF;IACxF,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,+DAA+D;AAC/D,MAAM,WAAW,kBAAkB,CAAC,KAAK,EAAE,QAAQ;IACjD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,MAAM,CAAC;IAC7B;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC;IAC9B;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC,CAAC;CACrC"}
@@ -1,5 +1,5 @@
1
1
  import { cronJobs } from "convex/server";
2
- import { api } from "./_generated/api";
2
+ import { api } from "./_generated/api.js";
3
3
  /**
4
4
  * Default sweep cadence and page size for the built-in prune cron. The cron is
5
5
  * the component's own self-healing safety net — it expires stale `pending`
@@ -1 +1 @@
1
- {"version":3,"file":"crons.js","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAEvC;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,EAAE,EAAW,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,KAAK,CAAC,QAAQ,CACZ,mCAAmC,EACnC,cAAc,EACd,GAAG,CAAC,SAAS,CAAC,mBAAmB,EACjC,EAAE,CACH,CAAC;AAEF,KAAK,CAAC,QAAQ,CAAC,mBAAmB,EAAE,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;IACvE,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
1
+ {"version":3,"file":"crons.js","sourceRoot":"","sources":["../../src/component/crons.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AACzC,OAAO,EAAE,GAAG,EAAE,MAAM,qBAAqB,CAAC;AAE1C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,KAAK,EAAE,EAAE,EAAW,CAAC;AAErD,uEAAuE;AACvE,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,CAAC;AAE/B,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;AAEzB,KAAK,CAAC,QAAQ,CACZ,mCAAmC,EACnC,cAAc,EACd,GAAG,CAAC,SAAS,CAAC,mBAAmB,EACjC,EAAE,CACH,CAAC;AAEF,KAAK,CAAC,QAAQ,CAAC,mBAAmB,EAAE,cAAc,EAAE,GAAG,CAAC,SAAS,CAAC,KAAK,EAAE;IACvE,KAAK,EAAE,WAAW;CACnB,CAAC,CAAC;AAEH,eAAe,KAAK,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Reject an empty host-supplied reference (`resourceRef`, `acceptedBy`, ...). */
2
+ export declare function requireNonEmpty(name: string, value: string): void;
3
+ /** Reject NaN and +/-Infinity where a concrete timestamp is required. */
4
+ export declare function requireFiniteTime(name: string, value: number): void;
5
+ /** Reject NaN; an infinite cutoff is a deliberate "everything" bound. */
6
+ export declare function requireNotNaN(name: string, value: number): void;
7
+ //# sourceMappingURL=guards.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.d.ts","sourceRoot":"","sources":["../../src/component/guards.ts"],"names":[],"mappings":"AAMA,kFAAkF;AAClF,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAIjE;AAED,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAInE;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAI/D"}
@@ -0,0 +1,23 @@
1
+ import { ConvexError } from "convex/values";
2
+ function invalidArgument(message) {
3
+ return new ConvexError({ code: "INVALID_ARGUMENT", message });
4
+ }
5
+ /** Reject an empty host-supplied reference (`resourceRef`, `acceptedBy`, ...). */
6
+ export function requireNonEmpty(name, value) {
7
+ if (value.length === 0) {
8
+ throw invalidArgument(`${name} must not be empty`);
9
+ }
10
+ }
11
+ /** Reject NaN and +/-Infinity where a concrete timestamp is required. */
12
+ export function requireFiniteTime(name, value) {
13
+ if (!Number.isFinite(value)) {
14
+ throw invalidArgument(`${name} must be a finite number`);
15
+ }
16
+ }
17
+ /** Reject NaN; an infinite cutoff is a deliberate "everything" bound. */
18
+ export function requireNotNaN(name, value) {
19
+ if (Number.isNaN(value)) {
20
+ throw invalidArgument(`${name} must not be NaN`);
21
+ }
22
+ }
23
+ //# sourceMappingURL=guards.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"guards.js","sourceRoot":"","sources":["../../src/component/guards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAE5C,SAAS,eAAe,CAAC,OAAe;IACtC,OAAO,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,kFAAkF;AAClF,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,KAAa;IACzD,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,eAAe,CAAC,GAAG,IAAI,oBAAoB,CAAC,CAAC;IACrD,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,iBAAiB,CAAC,IAAY,EAAE,KAAa;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,eAAe,CAAC,GAAG,IAAI,0BAA0B,CAAC,CAAC;IAC3D,CAAC;AACH,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,IAAY,EAAE,KAAa;IACvD,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC;QACxB,MAAM,eAAe,CAAC,GAAG,IAAI,kBAAkB,CAAC,CAAC;IACnD,CAAC;AACH,CAAC"}
@@ -1,5 +1,5 @@
1
- import type { Doc } from "./_generated/dataModel";
2
- import type { MutationCtx, QueryCtx } from "./_generated/server";
1
+ import type { Doc } from "./_generated/dataModel.js";
2
+ import type { MutationCtx, QueryCtx } from "./_generated/server.js";
3
3
  export declare function migrateLegacyToken(db: MutationCtx["db"], invite: Doc<"invitations">, tokenHash: string): Promise<Doc<"invitations">>;
4
4
  export declare function withLegacyTokenFallback(db: QueryCtx["db"], hashed: Doc<"invitations"> | null, token: string): Promise<Doc<"invitations"> | null>;
5
5
  //# sourceMappingURL=legacyToken.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legacyToken.d.ts","sourceRoot":"","sources":["../../src/component/legacyToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEjE,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,EACrB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAI7B;AAED,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAClB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAMpC"}
1
+ {"version":3,"file":"legacyToken.d.ts","sourceRoot":"","sources":["../../src/component/legacyToken.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wBAAsB,kBAAkB,CACtC,EAAE,EAAE,WAAW,CAAC,IAAI,CAAC,EACrB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,EAC1B,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,CAAC,CAI7B;AAED,wBAAsB,uBAAuB,CAC3C,EAAE,EAAE,QAAQ,CAAC,IAAI,CAAC,EAClB,MAAM,EAAE,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,EACjC,KAAK,EAAE,MAAM,GACZ,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,GAAG,IAAI,CAAC,CAMpC"}
@@ -74,9 +74,9 @@ export declare const revoke: import("convex/server").RegisteredMutation<"public"
74
74
  /**
75
75
  * The current view of one invitation by its `token`, or `null` if no such
76
76
  * invite is held. Lives in `mutations.ts` (not `queries.ts`) because it flips a
77
- * `pending` invite found past its TTL to `expired` before returning — the same
78
- * read-time TTL enforcement `accept` does, so a status check never reports a
79
- * stale invite as still open.
77
+ * `pending` invite found past its TTL to `expired` before returning — unlike
78
+ * `accept`, which rejects a stale invite but cannot persist the flip — so a
79
+ * status check never reports a stale invite as still open.
80
80
  */
81
81
  export declare const peek: import("convex/server").RegisteredMutation<"public", {
82
82
  token: string;
@@ -1 +1 @@
1
- {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAWA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;GA0ChB,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,mBAAmB;;mBAwC9B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM;;;;;;;GAgDjB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM;;iBA2BjB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;UAqBf,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK;;;;mBA2EhB,CAAC"}
1
+ {"version":3,"file":"mutations.d.ts","sourceRoot":"","sources":["../../src/component/mutations.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,KAAK;;;;;;;;;;;GAqDhB,CAAC;AAEH,mFAAmF;AACnF,eAAO,MAAM,mBAAmB;;mBAwC9B,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM;;;;;;;GAiDjB,CAAC;AAEH;;;;;;;;;;GAUG;AACH,eAAO,MAAM,MAAM;;iBA2BjB,CAAC;AAEH;;;;;;GAMG;AACH,eAAO,MAAM,IAAI;;;;;;;;;;;;;;;UAqBf,CAAC;AAEH;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,KAAK;;;;mBA6EhB,CAAC"}