@vllnt/convex-helpers 0.2.0 → 0.2.1-canary.2c46b84
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 +53 -5
- package/NOTICE +1 -1
- package/README.md +57 -25
- package/dist/builders.d.ts +3 -3
- package/dist/builders.js +3 -3
- package/dist/validators.d.ts +6 -7
- package/dist/validators.d.ts.map +1 -1
- package/dist/validators.js +11 -7
- package/dist/validators.js.map +1 -1
- package/docs/API.md +39 -21
- package/llms.txt +25 -12
- package/package.json +14 -15
- package/src/builders.ts +3 -3
- package/src/validators.ts +10 -7
- package/docs/READINESS.md +0 -175
package/CHANGELOG.md
CHANGED
|
@@ -8,6 +8,52 @@ and this project adheres to
|
|
|
8
8
|
|
|
9
9
|
## [Unreleased]
|
|
10
10
|
|
|
11
|
+
## [0.2.1] - 2026-11-27
|
|
12
|
+
|
|
13
|
+
### Fixed
|
|
14
|
+
|
|
15
|
+
- `./validators`: `validate` and `parse` reject arrays and class instances
|
|
16
|
+
(`Date`, `Map`, ...) for `v.record(...)` validators, as Convex and
|
|
17
|
+
`convex-helpers` 0.1.130+ do. They were accepted, and `parse` turned an array
|
|
18
|
+
into an object. The error reads `` Expected `record`, got `Array` ``.
|
|
19
|
+
- Shipped docs and source comments no longer name repository-only files (proof
|
|
20
|
+
scripts, tests, the vitest config, maintainer publication notes) without a
|
|
21
|
+
GitHub link.
|
|
22
|
+
|
|
23
|
+
### Added
|
|
24
|
+
|
|
25
|
+
- The npm package now states that its bundled docs (`docs/API.md`, `README.md`,
|
|
26
|
+
`CHANGELOG.md`, `llms.txt`) match the installed version: a "For coding agents"
|
|
27
|
+
note in the README and `llms.txt`, relative `llms.txt` links to the shipped
|
|
28
|
+
files, an Ecosystem link and a Related packages section. `docs/API.md` now
|
|
29
|
+
lists the exported types of each entry.
|
|
30
|
+
- `pnpm check:package` (run by `pnpm lint`) fails when the tarball misses a
|
|
31
|
+
required doc file or ships contributor or internal files; when a relative link
|
|
32
|
+
or `#anchor` in any shipped Markdown doc does not resolve inside it (inline
|
|
33
|
+
links with or without a title, reference definitions and HTML `href`/`src`;
|
|
34
|
+
code is ignored); or when a shipped file names a repository file that is not
|
|
35
|
+
packed. A test keeps `docs/API.md` in step with every entry's exports and
|
|
36
|
+
checks that the docs name no internal type.
|
|
37
|
+
|
|
38
|
+
### Changed
|
|
39
|
+
|
|
40
|
+
- `./builders` and `./validators` parity baseline is now `convex-helpers`
|
|
41
|
+
0.1.136 (`customFunctions` is unchanged since 0.1.124). Upstream now also
|
|
42
|
+
treats inherited names such as `constructor` as unknown object fields, so that
|
|
43
|
+
is no longer a difference; the `db` option remains refused.
|
|
44
|
+
- The tarball no longer ships
|
|
45
|
+
[`docs/READINESS.md`](https://github.com/vllnt/convex-helpers/blob/main/docs/READINESS.md)
|
|
46
|
+
(maintainer publication notes). `homepage` is now
|
|
47
|
+
https://oss.vllnt.com/packages/convex-helpers.
|
|
48
|
+
- Tooling: every push to `main` touching the package publishes a canary (no
|
|
49
|
+
repository-variable gate), and docs-only changes now trigger it.
|
|
50
|
+
- Development dependencies: `convex` 1.51.0, `convex-test` 0.0.73, `vitest` and
|
|
51
|
+
`@vitest/coverage-v8` 5.1.1, `@vllnt/typescript` 3.0.0 (with
|
|
52
|
+
`exactOptionalPropertyTypes` left off so the published types do not change),
|
|
53
|
+
pnpm 10.34.9. The peer ranges are unchanged; the tests and a type-check of a
|
|
54
|
+
consumer of the packed package pass at their minimums (`convex` 1.45.0,
|
|
55
|
+
`@modelcontextprotocol/sdk` 1.29.0, `zod` 4.3.6).
|
|
56
|
+
|
|
11
57
|
## [0.2.0] - 2026-11-26
|
|
12
58
|
|
|
13
59
|
### Fixed
|
|
@@ -28,7 +74,8 @@ and this project adheres to
|
|
|
28
74
|
- Reject MCP query `timeout` values that are negative, `NaN`, infinite or above
|
|
29
75
|
2147483647 ms; they previously fired immediately and failed the call.
|
|
30
76
|
- Patch development Handlebars, Vite/esbuild and deepmerge-ts advisory paths;
|
|
31
|
-
document the remaining minimatch tooling advisory in
|
|
77
|
+
document the remaining minimatch tooling advisory in
|
|
78
|
+
[`docs/READINESS.md`](https://github.com/vllnt/convex-helpers/blob/main/docs/READINESS.md).
|
|
32
79
|
|
|
33
80
|
- Convert MCP `int64` and `bytes` inputs to native Convex values and serialize
|
|
34
81
|
native Convex results with lossless tagged JSON.
|
|
@@ -57,10 +104,11 @@ and this project adheres to
|
|
|
57
104
|
|
|
58
105
|
### Added
|
|
59
106
|
|
|
60
|
-
- `scripts/better-auth-proof.mjs
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
107
|
+
- [`scripts/better-auth-proof.mjs`](https://github.com/vllnt/convex-helpers/blob/main/scripts/better-auth-proof.mjs)
|
|
108
|
+
(repository only): local, cloud-free proof that real Better Auth sessions
|
|
109
|
+
(anonymous plugin and email/password) issue JWTs whose issuer, subject and
|
|
110
|
+
anonymous claims `./identity` accepts on a real Convex backend, and that
|
|
111
|
+
tampered, foreign-issuer and expired tokens are rejected.
|
|
64
112
|
- `./builders` — `customQuery` / `customMutation` / `customAction` / `customCtx`
|
|
65
113
|
with the signatures and runtime behaviour of
|
|
66
114
|
`convex-helpers/server/customFunctions` 0.1.124, held by a convex-test parity
|
package/NOTICE
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Copyright (c) 2026 bntvllnt. Licensed under the MIT License (see LICENSE).
|
|
3
3
|
|
|
4
4
|
The ./builders and ./validators entry points follow the public API, runtime
|
|
5
|
-
behaviour and type signatures of convex-helpers 0.1.
|
|
5
|
+
behaviour and type signatures of convex-helpers 0.1.136
|
|
6
6
|
(https://github.com/get-convex/convex-helpers), Copyright Convex, Inc.,
|
|
7
7
|
licensed under the Apache License, Version 2.0, reproduced below. The
|
|
8
8
|
implementation in src/builders.ts and src/validators.ts was written for this
|
package/README.md
CHANGED
|
@@ -21,7 +21,15 @@ host-`ctx` glue that run with the host's `ctx` — no own tables, no `app.use()`
|
|
|
21
21
|
mounting. Stateful concerns (rate limiting, idempotency, flags) belong in
|
|
22
22
|
`@convex-dev/*` or `@vllnt/convex-*` components.
|
|
23
23
|
|
|
24
|
-
See [ROADMAP.md](
|
|
24
|
+
See [ROADMAP.md](https://github.com/vllnt/convex-helpers/blob/main/ROADMAP.md)
|
|
25
|
+
(in the repository) for the planned module surface.
|
|
26
|
+
|
|
27
|
+
## For coding agents
|
|
28
|
+
|
|
29
|
+
The npm package bundles its docs at `node_modules/@vllnt/convex-helpers/docs/`
|
|
30
|
+
(`API.md`), next to `README.md`, `CHANGELOG.md` and `llms.txt`. They match the
|
|
31
|
+
installed version. Read them before writing code that uses this package. Type
|
|
32
|
+
declarations are in `dist/` and the TypeScript source is in `src/`.
|
|
25
33
|
|
|
26
34
|
## Features
|
|
27
35
|
|
|
@@ -52,11 +60,12 @@ See [ROADMAP.md](./ROADMAP.md) for the planned module surface.
|
|
|
52
60
|
pnpm add @vllnt/convex-helpers
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
|
|
56
|
-
`./builders` and `./validators`
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
Modules marked **planned** are
|
|
63
|
+
On GitHub this README describes `main`; the copy in each npm version describes
|
|
64
|
+
that version. `./better-auth`, `./identity`, `./builders` and `./validators`
|
|
65
|
+
first ship in `0.2.0`; `0.1.0` has only the root utilities and `./mcp`. Builds
|
|
66
|
+
of `main` are published to the `canary` dist-tag; canary tags move, so pin the
|
|
67
|
+
resolved version and test before production use. Modules marked **planned** are
|
|
68
|
+
not exported yet.
|
|
60
69
|
|
|
61
70
|
`convex@^1.45.0` is a peer dependency:
|
|
62
71
|
|
|
@@ -173,7 +182,7 @@ cross-site cookies.
|
|
|
173
182
|
### Custom functions — `./builders`
|
|
174
183
|
|
|
175
184
|
Resolve shared context once for every function made with a builder. The
|
|
176
|
-
signatures match `convex-helpers/server/customFunctions` (0.1.
|
|
185
|
+
signatures match `convex-helpers/server/customFunctions` (0.1.136), so switching
|
|
177
186
|
is an import-path change.
|
|
178
187
|
|
|
179
188
|
```ts
|
|
@@ -222,8 +231,8 @@ const userDoc = doc(schema, "users"); // table validator + _id + _creationTime
|
|
|
222
231
|
The `db` option of `convex-helpers` (checking which table a `v.id` belongs to)
|
|
223
232
|
is refused; `v.id` checks that the value is a string. Object fields are matched
|
|
224
233
|
as own properties, so inherited names such as `constructor` count as unknown
|
|
225
|
-
fields
|
|
226
|
-
[docs/API.md](docs/API.md#validators-shipped).
|
|
234
|
+
fields, and records reject arrays and class instances such as `Date` or `Map`.
|
|
235
|
+
See [docs/API.md](docs/API.md#validators-shipped).
|
|
227
236
|
|
|
228
237
|
### Identity — `./identity`
|
|
229
238
|
|
|
@@ -290,40 +299,63 @@ pnpm test:coverage # must reach 100%
|
|
|
290
299
|
```
|
|
291
300
|
|
|
292
301
|
Tests use [vitest](https://vitest.dev) with the node environment. 100% coverage
|
|
293
|
-
is enforced via
|
|
294
|
-
**convex-test mocks**. Two
|
|
295
|
-
Convex backend (no cloud
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
[
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
is enforced via the repository's vitest coverage thresholds. Identity
|
|
303
|
+
integration tests use **convex-test mocks**. Two local scripts in the repository
|
|
304
|
+
(not in the npm package) run against a real anonymous Convex backend (no cloud
|
|
305
|
+
account):
|
|
306
|
+
[`scripts/local-identity-proof.mjs`](https://github.com/vllnt/convex-helpers/blob/main/scripts/local-identity-proof.mjs)
|
|
307
|
+
(16 concurrent bootstrap mutations with a synthetic identity, one row; tests
|
|
308
|
+
indexed OCC, not login) and
|
|
309
|
+
[`scripts/better-auth-proof.mjs`](https://github.com/vllnt/convex-helpers/blob/main/scripts/better-auth-proof.mjs)
|
|
310
|
+
(real Better Auth sign-in, anonymous and email/password, then the issued JWTs
|
|
311
|
+
sent to Convex functions that use `./identity` and `./better-auth`; see
|
|
312
|
+
[docs/READINESS.md](https://github.com/vllnt/convex-helpers/blob/main/docs/READINESS.md#real-better-auth-loginjwt-proof)
|
|
313
|
+
for versions and assertions). Consuming apps must verify their own auth
|
|
314
|
+
integration independently.
|
|
303
315
|
|
|
304
316
|
## Documentation and security
|
|
305
317
|
|
|
306
318
|
- [API reference](./docs/API.md) · [LLM index](./llms.txt) ·
|
|
307
319
|
[Changelog](./CHANGELOG.md)
|
|
308
|
-
- [Security policy and private reporting](
|
|
320
|
+
- [Security policy and private reporting](https://github.com/vllnt/convex-helpers/blob/main/SECURITY.md)
|
|
309
321
|
- [Issues](https://github.com/vllnt/convex-helpers/issues) for non-sensitive
|
|
310
322
|
bugs
|
|
311
323
|
|
|
312
324
|
## Contributing
|
|
313
325
|
|
|
314
|
-
See
|
|
315
|
-
|
|
326
|
+
See
|
|
327
|
+
[CONTRIBUTING.md](https://github.com/vllnt/convex-helpers/blob/main/CONTRIBUTING.md)
|
|
328
|
+
for development setup, code style, and PR guidelines.
|
|
329
|
+
|
|
330
|
+
## Related packages
|
|
331
|
+
|
|
332
|
+
- [`convex-helpers`](https://www.npmjs.com/package/convex-helpers) — the
|
|
333
|
+
official helpers. `./builders` and `./validators` follow its signatures; use
|
|
334
|
+
it for everything this package does not cover.
|
|
335
|
+
- [`@convex-dev/better-auth`](https://www.npmjs.com/package/@convex-dev/better-auth)
|
|
336
|
+
— the Better Auth component. `./better-auth` only builds origin and cookie
|
|
337
|
+
settings to pass to it.
|
|
338
|
+
- [`@vllnt/convex-api-keys`](https://oss.vllnt.com/packages/convex-api-keys) —
|
|
339
|
+
stores, validates and revokes API keys. Use it behind `./mcp` `auth.validate`
|
|
340
|
+
when keys must be issued and revoked at runtime.
|
|
341
|
+
- [`@vllnt/convex-idempotency`](https://oss.vllnt.com/packages/convex-idempotency)
|
|
342
|
+
and the other `@vllnt/convex-*` components — stateful concerns (own tables,
|
|
343
|
+
`app.use()`), which this package leaves out.
|
|
344
|
+
- [`@vllnt/logger`](https://oss.vllnt.com/packages/logger) — structured logging.
|
|
345
|
+
This package logs nothing; hosts own observability.
|
|
346
|
+
- `@vllnt/convex-mcp` — deprecated; its code now ships as `./mcp` here.
|
|
316
347
|
|
|
317
348
|
## Author
|
|
318
349
|
|
|
319
350
|
Built by [bntvllnt](https://github.com/bntvllnt) ·
|
|
320
351
|
[bntvllnt.com](https://bntvllnt.com) · [X @bntvllnt](https://x.com/bntvllnt)
|
|
321
352
|
|
|
322
|
-
Part of the [@vllnt](https://github.com/vllnt) Convex component fleet —
|
|
323
|
-
[vllnt.com](https://vllnt.com)
|
|
324
|
-
|
|
325
353
|
If this is useful, [sponsor the work](https://github.com/sponsors/bntvllnt).
|
|
326
354
|
|
|
327
355
|
## License
|
|
328
356
|
|
|
329
357
|
[MIT](./LICENSE)
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
Part of vllnt oss: https://oss.vllnt.com
|
package/dist/builders.d.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* with them gets extra `ctx` fields (and optionally consumes extra args), e.g.
|
|
5
5
|
* an authenticated user resolved once in a shared `input`.
|
|
6
6
|
*
|
|
7
|
-
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.
|
|
7
|
+
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.136
|
|
8
8
|
* (Apache-2.0, see NOTICE): same signatures and runtime behaviour for
|
|
9
9
|
* `customQuery`, `customMutation`, `customAction` and `customCtx`; the
|
|
10
10
|
* `CustomBuilder`, `Customization` and `Registration` types follow upstream's.
|
|
11
11
|
* Unlike upstream, a customization must supply both `args` and `input` (the
|
|
12
|
-
* types already require them).
|
|
13
|
-
*
|
|
12
|
+
* types already require them). The repository's parity tests run both side
|
|
13
|
+
* by side.
|
|
14
14
|
*/
|
|
15
15
|
import type { ActionBuilder, ArgsArrayForOptionalValidator, ArgsArrayToObject, DefaultArgsForOptionalValidator, DefaultFunctionArgs, FunctionVisibility, GenericActionCtx, GenericDataModel, GenericMutationCtx, GenericQueryCtx, MutationBuilder, QueryBuilder, RegisteredAction, RegisteredMutation, RegisteredQuery, ReturnValueForOptionalValidator } from "convex/server";
|
|
16
16
|
import type { GenericValidator, ObjectType, PropertyValidators, Validator } from "convex/values";
|
package/dist/builders.js
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* with them gets extra `ctx` fields (and optionally consumes extra args), e.g.
|
|
5
5
|
* an authenticated user resolved once in a shared `input`.
|
|
6
6
|
*
|
|
7
|
-
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.
|
|
7
|
+
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.136
|
|
8
8
|
* (Apache-2.0, see NOTICE): same signatures and runtime behaviour for
|
|
9
9
|
* `customQuery`, `customMutation`, `customAction` and `customCtx`; the
|
|
10
10
|
* `CustomBuilder`, `Customization` and `Registration` types follow upstream's.
|
|
11
11
|
* Unlike upstream, a customization must supply both `args` and `input` (the
|
|
12
|
-
* types already require them).
|
|
13
|
-
*
|
|
12
|
+
* types already require them). The repository's parity tests run both side
|
|
13
|
+
* by side.
|
|
14
14
|
*/
|
|
15
15
|
import { asObjectValidator, v } from "convex/values";
|
|
16
16
|
/**
|
package/dist/validators.d.ts
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* Runtime checks against Convex validators, and whole-document validators
|
|
4
4
|
* for schema tables.
|
|
5
5
|
*
|
|
6
|
-
* Adapted, with changes, from `convex-helpers/validators` 0.1.
|
|
7
|
-
* (Apache-2.0, see NOTICE): same behaviour for these functions, which
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* supporting it. The `AddFieldsToValidator` type follows upstream's.
|
|
6
|
+
* Adapted, with changes, from `convex-helpers/validators` 0.1.136
|
|
7
|
+
* (Apache-2.0, see NOTICE): same behaviour for these functions, which the
|
|
8
|
+
* repository's parity tests check side by side, plus one fail-closed
|
|
9
|
+
* difference: the runtime check throws on the `db` option, which checks a
|
|
10
|
+
* `v.id`'s table, instead of supporting it. The `AddFieldsToValidator` type
|
|
11
|
+
* follows upstream's.
|
|
13
12
|
*/
|
|
14
13
|
import type { DataModelFromSchemaDefinition, SchemaDefinition, TableNamesInDataModel } from "convex/server";
|
|
15
14
|
import type { GenericId, Infer, ObjectType, PropertyValidators, Validator, VFloat64, VId, VObject } from "convex/values";
|
package/dist/validators.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"validators.d.ts","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EACV,6BAA6B,EAC7B,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,eAAe,CAAC;AACvB,OAAO,KAAK,EACV,SAAS,EACT,KAAK,EACL,UAAU,EACV,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,GAAG,EACH,OAAO,EACR,MAAM,eAAe,CAAC;AAIvB,4BAA4B;AAC5B,MAAM,MAAM,YAAY,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC;AACpD,KAAK,SAAS,GAAG,gBAAgB,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAGhD,KAAK,MAAM,CAAC,OAAO,IACjB,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACnC;KAAG,GAAG,IAAI,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC;CAAE,GACxC,KAAK,CAAC;AAEZ,qCAAqC;AACrC,MAAM,MAAM,eAAe,GAAG;IAC5B,2DAA2D;IAC3D,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,oEAAoE;IACpE,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF,iFAAiF;AACjF,qBAAa,eAAgB,SAAQ,KAAK;IAO/B,QAAQ,EAAE,M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CAAC,EAAE,GAAG,SAAS;CACjE,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,GACvB,MAAM,GACN,UAAU,CAAC,YAAY,CAAC,CAC3B,CAAC;AAkBR;;;;;;;;;;;GAWG;AAEH,wBAAgB,GAAG,CACjB,OAAO,SAAS,SAAS,EACzB,UAAU,SAAS,qBAAqB,CACtC,6BAA6B,CAAC,OAAO,CAAC,CACvC,EAED,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,UAAU,GACpB,oBAAoB,CACrB,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,CAAC,WAAW,CAAC,EAC1C,YAAY,CAAC,UAAU,CAAC,CACzB,CAYA"}
|
package/dist/validators.js
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* Runtime checks against Convex validators, and whole-document validators
|
|
4
4
|
* for schema tables.
|
|
5
5
|
*
|
|
6
|
-
* Adapted, with changes, from `convex-helpers/validators` 0.1.
|
|
7
|
-
* (Apache-2.0, see NOTICE): same behaviour for these functions, which
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* supporting it. The `AddFieldsToValidator` type follows upstream's.
|
|
6
|
+
* Adapted, with changes, from `convex-helpers/validators` 0.1.136
|
|
7
|
+
* (Apache-2.0, see NOTICE): same behaviour for these functions, which the
|
|
8
|
+
* repository's parity tests check side by side, plus one fail-closed
|
|
9
|
+
* difference: the runtime check throws on the `db` option, which checks a
|
|
10
|
+
* `v.id`'s table, instead of supporting it. The `AddFieldsToValidator` type
|
|
11
|
+
* follows upstream's.
|
|
13
12
|
*/
|
|
14
13
|
import { v } from "convex/values";
|
|
15
14
|
/** Thrown on a mismatch when called with `throw: true`, and by {@link parse}. */
|
|
@@ -143,6 +142,11 @@ const checkUnion = (validator, value, walk) => {
|
|
|
143
142
|
const checkRecord = (validator, value, walk) => {
|
|
144
143
|
if (typeof value !== "object" || value === null)
|
|
145
144
|
return { expected: "record" };
|
|
145
|
+
// Arrays and class instances (Date, Map, ...) are not records, as in Convex.
|
|
146
|
+
// For a record, the non-plain object's constructor name is what it got.
|
|
147
|
+
const notPlain = plainObjectFailure(value);
|
|
148
|
+
if (notPlain)
|
|
149
|
+
return { expected: "record", got: notPlain.expected };
|
|
146
150
|
const keyValidator = validator.key;
|
|
147
151
|
const entryValidator = validator.value;
|
|
148
152
|
return firstFailure(Object.entries(value), ([key, entry]) => {
|
package/dist/validators.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validators.js","sourceRoot":"","sources":["../src/validators.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiBH,OAAO,EAAE,CAAC,EAAE,MAAM,eAAe,CAAC;AAqBlC,iFAAiF;AACjF,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAO/B,QAAQ;IACR,GAAG;IACH,IAAI;IARb;;;;OAIG;IACH,YACS,QAAgB,EAChB,GAAW,EACX,IAAa;QAEpB,MAAM,KAAK,GAAG,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE,CAAC;QACtE,KAAK,CAAC,kBAAkB,KAAK,gBAAgB,QAAQ,aAAa,GAAG,IAAI,CAAC,CAAC;wBALpE,QAAQ;mBACR,GAAG;oBACH,IAAI;QAIX,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AAeD,SAAS,QAAQ,CAAC,IAAwB,EAAE,GAAW;IACrD,OAAO,IAAI,KAAK,SAAS,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,GAAG,EAAE,CAAC;AACpE,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,KAAK,CAAC;AAChD,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SAAS,CAAC,IAAI,KAAK,OAAO,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CACb,8DAA8D,CAC/D,CAAC;IACJ,CAAC;IACD,MAAM,OAAO,GAAmB,SAAS,CAAC,OAAO,CAAC;IAClD,OAAO,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,gBAAgB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;GAWG;AACH,gJAAgJ;AAChJ,MAAM,UAAU,GAAG,CAMjB,MAAe,EACf,SAAqB;IAKrB,mDAAmD;IACnD,iHAAiH;IACjH,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,aAAa,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC;IACnE,MAAM,MAAM,GAAG,MAAM,CAAC,MAAqD,CAAC;IAC5E,OAAO,gBAAgB,CACpB,MAAM,CAAC,SAAS,CAAiC,CAAC,SAAS,EAC5D,MAAM,CAIP,CAAC;AACJ,CAAC"}
|
package/docs/API.md
CHANGED
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
**Compatibility:** `convex@^1.45.0`; ESM-only.
|
|
4
4
|
|
|
5
|
-
**Availability:** this reference
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
**Availability:** on GitHub this reference describes `main`; the copy shipped at
|
|
6
|
+
`node_modules/@vllnt/convex-helpers/docs/API.md` describes the installed
|
|
7
|
+
version. `./better-auth`, `./identity`, `./builders` and `./validators` first
|
|
8
|
+
ship in `0.2.0`; `0.1.0` has only the root utilities and `./mcp`. See the
|
|
8
9
|
[installation guide](../README.md#installation). Planned modules are not
|
|
9
10
|
exports.
|
|
10
11
|
|
|
@@ -146,13 +147,13 @@ per-instance secret. An `onResourceRead` hook is not provided.
|
|
|
146
147
|
`query(ref, options)` / `mutation(ref, options)` / `action(ref, options)` wrap a
|
|
147
148
|
Convex function reference as a typed `ToolDef`.
|
|
148
149
|
|
|
149
|
-
| Option | Type
|
|
150
|
-
| ------------- |
|
|
151
|
-
| `args` | `ConvexValidator`
|
|
152
|
-
| `description` | `string`
|
|
153
|
-
| `tags` | `Record<string, string>`
|
|
154
|
-
| `timeout` | `number`
|
|
155
|
-
| `onError` | `(ctx) =>
|
|
150
|
+
| Option | Type | Description |
|
|
151
|
+
| ------------- | ------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
152
|
+
| `args` | `ConvexValidator` | A `v.object({...})` validator; converted to the tool's JSON-Schema input. |
|
|
153
|
+
| `description` | `string` | Human/LLM-facing tool description. |
|
|
154
|
+
| `tags` | `Record<string, string>` | Arbitrary metadata. |
|
|
155
|
+
| `timeout` | `number` | Per-call timeout (ms, finite, 0 to 2147483647; 0 disables), supported only for queries. Mutation/action timeouts are rejected because their execution cannot be cancelled safely. |
|
|
156
|
+
| `onError` | `(ctx) => OnCallResult \| undefined \| Promise<OnCallResult \| undefined> \| Promise<void>` | Per-tool error hook. |
|
|
156
157
|
|
|
157
158
|
### resource(ref, options)
|
|
158
159
|
|
|
@@ -164,7 +165,7 @@ authorize inside the backing function. JSON `int64` strings become `bigint`,
|
|
|
164
165
|
base64 `bytes` strings become `ArrayBuffer`, and native Convex results use
|
|
165
166
|
Convex's lossless tagged JSON encoding.
|
|
166
167
|
|
|
167
|
-
###
|
|
168
|
+
### Tool-list pagination
|
|
168
169
|
|
|
169
170
|
`PaginationConfig` opts `tools/list` into cursor pagination. `tools/list`
|
|
170
171
|
**without** a cursor always returns ALL tools (backward-compatible); pagination
|
|
@@ -177,6 +178,14 @@ activates only when the client sends a cursor.
|
|
|
177
178
|
|
|
178
179
|
Cursors are HMAC-signed per server instance and verified in constant time.
|
|
179
180
|
|
|
181
|
+
### Exported types
|
|
182
|
+
|
|
183
|
+
`AuthConfig`, `CallContext`, `ConvexClient`, `ConvexMCPServer` (the
|
|
184
|
+
`{ handler() }` return of `createMCPServer`), `ConvexValidator`, `FunctionType`
|
|
185
|
+
(`"query" | "mutation" | "action"`), `LifecycleHooks`, `OnCallResult`,
|
|
186
|
+
`PaginationConfig`, `ResourceDef`, `ServerConfig`, `ToolDef`, `ToolPage` and
|
|
187
|
+
`ToolSummary`.
|
|
188
|
+
|
|
180
189
|
### Validator utilities
|
|
181
190
|
|
|
182
191
|
| Export | Description |
|
|
@@ -227,6 +236,8 @@ you control. These are syntax helpers, not proof of ownership or CSRF
|
|
|
227
236
|
protection. Returning undefined leaves host/provider defaults in effect; it is
|
|
228
237
|
not a deny-all trusted-origin configuration.
|
|
229
238
|
|
|
239
|
+
Exported type: `CookieSettings` (the return of `cookieSettingsForSite`).
|
|
240
|
+
|
|
230
241
|
```ts
|
|
231
242
|
import {
|
|
232
243
|
cookieSettingsForSite,
|
|
@@ -254,6 +265,9 @@ their own code. The host configures Better Auth and its anonymous plugin.
|
|
|
254
265
|
| `requireFromAuth(ctx, lookup)` | Same row, or `USER_NOT_INITIALIZED` (also for missing session). |
|
|
255
266
|
| `getOrCreateFromAuth(ctx, { lookup, insert })` | Lookup then insert if absent; both callbacks receive subject. |
|
|
256
267
|
| `retargetRows(rows, apply)` | At most 1000 rows, sequential callbacks returning `deleted`, `patched`, or `skipped`; returns counts. Oversized pages reject before callbacks. |
|
|
268
|
+
| `isAnonymousIdentity(identity)` | `true` only for a literal boolean `isAnonymous: true` claim. |
|
|
269
|
+
|
|
270
|
+
Exported types: `AuthCtx` (`{ auth, trustedIssuer }`) and `AuthIdentity`.
|
|
257
271
|
|
|
258
272
|
Race-safe bootstrap requires the same Convex mutation transaction for indexed
|
|
259
273
|
lookup and insert, with every competing creator using that lookup. Remote calls
|
|
@@ -287,7 +301,7 @@ const user = await getOrCreateFromAuth(ctx, {
|
|
|
287
301
|
|
|
288
302
|
Wrap a Convex function builder so every function made with it receives extra
|
|
289
303
|
`ctx` fields and, optionally, consumes extra args. Signatures and runtime
|
|
290
|
-
behaviour match `convex-helpers/server/customFunctions` 0.1.
|
|
304
|
+
behaviour match `convex-helpers/server/customFunctions` 0.1.136; a parity test
|
|
291
305
|
runs both on the same convex-test backend.
|
|
292
306
|
|
|
293
307
|
| Export | Contract |
|
|
@@ -298,6 +312,7 @@ runs both on the same convex-test backend.
|
|
|
298
312
|
| `customCtx(modifyCtx)` | Customization with no args: `modifyCtx(ctx, extra)` returns the ctx fields to add. `extra` holds the definition's keys other than `args`, `handler` and `returns`. |
|
|
299
313
|
| `Customization` | `{ args, input }`. `args` (property validators) are merged into the function's args and taken out of the handler's args; `input(ctx, consumedArgs, extra)` returns `{ ctx, args, onSuccess? }`. `onSuccess` runs after the handler. |
|
|
300
314
|
| `CustomBuilder`, `CustomCtx<Builder>` | Types of a custom builder and of the ctx its handlers receive. |
|
|
315
|
+
| `CustomInput`, `Registration` | Types of the `input` callback's return and of a registered function. |
|
|
301
316
|
|
|
302
317
|
Merging fails with an error when a consumed arg and a function arg share a name
|
|
303
318
|
but not a validator kind, when the function's args validator is neither an
|
|
@@ -313,15 +328,17 @@ declares none. Builders add no authorization of their own.
|
|
|
313
328
|
| `doc(schema, tableName)` | The table's validator plus `_id` and `_creationTime`; union tables get them on every member. Throws for other validator kinds. |
|
|
314
329
|
| `ValidationError` | Has `expected`, `got` and an optional `path`; the message names all three. |
|
|
315
330
|
|
|
316
|
-
|
|
317
|
-
|
|
331
|
+
Exported types: `AnyValidator`, `ValidateOptions`, `SystemFields` and
|
|
332
|
+
`AddFieldsToValidator`.
|
|
318
333
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
334
|
+
Behaviour matches `convex-helpers/validators` 0.1.136 for these exports, held by
|
|
335
|
+
a parity test. Declared object fields are looked up as own properties, so
|
|
336
|
+
inherited names (`constructor`, `toString`, `__proto__`) are unknown fields
|
|
337
|
+
(rejected by a strict `validate`, dropped by `parse`). Records accept only plain
|
|
338
|
+
objects: arrays and class instances such as `Date` or `Map` fail with
|
|
339
|
+
`` Expected `record` ``. One fail-closed difference: the `db` option (checking a
|
|
340
|
+
`v.id`'s table) is refused with an error instead of supported; `v.id` checks for
|
|
341
|
+
a string.
|
|
325
342
|
|
|
326
343
|
`ValidationError.expected` is always a string (upstream passes a literal's raw
|
|
327
344
|
value); messages are identical.
|
|
@@ -329,7 +346,8 @@ value); messages are identical.
|
|
|
329
346
|
## Planned modules
|
|
330
347
|
|
|
331
348
|
The following modules are on the roadmap but not yet shipped. See
|
|
332
|
-
[ROADMAP.md](
|
|
349
|
+
[ROADMAP.md](https://github.com/vllnt/convex-helpers/blob/main/ROADMAP.md) (in
|
|
350
|
+
the repository, not the package) for milestones and exit criteria.
|
|
333
351
|
|
|
334
352
|
| Module | Status | Description |
|
|
335
353
|
| ----------------- | ------------------------ | --------------------------------------------------------- |
|
package/llms.txt
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
Convex backends. It provides pure functions and host-`ctx` glue utilities that run with the host's
|
|
8
8
|
`ctx` — no own tables, no `app.use()` mounting. The library targets `convex@^1.45.0`. Stateful
|
|
9
9
|
concerns (rate limiting, idempotency, flags, etc.) belong in `@convex-dev/*` or `@vllnt/convex-*`
|
|
10
|
-
components. Optional entries: `./better-auth` (trusted origins + HTTPS cookies), `./identity` (`getOrCreateFromAuth` / `retargetRows`), `./builders` (`customQuery` / `customMutation` / `customAction` / `customCtx`, matching `convex-helpers/server/customFunctions`), `./validators` (`validate` / `parse` / `doc`, matching `convex-helpers/validators
|
|
10
|
+
components. Optional entries: `./better-auth` (trusted origins + HTTPS cookies), `./identity` (`getOrCreateFromAuth` / `retargetRows`), `./builders` (`customQuery` / `customMutation` / `customAction` / `customCtx`, matching `convex-helpers/server/customFunctions`), `./validators` (`validate` / `parse` / `doc`, matching `convex-helpers/validators` 0.1.136; it refuses the `db` id-table option), and a tree-shakeable `./mcp` entry exposes Convex functions as Model Context
|
|
11
11
|
Protocol tools (`@vllnt/convex-helpers/mcp`); it needs the optional peer deps
|
|
12
12
|
`@modelcontextprotocol/sdk` and `zod`, so backend-only consumers pull neither.
|
|
13
13
|
|
|
@@ -23,25 +23,38 @@ are not CSRF protection. Existing identity integration tests use convex-test moc
|
|
|
23
23
|
not real Better Auth or backend OCC proof. Errors/env/tracing remain planned. Builders add no authorization: the host's
|
|
24
24
|
`input` decides who may call.
|
|
25
25
|
|
|
26
|
+
## For coding agents
|
|
27
|
+
|
|
28
|
+
This package ships its docs: `node_modules/@vllnt/convex-helpers/docs/API.md`,
|
|
29
|
+
`README.md`, `CHANGELOG.md` and this `llms.txt`. They match the installed version.
|
|
30
|
+
Read them before writing code that uses this package. Type declarations are in
|
|
31
|
+
`dist/` and the TypeScript source is in `src/`.
|
|
32
|
+
|
|
26
33
|
## Release channels
|
|
27
34
|
|
|
28
|
-
|
|
29
|
-
`./validators` first ship in `0.2.0`; `0.1.0` has only the root utilities and `./mcp`. Prereleases are published
|
|
35
|
+
On GitHub this index describes `main`; the copy in each npm version describes that
|
|
36
|
+
version. `./better-auth`, `./identity`, `./builders` and `./validators` first ship in `0.2.0`; `0.1.0` has only the root utilities and `./mcp`. Prereleases are published
|
|
30
37
|
to the `canary` dist-tag; pin and test them before deployment.
|
|
31
38
|
MCP requires optional peers `@modelcontextprotocol/sdk@^1.29.0` and `zod@^4.3.6`;
|
|
32
39
|
the package is ESM-only and requires `convex@^1.45.0`.
|
|
33
40
|
|
|
34
41
|
## Docs
|
|
35
42
|
|
|
36
|
-
- [README](README.md): Project overview, installation, usage examples, and planned surface
|
|
37
|
-
- [API Reference](docs/API.md): Exported utilities, signatures, and compatibility
|
|
38
|
-
- [Changelog](CHANGELOG.md): Version history and release notes
|
|
39
|
-
- [
|
|
40
|
-
- [
|
|
43
|
+
- [README](./README.md): Project overview, installation, usage examples, and planned surface
|
|
44
|
+
- [API Reference](./docs/API.md): Exported utilities, signatures, and compatibility
|
|
45
|
+
- [Changelog](./CHANGELOG.md): Version history and release notes
|
|
46
|
+
- [Notice](./NOTICE): Attribution for the convex-helpers behaviour and types these entries follow
|
|
47
|
+
- [License](./LICENSE): MIT license
|
|
41
48
|
|
|
42
49
|
## Optional
|
|
43
50
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- [
|
|
47
|
-
- [
|
|
51
|
+
Repository files, not in the npm package; they describe `main`.
|
|
52
|
+
|
|
53
|
+
- [Roadmap](https://github.com/vllnt/convex-helpers/blob/main/ROADMAP.md): Planned modules and milestones
|
|
54
|
+
- [Contributing](https://github.com/vllnt/convex-helpers/blob/main/CONTRIBUTING.md): Development setup, validation commands, and release workflow
|
|
55
|
+
- [Security Policy](https://github.com/vllnt/convex-helpers/blob/main/SECURITY.md): Vulnerability reporting policy
|
|
56
|
+
- [Code of Conduct](https://github.com/vllnt/convex-helpers/blob/main/CODE_OF_CONDUCT.md): Community participation guidelines
|
|
57
|
+
|
|
58
|
+
## Ecosystem
|
|
59
|
+
|
|
60
|
+
- [vllnt oss](https://oss.vllnt.com/llms.txt): Index of the vllnt open-source packages on npm
|
package/package.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vllnt/convex-helpers",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1-canary.2c46b84",
|
|
4
4
|
"description": "Typed Convex host-side utilities, trusted-origin and cookie configuration helpers, identity-row glue, and optional MCP tools.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
7
|
-
"packageManager": "pnpm@10.34.
|
|
7
|
+
"packageManager": "pnpm@10.34.9",
|
|
8
8
|
"files": [
|
|
9
9
|
"dist",
|
|
10
10
|
"src",
|
|
11
|
-
"
|
|
12
|
-
"docs",
|
|
11
|
+
"docs/API.md",
|
|
13
12
|
"CHANGELOG.md",
|
|
14
13
|
"NOTICE",
|
|
15
14
|
"llms.txt",
|
|
15
|
+
"!src/**/*.test.*",
|
|
16
16
|
"!src/**/*.spec.*"
|
|
17
17
|
],
|
|
18
18
|
"exports": {
|
|
@@ -49,12 +49,13 @@
|
|
|
49
49
|
"build": "tsc --project ./tsconfig.build.json",
|
|
50
50
|
"typecheck": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck.tsbuildinfo && tsc --noEmit --project tests/tsconfig.json",
|
|
51
51
|
"typecheck:ci": "tsc --noEmit --incremental --tsBuildInfoFile node_modules/.cache/tsc/typecheck-ci.tsbuildinfo --project tsconfig.ci.json && tsc --noEmit --project tests/tsconfig.json",
|
|
52
|
-
"lint": "pnpm check:agents && pnpm check:docs && eslint --cache --cache-location node_modules/.cache/eslint/ .",
|
|
52
|
+
"lint": "pnpm check:agents && pnpm check:docs && pnpm check:package && eslint --cache --cache-location node_modules/.cache/eslint/ .",
|
|
53
53
|
"test": "vitest run --passWithNoTests",
|
|
54
54
|
"test:watch": "vitest --typecheck --clearScreen false",
|
|
55
55
|
"test:coverage": "vitest run --coverage --coverage.reporter=text",
|
|
56
56
|
"generate:llms": "node scripts/generate-llms.mjs",
|
|
57
57
|
"check:docs": "node scripts/check-docs.mjs",
|
|
58
|
+
"check:package": "node scripts/check-package.mjs",
|
|
58
59
|
"preversion": "pnpm install --frozen-lockfile && pnpm build && pnpm test && pnpm typecheck && pnpm generate:llms",
|
|
59
60
|
"check:agents": "node -e \"const f=require('node:fs');if(!f.existsSync('AGENTS.md')||f.existsSync('CLAUDE.md')||f.existsSync('.claude'))process.exit(1)\""
|
|
60
61
|
},
|
|
@@ -75,17 +76,17 @@
|
|
|
75
76
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
76
77
|
"@types/node": "^26.6.6",
|
|
77
78
|
"@typescript/native": "npm:typescript@7.0.2",
|
|
78
|
-
"@vitest/coverage-v8": "^5.1.
|
|
79
|
+
"@vitest/coverage-v8": "^5.1.1",
|
|
79
80
|
"@vllnt/eslint-config": "2.1.0",
|
|
80
|
-
"@vllnt/typescript": "
|
|
81
|
-
"convex": "^1.
|
|
82
|
-
"convex-helpers": "0.1.
|
|
83
|
-
"convex-test": "^0.0.
|
|
81
|
+
"@vllnt/typescript": "3.0.0",
|
|
82
|
+
"convex": "^1.51.0",
|
|
83
|
+
"convex-helpers": "0.1.136",
|
|
84
|
+
"convex-test": "^0.0.73",
|
|
84
85
|
"eslint": "^9.39.5",
|
|
85
86
|
"prettier": "^3.10.1",
|
|
86
87
|
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
87
88
|
"vite": "^8.3.8",
|
|
88
|
-
"vitest": "^5.1.
|
|
89
|
+
"vitest": "^5.1.1",
|
|
89
90
|
"zod": "^4.6.7"
|
|
90
91
|
},
|
|
91
92
|
"pnpm": {
|
|
@@ -94,9 +95,7 @@
|
|
|
94
95
|
"@vllnt/*"
|
|
95
96
|
],
|
|
96
97
|
"overrides": {
|
|
97
|
-
"minimatch@>=7.0.0 <11.0.1": "11.0.
|
|
98
|
-
"hono": "4.13.19",
|
|
99
|
-
"@hono/node-server": "2.1.8",
|
|
98
|
+
"minimatch@>=7.0.0 <11.0.1": "11.0.9",
|
|
100
99
|
"deepmerge-ts@<8.0.0": "8.0.2",
|
|
101
100
|
"handlebars@<4.7.10": "4.7.10"
|
|
102
101
|
},
|
|
@@ -110,7 +109,7 @@
|
|
|
110
109
|
"publishConfig": {
|
|
111
110
|
"access": "public"
|
|
112
111
|
},
|
|
113
|
-
"homepage": "https://
|
|
112
|
+
"homepage": "https://oss.vllnt.com/packages/convex-helpers",
|
|
114
113
|
"bugs": {
|
|
115
114
|
"url": "https://github.com/vllnt/convex-helpers/issues"
|
|
116
115
|
},
|
package/src/builders.ts
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
* with them gets extra `ctx` fields (and optionally consumes extra args), e.g.
|
|
5
5
|
* an authenticated user resolved once in a shared `input`.
|
|
6
6
|
*
|
|
7
|
-
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.
|
|
7
|
+
* Adapted, with changes, from `convex-helpers/server/customFunctions` 0.1.136
|
|
8
8
|
* (Apache-2.0, see NOTICE): same signatures and runtime behaviour for
|
|
9
9
|
* `customQuery`, `customMutation`, `customAction` and `customCtx`; the
|
|
10
10
|
* `CustomBuilder`, `Customization` and `Registration` types follow upstream's.
|
|
11
11
|
* Unlike upstream, a customization must supply both `args` and `input` (the
|
|
12
|
-
* types already require them).
|
|
13
|
-
*
|
|
12
|
+
* types already require them). The repository's parity tests run both side
|
|
13
|
+
* by side.
|
|
14
14
|
*/
|
|
15
15
|
|
|
16
16
|
import type {
|
package/src/validators.ts
CHANGED
|
@@ -3,13 +3,12 @@
|
|
|
3
3
|
* Runtime checks against Convex validators, and whole-document validators
|
|
4
4
|
* for schema tables.
|
|
5
5
|
*
|
|
6
|
-
* Adapted, with changes, from `convex-helpers/validators` 0.1.
|
|
7
|
-
* (Apache-2.0, see NOTICE): same behaviour for these functions, which
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* supporting it. The `AddFieldsToValidator` type follows upstream's.
|
|
6
|
+
* Adapted, with changes, from `convex-helpers/validators` 0.1.136
|
|
7
|
+
* (Apache-2.0, see NOTICE): same behaviour for these functions, which the
|
|
8
|
+
* repository's parity tests check side by side, plus one fail-closed
|
|
9
|
+
* difference: the runtime check throws on the `db` option, which checks a
|
|
10
|
+
* `v.id`'s table, instead of supporting it. The `AddFieldsToValidator` type
|
|
11
|
+
* follows upstream's.
|
|
13
12
|
*/
|
|
14
13
|
|
|
15
14
|
import type {
|
|
@@ -220,6 +219,10 @@ const checkUnion: Checker<"union"> = (validator, value, walk) => {
|
|
|
220
219
|
const checkRecord: Checker<"record"> = (validator, value, walk) => {
|
|
221
220
|
if (typeof value !== "object" || value === null)
|
|
222
221
|
return { expected: "record" };
|
|
222
|
+
// Arrays and class instances (Date, Map, ...) are not records, as in Convex.
|
|
223
|
+
// For a record, the non-plain object's constructor name is what it got.
|
|
224
|
+
const notPlain = plainObjectFailure(value);
|
|
225
|
+
if (notPlain) return { expected: "record", got: notPlain.expected };
|
|
223
226
|
const keyValidator: AnyValidator = validator.key;
|
|
224
227
|
const entryValidator: AnyValidator = validator.value;
|
|
225
228
|
return firstFailure(Object.entries(value), ([key, entry]) => {
|
package/docs/READINESS.md
DELETED
|
@@ -1,175 +0,0 @@
|
|
|
1
|
-
# Publication remediation evidence
|
|
2
|
-
|
|
3
|
-
Status: **not publication-ready**: an independent review is done (2026-10-31, no
|
|
4
|
-
critical or high findings) and its fixes are applied, and the real Better Auth
|
|
5
|
-
login/JWT proof now passes locally (2026-11-03, see below). Publication still
|
|
6
|
-
needs the maintainer's release decision.
|
|
7
|
-
|
|
8
|
-
## Repairs and checks
|
|
9
|
-
|
|
10
|
-
- Origin preview allowlisting no longer bypasses scheme/credential/path
|
|
11
|
-
validation. Wildcards require an exact explicitly configured HTTPS pattern
|
|
12
|
-
with a single prefixed/suffixed wildcard label and fixed DNS suffix. Host
|
|
13
|
-
deployment ownership remains a prerequisite.
|
|
14
|
-
- Local HTTP rejects paths and URL normalization; controls reject before
|
|
15
|
-
trimming.
|
|
16
|
-
- Cookies require a validated HTTPS origin. SameSite=None remains opt-in host
|
|
17
|
-
policy.
|
|
18
|
-
- Retarget callbacks execute sequentially, stop on error and reject pages over
|
|
19
|
-
1000 before side effects. Host authorization and transaction boundaries remain
|
|
20
|
-
mandatory.
|
|
21
|
-
- MCP before-hook throws/timeouts deny dispatch generically. Auth and lifecycle
|
|
22
|
-
callbacks have 10-second deadlines; underlying host work is not cancelled.
|
|
23
|
-
- Raw tool/resource errors and attacker-controlled reserved keys are not logged.
|
|
24
|
-
Host hooks own observability/redaction; explicit hook-returned messages are
|
|
25
|
-
public.
|
|
26
|
-
- `AuthCtx.trustedIssuer` is required; missing/empty configuration and
|
|
27
|
-
mismatched issuer claims fail closed before row callbacks.
|
|
28
|
-
- README/API/llms describe actual shipped surfaces and conditional bootstrap
|
|
29
|
-
safety.
|
|
30
|
-
- Release notes are passed via a file, not interpolated shell source. Stable
|
|
31
|
-
release runs only from a `vX.Y.Z` tag on main that matches `package.json` and
|
|
32
|
-
`CHANGELOG.md`; default workflow permissions are read-only.
|
|
33
|
-
|
|
34
|
-
Commands executed from this repository:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
pnpm install --frozen-lockfile
|
|
38
|
-
pnpm lint
|
|
39
|
-
pnpm build
|
|
40
|
-
pnpm typecheck
|
|
41
|
-
pnpm test:coverage
|
|
42
|
-
pnpm audit --json
|
|
43
|
-
pnpm audit --prod --json
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Coverage at the remediation checkpoint: 204 tests (including a real-clock policy
|
|
47
|
-
timeout), 100% statements, branches, functions and lines. Strict lint now
|
|
48
|
-
includes identity integration tests and schema; legacy MCP integration fixtures
|
|
49
|
-
remain excluded, explicitly rather than all tests. Typechecks now include host
|
|
50
|
-
wrappers. Packed runtime imports of all four entries passed, and packed API
|
|
51
|
-
TypeScript checks passed using
|
|
52
|
-
`tsc --ignoreConfig --noEmit --strict --skipLibCheck --module NodeNext --target ES2022`
|
|
53
|
-
against the installed local tarball. No publish command was executed.
|
|
54
|
-
|
|
55
|
-
## Independent review (2026-10-31)
|
|
56
|
-
|
|
57
|
-
A read-only source review found no critical or high issues. Outcome:
|
|
58
|
-
|
|
59
|
-
| Finding | Result |
|
|
60
|
-
| ------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
61
|
-
| Subject-only lookups share a row across issuers (medium) | Fixed: `trustedIssuer` required, fail closed. Regression tests in `identity.e2e.test.ts`. |
|
|
62
|
-
| Optional `trustedIssuer` accepts any issuer (medium) | Fixed with the above. |
|
|
63
|
-
| Resources skip `onToolCall`/`before` hooks (medium) | Documented; an `onResourceRead` hook would be a future minor. |
|
|
64
|
-
| `timeout: 0` means no timeout (low) | Documented, unchanged. |
|
|
65
|
-
| Example injects the raw bearer into args (low) | Fixed: example injects a derived principal; `apiKey` documented as sensitive. |
|
|
66
|
-
| Resources accept `_`-prefixed params (low) | Fixed: rejected before dispatch. Regression test in `server.test.ts`. |
|
|
67
|
-
| No body, stream or deadline caps (low) | Documented as a host/platform duty. |
|
|
68
|
-
| Preview wildcard depends on Better Auth matcher (plausible) | Checked in Better Auth 1.7.12 source: `*` can span `.`. Documented; pattern shape tested. |
|
|
69
|
-
| SameSite=None, cursor secret, no Origin check, Bearer case, `isAnonymous`, `retargetRows` outcome (low) | Documented; no behavior change. |
|
|
70
|
-
|
|
71
|
-
Review limits: source reading only. Real login/JWT behavior was not exercised.
|
|
72
|
-
|
|
73
|
-
## Dependency reachability
|
|
74
|
-
|
|
75
|
-
Development-only advisories (Handlebars, esbuild, deepmerge-ts) are fixed with
|
|
76
|
-
scoped overrides in `package.json` (`handlebars@<4.7.10`,
|
|
77
|
-
`deepmerge-ts@<8.0.0`); other overrides were dropped once the lockfile resolved
|
|
78
|
-
the same versions without them.
|
|
79
|
-
|
|
80
|
-
Remaining: `minimatch` (3.x and 10.x, moderate,
|
|
81
|
-
[GHSA-g3hv-75wg-m249](https://github.com/advisories/GHSA-g3hv-75wg-m249)),
|
|
82
|
-
reached only through `@vllnt/eslint-config` lint tooling. The fix is minimatch
|
|
83
|
-
11, a major outside those packages' ranges, so no override is applied. Not
|
|
84
|
-
imported by package runtime. `pnpm audit --prod` reports zero advisories; this
|
|
85
|
-
is not proof for a host's independently installed optional peers. Convex CLI's
|
|
86
|
-
esbuild 0.27.0 is outside the reported vulnerable range (>=0.27.3 <0.28.1).
|
|
87
|
-
|
|
88
|
-
## Unverified conditions
|
|
89
|
-
|
|
90
|
-
- The Better Auth proof covers only the cases listed under its section below.
|
|
91
|
-
Not exercised: HTTPS cookies (`cookieSettingsForSite`), preview-pattern
|
|
92
|
-
origins, anonymous-to-registered account linking with `retargetRows`, social
|
|
93
|
-
or other plugins, and Better Auth 1.7.x (the component's peer range is
|
|
94
|
-
`<1.7.0`).
|
|
95
|
-
- No publishing, merging, tagging, visibility changes or production access
|
|
96
|
-
performed.
|
|
97
|
-
|
|
98
|
-
## Real local backend proof
|
|
99
|
-
|
|
100
|
-
Executed
|
|
101
|
-
`HOME=$(mktemp -d /tmp/helpers-home.XXXXXX) CONVEX_AGENT_MODE=anonymous node scripts/local-identity-proof.mjs`
|
|
102
|
-
through a managed process with declared 3340/3341 ports. Convex CLI 1.45.0
|
|
103
|
-
configured an anonymous local backend, created CLI-owned bindings in a temporary
|
|
104
|
-
fixture, deployed the indexed mutation and ran 16 simultaneous HTTP mutations.
|
|
105
|
-
All returned the same row ID; a separate query found exactly one row. Exit
|
|
106
|
-
status 0. No cloud account, production deployment or hand-edited generated
|
|
107
|
-
files. Identity injection was synthetic and cannot prove Better Auth login or
|
|
108
|
-
JWT integration. The retained script reproduces this evidence. Stable publishing
|
|
109
|
-
is tag-driven and uses reviewed current versions only.
|
|
110
|
-
|
|
111
|
-
## Real Better Auth login/JWT proof
|
|
112
|
-
|
|
113
|
-
Executed on 2026-11-03:
|
|
114
|
-
|
|
115
|
-
```sh
|
|
116
|
-
node scripts/better-auth-proof.mjs
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Result: `RESULT: PASS`, 13 assertions, exit status 0, about one minute. The
|
|
120
|
-
script builds a throwaway fixture under `/var/tmp`, installs its dependencies
|
|
121
|
-
there with `npm install --ignore-scripts --before <now - 7 days>` (nothing is
|
|
122
|
-
added to this package), starts an anonymous local Convex backend on ports
|
|
123
|
-
3350/3351 with an isolated `HOME`, generates `BETTER_AUTH_SECRET` randomly and
|
|
124
|
-
passes it over stdin, then deletes the fixture, `HOME` and backend process. No
|
|
125
|
-
cloud account, production deployment or hand-edited generated files. Rerunning
|
|
126
|
-
needs the network for npm and for the local backend download.
|
|
127
|
-
|
|
128
|
-
Pinned local backend: `precompiled-2026-10-22-1447815` (published 2026-10-22),
|
|
129
|
-
selected with the Convex CLI's `convex dev --local-backend-version` flag; the
|
|
130
|
-
script prints `Local backend: <version>`. The CLI's default is a moving
|
|
131
|
-
"latest", so the pin is what makes reruns reproducible.
|
|
132
|
-
Child processes inherit the caller's environment (so proxy and custom CA
|
|
133
|
-
settings still apply) minus every `CONVEX_*` variable, plus the script's own
|
|
134
|
-
`HOME`, ports and `CONVEX_AGENT_MODE=anonymous`, so `CONVEX_DEPLOYMENT`, `CONVEX_URL`,
|
|
135
|
-
`CONVEX_DEPLOY_KEY` and other `CONVEX_*` variables from the caller's shell
|
|
136
|
-
cannot redirect it.
|
|
137
|
-
|
|
138
|
-
Versions used: `convex` 1.48.0, `better-auth` 1.6.33, `@convex-dev/better-auth`
|
|
139
|
-
0.12.6, `jose` 6.2.13 (test token forging only), Node 24.22.1. The fixture
|
|
140
|
-
follows the component's documented setup: `app.use(betterAuth)`,
|
|
141
|
-
`getAuthConfigProvider()`,
|
|
142
|
-
`betterAuth({ plugins: [anonymous(), convex({ authConfig })] })` and
|
|
143
|
-
`registerRoutes`. It copies `src/identity.ts` and `src/better-auth.ts` unchanged
|
|
144
|
-
and calls them from Convex functions, with
|
|
145
|
-
`trustedOrigins: trustedOriginsFromCsv(siteUrl, ...)` configured in Better Auth
|
|
146
|
-
and `trustedIssuer` set to the deployment's site URL.
|
|
147
|
-
|
|
148
|
-
Asserted against real Better Auth sessions and tokens:
|
|
149
|
-
|
|
150
|
-
- Anonymous plugin sign-in and a separate email/password sign-in each issue a
|
|
151
|
-
token from `GET /api/auth/convex/token` with `iss` equal to the deployment
|
|
152
|
-
site URL, `aud` `convex` and `sub` equal to the Better Auth user id. The
|
|
153
|
-
anonymous token carries `isAnonymous: true`; the email token's is not `true`.
|
|
154
|
-
- Convex's `ctx.auth.getUserIdentity()` reports the same issuer, subject and
|
|
155
|
-
`isAnonymous` custom claim.
|
|
156
|
-
- `getOrCreateFromAuth` accepts both, inserts one row per subject, is
|
|
157
|
-
idempotent, and reports `isAnonymous` true and false respectively;
|
|
158
|
-
`getFromAuth` returns `null` before bootstrap and the flagged row after.
|
|
159
|
-
- Rejected: no token (`UNAUTHENTICATED`), `trustedIssuer` mismatch on a valid
|
|
160
|
-
token (`UNAUTHENTICATED`, no row written), payload edited with the signature
|
|
161
|
-
kept, foreign issuer signed with a foreign key, correct issuer signed with a
|
|
162
|
-
foreign key, and a real Better Auth token after it expires (valid just before,
|
|
163
|
-
rejected with "expired" later). Convex tolerates a few seconds of clock skew,
|
|
164
|
-
so the script waits 10 seconds past expiry. Queries can be served from the
|
|
165
|
-
backend cache, so the expiry check uses a mutation.
|
|
166
|
-
- Better Auth refuses a sign-in from an origin outside `trustedOrigins` (403)
|
|
167
|
-
and issues no token after sign-out.
|
|
168
|
-
|
|
169
|
-
The proof can fail: with the issuer check in `src/identity.ts` disabled, the
|
|
170
|
-
mismatch assertion fails and the script exits 1. `convex dev --once --start`
|
|
171
|
-
exits 0 even when the started command fails, so the script requires a result
|
|
172
|
-
marker that is written only after all assertions pass.
|
|
173
|
-
|
|
174
|
-
Findings: none. The helpers accepted every real token and rejected every invalid
|
|
175
|
-
one; no change to `src/` was needed.
|