@vllnt/convex-invitations 0.1.0 → 0.1.1-canary.009f81e
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 +117 -0
- package/README.md +444 -80
- package/dist/client/index.d.ts +9 -7
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +9 -7
- package/dist/client/index.js.map +1 -1
- package/dist/client/types.d.ts +7 -4
- package/dist/client/types.d.ts.map +1 -1
- package/dist/component/convex.config.d.ts +1 -0
- package/dist/component/convex.config.d.ts.map +1 -1
- package/dist/component/convex.config.js +1 -0
- package/dist/component/convex.config.js.map +1 -1
- package/dist/component/crons.js +1 -1
- package/dist/component/crons.js.map +1 -1
- package/dist/component/guards.d.ts +7 -0
- package/dist/component/guards.d.ts.map +1 -0
- package/dist/component/guards.js +23 -0
- package/dist/component/guards.js.map +1 -0
- package/dist/component/legacyToken.d.ts +4 -2
- package/dist/component/legacyToken.d.ts.map +1 -1
- package/dist/component/legacyToken.js +2 -0
- package/dist/component/legacyToken.js.map +1 -1
- package/dist/component/mutations.d.ts +3 -3
- package/dist/component/mutations.d.ts.map +1 -1
- package/dist/component/mutations.js +29 -10
- package/dist/component/mutations.js.map +1 -1
- package/dist/component/queries.d.ts +1 -1
- package/dist/component/queries.d.ts.map +1 -1
- package/dist/component/queries.js +9 -6
- package/dist/component/queries.js.map +1 -1
- package/dist/component/schema.d.ts +2 -2
- package/dist/component/schema.js +3 -3
- package/dist/component/schema.js.map +1 -1
- package/dist/component/token.d.ts +3 -0
- package/dist/component/token.d.ts.map +1 -1
- package/dist/component/token.js +6 -1
- package/dist/component/token.js.map +1 -1
- package/dist/component/validators.d.ts +7 -4
- package/dist/component/validators.d.ts.map +1 -1
- package/dist/component/validators.js +7 -4
- package/dist/component/validators.js.map +1 -1
- package/dist/shared.d.ts +5 -3
- package/dist/shared.d.ts.map +1 -1
- package/dist/shared.js +5 -3
- package/dist/shared.js.map +1 -1
- package/docs/API.md +320 -0
- package/llms.txt +65 -0
- package/package.json +48 -25
- package/src/client/index.ts +9 -7
- package/src/client/types.ts +7 -4
- package/src/component/convex.config.ts +1 -0
- package/src/component/crons.ts +1 -1
- package/src/component/guards.ts +26 -0
- package/src/component/legacyToken.ts +4 -2
- package/src/component/mutations.ts +25 -10
- package/src/component/queries.ts +9 -7
- package/src/component/schema.ts +3 -3
- package/src/component/token.ts +7 -1
- package/src/component/validators.ts +7 -4
- package/src/shared.ts +5 -3
- package/src/test.ts +9 -2
- package/src/component/migration.test.ts +0 -110
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,117 @@
|
|
|
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
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.1] - 2026-11-28
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
|
|
13
|
+
- `register(t)` from `@vllnt/convex-invitations/test` accepts a `convex-test` instance built from
|
|
14
|
+
any host schema. It was typed to the component's own schema, so `convexTest(hostSchema, modules)`
|
|
15
|
+
failed type-checking with TS2345. Runtime behaviour is unchanged.
|
|
16
|
+
- `issue` rejects an `expiresAt` that is `NaN`, infinite or not in the future (so a `NaN`,
|
|
17
|
+
infinite, zero or negative `ttlMs`) with `ConvexError({ code: "INVALID_ARGUMENT" })`. Previously a
|
|
18
|
+
non-finite expiry produced an invitation that never expired.
|
|
19
|
+
- `issue` rejects an empty `resourceRef`, `inviterRef` or `inviteeRef`, and `accept` an empty
|
|
20
|
+
`acceptedBy`, with `INVALID_ARGUMENT`.
|
|
21
|
+
- `prune` rejects a `NaN` `before` / `retentionBefore` cutoff instead of sweeping every invitation.
|
|
22
|
+
- `getByToken` returns `null` for an empty or over-long token instead of throwing, so reactive UIs
|
|
23
|
+
can call it with a placeholder. Mutations still throw `INVALID_TOKEN`.
|
|
24
|
+
- The published tarball no longer includes the test file.
|
|
25
|
+
- `@vllnt/convex-invitations/test` now type-checks under `moduleResolution: nodenext` (explicit `.js`
|
|
26
|
+
relative imports, Vite client types referenced).
|
|
27
|
+
- The `Parser` and `Invitations` doc comments no longer suggest a Convex `v.*` validator's `.parse`,
|
|
28
|
+
which does not exist; they show a plain `(value: unknown) => T` function.
|
|
29
|
+
|
|
30
|
+
### Changed
|
|
31
|
+
|
|
32
|
+
- Adopt pnpm 10 with a release-age gate; releases are published only from CI with npm trusted
|
|
33
|
+
publishing and provenance. Pin the deepmerge-ts override to 8.0.2.
|
|
34
|
+
- Document the component error codes and how to use `/test` in a consuming app.
|
|
35
|
+
- The npm package now ships `docs/API.md`, `CHANGELOG.md` and `llms.txt`, so the docs under
|
|
36
|
+
`node_modules/@vllnt/convex-invitations/` match the installed version. `llms.txt` links shipped
|
|
37
|
+
files relatively. `pnpm test:package` (run by `pnpm lint`) fails when a required file is missing
|
|
38
|
+
from the tarball.
|
|
39
|
+
- `docs/API.md` lists the package entry points; the README adds a note for coding agents and states
|
|
40
|
+
that no other `@vllnt` package is used with this one in code; `homepage` points at
|
|
41
|
+
https://oss.vllnt.com/packages/convex-invitations.
|
|
42
|
+
- Canary releases publish on every push to `main` that touches the package or its shipped docs,
|
|
43
|
+
with no repository-variable gate. Canaries use the `canary` dist-tag only and never move `latest`.
|
|
44
|
+
- README rewritten for coding agents: when to use it, install, a complete quick start, an API
|
|
45
|
+
table linked to `docs/API.md`, common tasks, an errors-and-fixes table for every error code,
|
|
46
|
+
limits and gotchas, and compatibility. `docs/API.md` documents every export and method with its
|
|
47
|
+
signature, defaults, limits and errors; `llms.txt` carries the same summary and links.
|
|
48
|
+
- `package.json` `description` and `keywords` describe what the package does in search terms.
|
|
49
|
+
- TSDoc summaries on every public export; the `Invitations` class links its package page with
|
|
50
|
+
`@see`. A doc comment no longer describes delegating tokens or memberships to other packages.
|
|
51
|
+
- `pnpm test:package` packs and installs the package, checks the README, `docs/API.md` and
|
|
52
|
+
`llms.txt` against a docs contract (`scripts/check-documentation.mjs`), type-checks every README
|
|
53
|
+
example against convex 1.45.0 and runs the README test example under Vitest.
|
|
54
|
+
- `pnpm typecheck:tests` also type-checks `src/test.ts` under `moduleResolution: nodenext`.
|
|
55
|
+
- `package.json` `engines.node` is `>=20.0.0`, the oldest Node.js any supported convex version
|
|
56
|
+
runs on (convex 1.45 to 1.48 need 20, 1.49 and later need 22). It said `>=18`.
|
|
57
|
+
|
|
58
|
+
## [0.1.0] - 2026-09-01
|
|
59
|
+
|
|
60
|
+
### Added
|
|
61
|
+
|
|
62
|
+
- First release of `@vllnt/convex-invitations` — the invite → accept → expire
|
|
63
|
+
flow as a Convex component.
|
|
64
|
+
- `issue(resourceRef, { role?, inviterRef?, inviteeRef?, payload?, ttlMs?,
|
|
65
|
+
expiresAt? })` records a `pending` invitation and returns its single-use
|
|
66
|
+
`token` (to deliver out of band) plus its absolute `expiresAt`; the token must
|
|
67
|
+
be unique.
|
|
68
|
+
- `accept(token, acceptedBy)` consumes the invite (single-use, `pending →
|
|
69
|
+
accepted`) and returns the grant (`resourceRef` + opaque `role`/`payload`) the
|
|
70
|
+
host applies; two racing accepts yield exactly one winner.
|
|
71
|
+
- `revoke(token)` cancels a still-`pending` invite; `peek(token)` reads with
|
|
72
|
+
read-time TTL enforcement (flips a stale pending invite to `expired`);
|
|
73
|
+
`getByToken(token)` is a pure reactive read; `listPending(resourceRef,
|
|
74
|
+
paginationOpts)` and `listByResourceState` page an org's invites.
|
|
75
|
+
- Single-use + terminal states are final: accepting or revoking an `accepted`/
|
|
76
|
+
`revoked`/`expired` invite is rejected with a coded `ConvexError`, so a replayed
|
|
77
|
+
link can never double-grant.
|
|
78
|
+
- TTL enforced on read: accepting a past-`expiresAt` invite is rejected with
|
|
79
|
+
`EXPIRED` (a thrown accept does not persist a flip — `peek`/the cron sweep
|
|
80
|
+
`pending → expired` instead).
|
|
81
|
+
- Server-sourced time: every handler stamps `createdAt`/`acceptedAt`/`revokedAt`
|
|
82
|
+
from `Date.now()` inside the mutation — no caller-supplied clock.
|
|
83
|
+
- Typed generics: `Invitations<TRole, TPayload>` with optional `roleValidator` /
|
|
84
|
+
`payloadValidator` host parsers narrowing the opaque stored `role`/`payload` at
|
|
85
|
+
the client boundary on write and read — no `v.any()` dump, no unchecked cast.
|
|
86
|
+
Configurable `ttlMs` and `generateToken`.
|
|
87
|
+
- Bounded, self-rescheduling `prune` (retention delete of terminal invites +
|
|
88
|
+
TTL sweep of stale pending invites) plus a built-in daily prune cron
|
|
89
|
+
(`crons.ts`); idempotent. Default TTL 7 days, default retention 30 days.
|
|
90
|
+
- Mount-safe: correct under multiple `app.use(component, { name })` mounts — each
|
|
91
|
+
instance is sandboxed, the cron is registered per instance.
|
|
92
|
+
- Minimal stage: the invite (including its token) is modelled self-contained; a
|
|
93
|
+
later version delegates the hashed token to `@vllnt/convex-tokens` and the
|
|
94
|
+
granted membership to `@vllnt/convex-memberships`.
|
|
95
|
+
|
|
96
|
+
### Breaking
|
|
97
|
+
|
|
98
|
+
- Pending/history list pages now return token-free `InvitationMetadata` projections. Consumers that
|
|
99
|
+
previously read `page[].token` must retain the one-time `issue()` result for delivery and use
|
|
100
|
+
`peek(token)` / `getByToken(token)` for direct token lookup.
|
|
101
|
+
|
|
102
|
+
### Fixed
|
|
103
|
+
|
|
104
|
+
- Apply the documented 30-day default retention window to terminal invitations instead of
|
|
105
|
+
deleting them on the next daily sweep.
|
|
106
|
+
- Reject invalid prune batch sizes to prevent infinite self-scheduling and oversized transactions.
|
|
107
|
+
- Store only SHA-256 invitation-token digests and remove bearer tokens from pending/history list
|
|
108
|
+
projections; raw tokens are returned only when issued and accepted only for direct lookup.
|
|
109
|
+
- Migrate pre-upgrade raw bearer tokens opportunistically on mutation and through a bounded daily
|
|
110
|
+
backfill while preserving direct lookup and duplicate detection during the transition.
|
|
111
|
+
|
|
112
|
+
### Changed
|
|
113
|
+
|
|
114
|
+
- Treat Convex `_generated` output as CLI-owned, exclude it from formatting, and expose a
|
|
115
|
+
dedicated codegen script.
|
|
116
|
+
- Refresh all direct dependencies to their latest compatible releases for canary validation.
|
|
117
|
+
- Require `convex@^1.45.0` and update `convex-test` to `^0.0.56`.
|