convex 1.13.0-alpha.1 → 1.13.0
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 +48 -0
- package/bin/main-dev +2 -2
- package/dist/browser.bundle.js +1 -1
- package/dist/browser.bundle.js.map +1 -1
- package/dist/cjs/browser/logging.js.map +1 -1
- package/dist/cjs/bundler/context.js +5 -1
- package/dist/cjs/bundler/context.js.map +2 -2
- package/dist/cjs/cli/codegen_templates/tsconfig.js +3 -2
- package/dist/cjs/cli/codegen_templates/tsconfig.js.map +2 -2
- package/dist/cjs/cli/convexImport.js +54 -3
- package/dist/cjs/cli/convexImport.js.map +2 -2
- package/dist/cjs/cli/dashboard.js +1 -1
- package/dist/cjs/cli/dashboard.js.map +2 -2
- package/dist/cjs/cli/lib/utils.js +3 -2
- package/dist/cjs/cli/lib/utils.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/components/index.js.map +1 -1
- package/dist/cjs/server/pagination.js.map +1 -1
- package/dist/cjs/server/registration.js.map +1 -1
- package/dist/cjs/values/validator.js +1 -1
- package/dist/cjs/values/validator.js.map +2 -2
- package/dist/cjs/values/validators.js +69 -64
- package/dist/cjs/values/validators.js.map +2 -2
- package/dist/cjs-types/browser/logging.d.ts +1 -1
- package/dist/cjs-types/browser/logging.d.ts.map +1 -1
- package/dist/cjs-types/bundler/context.d.ts.map +1 -1
- package/dist/cjs-types/cli/codegen_templates/tsconfig.d.ts.map +1 -1
- package/dist/cjs-types/cli/convexImport.d.ts.map +1 -1
- package/dist/cjs-types/cli/dashboard.d.ts +1 -1
- package/dist/cjs-types/cli/dashboard.d.ts.map +1 -1
- package/dist/cjs-types/cli/lib/utils.d.ts +1 -1
- package/dist/cjs-types/cli/lib/utils.d.ts.map +1 -1
- package/dist/cjs-types/index.d.ts +1 -1
- package/dist/cjs-types/index.d.ts.map +1 -1
- package/dist/cjs-types/server/pagination.d.ts +5 -5
- package/dist/cjs-types/server/registration.d.ts +73 -0
- package/dist/cjs-types/server/registration.d.ts.map +1 -1
- package/dist/cjs-types/server/schema.d.ts +2 -2
- package/dist/cjs-types/values/validator.d.ts +2 -2
- package/dist/cjs-types/values/validator.d.ts.map +1 -1
- package/dist/cjs-types/values/validators.d.ts +32 -88
- package/dist/cjs-types/values/validators.d.ts.map +1 -1
- package/dist/cli.bundle.cjs +64 -10
- package/dist/cli.bundle.cjs.map +2 -2
- package/dist/esm/browser/logging.js.map +1 -1
- package/dist/esm/bundler/context.js +5 -1
- package/dist/esm/bundler/context.js.map +2 -2
- package/dist/esm/cli/codegen_templates/tsconfig.js +3 -2
- package/dist/esm/cli/codegen_templates/tsconfig.js.map +2 -2
- package/dist/esm/cli/convexImport.js +54 -3
- package/dist/esm/cli/convexImport.js.map +2 -2
- package/dist/esm/cli/dashboard.js +1 -1
- package/dist/esm/cli/dashboard.js.map +2 -2
- package/dist/esm/cli/lib/utils.js +3 -2
- package/dist/esm/cli/lib/utils.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/components/index.js.map +1 -1
- package/dist/esm/server/pagination.js.map +1 -1
- package/dist/esm/values/validator.js +1 -1
- package/dist/esm/values/validator.js.map +2 -2
- package/dist/esm/values/validators.js +69 -64
- package/dist/esm/values/validators.js.map +2 -2
- package/dist/esm-types/browser/logging.d.ts +1 -1
- package/dist/esm-types/browser/logging.d.ts.map +1 -1
- package/dist/esm-types/bundler/context.d.ts.map +1 -1
- package/dist/esm-types/cli/codegen_templates/tsconfig.d.ts.map +1 -1
- package/dist/esm-types/cli/convexImport.d.ts.map +1 -1
- package/dist/esm-types/cli/dashboard.d.ts +1 -1
- package/dist/esm-types/cli/dashboard.d.ts.map +1 -1
- package/dist/esm-types/cli/lib/utils.d.ts +1 -1
- package/dist/esm-types/cli/lib/utils.d.ts.map +1 -1
- package/dist/esm-types/index.d.ts +1 -1
- package/dist/esm-types/index.d.ts.map +1 -1
- package/dist/esm-types/server/pagination.d.ts +5 -5
- package/dist/esm-types/server/registration.d.ts +73 -0
- package/dist/esm-types/server/registration.d.ts.map +1 -1
- package/dist/esm-types/server/schema.d.ts +2 -2
- package/dist/esm-types/values/validator.d.ts +2 -2
- package/dist/esm-types/values/validator.d.ts.map +1 -1
- package/dist/esm-types/values/validators.d.ts +32 -88
- package/dist/esm-types/values/validators.d.ts.map +1 -1
- package/dist/react.bundle.js +1 -1
- package/dist/react.bundle.js.map +1 -1
- package/package.json +11 -12
- package/src/browser/logging.ts +1 -1
- package/src/bundler/context.ts +4 -0
- package/src/cli/codegen_templates/tsconfig.ts +3 -2
- package/src/cli/convexImport.ts +62 -4
- package/src/cli/dashboard.ts +2 -2
- package/src/cli/lib/utils.ts +3 -1
- package/src/index.ts +1 -1
- package/src/server/components/index.ts +1 -1
- package/src/server/pagination.ts +1 -1
- package/src/server/registration.ts +73 -0
- package/src/values/validator.ts +10 -2
- package/src/values/validators.ts +104 -142
- package/vitest.config.js +11 -0
- package/browser/node_modules/.modules.yaml +0 -19
- package/react/node_modules/.modules.yaml +0 -19
- package/react-auth0/node_modules/.modules.yaml +0 -19
- package/react-clerk/node_modules/.modules.yaml +0 -19
- package/server/node_modules/.modules.yaml +0 -19
- package/src/environment/index.d.ts +0 -28
- package/values/node_modules/.modules.yaml +0 -19
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,53 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
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.
|
|
28
|
+
|
|
29
|
+
These are breaking changes if you're using the two optional type parameters of
|
|
30
|
+
`Validator` or doing `instanceof` checks with `Validator`! We apologize for
|
|
31
|
+
the inconvenience. The same users this affects should be the ones that most
|
|
32
|
+
benefit from the ability to work with validator types more directly.
|
|
33
|
+
|
|
34
|
+
- Argument validators now accept validators (object validators and union
|
|
35
|
+
validators) in addition to objects with validators as properties. Return value
|
|
36
|
+
validators similarly accept either validators or objects with validators as
|
|
37
|
+
properties, but unlike `args:` any validator is allowed.
|
|
38
|
+
|
|
39
|
+
Custom function wrappers (AKA middleware) should continue to work, but to
|
|
40
|
+
present the same API has the builtin Convex function wrappers `query`,
|
|
41
|
+
`internalQuery`, `mutation` etc. you'll need to update such code to accept
|
|
42
|
+
either a validator or an object of validators. You'll likely want to update
|
|
43
|
+
these anyway to support return value validators. The new `asValidator` helper
|
|
44
|
+
maybe useful here.
|
|
45
|
+
|
|
46
|
+
- The default tsconfig.json created in projects when first creating the
|
|
47
|
+
`convex/` directory now uses `"moduleResolution": "Bundler"`. This is just a
|
|
48
|
+
better default, you
|
|
49
|
+
[probably never want the previous default `"node"`/`"node10"`](https://www.typescriptlang.org/tsconfig/#moduleResolution).
|
|
50
|
+
|
|
3
51
|
## 1.12.1
|
|
4
52
|
|
|
5
53
|
- Fix bug where `npx convex deploy` and `npx convex dev` would incorrectly skip
|
package/bin/main-dev
CHANGED
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
|
|
4
4
|
if [ "$(uname)" == "Darwin" ] || [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
|
|
5
5
|
SCRIPTDIR="$(echo "$0" | python3 -c 'import os; print(os.path.dirname(os.path.realpath(input())))')"
|
|
6
|
-
"exec" "$SCRIPTDIR/../node_modules/.bin/
|
|
6
|
+
CONVEX_RUNNING_LIVE_IN_MONOREPO=1 "exec" "$SCRIPTDIR/../node_modules/.bin/tsx" "$SCRIPTDIR/../src/cli/index.ts" "$@"
|
|
7
7
|
else # it's probably Windows
|
|
8
8
|
# This doesn't follow symlinks quite as correctly as the Mac/Linux solution above
|
|
9
9
|
CONVEXDIR="$(dirname "$(dirname "$0")")"
|
|
10
|
-
"exec" "$CONVEXDIR/node_modules/.bin/
|
|
10
|
+
CONVEX_RUNNING_LIVE_IN_MONOREPO=1 "exec" "$CONVEXDIR/node_modules/.bin/tsx" "$CONVEXDIR/src/cli/index.ts" "$@"
|
|
11
11
|
fi
|