convex-helpers 0.1.132 → 0.1.134
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 +308 -0
- package/README.md +17 -10
- package/dist/bin.cjs +4466 -0
- package/dist/browser.d.ts.map +1 -0
- package/{browser.js → dist/browser.js} +1 -0
- package/dist/browser.js.map +1 -0
- package/dist/index.d.ts.map +1 -0
- package/{index.js → dist/index.js} +1 -0
- package/dist/index.js.map +1 -0
- package/dist/react/cache/hooks.d.ts.map +1 -0
- package/{react → dist/react}/cache/hooks.js +1 -0
- package/dist/react/cache/hooks.js.map +1 -0
- package/dist/react/cache/provider.d.ts.map +1 -0
- package/{react → dist/react}/cache/provider.js +1 -0
- package/dist/react/cache/provider.js.map +1 -0
- package/dist/react/cache.d.ts.map +1 -0
- package/{react → dist/react}/cache.js +1 -0
- package/dist/react/cache.js.map +1 -0
- package/dist/react/sessions.d.ts.map +1 -0
- package/{react → dist/react}/sessions.js +1 -0
- package/dist/react/sessions.js.map +1 -0
- package/dist/react.d.ts.map +1 -0
- package/{react.js → dist/react.js} +1 -0
- package/dist/react.js.map +1 -0
- package/dist/server/compare.d.ts.map +1 -0
- package/{server → dist/server}/compare.js +1 -0
- package/dist/server/compare.js.map +1 -0
- package/{server → dist/server}/cors.d.ts +17 -1
- package/dist/server/cors.d.ts.map +1 -0
- package/{server → dist/server}/cors.js +3 -7
- package/dist/server/cors.js.map +1 -0
- package/dist/server/crud.d.ts.map +1 -0
- package/{server → dist/server}/crud.js +1 -0
- package/dist/server/crud.js.map +1 -0
- package/dist/server/customFunctions.d.ts.map +1 -0
- package/{server → dist/server}/customFunctions.js +1 -0
- package/dist/server/customFunctions.js.map +1 -0
- package/dist/server/filter.d.ts.map +1 -0
- package/{server → dist/server}/filter.js +1 -0
- package/dist/server/filter.js.map +1 -0
- package/dist/server/hono.d.ts.map +1 -0
- package/{server → dist/server}/hono.js +1 -0
- package/dist/server/hono.js.map +1 -0
- package/dist/server/migrations.d.ts.map +1 -0
- package/{server → dist/server}/migrations.js +1 -0
- package/dist/server/migrations.js.map +1 -0
- package/dist/server/pagination.d.ts.map +1 -0
- package/{server → dist/server}/pagination.js +1 -0
- package/dist/server/pagination.js.map +1 -0
- package/dist/server/rateLimit.d.ts.map +1 -0
- package/{server → dist/server}/rateLimit.js +1 -0
- package/dist/server/rateLimit.js.map +1 -0
- package/dist/server/relationships.d.ts.map +1 -0
- package/{server → dist/server}/relationships.js +1 -0
- package/dist/server/relationships.js.map +1 -0
- package/dist/server/retries.d.ts.map +1 -0
- package/{server → dist/server}/retries.js +1 -0
- package/dist/server/retries.js.map +1 -0
- package/dist/server/rowLevelSecurity.d.ts.map +1 -0
- package/{server → dist/server}/rowLevelSecurity.js +1 -0
- package/dist/server/rowLevelSecurity.js.map +1 -0
- package/dist/server/sessions.d.ts.map +1 -0
- package/{server → dist/server}/sessions.js +1 -0
- package/dist/server/sessions.js.map +1 -0
- package/dist/server/stream.d.ts.map +1 -0
- package/{server → dist/server}/stream.js +1 -0
- package/dist/server/stream.js.map +1 -0
- package/dist/server/triggers.d.ts.map +1 -0
- package/{server → dist/server}/triggers.js +1 -0
- package/dist/server/triggers.js.map +1 -0
- package/dist/server/zod.d.ts.map +1 -0
- package/{server → dist/server}/zod.js +1 -0
- package/dist/server/zod.js.map +1 -0
- package/dist/server/zod3.d.ts.map +1 -0
- package/{server → dist/server}/zod3.js +1 -0
- package/dist/server/zod3.js.map +1 -0
- package/dist/server/zod4.d.ts.map +1 -0
- package/{server → dist/server}/zod4.js +7 -1
- package/dist/server/zod4.js.map +1 -0
- package/dist/server.d.ts.map +1 -0
- package/{server.js → dist/server.js} +1 -0
- package/dist/server.js.map +1 -0
- package/dist/standardSchema.d.ts.map +1 -0
- package/{standardSchema.js → dist/standardSchema.js} +1 -0
- package/dist/standardSchema.js.map +1 -0
- package/dist/test/zodToConvex.d.ts +57 -0
- package/dist/test/zodToConvex.d.ts.map +1 -0
- package/dist/test/zodToConvex.js +70 -0
- package/dist/test/zodToConvex.js.map +1 -0
- package/dist/test/zodVersion.d.ts +27 -0
- package/dist/test/zodVersion.d.ts.map +1 -0
- package/dist/test/zodVersion.js +31 -0
- package/dist/test/zodVersion.js.map +1 -0
- package/dist/testing.d.ts.map +1 -0
- package/{testing.js → dist/testing.js} +1 -0
- package/dist/testing.js.map +1 -0
- package/dist/validators.d.ts.map +1 -0
- package/{validators.js → dist/validators.js} +1 -0
- package/dist/validators.js.map +1 -0
- package/package.json +161 -74
- package/packages/convex-helpers/cli/index.ts +20 -0
- package/packages/convex-helpers/cli/openApiSpec.ts +319 -0
- package/packages/convex-helpers/cli/tsApiSpec.ts +200 -0
- package/packages/convex-helpers/cli/utils.ts +84 -0
- package/{src → packages/convex-helpers}/server/cors.ts +26 -3
- package/{src → packages/convex-helpers}/server/zod4.ts +9 -1
- package/packages/convex-helpers/test/zodToConvex.ts +151 -0
- package/packages/convex-helpers/test/zodVersion.ts +42 -0
- package/bin.cjs +0 -4835
- package/browser.d.ts.map +0 -1
- package/index.d.ts.map +0 -1
- package/react/cache/hooks.d.ts.map +0 -1
- package/react/cache/provider.d.ts.map +0 -1
- package/react/cache.d.ts.map +0 -1
- package/react/sessions.d.ts.map +0 -1
- package/react.d.ts.map +0 -1
- package/server/compare.d.ts.map +0 -1
- package/server/cors.d.ts.map +0 -1
- package/server/crud.d.ts.map +0 -1
- package/server/customFunctions.d.ts.map +0 -1
- package/server/filter.d.ts.map +0 -1
- package/server/hono.d.ts.map +0 -1
- package/server/migrations.d.ts.map +0 -1
- package/server/pagination.d.ts.map +0 -1
- package/server/rateLimit.d.ts.map +0 -1
- package/server/relationships.d.ts.map +0 -1
- package/server/retries.d.ts.map +0 -1
- package/server/rowLevelSecurity.d.ts.map +0 -1
- package/server/sessions.d.ts.map +0 -1
- package/server/stream.d.ts.map +0 -1
- package/server/triggers.d.ts.map +0 -1
- package/server/zod.d.ts.map +0 -1
- package/server/zod3.d.ts.map +0 -1
- package/server/zod4.d.ts.map +0 -1
- package/server.d.ts.map +0 -1
- package/src/browser.test.ts +0 -108
- package/src/functionReferences.test.ts +0 -359
- package/src/index.test.ts +0 -66
- package/src/react.test.ts +0 -114
- package/src/standardSchema.test.ts +0 -99
- package/src/tsconfig.json +0 -114
- package/src/validators.test.ts +0 -306
- package/standardSchema.d.ts.map +0 -1
- package/testing.d.ts.map +0 -1
- package/validators.d.ts.map +0 -1
- /package/{browser.d.ts → dist/browser.d.ts} +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{react → dist/react}/cache/hooks.d.ts +0 -0
- /package/{react → dist/react}/cache/provider.d.ts +0 -0
- /package/{react → dist/react}/cache.d.ts +0 -0
- /package/{react → dist/react}/sessions.d.ts +0 -0
- /package/{react.d.ts → dist/react.d.ts} +0 -0
- /package/{server → dist/server}/compare.d.ts +0 -0
- /package/{server → dist/server}/crud.d.ts +0 -0
- /package/{server → dist/server}/customFunctions.d.ts +0 -0
- /package/{server → dist/server}/filter.d.ts +0 -0
- /package/{server → dist/server}/hono.d.ts +0 -0
- /package/{server → dist/server}/migrations.d.ts +0 -0
- /package/{server → dist/server}/pagination.d.ts +0 -0
- /package/{server → dist/server}/rateLimit.d.ts +0 -0
- /package/{server → dist/server}/relationships.d.ts +0 -0
- /package/{server → dist/server}/retries.d.ts +0 -0
- /package/{server → dist/server}/rowLevelSecurity.d.ts +0 -0
- /package/{server → dist/server}/sessions.d.ts +0 -0
- /package/{server → dist/server}/stream.d.ts +0 -0
- /package/{server → dist/server}/triggers.d.ts +0 -0
- /package/{server → dist/server}/zod.d.ts +0 -0
- /package/{server → dist/server}/zod3.d.ts +0 -0
- /package/{server → dist/server}/zod4.d.ts +0 -0
- /package/{server.d.ts → dist/server.d.ts} +0 -0
- /package/{standardSchema.d.ts → dist/standardSchema.d.ts} +0 -0
- /package/{testing.d.ts → dist/testing.d.ts} +0 -0
- /package/{validators.d.ts → dist/validators.d.ts} +0 -0
- /package/{src → packages/convex-helpers}/browser.ts +0 -0
- /package/{src → packages/convex-helpers}/index.ts +0 -0
- /package/{src → packages/convex-helpers}/react/cache/hooks.ts +0 -0
- /package/{src → packages/convex-helpers}/react/cache/provider.tsx +0 -0
- /package/{src → packages/convex-helpers}/react/cache.ts +0 -0
- /package/{src → packages/convex-helpers}/react/sessions.ts +0 -0
- /package/{src → packages/convex-helpers}/react.ts +0 -0
- /package/{src → packages/convex-helpers}/server/compare.ts +0 -0
- /package/{src → packages/convex-helpers}/server/crud.ts +0 -0
- /package/{src → packages/convex-helpers}/server/customFunctions.ts +0 -0
- /package/{src → packages/convex-helpers}/server/filter.ts +0 -0
- /package/{src → packages/convex-helpers}/server/hono.ts +0 -0
- /package/{src → packages/convex-helpers}/server/migrations.ts +0 -0
- /package/{src → packages/convex-helpers}/server/pagination.ts +0 -0
- /package/{src → packages/convex-helpers}/server/rateLimit.ts +0 -0
- /package/{src → packages/convex-helpers}/server/relationships.ts +0 -0
- /package/{src → packages/convex-helpers}/server/retries.ts +0 -0
- /package/{src → packages/convex-helpers}/server/rowLevelSecurity.ts +0 -0
- /package/{src → packages/convex-helpers}/server/sessions.ts +0 -0
- /package/{src → packages/convex-helpers}/server/stream.ts +0 -0
- /package/{src → packages/convex-helpers}/server/triggers.ts +0 -0
- /package/{src → packages/convex-helpers}/server/zod.ts +0 -0
- /package/{src → packages/convex-helpers}/server/zod3.ts +0 -0
- /package/{src → packages/convex-helpers}/server.ts +0 -0
- /package/{src → packages/convex-helpers}/standardSchema.ts +0 -0
- /package/{src → packages/convex-helpers}/testing.ts +0 -0
- /package/{src → packages/convex-helpers}/validators.ts +0 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.1.134
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- `open-api-spec` renders unions as `anyOf`, so a value matching more than one member
|
|
8
|
+
validates. It also supports `v.bytes()` instead of aborting with "bytes unsupported".
|
|
9
|
+
|
|
10
|
+
## 0.1.133
|
|
11
|
+
|
|
12
|
+
- Zod 4 support: when a `z.object()` schema is passed as `args` to
|
|
13
|
+
`zCustomQuery`/`zCustomMutation`/`zCustomAction`, checks on the object
|
|
14
|
+
itself (`.refine()`, `.superRefine()`, `.check()`) are now run. Previously
|
|
15
|
+
they were silently skipped. (#1055)
|
|
16
|
+
|
|
17
|
+
## 0.1.132
|
|
18
|
+
|
|
19
|
+
- Enforces defaultPolicy: "deny" for RLS on bare db.get calls where
|
|
20
|
+
table name is not provided and cannot be determined.
|
|
21
|
+
|
|
22
|
+
## 0.1.131
|
|
23
|
+
|
|
24
|
+
- Zod 4 support: fixed a regression in 0.1.130 when chaining multiple `.brand()`
|
|
25
|
+
calls together.
|
|
26
|
+
|
|
27
|
+
## 0.1.130
|
|
28
|
+
|
|
29
|
+
- Zod 4 support: bug fixes when used across different Zod versions:
|
|
30
|
+
- `zodToConvex` now makes the fields of `z.partialRecord` optional on Zod 4.5
|
|
31
|
+
and later, with literal and enum keys. Thanks to @aymanemt1 for the fix!
|
|
32
|
+
(#1025, #1047)
|
|
33
|
+
- Fixed `TS2589: Type instantiation is excessively deep and possibly infinite`
|
|
34
|
+
when calling `convexToZod` inline (e.g. in the `args` of `zCustomMutation`)
|
|
35
|
+
on Zod 4.6.6 and later. Thanks to @jherth for the fix! (#1043)
|
|
36
|
+
- Fixed the type of `v.commitTs()` in `convexToZod` on Zod 4.6. (#1050)
|
|
37
|
+
- Fixed the type of branded `zod/mini` objects on Zod 4.0–4.2. (#1051)
|
|
38
|
+
- `validate` and `parse` now reject arrays and class instances (e.g. `Date`,
|
|
39
|
+
`Map`) for `v.record(...)` validators, as Convex does. Thanks to
|
|
40
|
+
@RishavTiwari25 for the fix! (#1040)
|
|
41
|
+
|
|
42
|
+
## 0.1.129
|
|
43
|
+
|
|
44
|
+
- (fix:streams) Retry later groups after nonempty pages (#1027)
|
|
45
|
+
- (fix:validators) Only match own keys of an object validator's fields. Thanks to
|
|
46
|
+
@mikirejf for the fix! (#1035)
|
|
47
|
+
|
|
48
|
+
## 0.1.128
|
|
49
|
+
|
|
50
|
+
- Triggers: `patch`, `replace` and `delete` with an explicit table name now
|
|
51
|
+
skip the trigger path when the table has no registered triggers, as `insert`
|
|
52
|
+
already does. They no longer read the document before and after the write.
|
|
53
|
+
- Zod 4 support: fixed the TypeScript return type of `zodOutputToConvex` for
|
|
54
|
+
schemas nested in objects, arrays, records, unions and tuples (and inside
|
|
55
|
+
`.readonly()`, `z.lazy()`, `.catch()` and `.nonoptional()`). These nested
|
|
56
|
+
schemas were typed from their input, like in `zodToConvex`, so a nested
|
|
57
|
+
`z.codec`, `z.pipe` or `.default()` got the wrong type. The return type now
|
|
58
|
+
matches the validator returned at runtime. Thanks to @vinnysaj for the fix!
|
|
59
|
+
- fix(stream): Ensure cursors advance past exhausted flatMap items on resume (#1018)
|
|
60
|
+
|
|
61
|
+
## 0.1.127
|
|
62
|
+
|
|
63
|
+
- (fix:streams) Preserve empty stream intersections and their index metadata (#1017)
|
|
64
|
+
|
|
65
|
+
## 0.1.126
|
|
66
|
+
|
|
67
|
+
- (fix:streams) Preserve flatMap rows when resuming from cursor (#1014)
|
|
68
|
+
|
|
69
|
+
## 0.1.125
|
|
70
|
+
|
|
71
|
+
- Support Convex 1.46's `FunctionReference_future` in query hooks and function
|
|
72
|
+
wrappers, including composing cached `useQueries` with `makeUseQueryWithStatus`.
|
|
73
|
+
Requires `convex` ^1.46.0.
|
|
74
|
+
|
|
75
|
+
## 0.1.124
|
|
76
|
+
|
|
77
|
+
- `validate` now normalizes system table ids (e.g. `v.id("_storage")`) with
|
|
78
|
+
`db.system.normalizeId` instead of throwing when passed a real `db`.
|
|
79
|
+
|
|
80
|
+
## 0.1.123
|
|
81
|
+
|
|
82
|
+
- Deprecates some validator utilities now that convex@1.44 has schema.doc and schema.id
|
|
83
|
+
|
|
84
|
+
## 0.1.122
|
|
85
|
+
|
|
86
|
+
- Support TypeScript 7.
|
|
87
|
+
|
|
88
|
+
## 0.1.121
|
|
89
|
+
|
|
90
|
+
- Support the new `db.vars.commitTs` variable and `v.commitTs()` validator added in
|
|
91
|
+
convex 1.43.0.
|
|
92
|
+
- `convex-helpers/server/compare` is deprecated and now re-exports
|
|
93
|
+
`compareValues` from `convex/values`. There may be small differences in behavior in
|
|
94
|
+
uncommon cases (NaNs, negative zero, etc.) compared with the previous implementation.
|
|
95
|
+
|
|
96
|
+
## 0.1.120
|
|
97
|
+
|
|
98
|
+
- Zod 4 support: fix a regression introduced in 0.1.119 in the return types of
|
|
99
|
+
`zodToConvex`/`zodOutputToConvex` when using branded types (including `zid`)
|
|
100
|
+
|
|
101
|
+
## 0.1.119
|
|
102
|
+
|
|
103
|
+
- Zod 4 support: the return types of `zodToConvex` and `zodOutputToConvex`
|
|
104
|
+
now return the expected type when enabling the
|
|
105
|
+
`exactOptionalPropertyTypes` TypeScript setting.
|
|
106
|
+
|
|
107
|
+
## 0.1.118
|
|
108
|
+
|
|
109
|
+
- Fixes the helpers custom pagination page splitting logic when used
|
|
110
|
+
with filters. Previously it would aggressively split pages whenever
|
|
111
|
+
more items were _scanned_ than requested. Now it only splits when
|
|
112
|
+
the page grows to be larger than the number of requested items or
|
|
113
|
+
so many documents are being scanned that the limits are close to being
|
|
114
|
+
hit.
|
|
115
|
+
|
|
116
|
+
## 0.1.117
|
|
117
|
+
|
|
118
|
+
- Zod 4 support: fixed an issue with the return type of `convexToZod`
|
|
119
|
+
when the input type is a non-tuple array type.
|
|
120
|
+
|
|
121
|
+
## 0.1.116
|
|
122
|
+
|
|
123
|
+
- `HonoWithConvex` and `HttpRouterWithHono` now accept an optional `Variables`
|
|
124
|
+
type parameter, so consumers using middleware-driven typed context state
|
|
125
|
+
(`c.var` / `c.set` / `c.get`) no longer need to cast their `Hono` app.
|
|
126
|
+
- Support nullable empty schemas in open-api-spec
|
|
127
|
+
|
|
128
|
+
## 0.1.115
|
|
129
|
+
|
|
130
|
+
- Supports typescript ^6.0.0
|
|
131
|
+
|
|
132
|
+
## 0.1.114
|
|
133
|
+
|
|
134
|
+
- Adds support for maximumBytesRead option for PaginationOptions on the
|
|
135
|
+
stream / paginator helpers.
|
|
136
|
+
|
|
137
|
+
## 0.1.113
|
|
138
|
+
|
|
139
|
+
- Zod 4 support: fix the input type of `zid` (thanks @danth3b0t!)
|
|
140
|
+
|
|
141
|
+
## 0.1.112
|
|
142
|
+
|
|
143
|
+
- Zod 4 support: fix an issue where `zodToConvex` would incorrectly
|
|
144
|
+
identify some types as `v.id()` when using Zod schema inheritance.
|
|
145
|
+
- Relationships: fix the return type of `getManyVia`
|
|
146
|
+
and `getManyViaOrThrow` when using system tables.
|
|
147
|
+
|
|
148
|
+
## 0.1.111
|
|
149
|
+
|
|
150
|
+
- Allow a hono http router register more routes using the standard
|
|
151
|
+
Convex HttpRouter API
|
|
152
|
+
|
|
153
|
+
## 0.1.110
|
|
154
|
+
|
|
155
|
+
- Improve db wrapping in Triggers to support using an RLS-wrapped DB
|
|
156
|
+
|
|
157
|
+
## 0.1.109
|
|
158
|
+
|
|
159
|
+
- Triggers/row-level security: fix a type issue with the `ctx.db` APIs with
|
|
160
|
+
table name arguments (see the changelog of
|
|
161
|
+
[`convex@1.31.2`](https://github.com/convex/convex-js/blob/main/CHANGELOG.md#1312))
|
|
162
|
+
- Zod 4: fix handling of optional in the type of `zodOutputToConvex` (credit: ksinghal)
|
|
163
|
+
- Fixes validation of records with undefined values. `validate` will now skip entries
|
|
164
|
+
with undefined values for record and object validators, and `parse` will drop
|
|
165
|
+
entries from records that have undefined values.
|
|
166
|
+
- The openapi and ts generator commands will now avoid adding .yaml if the filename
|
|
167
|
+
already includes it.
|
|
168
|
+
|
|
169
|
+
## 0.1.108
|
|
170
|
+
|
|
171
|
+
- `makeUseQueryWithStatus`: fix handling of some argument values
|
|
172
|
+
(credit: RhysSullivan)
|
|
173
|
+
- Triggers: fix handling of `ctx.db` calls with a table name parameter
|
|
174
|
+
|
|
175
|
+
## 0.1.107
|
|
176
|
+
|
|
177
|
+
- Zod support: branded object types are now supported (credit: gary-ix)
|
|
178
|
+
- Fixes `skipConvexValidation` for zod custom functions to still do zod validation.
|
|
179
|
+
|
|
180
|
+
## 0.1.106
|
|
181
|
+
|
|
182
|
+
- Update typedV to match the type of the installed convex validators for v.nullable
|
|
183
|
+
- Improves handling of literals() helper to keep the ordering of its members
|
|
184
|
+
- Improved Zod 4 handling of circular types, empty returns, and empty function args
|
|
185
|
+
- Zod 4 transforms can now be asynchronous
|
|
186
|
+
|
|
187
|
+
## 0.1.105
|
|
188
|
+
|
|
189
|
+
- **convex-helpers now supports Zod 4!** (#840)
|
|
190
|
+
- The new methods that support Zod 4 can be found in `convex-helpers/server/zod4`
|
|
191
|
+
- Existing types and methods for Zod 3 support have been moved
|
|
192
|
+
(`convex-helpers/server/zod` → `convex-helpers/server/zod3`)
|
|
193
|
+
- Thanks to @ksinghal and @natedunn for their contributions to this improvement.
|
|
194
|
+
- Zod 3 support: fix the return types of `zodOutputToConvex` for objects and unions
|
|
195
|
+
(credit: gari-ix)
|
|
196
|
+
- Zod 3 support: improve the type safety of `onSuccess` in custom function builders
|
|
197
|
+
- Sessions: If the only argument to a session function is the sessionId,
|
|
198
|
+
allow omitting args in React.
|
|
199
|
+
|
|
200
|
+
## 0.1.104
|
|
201
|
+
|
|
202
|
+
- Allows RLS to deny access by default
|
|
203
|
+
|
|
204
|
+
## 0.1.103
|
|
205
|
+
|
|
206
|
+
- Parsing validators with optional fields and explicit { field: undefined } works
|
|
207
|
+
|
|
208
|
+
## 0.1.102
|
|
209
|
+
|
|
210
|
+
- You can use Zod4 alongside convex-helpers.
|
|
211
|
+
Note: convex-helpers/zod supports zod3 only. Zod4 support is WIP
|
|
212
|
+
|
|
213
|
+
## 0.1.101
|
|
214
|
+
|
|
215
|
+
- Improved Zod union type (credit:Firephoenix25)
|
|
216
|
+
- Fixes zCustom\* function type inference regression
|
|
217
|
+
- Adds a helper function `addFieldsToValidator` which recursively adds fields
|
|
218
|
+
to either a `{ key: v.string() }`, a `v.object(..)`, or `v.union(...` of objects/unions.
|
|
219
|
+
- Tightens the types when not using extra args, so it catches typos
|
|
220
|
+
- Removes the long-deprecated "output" argument (use `returns` instead)- Improved Zod union type (credit:Firephoenix25)
|
|
221
|
+
- Bumps the Convex peer dependency as we rely on compareValues (credit:nicolas)
|
|
222
|
+
- Exports types for QueryStream
|
|
223
|
+
|
|
224
|
+
## 0.1.100
|
|
225
|
+
|
|
226
|
+
- Custom Functions now can take dynamic parameters for each function
|
|
227
|
+
they define (e.g. each custom query providing a "role" it expects)
|
|
228
|
+
- Custom Functions can provide an "onSuccess" callback to do final
|
|
229
|
+
things after the inner function succeeds. Throwing fails it.
|
|
230
|
+
- Custom Functions exposes a customCtxAndArgs utility to help with types
|
|
231
|
+
- Trigger DB wrapper is now an object, not a class when using
|
|
232
|
+
`.wrapDB()` or `writerWithTriggers` explicitly (credit: front-depiction)
|
|
233
|
+
- `convexToZod` now transforms to more specific zod types (credit: Firephoenix25)
|
|
234
|
+
- `crud` helper works for tables with top-level unions
|
|
235
|
+
- `paginator` works over indexes including `undefined` values.
|
|
236
|
+
- `Mod` type is deprecated - renamed to `Customization`
|
|
237
|
+
|
|
238
|
+
## 0.1.99
|
|
239
|
+
|
|
240
|
+
- Fixes LoadingMore for custom pagintation
|
|
241
|
+
|
|
242
|
+
## 0.1.98
|
|
243
|
+
|
|
244
|
+
- `partial` now supports unions too (including recursive unions).
|
|
245
|
+
|
|
246
|
+
## 0.1.97
|
|
247
|
+
|
|
248
|
+
- `partial` from `convex-helpers/validators` now supports either a
|
|
249
|
+
v.object or POJO of validators.
|
|
250
|
+
|
|
251
|
+
## 0.1.96
|
|
252
|
+
|
|
253
|
+
- Fix the usePaginatedQuery helper to show LoadingMore when loading
|
|
254
|
+
the last page
|
|
255
|
+
|
|
256
|
+
## 0.1.95
|
|
257
|
+
|
|
258
|
+
- Improved CORS support for server-to-server endpoints, along with more
|
|
259
|
+
nuanced handling of Vary headers.
|
|
260
|
+
If you want the server to continue throwing when origins don't match,
|
|
261
|
+
pass `enforceAllowOrigins: true`. By default it will not throw and let
|
|
262
|
+
the browser or other server decide what to do about a conflict.
|
|
263
|
+
|
|
264
|
+
## 0.1.94
|
|
265
|
+
|
|
266
|
+
- Fix: Pagination of distinct streams
|
|
267
|
+
|
|
268
|
+
## 0.1.93
|
|
269
|
+
|
|
270
|
+
- Changes `usePaginatedQuery` for caching to take a `customPagination`
|
|
271
|
+
option instead of "fixed" vs. "grow" for now. Pass `true` when using
|
|
272
|
+
the `paginator` or `stream` helpers.
|
|
273
|
+
- Adds a regular `usePaginatedQuery` to use with `stream` and `paginator`
|
|
274
|
+
helpers that doesn't use the subscription cache helper.
|
|
275
|
+
|
|
276
|
+
## 0.1.92
|
|
277
|
+
|
|
278
|
+
- `usePaginatedQuery` has the default `latestPageSize` option of "fixed"
|
|
279
|
+
which has the first (or latest once loadMore is called) page stay a
|
|
280
|
+
fixed size. Today this only affects queries using `paginator` or
|
|
281
|
+
`stream` helpers, and will soon also be able to fix the page size for
|
|
282
|
+
built-in pagination too.
|
|
283
|
+
- Fix: update type annotations of imports for tsApiApec.ts.
|
|
284
|
+
|
|
285
|
+
## 0.1.91
|
|
286
|
+
|
|
287
|
+
- `usePaginatedQuery` is now available in the cached query helpers.
|
|
288
|
+
- With `usePaginatedQuery`, you can pass `endCursorBehavior: "setOnLoadMore"`,
|
|
289
|
+
which allows seamless pagination when using `stream` and`paginator` helpers
|
|
290
|
+
and will allow future deprecation of the too-magical QueryJournal.
|
|
291
|
+
- Split pages more eagerly in the custom pagination hooks to reduce bandwidth.
|
|
292
|
+
- Fix descending multi-column index pagination for `paginator` and `streams`
|
|
293
|
+
helpers.
|
|
294
|
+
|
|
295
|
+
## 0.1.90
|
|
296
|
+
|
|
297
|
+
- Support unions with `parse` and `validate(... { throws: true })`
|
|
298
|
+
|
|
299
|
+
## 0.1.89
|
|
300
|
+
|
|
301
|
+
- `parse` validator utility
|
|
302
|
+
|
|
303
|
+
## 0.1.88
|
|
304
|
+
|
|
305
|
+
- Support for standard schema
|
|
306
|
+
- Allow debugging cors
|
|
307
|
+
|
|
308
|
+
... older: check git!
|
package/README.md
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
# convex-helpers
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`npm i convex-helpers@latest`
|
|
4
|
+
|
|
5
|
+
**[Changelog](./CHANGELOG.md)**
|
|
4
6
|
|
|
5
7
|
A collection of useful code to complement the official packages.
|
|
6
8
|
|
|
9
|
+
See the [example app](./example-ui/README.md) to run the helpers locally, and
|
|
10
|
+
[CONTRIBUTING.md](./CONTRIBUTING.md) for development and release instructions.
|
|
11
|
+
|
|
7
12
|
Table of contents:
|
|
8
13
|
|
|
9
14
|
- [Custom Functions](#custom-functions)
|
|
@@ -128,7 +133,7 @@ import {
|
|
|
128
133
|
getOneFromOrThrow,
|
|
129
134
|
getManyFrom,
|
|
130
135
|
getManyViaOrThrow,
|
|
131
|
-
} from "convex-helpers/server/relationships
|
|
136
|
+
} from "convex-helpers/server/relationships";
|
|
132
137
|
import { asyncMap } from "convex-helpers";
|
|
133
138
|
|
|
134
139
|
const author = await getOneFromOrThrow(db, "authors", "userId", user._id);
|
|
@@ -192,7 +197,7 @@ needing to add any tables to your schema. (`npm i @convex-dev/migrations`)
|
|
|
192
197
|
See the [Stack post on migrations](https://stack.convex.dev/migrating-data-with-mutations)
|
|
193
198
|
and the [migration primer Stack post](https://stack.convex.dev/intro-to-migrations).
|
|
194
199
|
|
|
195
|
-
To see the library code and usage, see the [migrations.ts file](./server/migrations.ts).
|
|
200
|
+
To see the library code and usage, see the [migrations.ts file](./packages/convex-helpers/server/migrations.ts).
|
|
196
201
|
|
|
197
202
|
Example migration:
|
|
198
203
|
|
|
@@ -215,15 +220,15 @@ See the associated Stack post for details:
|
|
|
215
220
|
|
|
216
221
|
https://stack.convex.dev/rate-limiting
|
|
217
222
|
|
|
218
|
-
For usage details, see the [rateLimit.ts file](./server/rateLimit.ts).
|
|
223
|
+
For usage details, see the [rateLimit.ts file](./packages/convex-helpers/server/rateLimit.ts).
|
|
219
224
|
|
|
220
225
|
## Session tracking via client-side sessionID storage
|
|
221
226
|
|
|
222
227
|
Store a session ID on the client and pass it up with requests to keep track of
|
|
223
228
|
a user, even if they aren't logged in.
|
|
224
229
|
|
|
225
|
-
Use the client-side helpers in [react/sessions](./react/sessions.ts) and
|
|
226
|
-
server-side helpers in [server/sessions](./server/sessions.ts).
|
|
230
|
+
Use the client-side helpers in [react/sessions](./packages/convex-helpers/react/sessions.ts) and
|
|
231
|
+
server-side helpers in [server/sessions](./packages/convex-helpers/server/sessions.ts).
|
|
227
232
|
|
|
228
233
|
See the associated [Stack post](https://stack.convex.dev/track-sessions-without-cookies) for more information.
|
|
229
234
|
|
|
@@ -329,7 +334,7 @@ type ret =
|
|
|
329
334
|
|
|
330
335
|
See the [Stack post on row-level security](https://stack.convex.dev/row-level-security)
|
|
331
336
|
|
|
332
|
-
Use the [RowLevelSecurity](./server/rowLevelSecurity.ts) helper to define
|
|
337
|
+
Use the [RowLevelSecurity](./packages/convex-helpers/server/rowLevelSecurity.ts) helper to define
|
|
333
338
|
database wrappers to add row-level checks for a server-side function.
|
|
334
339
|
Any access to `db` inside functions wrapped with these
|
|
335
340
|
will check your access rules on read/insert/modify per-document.
|
|
@@ -983,10 +988,10 @@ bandwidth.
|
|
|
983
988
|
|
|
984
989
|
Related files:
|
|
985
990
|
|
|
986
|
-
- [cache.ts](./react/cache.ts) re-exports things so you can import from a single convenient location.
|
|
987
|
-
- [provider.tsx](./react/cache/provider.tsx) contains `ConvexQueryCacheProvider`,
|
|
991
|
+
- [cache.ts](./packages/convex-helpers/react/cache.ts) re-exports things so you can import from a single convenient location.
|
|
992
|
+
- [provider.tsx](./packages/convex-helpers/react/cache/provider.tsx) contains `ConvexQueryCacheProvider`,
|
|
988
993
|
a configurable cache provider you put in your react app's root.
|
|
989
|
-
- [hooks.ts](./react/cache/hooks.ts) contains cache-enabled drop-in
|
|
994
|
+
- [hooks.ts](./packages/convex-helpers/react/cache/hooks.ts) contains cache-enabled drop-in
|
|
990
995
|
replacements for `useQuery`, `usePaginatedQuery`, and `useQueries`.
|
|
991
996
|
|
|
992
997
|
To use the cache, first make sure to put a `<ConvexQueryCacheProvider>`
|
|
@@ -1285,6 +1290,8 @@ http.route({
|
|
|
1285
1290
|
export default http;
|
|
1286
1291
|
```
|
|
1287
1292
|
|
|
1293
|
+
If you turn on `allowCredentials`, list the origins your frontend runs on in `allowedOrigins`. With `"*"`, any website can make requests that carry the user's cookies and read the responses. Note: if you authenticate with a bearer token in the `Authorization` header, you do not need `allowCredentials`.
|
|
1294
|
+
|
|
1288
1295
|
## Standard Schema
|
|
1289
1296
|
|
|
1290
1297
|
[Standard Schema](https://github.com/standard-schema/standard-schema)
|