Skip to content

Commit dccc63a

Browse files
thomasballingerConvex, Inc.
authored and
Convex, Inc.
committed
Changelog for 1.13 (#27206)
update changelog for 1.13.0-alpha.1 GitOrigin-RevId: f72b348debf0e293d77aad8aeead8cbde064335e
1 parent cf5d43d commit dccc63a

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

npm-packages/convex/CHANGELOG.md

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,54 @@
11
# Changelog
22

3+
## 1.13.0-alpha.1
4+
5+
- Convex queries, mutations, and actions now accept `returns:` property to
6+
specify a return value validator.
7+
8+
Return value validators throw a runtime error (so will roll back the
9+
transaction in a mutation) when the value returned from a query or mutation
10+
does not match this validator. This is _stricter than TypeScript_ in that
11+
extra properties will not be allowed.
12+
13+
- Validator fields are now exposed: the return value of `v.object({ ... })` now
14+
has a `.fields` property with the validators for each property on it.
15+
16+
```
17+
const message = v.object({ user: v.string(), body: v.string() });
18+
const imageMessage = v.object({ ...message.fields, })
19+
```
20+
21+
These validators are also exposed on the schema at
22+
`schema.tables.messages.validator`
23+
24+
The `Validator` export is no longer a class. It is now a discriminated union
25+
type of all validators where the `.kind` as the discriminator. The `Validator`
26+
type still has three type parameters with only the first (the TypeScript type
27+
enforced by the validator) required. The second type parameter, `IsOptional`,
28+
is no longer a boolean. It is instead either `"required"` or `"optional"`.
29+
30+
These are breaking changes if you're using the two optional type parameters of
31+
`Validator` or doing `instanceof` checks with `Validator`! We apologize for
32+
the inconvenience. The same users this affects should be the ones that most
33+
benefit from the ability to work with validator types more directly.
34+
35+
- Argument validators now accept validators (object validators and union
36+
validators) in addition to objects with validators as properties. Return value
37+
validators similarly accept either validators or objects with validators as
38+
properties, but unlike `args:` any validator is allowed.
39+
40+
Custom function wrappers (AKA middleware) should continue to work, but to
41+
present the same API has the builtin Convex function wrappers `query`,
42+
`internalQuery`, `mutation` etc. you'll need to update such code to accept
43+
either a validator or an object of validators. You'll likely want to update
44+
these anyway to support return value validators. The new `asValidator` helper
45+
maybe useful here.
46+
47+
- The default tsconfig.json created in projects when first creating the
48+
`convex/` directory now uses `"moduleResolution": "Bundler"`. This is just a
49+
better default, you
50+
[probably never want the previous default `"node"`/`"node10"`](https://www.typescriptlang.org/tsconfig/#moduleResolution).
51+
352
## 1.12.1
453

554
- Fix bug where `npx convex deploy` and `npx convex dev` would incorrectly skip

0 commit comments

Comments
 (0)