Skip to content

Commit 29c4df2

Browse files
authored
Merge pull request #445 from zenstackhq/dev
merge dev to main (v3.0.0-beta.26)
2 parents 1e6f7ef + d4e9f31 commit 29c4df2

File tree

77 files changed

+2137
-616
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+2137
-616
lines changed

TODO.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
- [ ] CLI
44
- [x] generate
55
- [x] migrate
6-
- [ ] db
6+
- [x] db
77
- [x] push
8-
- [ ] seed
8+
- [x] seed
99
- [x] info
1010
- [x] init
1111
- [x] validate
12-
- [ ] format
12+
- [x] format
1313
- [ ] repl
1414
- [x] plugin mechanism
1515
- [x] built-in plugins
@@ -85,7 +85,7 @@
8585
- [x] Error system
8686
- [x] Custom table name
8787
- [x] Custom field name
88-
- [ ] Global omit
88+
- [x] Global omit
8989
- [ ] DbNull vs JsonNull
9090
- [ ] Migrate to tsdown
9191
- [x] @default validation

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "zenstack-v3",
3-
"version": "3.0.0-beta.25",
3+
"version": "3.0.0-beta.26",
44
"description": "ZenStack",
5-
"packageManager": "pnpm@10.20.0",
5+
"packageManager": "pnpm@10.23.0",
66
"scripts": {
77
"build": "turbo run build",
88
"watch": "turbo run watch build",
@@ -25,14 +25,14 @@
2525
"eslint": "~9.29.0",
2626
"glob": "^11.0.2",
2727
"prettier": "^3.5.3",
28+
"prisma": "catalog:",
2829
"tsup": "^8.5.0",
2930
"tsx": "^4.20.3",
3031
"turbo": "^2.5.4",
3132
"typescript": "catalog:",
3233
"typescript-eslint": "^8.34.1",
3334
"vitest": "^3.2.4",
34-
"yaml": "^2.8.0",
35-
"prisma": "catalog:"
35+
"yaml": "^2.8.0"
3636
},
3737
"pnpm": {
3838
"onlyBuiltDependencies": [

packages/auth-adapters/better-auth/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/better-auth",
3-
"version": "3.0.0-beta.25",
3+
"version": "3.0.0-beta.26",
44
"description": "ZenStack Better Auth Adapter. This adapter is modified from better-auth's Prisma adapter.",
55
"type": "module",
66
"scripts": {

packages/cli/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"publisher": "zenstack",
44
"displayName": "ZenStack CLI",
55
"description": "FullStack database toolkit with built-in access control and automatic API generation.",
6-
"version": "3.0.0-beta.25",
6+
"version": "3.0.0-beta.26",
77
"type": "module",
88
"author": {
99
"name": "ZenStack Team"

packages/clients/tanstack-query/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@zenstackhq/tanstack-query",
3-
"version": "3.0.0-beta.25",
3+
"version": "3.0.0-beta.26",
44
"description": "TanStack Query Client for consuming ZenStack v3's CRUD service",
55
"main": "index.js",
66
"type": "module",

packages/clients/tanstack-query/src/react.ts

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
AggregateArgs,
2525
AggregateResult,
2626
BatchResult,
27+
ClientOptions,
2728
CountArgs,
2829
CountResult,
2930
CreateArgs,
@@ -128,11 +129,14 @@ export type ModelMutationModelResult<
128129
Model extends GetModels<Schema>,
129130
TArgs,
130131
Array extends boolean = false,
131-
> = Omit<ModelMutationResult<SimplifiedModelResult<Schema, Model, TArgs, false, Array>, TArgs>, 'mutateAsync'> & {
132+
> = Omit<
133+
ModelMutationResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, TArgs, false, Array>, TArgs>,
134+
'mutateAsync'
135+
> & {
132136
mutateAsync<T extends TArgs>(
133137
args: T,
134-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T, false, Array>, T>,
135-
): Promise<SimplifiedModelResult<Schema, Model, T, false, Array>>;
138+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T, false, Array>, T>,
139+
): Promise<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T, false, Array>>;
136140
};
137141

138142
export type ClientHooks<Schema extends SchemaDef> = {
@@ -147,74 +151,78 @@ export type ModelQueryHooks<Schema extends SchemaDef, Model extends GetModels<Sc
147151
{
148152
useFindUnique<T extends FindUniqueArgs<Schema, Model>>(
149153
args: SelectSubset<T, FindUniqueArgs<Schema, Model>>,
150-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
151-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
154+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
155+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
152156

153157
useSuspenseFindUnique<T extends FindUniqueArgs<Schema, Model>>(
154158
args: SelectSubset<T, FindUniqueArgs<Schema, Model>>,
155-
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
156-
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
159+
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
160+
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
157161

158162
useFindFirst<T extends FindFirstArgs<Schema, Model>>(
159163
args?: SelectSubset<T, FindFirstArgs<Schema, Model>>,
160-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
161-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
164+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
165+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
162166

163167
useSuspenseFindFirst<T extends FindFirstArgs<Schema, Model>>(
164168
args?: SelectSubset<T, FindFirstArgs<Schema, Model>>,
165-
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
166-
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
169+
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
170+
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
167171

168172
useFindMany<T extends FindManyArgs<Schema, Model>>(
169173
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
170-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
171-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T>[]>;
174+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>,
175+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>;
172176

173177
useSuspenseFindMany<T extends FindManyArgs<Schema, Model>>(
174178
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
175-
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
176-
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, T>[]>;
179+
options?: ModelSuspenseQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>,
180+
): ModelSuspenseQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>;
177181

178182
useInfiniteFindMany<T extends FindManyArgs<Schema, Model>>(
179183
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
180-
options?: ModelInfiniteQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
181-
): ModelInfiniteQueryResult<InfiniteData<SimplifiedModelResult<Schema, Model, T>[]>>;
184+
options?: ModelInfiniteQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>,
185+
): ModelInfiniteQueryResult<InfiniteData<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>>;
182186

183187
useSuspenseInfiniteFindMany<T extends FindManyArgs<Schema, Model>>(
184188
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
185-
options?: ModelSuspenseInfiniteQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
186-
): ModelSuspenseInfiniteQueryResult<InfiniteData<SimplifiedModelResult<Schema, Model, T>[]>>;
189+
options?: ModelSuspenseInfiniteQueryOptions<
190+
SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]
191+
>,
192+
): ModelSuspenseInfiniteQueryResult<
193+
InfiniteData<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>
194+
>;
187195

188196
useCreate<T extends CreateArgs<Schema, Model>>(
189-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
197+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
190198
): ModelMutationModelResult<Schema, Model, T>;
191199

192200
useCreateMany<T extends CreateManyArgs<Schema, Model>>(
193201
options?: ModelMutationOptions<BatchResult, T>,
194202
): ModelMutationResult<BatchResult, T>;
195203

196204
useCreateManyAndReturn<T extends CreateManyAndReturnArgs<Schema, Model>>(
197-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>[], T>,
205+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[], T>,
198206
): ModelMutationModelResult<Schema, Model, T, true>;
199207

200208
useUpdate<T extends UpdateArgs<Schema, Model>>(
201-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
209+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
202210
): ModelMutationModelResult<Schema, Model, T>;
203211

204212
useUpdateMany<T extends UpdateManyArgs<Schema, Model>>(
205213
options?: ModelMutationOptions<BatchResult, T>,
206214
): ModelMutationResult<BatchResult, T>;
207215

208216
useUpdateManyAndReturn<T extends UpdateManyAndReturnArgs<Schema, Model>>(
209-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>[], T>,
217+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[], T>,
210218
): ModelMutationModelResult<Schema, Model, T, true>;
211219

212220
useUpsert<T extends UpsertArgs<Schema, Model>>(
213-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
221+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
214222
): ModelMutationModelResult<Schema, Model, T>;
215223

216224
useDelete<T extends DeleteArgs<Schema, Model>>(
217-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
225+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
218226
): ModelMutationModelResult<Schema, Model, T>;
219227

220228
useDeleteMany<T extends DeleteManyArgs<Schema, Model>>(

packages/clients/tanstack-query/src/svelte.ts

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import type {
2020
AggregateArgs,
2121
AggregateResult,
2222
BatchResult,
23+
ClientOptions,
2324
CountArgs,
2425
CountResult,
2526
CreateArgs,
@@ -118,13 +119,18 @@ export type ModelMutationModelResult<
118119
Array extends boolean = false,
119120
> = Readable<
120121
Omit<
121-
UnwrapStore<ModelMutationResult<SimplifiedModelResult<Schema, Model, TArgs, false, Array>, TArgs>>,
122+
UnwrapStore<
123+
ModelMutationResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, TArgs, false, Array>, TArgs>
124+
>,
122125
'mutateAsync'
123126
> & {
124127
mutateAsync<T extends TArgs>(
125128
args: T,
126-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T, false, Array>, T>,
127-
): Promise<SimplifiedModelResult<Schema, Model, T, false, Array>>;
129+
options?: ModelMutationOptions<
130+
SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T, false, Array>,
131+
T
132+
>,
133+
): Promise<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T, false, Array>>;
128134
}
129135
>;
130136

@@ -140,54 +146,54 @@ export type ModelQueryHooks<Schema extends SchemaDef, Model extends GetModels<Sc
140146
{
141147
useFindUnique<T extends FindUniqueArgs<Schema, Model>>(
142148
args: SelectSubset<T, FindUniqueArgs<Schema, Model>>,
143-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
144-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
149+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
150+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
145151

146152
useFindFirst<T extends FindFirstArgs<Schema, Model>>(
147153
args?: SelectSubset<T, FindFirstArgs<Schema, Model>>,
148-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T> | null>,
149-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T> | null>;
154+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>,
155+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T> | null>;
150156

151157
useFindMany<T extends FindManyArgs<Schema, Model>>(
152158
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
153-
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
154-
): ModelQueryResult<SimplifiedModelResult<Schema, Model, T>[]>;
159+
options?: ModelQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>,
160+
): ModelQueryResult<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>;
155161

156162
useInfiniteFindMany<T extends FindManyArgs<Schema, Model>>(
157163
args?: SelectSubset<T, FindManyArgs<Schema, Model>>,
158-
options?: ModelInfiniteQueryOptions<SimplifiedModelResult<Schema, Model, T>[]>,
159-
): ModelInfiniteQueryResult<InfiniteData<SimplifiedModelResult<Schema, Model, T>[]>>;
164+
options?: ModelInfiniteQueryOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>,
165+
): ModelInfiniteQueryResult<InfiniteData<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[]>>;
160166

161167
useCreate<T extends CreateArgs<Schema, Model>>(
162-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
168+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
163169
): ModelMutationModelResult<Schema, Model, T>;
164170

165171
useCreateMany<T extends CreateManyArgs<Schema, Model>>(
166172
options?: ModelMutationOptions<BatchResult, T>,
167173
): ModelMutationResult<BatchResult, T>;
168174

169175
useCreateManyAndReturn<T extends CreateManyAndReturnArgs<Schema, Model>>(
170-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>[], T>,
176+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[], T>,
171177
): ModelMutationModelResult<Schema, Model, T, true>;
172178

173179
useUpdate<T extends UpdateArgs<Schema, Model>>(
174-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
180+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
175181
): ModelMutationModelResult<Schema, Model, T>;
176182

177183
useUpdateMany<T extends UpdateManyArgs<Schema, Model>>(
178184
options?: ModelMutationOptions<BatchResult, T>,
179185
): ModelMutationResult<BatchResult, T>;
180186

181187
useUpdateManyAndReturn<T extends UpdateManyAndReturnArgs<Schema, Model>>(
182-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>[], T>,
188+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>[], T>,
183189
): ModelMutationModelResult<Schema, Model, T, true>;
184190

185191
useUpsert<T extends UpsertArgs<Schema, Model>>(
186-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
192+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
187193
): ModelMutationModelResult<Schema, Model, T>;
188194

189195
useDelete<T extends DeleteArgs<Schema, Model>>(
190-
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, T>, T>,
196+
options?: ModelMutationOptions<SimplifiedModelResult<Schema, Model, ClientOptions<Schema>, T>, T>,
191197
): ModelMutationModelResult<Schema, Model, T>;
192198

193199
useDeleteMany<T extends DeleteManyArgs<Schema, Model>>(

0 commit comments

Comments
 (0)