convex 1.43.0-alpha.1 → 1.44.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.
Files changed (123) hide show
  1. package/CHANGELOG.md +133 -81
  2. package/dist/browser.bundle.js +1 -1
  3. package/dist/browser.bundle.js.map +1 -1
  4. package/dist/cjs/cli/codegen_templates/component_server.js +4 -3
  5. package/dist/cjs/cli/codegen_templates/component_server.js.map +2 -2
  6. package/dist/cjs/cli/codegen_templates/server.js +24 -12
  7. package/dist/cjs/cli/codegen_templates/server.js.map +2 -2
  8. package/dist/cjs/cli/lib/localDeployment/run.js +1 -1
  9. package/dist/cjs/cli/lib/localDeployment/run.js.map +2 -2
  10. package/dist/cjs/cli/lib/login.js +12 -8
  11. package/dist/cjs/cli/lib/login.js.map +2 -2
  12. package/dist/cjs/cli/lib/utils/sentry.js +2 -0
  13. package/dist/cjs/cli/lib/utils/sentry.js.map +2 -2
  14. package/dist/cjs/cli/login.js +52 -7
  15. package/dist/cjs/cli/login.js.map +2 -2
  16. package/dist/cjs/index.js +1 -1
  17. package/dist/cjs/index.js.map +1 -1
  18. package/dist/cjs/react/ConvexAuthState.js +30 -32
  19. package/dist/cjs/react/ConvexAuthState.js.map +2 -2
  20. package/dist/cjs/server/impl/actions_impl.js +12 -0
  21. package/dist/cjs/server/impl/actions_impl.js.map +2 -2
  22. package/dist/cjs/server/index.js +3 -0
  23. package/dist/cjs/server/index.js.map +2 -2
  24. package/dist/cjs/server/log.js +1 -2
  25. package/dist/cjs/server/log.js.map +2 -2
  26. package/dist/cjs/server/logVars.js +1 -4
  27. package/dist/cjs/server/logVars.js.map +2 -2
  28. package/dist/cjs/server/schema.js +69 -1
  29. package/dist/cjs/server/schema.js.map +2 -2
  30. package/dist/cjs-types/cli/codegen_templates/component_server.d.ts.map +1 -1
  31. package/dist/cjs-types/cli/codegen_templates/server.d.ts +1 -0
  32. package/dist/cjs-types/cli/codegen_templates/server.d.ts.map +1 -1
  33. package/dist/cjs-types/cli/lib/login.d.ts +5 -0
  34. package/dist/cjs-types/cli/lib/login.d.ts.map +1 -1
  35. package/dist/cjs-types/cli/lib/utils/sentry.d.ts +1 -0
  36. package/dist/cjs-types/cli/lib/utils/sentry.d.ts.map +1 -1
  37. package/dist/cjs-types/cli/login.d.ts.map +1 -1
  38. package/dist/cjs-types/cli/login.test.d.ts +2 -0
  39. package/dist/cjs-types/cli/login.test.d.ts.map +1 -0
  40. package/dist/cjs-types/index.d.ts +1 -1
  41. package/dist/cjs-types/index.d.ts.map +1 -1
  42. package/dist/cjs-types/react/ConvexAuthState.d.ts.map +1 -1
  43. package/dist/cjs-types/server/impl/actions_impl.d.ts.map +1 -1
  44. package/dist/cjs-types/server/impl/actions_impl.test.d.ts +2 -0
  45. package/dist/cjs-types/server/impl/actions_impl.test.d.ts.map +1 -0
  46. package/dist/cjs-types/server/index.d.ts +2 -2
  47. package/dist/cjs-types/server/index.d.ts.map +1 -1
  48. package/dist/cjs-types/server/log.d.ts.map +1 -1
  49. package/dist/cjs-types/server/logVars.d.ts +0 -6
  50. package/dist/cjs-types/server/logVars.d.ts.map +1 -1
  51. package/dist/cjs-types/server/schema.d.ts +83 -5
  52. package/dist/cjs-types/server/schema.d.ts.map +1 -1
  53. package/dist/cli.bundle.cjs +1280 -572
  54. package/dist/cli.bundle.cjs.map +4 -4
  55. package/dist/esm/cli/codegen_templates/component_server.js +8 -4
  56. package/dist/esm/cli/codegen_templates/component_server.js.map +2 -2
  57. package/dist/esm/cli/codegen_templates/server.js +22 -11
  58. package/dist/esm/cli/codegen_templates/server.js.map +2 -2
  59. package/dist/esm/cli/lib/localDeployment/run.js +2 -2
  60. package/dist/esm/cli/lib/localDeployment/run.js.map +2 -2
  61. package/dist/esm/cli/lib/login.js +11 -8
  62. package/dist/esm/cli/lib/login.js.map +2 -2
  63. package/dist/esm/cli/lib/utils/sentry.js +1 -0
  64. package/dist/esm/cli/lib/utils/sentry.js.map +2 -2
  65. package/dist/esm/cli/login.js +54 -10
  66. package/dist/esm/cli/login.js.map +2 -2
  67. package/dist/esm/index.js +1 -1
  68. package/dist/esm/index.js.map +1 -1
  69. package/dist/esm/react/ConvexAuthState.js +31 -32
  70. package/dist/esm/react/ConvexAuthState.js.map +2 -2
  71. package/dist/esm/server/impl/actions_impl.js +11 -0
  72. package/dist/esm/server/impl/actions_impl.js.map +2 -2
  73. package/dist/esm/server/index.js +2 -1
  74. package/dist/esm/server/index.js.map +2 -2
  75. package/dist/esm/server/log.js +2 -3
  76. package/dist/esm/server/log.js.map +2 -2
  77. package/dist/esm/server/logVars.js +1 -3
  78. package/dist/esm/server/logVars.js.map +2 -2
  79. package/dist/esm/server/schema.js +67 -0
  80. package/dist/esm/server/schema.js.map +2 -2
  81. package/dist/esm-types/cli/codegen_templates/component_server.d.ts.map +1 -1
  82. package/dist/esm-types/cli/codegen_templates/server.d.ts +1 -0
  83. package/dist/esm-types/cli/codegen_templates/server.d.ts.map +1 -1
  84. package/dist/esm-types/cli/lib/login.d.ts +5 -0
  85. package/dist/esm-types/cli/lib/login.d.ts.map +1 -1
  86. package/dist/esm-types/cli/lib/utils/sentry.d.ts +1 -0
  87. package/dist/esm-types/cli/lib/utils/sentry.d.ts.map +1 -1
  88. package/dist/esm-types/cli/login.d.ts.map +1 -1
  89. package/dist/esm-types/cli/login.test.d.ts +2 -0
  90. package/dist/esm-types/cli/login.test.d.ts.map +1 -0
  91. package/dist/esm-types/index.d.ts +1 -1
  92. package/dist/esm-types/index.d.ts.map +1 -1
  93. package/dist/esm-types/react/ConvexAuthState.d.ts.map +1 -1
  94. package/dist/esm-types/server/impl/actions_impl.d.ts.map +1 -1
  95. package/dist/esm-types/server/impl/actions_impl.test.d.ts +2 -0
  96. package/dist/esm-types/server/impl/actions_impl.test.d.ts.map +1 -0
  97. package/dist/esm-types/server/index.d.ts +2 -2
  98. package/dist/esm-types/server/index.d.ts.map +1 -1
  99. package/dist/esm-types/server/log.d.ts.map +1 -1
  100. package/dist/esm-types/server/logVars.d.ts +0 -6
  101. package/dist/esm-types/server/logVars.d.ts.map +1 -1
  102. package/dist/esm-types/server/schema.d.ts +83 -5
  103. package/dist/esm-types/server/schema.d.ts.map +1 -1
  104. package/dist/react.bundle.js +31 -33
  105. package/dist/react.bundle.js.map +2 -2
  106. package/package.json +3 -4
  107. package/src/cli/codegen_templates/component_server.ts +12 -6
  108. package/src/cli/codegen_templates/server.ts +36 -19
  109. package/src/cli/lib/localDeployment/run.ts +2 -2
  110. package/src/cli/lib/login.ts +20 -9
  111. package/src/cli/lib/utils/sentry.ts +3 -0
  112. package/src/cli/login.test.ts +261 -0
  113. package/src/cli/login.ts +88 -13
  114. package/src/index.ts +1 -1
  115. package/src/react/ConvexAuthState.tsx +15 -7
  116. package/src/server/audit_logging.test.ts +1 -1
  117. package/src/server/impl/actions_impl.test.ts +59 -0
  118. package/src/server/impl/actions_impl.ts +23 -0
  119. package/src/server/index.ts +7 -1
  120. package/src/server/log.ts +1 -4
  121. package/src/server/logVars.ts +0 -7
  122. package/src/server/schema.test.ts +98 -0
  123. package/src/server/schema.ts +178 -1
package/CHANGELOG.md CHANGED
@@ -1,28 +1,74 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.44.0
4
+
5
+ - `schema.doc(tableName)` returns the validator for whole documents of a table:
6
+ the table's own validator with the `_id` and `_creationTime` system fields
7
+ added (to each member, for tables defined with a union).
8
+ `schema.id(tableName)` is `v.id(tableName)` restricted to the table names in
9
+ the schema. `docValidator(tableName, tableDefinition)` from `convex/server`
10
+ does the same as `schema.doc` when you only have a table definition.
11
+ - The server-provided environment variables `CONVEX_SITE_URL` and
12
+ `CONVEX_CLOUD_URL` are now available on `env` by default in
13
+ `_generated/server.d.ts`, along with other environment variables specified in
14
+ `convex/convex.config.ts`.
15
+ - Fixed a bug where the context value provided by `ConvexProviderWithAuth` was
16
+ not referentially stable.
17
+ - Fixed a bug where `npx convex login status` would report misleading results
18
+ when the user is logged in but does not have access to the current project.
19
+
20
+ ## 1.43.0
21
+
22
+ - Added new `npx convex deployment usage` and
23
+ `npx convex deployment usage-limits` CLI commands to view a deployment’s
24
+ current resource usage, and view or edit deployment usage limits.
25
+ - When defining hourly cron jobs, you can now omit the `minuteUTC` parameter.
26
+ When omitted, Convex will automatically choose a stable start time within the
27
+ scheduled hour, avoiding concentrating jobs at the top of the hour.
28
+ - Mutations can now reference their upcoming
29
+ [commit timestamp](https://docs.convex.dev/database/advanced/commit-timestamp)
30
+ with `ctx.db.vars.commitTs`. While the mutation is running,
31
+ `ctx.db.vars.commitTs` is a placeholder symbol that is replaced with a Int64
32
+ value at commit time that is guaranteed to strictly follow commit order,
33
+ unlike the `_creationTime` system field. This low-level primitive is helpful
34
+ for advanced use cases such as implementing efficient FIFO queues.
35
+ - Added a new `v.commitTs()` validator that accepts either the upcoming commit
36
+ timestamp placeholder, or a Int64 commit timestamp.
37
+ - The Convex CLI is now able to find the right TypeScript compiler when using
38
+ side-by-side TypeScript 6 and 7 installation. (This setup is used in codebases
39
+ that want to use the native TypeScript 7 compiler but still need access to the
40
+ TypeScript compiler JavaScript API.)
41
+ - Deprecated the `typescriptCompiler` parameter in `convex.json`. This parameter
42
+ was only necessary when using the TypeScript Native Preview
43
+ (@typescript/native-preview). With TypeScript 7, Convex automatically picks
44
+ the right binary.
45
+ - When a component only uses environment variables that are all optional, it’s
46
+ now possible to omit the `env` argument from `app.use(component, { … })`.
47
+ - Fixed a bug where `app.use()` failed to require a second argument when a
48
+ component has required environment variables (e.g.
49
+ `app.use(component, { env: { REQUIRED_VAR: "value" } })`).
50
+ - Fixed a bug in `usePaginatedQuery_experimental` where page splits were handled
51
+ incorrectly.
52
+
3
53
  ## 1.42.3
4
54
 
5
- - Fixed a bug where the codegen would not sort module paths in
6
- an order consistent with other platforms when running
7
- on Windows. This completes a fix that was only partially
8
- applied in 1.42.2.
55
+ - Fixed a bug where the codegen would not sort module paths in an order
56
+ consistent with other platforms when running on Windows. This completes a fix
57
+ that was only partially applied in 1.42.2.
9
58
 
10
59
  ## 1.42.2
11
- - Mutations and actions can now read the raw authentication
12
- token used in the request by accessing `authToken` in
13
- `ctx.meta.getRequestMetadata()`.
14
- - Fixed a circular import in `convex/browser` that caused issues
15
- when using the `ConvexHttpClient` in some JavaScript
16
- environments.
17
- - Fixed a bug in `ConvexProviderWithClerk` that caused
18
- the Convex client to ignore session changes in some situations.
19
- - Fixed a bug where the codegen would not sort module paths in
20
- an order consistent with other platforms when running
21
- on Windows.
22
- - When running `npx convex dev` outside a Convex project,
23
- the CLI now returns an error message immediately instead of
24
- first asking the user to select a project and then failing
25
- later.
60
+
61
+ - Mutations and actions can now read the raw authentication token used in the
62
+ request by accessing `authToken` in `ctx.meta.getRequestMetadata()`.
63
+ - Fixed a circular import in `convex/browser` that caused issues when using the
64
+ `ConvexHttpClient` in some JavaScript environments.
65
+ - Fixed a bug in `ConvexProviderWithClerk` that caused the Convex client to
66
+ ignore session changes in some situations.
67
+ - Fixed a bug where the codegen would not sort module paths in an order
68
+ consistent with other platforms when running on Windows.
69
+ - When running `npx convex dev` outside a Convex project, the CLI now returns an
70
+ error message immediately instead of first asking the user to select a project
71
+ and then failing later.
26
72
 
27
73
  ## 1.42.1
28
74
 
@@ -33,66 +79,67 @@
33
79
 
34
80
  ## 1.42.0
35
81
 
36
- - Added a new `npx convex project create` command that can be used
37
- to create new projects programmatically.
38
- - Added a new `--names-only` flag to `npx convex env list`
39
- (and `npx convex env default list`). This flag shows the names of
40
- the env vars that are set, without the values. It can be useful
41
- to let AI coding agents know the variables that are set on a deployment,
42
- without giving them the actual values.
43
- - Added a new `useStaleSnapshot` option to the arguments for `runQuery`.
44
- This is an advanced feature that can be used to allow mutations
45
- to avoid optimistic concurrency control (OCC) conflicts in some cases
46
- where they can commit even though they depend on conflicting reads.
47
- This change allows us to improve the performance of some of the
48
- official Convex components, including Workpool.
49
- - Improved the documentation of `db.*` methods to more clearly explain
50
- the difference between the old APIs without table names
51
- (e.g. `db.get(userId)`) and the new APIs with table names
52
- (e.g. `db.get("users", userId)`).
53
- - Fixed an issue where the CLI would not surface permission errors
54
- correctly when the user or token doesn’t have permission to do something.
82
+ - Added a new `npx convex project create` command that can be used to create new
83
+ projects programmatically.
84
+ - Added a new `--names-only` flag to `npx convex env list` (and
85
+ `npx convex env default list`). This flag shows the names of the env vars that
86
+ are set, without the values. It can be useful to let AI coding agents know the
87
+ variables that are set on a deployment, without giving them the actual values.
88
+ - Added a new `useStaleSnapshot` option to the arguments for `runQuery`. This is
89
+ an advanced feature that can be used to allow mutations to avoid optimistic
90
+ concurrency control (OCC) conflicts in some cases where they can commit even
91
+ though they depend on conflicting reads. This change allows us to improve the
92
+ performance of some of the official Convex components, including Workpool.
93
+ - Improved the documentation of `db.*` methods to more clearly explain the
94
+ difference between the old APIs without table names (e.g. `db.get(userId)`)
95
+ and the new APIs with table names (e.g. `db.get("users", userId)`).
96
+ - Fixed an issue where the CLI would not surface permission errors correctly
97
+ when the user or token doesn’t have permission to do something.
55
98
  - Exposes the current scheduled function's ID as `scheduledFunctionId` in
56
99
  `ctx.meta.getRequestMetadata()`.
57
- - `npx convex insights` has a new `--json` flag that makes the command
58
- output easier to parse programmatically.
59
- - File storage: marked a few TypeScript types in `convex/server` as `@deprecated`
60
- (`FileMetadata`, `FileStorageId`, `StorageId`). These types are used
61
- only by file storage APIs that were deprecated in `convex@1.6.0`,
62
- so we also marked them as `@deprecated` for clarity.
100
+ - `npx convex insights` has a new `--json` flag that makes the command output
101
+ easier to parse programmatically.
102
+ - File storage: marked a few TypeScript types in `convex/server` as
103
+ `@deprecated` (`FileMetadata`, `FileStorageId`, `StorageId`). These types are
104
+ used only by file storage APIs that were deprecated in `convex@1.6.0`, so we
105
+ also marked them as `@deprecated` for clarity.
63
106
  - Bumps the `ws` peer dependency to avoid a vulnerable range.
64
107
 
65
108
  ## 1.41.0
66
- - It is now possible to set limits on nested queries and mutations
67
- with the new `transactionLimits` option in `runQuery`/`runMutation`.
68
- - `npx convex ai-files` now installs skills with separate copies of
69
- each skill for each coding agent instead of using symlinks.
70
- We made this change to avoid known issues with symlinks on Windows.
109
+
110
+ - It is now possible to set limits on nested queries and mutations with the new
111
+ `transactionLimits` option in `runQuery`/`runMutation`.
112
+ - `npx convex ai-files` now installs skills with separate copies of each skill
113
+ for each coding agent instead of using symlinks. We made this change to avoid
114
+ known issues with symlinks on Windows.
71
115
  - When using Convex in anonymous mode (without a Convex account),
72
- `npx convex dev` now starts a different dashboard server for each
73
- deployment. This ensures the dashboard always connects to the
74
- right deployment when multiple deployments are running at the same time.
116
+ `npx convex dev` now starts a different dashboard server for each deployment.
117
+ This ensures the dashboard always connects to the right deployment when
118
+ multiple deployments are running at the same time.
75
119
 
76
120
  ## 1.40.0
121
+
77
122
  - You can now create a local deployment in a specific Convex cloud project with
78
123
  `npx convex deployment create team-slug:project-slug:local`.
79
- - You can now move a local deployment to another cloud project
80
- using `npx convex deployment select team-slug:project-slug:local`. This command warns
81
- when it moves the deployment to another project.
82
- - The CLI now shows more clearly which deployment is targeted when running commands
83
- such as `npx convex dev` and `npx convex deploy`.
84
- - Added a new `<AuthRefreshing />` helper component, used to show indicators when
85
- function calls are paused because the authentication token is refreshing.
86
- - Removed `--local` and `--cloud` flags from `npx convex dev`. The behavior of these flags
87
- was misleading when a deployment was already selected. Instead, use
88
- `npx convex deployment select local` to use a local deployment, and
124
+ - You can now move a local deployment to another cloud project using
125
+ `npx convex deployment select team-slug:project-slug:local`. This command
126
+ warns when it moves the deployment to another project.
127
+ - The CLI now shows more clearly which deployment is targeted when running
128
+ commands such as `npx convex dev` and `npx convex deploy`.
129
+ - Added a new `<AuthRefreshing />` helper component, used to show indicators
130
+ when function calls are paused because the authentication token is refreshing.
131
+ - Removed `--local` and `--cloud` flags from `npx convex dev`. The behavior of
132
+ these flags was misleading when a deployment was already selected. Instead,
133
+ use `npx convex deployment select local` to use a local deployment, and
89
134
  `npx convex deployment select dev` to use your personal cloud dev deployment.
90
- - The CLI now provides guidance when TypeScript type checking is taking too long.
135
+ - The CLI now provides guidance when TypeScript type checking is taking too
136
+ long.
91
137
  - Improved the CLI command documentation to include more details and examples.
92
- - `npx convex logs`: `--tail` is now accepted as an alias for the `--history` flag.
93
- - When creating a local deployment, the CLI now skips importing the default environment variables
94
- from the Convex cloud project if you don’t have permission to view the default environment
95
- variables instead of crashing.
138
+ - `npx convex logs`: `--tail` is now accepted as an alias for the `--history`
139
+ flag.
140
+ - When creating a local deployment, the CLI now skips importing the default
141
+ environment variables from the Convex cloud project if you don’t have
142
+ permission to view the default environment variables instead of crashing.
96
143
 
97
144
  ## 1.39.1
98
145
 
@@ -100,28 +147,31 @@
100
147
 
101
148
  ## 1.39.0
102
149
 
103
- - Apps and components may now declare typesafe env vars that they require. Both `defineApp`
104
- and `defineComponent` now accept an `env` object with string keys and validator values.
105
- Declared environment variables must be present and match the validators before deployment.
150
+ - Apps and components may now declare typesafe env vars that they require. Both
151
+ `defineApp` and `defineComponent` now accept an `env` object with string keys
152
+ and validator values. Declared environment variables must be present and match
153
+ the validators before deployment.
106
154
  - Allow `--local-cloud-port`, `--local-site-port`, `--local-backend-version` and
107
- `--local-force-upgrade` options to `npx convex dev` to be used whenever using a local deployment.
108
- - The `AsyncLocalStorage` and `AsyncResource` APIs from `node:async_hooks` are now available
109
- in the standard Convex runtime. Note that stored values will not be threaded through calls to
110
- `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction`.
155
+ `--local-force-upgrade` options to `npx convex dev` to be used whenever using
156
+ a local deployment.
157
+ - The `AsyncLocalStorage` and `AsyncResource` APIs from `node:async_hooks` are
158
+ now available in the standard Convex runtime. Note that stored values will not
159
+ be threaded through calls to `ctx.runQuery`/`ctx.runMutation`/`ctx.runAction`.
111
160
 
112
161
  ## 1.38.0
113
162
 
114
- - Adds `ctx.meta.getRequestMetadata()` to access request metadata in mutations and actions:
115
- request ID, client IP, and client User-Agent.
163
+ - Adds `ctx.meta.getRequestMetadata()` to access request metadata in mutations
164
+ and actions: request ID, client IP, and client User-Agent.
116
165
  - Default env vars are now imported when creating a new local deployment.
117
- - Allows creating new local deployments using `npx convex deployment select local`.
118
- - Adds support for `--expiry` and `--expires` aliases for `--expiration` in `npx
119
- convex deployment create`.
166
+ - Allows creating new local deployments using
167
+ `npx convex deployment select local`.
168
+ - Adds support for `--expiry` and `--expires` aliases for `--expiration` in
169
+ `npx convex deployment create`.
120
170
  - Supports using `import "server-only"` to mark files as server-only.
121
171
  - Removes the `npx convex disable-local-deployments` command.
122
172
  - Fixes an issue where stdout/stderr would be truncated after exit in the CLI.
123
- - Updated `usePaginatedQuery_experimental` overload that has an object-based API similar
124
- to `useQuery_experimental`.
173
+ - Updated `usePaginatedQuery_experimental` overload that has an object-based API
174
+ similar to `useQuery_experimental`.
125
175
 
126
176
  ## 1.37.0
127
177
 
@@ -445,6 +495,8 @@
445
495
  confirmation before deleting large indexes. This change is helpful for
446
496
  avoiding situations where an index is accidentally deleted and backfilling it
447
497
  takes a long time.
498
+ - You can use `v.nullable` as a convenient alias for `v.union(v.null(), ...)`
499
+ when defining validators.
448
500
 
449
501
  ## 1.29.1
450
502
 
@@ -29,7 +29,7 @@ var convex = (() => {
29
29
  });
30
30
 
31
31
  // src/index.ts
32
- var version = "1.43.0-alpha.1";
32
+ var version = "1.44.0";
33
33
 
34
34
  // src/values/base64.ts
35
35
  var base64_exports = {};