@opensaas/stack-cli 0.5.0 → 0.6.1
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/README.md +76 -0
- package/dist/commands/migrate.d.ts.map +1 -1
- package/dist/commands/migrate.js +94 -268
- package/dist/commands/migrate.js.map +1 -1
- package/package.json +7 -2
- package/.turbo/turbo-build.log +0 -4
- package/CHANGELOG.md +0 -462
- package/CLAUDE.md +0 -298
- package/src/commands/__snapshots__/generate.test.ts.snap +0 -413
- package/src/commands/dev.test.ts +0 -215
- package/src/commands/dev.ts +0 -48
- package/src/commands/generate.test.ts +0 -282
- package/src/commands/generate.ts +0 -182
- package/src/commands/init.ts +0 -34
- package/src/commands/mcp.ts +0 -135
- package/src/commands/migrate.ts +0 -534
- package/src/generator/__snapshots__/context.test.ts.snap +0 -361
- package/src/generator/__snapshots__/prisma.test.ts.snap +0 -174
- package/src/generator/__snapshots__/types.test.ts.snap +0 -1702
- package/src/generator/context.test.ts +0 -139
- package/src/generator/context.ts +0 -227
- package/src/generator/index.ts +0 -7
- package/src/generator/lists.test.ts +0 -335
- package/src/generator/lists.ts +0 -140
- package/src/generator/plugin-types.ts +0 -147
- package/src/generator/prisma-config.ts +0 -46
- package/src/generator/prisma-extensions.ts +0 -159
- package/src/generator/prisma.test.ts +0 -211
- package/src/generator/prisma.ts +0 -161
- package/src/generator/types.test.ts +0 -268
- package/src/generator/types.ts +0 -537
- package/src/index.ts +0 -46
- package/src/mcp/lib/documentation-provider.ts +0 -710
- package/src/mcp/lib/features/catalog.ts +0 -301
- package/src/mcp/lib/generators/feature-generator.ts +0 -598
- package/src/mcp/lib/types.ts +0 -89
- package/src/mcp/lib/wizards/migration-wizard.ts +0 -584
- package/src/mcp/lib/wizards/wizard-engine.ts +0 -427
- package/src/mcp/server/index.ts +0 -361
- package/src/mcp/server/stack-mcp-server.ts +0 -544
- package/src/migration/generators/migration-generator.ts +0 -675
- package/src/migration/introspectors/index.ts +0 -12
- package/src/migration/introspectors/keystone-introspector.ts +0 -296
- package/src/migration/introspectors/nextjs-introspector.ts +0 -209
- package/src/migration/introspectors/prisma-introspector.ts +0 -233
- package/src/migration/types.ts +0 -92
- package/tests/introspectors/keystone-introspector.test.ts +0 -255
- package/tests/introspectors/nextjs-introspector.test.ts +0 -302
- package/tests/introspectors/prisma-introspector.test.ts +0 -268
- package/tests/migration-generator.test.ts +0 -592
- package/tests/migration-wizard.test.ts +0 -442
- package/tsconfig.json +0 -13
- package/tsconfig.tsbuildinfo +0 -1
- package/vitest.config.ts +0 -26
|
@@ -1,1702 +0,0 @@
|
|
|
1
|
-
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
-
|
|
3
|
-
exports[`Types Generator > generateTypes > should generate Context type with all operations 1`] = `
|
|
4
|
-
"/**
|
|
5
|
-
* Generated types from OpenSaas configuration
|
|
6
|
-
* DO NOT EDIT - This file is automatically generated
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
10
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
11
|
-
import type { PluginServices } from './plugin-types'
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Virtual fields for User - computed fields not in database
|
|
15
|
-
* These are added to query results via resolveOutput hooks
|
|
16
|
-
*/
|
|
17
|
-
export type UserVirtualFields = {
|
|
18
|
-
// No virtual fields defined
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
23
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
24
|
-
*/
|
|
25
|
-
export type UserTransformedFields = {
|
|
26
|
-
// No transformed fields defined
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
export type UserOutput = {
|
|
30
|
-
id: string
|
|
31
|
-
name: string | null
|
|
32
|
-
createdAt: Date
|
|
33
|
-
updatedAt: Date
|
|
34
|
-
} & UserVirtualFields
|
|
35
|
-
|
|
36
|
-
export type User = UserOutput
|
|
37
|
-
|
|
38
|
-
export type UserCreateInput = {
|
|
39
|
-
name?: string
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export type UserUpdateInput = {
|
|
43
|
-
name?: string
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type UserWhereInput = {
|
|
47
|
-
id?: string
|
|
48
|
-
AND?: Array<UserWhereInput>
|
|
49
|
-
OR?: Array<UserWhereInput>
|
|
50
|
-
NOT?: UserWhereInput
|
|
51
|
-
name?: { equals?: string, not?: string }
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Hook types for User list
|
|
56
|
-
* Properly typed to use Prisma's generated input types
|
|
57
|
-
*/
|
|
58
|
-
export type UserHooks = {
|
|
59
|
-
resolveInput?: (args:
|
|
60
|
-
| {
|
|
61
|
-
operation: 'create'
|
|
62
|
-
resolvedData: Prisma.UserCreateInput
|
|
63
|
-
item: undefined
|
|
64
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
65
|
-
}
|
|
66
|
-
| {
|
|
67
|
-
operation: 'update'
|
|
68
|
-
resolvedData: Prisma.UserUpdateInput
|
|
69
|
-
item: User
|
|
70
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
71
|
-
}
|
|
72
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
73
|
-
validateInput?: (args: {
|
|
74
|
-
operation: 'create' | 'update'
|
|
75
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
76
|
-
item?: User
|
|
77
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
78
|
-
addValidationError: (msg: string) => void
|
|
79
|
-
}) => Promise<void>
|
|
80
|
-
beforeOperation?: (args: {
|
|
81
|
-
operation: 'create' | 'update' | 'delete'
|
|
82
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
83
|
-
item?: User
|
|
84
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
85
|
-
}) => Promise<void>
|
|
86
|
-
afterOperation?: (args: {
|
|
87
|
-
operation: 'create' | 'update' | 'delete'
|
|
88
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
89
|
-
item?: User
|
|
90
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
91
|
-
}) => Promise<void>
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
/**
|
|
95
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
96
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
97
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
98
|
-
*/
|
|
99
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
100
|
-
'user'
|
|
101
|
-
> & {
|
|
102
|
-
user: {
|
|
103
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
104
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
105
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
106
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
107
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
108
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
109
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
110
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
111
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
112
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
113
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
114
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
115
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
116
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
117
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
118
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
124
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
125
|
-
*/
|
|
126
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
127
|
-
db: CustomDB
|
|
128
|
-
session: TSession
|
|
129
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
130
|
-
sudo: () => Context<TSession>
|
|
131
|
-
}"
|
|
132
|
-
`;
|
|
133
|
-
|
|
134
|
-
exports[`Types Generator > generateTypes > should generate CreateInput type 1`] = `
|
|
135
|
-
"/**
|
|
136
|
-
* Generated types from OpenSaas configuration
|
|
137
|
-
* DO NOT EDIT - This file is automatically generated
|
|
138
|
-
*/
|
|
139
|
-
|
|
140
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
141
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
142
|
-
import type { PluginServices } from './plugin-types'
|
|
143
|
-
|
|
144
|
-
/**
|
|
145
|
-
* Virtual fields for Post - computed fields not in database
|
|
146
|
-
* These are added to query results via resolveOutput hooks
|
|
147
|
-
*/
|
|
148
|
-
export type PostVirtualFields = {
|
|
149
|
-
// No virtual fields defined
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
/**
|
|
153
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
154
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
155
|
-
*/
|
|
156
|
-
export type PostTransformedFields = {
|
|
157
|
-
// No transformed fields defined
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
export type PostOutput = {
|
|
161
|
-
id: string
|
|
162
|
-
title: string
|
|
163
|
-
content: string | null
|
|
164
|
-
createdAt: Date
|
|
165
|
-
updatedAt: Date
|
|
166
|
-
} & PostVirtualFields
|
|
167
|
-
|
|
168
|
-
export type Post = PostOutput
|
|
169
|
-
|
|
170
|
-
export type PostCreateInput = {
|
|
171
|
-
title: string
|
|
172
|
-
content?: string
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
export type PostUpdateInput = {
|
|
176
|
-
title?: string
|
|
177
|
-
content?: string
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
export type PostWhereInput = {
|
|
181
|
-
id?: string
|
|
182
|
-
AND?: Array<PostWhereInput>
|
|
183
|
-
OR?: Array<PostWhereInput>
|
|
184
|
-
NOT?: PostWhereInput
|
|
185
|
-
title?: { equals?: string, not?: string }
|
|
186
|
-
content?: { equals?: string, not?: string }
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
/**
|
|
190
|
-
* Hook types for Post list
|
|
191
|
-
* Properly typed to use Prisma's generated input types
|
|
192
|
-
*/
|
|
193
|
-
export type PostHooks = {
|
|
194
|
-
resolveInput?: (args:
|
|
195
|
-
| {
|
|
196
|
-
operation: 'create'
|
|
197
|
-
resolvedData: Prisma.PostCreateInput
|
|
198
|
-
item: undefined
|
|
199
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
200
|
-
}
|
|
201
|
-
| {
|
|
202
|
-
operation: 'update'
|
|
203
|
-
resolvedData: Prisma.PostUpdateInput
|
|
204
|
-
item: Post
|
|
205
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
206
|
-
}
|
|
207
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
208
|
-
validateInput?: (args: {
|
|
209
|
-
operation: 'create' | 'update'
|
|
210
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
211
|
-
item?: Post
|
|
212
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
213
|
-
addValidationError: (msg: string) => void
|
|
214
|
-
}) => Promise<void>
|
|
215
|
-
beforeOperation?: (args: {
|
|
216
|
-
operation: 'create' | 'update' | 'delete'
|
|
217
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
218
|
-
item?: Post
|
|
219
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
220
|
-
}) => Promise<void>
|
|
221
|
-
afterOperation?: (args: {
|
|
222
|
-
operation: 'create' | 'update' | 'delete'
|
|
223
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
224
|
-
item?: Post
|
|
225
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
226
|
-
}) => Promise<void>
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
/**
|
|
230
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
231
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
232
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
233
|
-
*/
|
|
234
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
235
|
-
'post'
|
|
236
|
-
> & {
|
|
237
|
-
post: {
|
|
238
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
239
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
240
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
241
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
242
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
243
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
244
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
245
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
246
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
247
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
248
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
249
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
250
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
251
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
252
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
253
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
259
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
260
|
-
*/
|
|
261
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
262
|
-
db: CustomDB
|
|
263
|
-
session: TSession
|
|
264
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
265
|
-
sudo: () => Context<TSession>
|
|
266
|
-
}"
|
|
267
|
-
`;
|
|
268
|
-
|
|
269
|
-
exports[`Types Generator > generateTypes > should generate UpdateInput type 1`] = `
|
|
270
|
-
"/**
|
|
271
|
-
* Generated types from OpenSaas configuration
|
|
272
|
-
* DO NOT EDIT - This file is automatically generated
|
|
273
|
-
*/
|
|
274
|
-
|
|
275
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
276
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
277
|
-
import type { PluginServices } from './plugin-types'
|
|
278
|
-
|
|
279
|
-
/**
|
|
280
|
-
* Virtual fields for Post - computed fields not in database
|
|
281
|
-
* These are added to query results via resolveOutput hooks
|
|
282
|
-
*/
|
|
283
|
-
export type PostVirtualFields = {
|
|
284
|
-
// No virtual fields defined
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
289
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
290
|
-
*/
|
|
291
|
-
export type PostTransformedFields = {
|
|
292
|
-
// No transformed fields defined
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
export type PostOutput = {
|
|
296
|
-
id: string
|
|
297
|
-
title: string
|
|
298
|
-
content: string | null
|
|
299
|
-
createdAt: Date
|
|
300
|
-
updatedAt: Date
|
|
301
|
-
} & PostVirtualFields
|
|
302
|
-
|
|
303
|
-
export type Post = PostOutput
|
|
304
|
-
|
|
305
|
-
export type PostCreateInput = {
|
|
306
|
-
title: string
|
|
307
|
-
content?: string
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
export type PostUpdateInput = {
|
|
311
|
-
title?: string
|
|
312
|
-
content?: string
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
export type PostWhereInput = {
|
|
316
|
-
id?: string
|
|
317
|
-
AND?: Array<PostWhereInput>
|
|
318
|
-
OR?: Array<PostWhereInput>
|
|
319
|
-
NOT?: PostWhereInput
|
|
320
|
-
title?: { equals?: string, not?: string }
|
|
321
|
-
content?: { equals?: string, not?: string }
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
/**
|
|
325
|
-
* Hook types for Post list
|
|
326
|
-
* Properly typed to use Prisma's generated input types
|
|
327
|
-
*/
|
|
328
|
-
export type PostHooks = {
|
|
329
|
-
resolveInput?: (args:
|
|
330
|
-
| {
|
|
331
|
-
operation: 'create'
|
|
332
|
-
resolvedData: Prisma.PostCreateInput
|
|
333
|
-
item: undefined
|
|
334
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
335
|
-
}
|
|
336
|
-
| {
|
|
337
|
-
operation: 'update'
|
|
338
|
-
resolvedData: Prisma.PostUpdateInput
|
|
339
|
-
item: Post
|
|
340
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
341
|
-
}
|
|
342
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
343
|
-
validateInput?: (args: {
|
|
344
|
-
operation: 'create' | 'update'
|
|
345
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
346
|
-
item?: Post
|
|
347
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
348
|
-
addValidationError: (msg: string) => void
|
|
349
|
-
}) => Promise<void>
|
|
350
|
-
beforeOperation?: (args: {
|
|
351
|
-
operation: 'create' | 'update' | 'delete'
|
|
352
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
353
|
-
item?: Post
|
|
354
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
355
|
-
}) => Promise<void>
|
|
356
|
-
afterOperation?: (args: {
|
|
357
|
-
operation: 'create' | 'update' | 'delete'
|
|
358
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
359
|
-
item?: Post
|
|
360
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
361
|
-
}) => Promise<void>
|
|
362
|
-
}
|
|
363
|
-
|
|
364
|
-
/**
|
|
365
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
366
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
367
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
368
|
-
*/
|
|
369
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
370
|
-
'post'
|
|
371
|
-
> & {
|
|
372
|
-
post: {
|
|
373
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
374
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
375
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
376
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
377
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
378
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
379
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
380
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
381
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
382
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
383
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
384
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
385
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
386
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
387
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
388
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
/**
|
|
393
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
394
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
395
|
-
*/
|
|
396
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
397
|
-
db: CustomDB
|
|
398
|
-
session: TSession
|
|
399
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
400
|
-
sudo: () => Context<TSession>
|
|
401
|
-
}"
|
|
402
|
-
`;
|
|
403
|
-
|
|
404
|
-
exports[`Types Generator > generateTypes > should generate WhereInput type 1`] = `
|
|
405
|
-
"/**
|
|
406
|
-
* Generated types from OpenSaas configuration
|
|
407
|
-
* DO NOT EDIT - This file is automatically generated
|
|
408
|
-
*/
|
|
409
|
-
|
|
410
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
411
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
412
|
-
import type { PluginServices } from './plugin-types'
|
|
413
|
-
|
|
414
|
-
/**
|
|
415
|
-
* Virtual fields for User - computed fields not in database
|
|
416
|
-
* These are added to query results via resolveOutput hooks
|
|
417
|
-
*/
|
|
418
|
-
export type UserVirtualFields = {
|
|
419
|
-
// No virtual fields defined
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
/**
|
|
423
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
424
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
425
|
-
*/
|
|
426
|
-
export type UserTransformedFields = {
|
|
427
|
-
// No transformed fields defined
|
|
428
|
-
}
|
|
429
|
-
|
|
430
|
-
export type UserOutput = {
|
|
431
|
-
id: string
|
|
432
|
-
name: string | null
|
|
433
|
-
createdAt: Date
|
|
434
|
-
updatedAt: Date
|
|
435
|
-
} & UserVirtualFields
|
|
436
|
-
|
|
437
|
-
export type User = UserOutput
|
|
438
|
-
|
|
439
|
-
export type UserCreateInput = {
|
|
440
|
-
name?: string
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
export type UserUpdateInput = {
|
|
444
|
-
name?: string
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
export type UserWhereInput = {
|
|
448
|
-
id?: string
|
|
449
|
-
AND?: Array<UserWhereInput>
|
|
450
|
-
OR?: Array<UserWhereInput>
|
|
451
|
-
NOT?: UserWhereInput
|
|
452
|
-
name?: { equals?: string, not?: string }
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
/**
|
|
456
|
-
* Hook types for User list
|
|
457
|
-
* Properly typed to use Prisma's generated input types
|
|
458
|
-
*/
|
|
459
|
-
export type UserHooks = {
|
|
460
|
-
resolveInput?: (args:
|
|
461
|
-
| {
|
|
462
|
-
operation: 'create'
|
|
463
|
-
resolvedData: Prisma.UserCreateInput
|
|
464
|
-
item: undefined
|
|
465
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
466
|
-
}
|
|
467
|
-
| {
|
|
468
|
-
operation: 'update'
|
|
469
|
-
resolvedData: Prisma.UserUpdateInput
|
|
470
|
-
item: User
|
|
471
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
472
|
-
}
|
|
473
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
474
|
-
validateInput?: (args: {
|
|
475
|
-
operation: 'create' | 'update'
|
|
476
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
477
|
-
item?: User
|
|
478
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
479
|
-
addValidationError: (msg: string) => void
|
|
480
|
-
}) => Promise<void>
|
|
481
|
-
beforeOperation?: (args: {
|
|
482
|
-
operation: 'create' | 'update' | 'delete'
|
|
483
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
484
|
-
item?: User
|
|
485
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
486
|
-
}) => Promise<void>
|
|
487
|
-
afterOperation?: (args: {
|
|
488
|
-
operation: 'create' | 'update' | 'delete'
|
|
489
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
490
|
-
item?: User
|
|
491
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
492
|
-
}) => Promise<void>
|
|
493
|
-
}
|
|
494
|
-
|
|
495
|
-
/**
|
|
496
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
497
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
498
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
499
|
-
*/
|
|
500
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
501
|
-
'user'
|
|
502
|
-
> & {
|
|
503
|
-
user: {
|
|
504
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
505
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
506
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
507
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
508
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
509
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
510
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
511
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
512
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
513
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
514
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
515
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
516
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
517
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
518
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
519
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
520
|
-
}
|
|
521
|
-
}
|
|
522
|
-
|
|
523
|
-
/**
|
|
524
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
525
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
526
|
-
*/
|
|
527
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
528
|
-
db: CustomDB
|
|
529
|
-
session: TSession
|
|
530
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
531
|
-
sudo: () => Context<TSession>
|
|
532
|
-
}"
|
|
533
|
-
`;
|
|
534
|
-
|
|
535
|
-
exports[`Types Generator > generateTypes > should generate type definitions for basic model 1`] = `
|
|
536
|
-
"/**
|
|
537
|
-
* Generated types from OpenSaas configuration
|
|
538
|
-
* DO NOT EDIT - This file is automatically generated
|
|
539
|
-
*/
|
|
540
|
-
|
|
541
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
542
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
543
|
-
import type { PluginServices } from './plugin-types'
|
|
544
|
-
|
|
545
|
-
/**
|
|
546
|
-
* Virtual fields for User - computed fields not in database
|
|
547
|
-
* These are added to query results via resolveOutput hooks
|
|
548
|
-
*/
|
|
549
|
-
export type UserVirtualFields = {
|
|
550
|
-
// No virtual fields defined
|
|
551
|
-
}
|
|
552
|
-
|
|
553
|
-
/**
|
|
554
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
555
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
556
|
-
*/
|
|
557
|
-
export type UserTransformedFields = {
|
|
558
|
-
// No transformed fields defined
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
export type UserOutput = {
|
|
562
|
-
id: string
|
|
563
|
-
name: string
|
|
564
|
-
email: string
|
|
565
|
-
createdAt: Date
|
|
566
|
-
updatedAt: Date
|
|
567
|
-
} & UserVirtualFields
|
|
568
|
-
|
|
569
|
-
export type User = UserOutput
|
|
570
|
-
|
|
571
|
-
export type UserCreateInput = {
|
|
572
|
-
name: string
|
|
573
|
-
email: string
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
export type UserUpdateInput = {
|
|
577
|
-
name?: string
|
|
578
|
-
email?: string
|
|
579
|
-
}
|
|
580
|
-
|
|
581
|
-
export type UserWhereInput = {
|
|
582
|
-
id?: string
|
|
583
|
-
AND?: Array<UserWhereInput>
|
|
584
|
-
OR?: Array<UserWhereInput>
|
|
585
|
-
NOT?: UserWhereInput
|
|
586
|
-
name?: { equals?: string, not?: string }
|
|
587
|
-
email?: { equals?: string, not?: string }
|
|
588
|
-
}
|
|
589
|
-
|
|
590
|
-
/**
|
|
591
|
-
* Hook types for User list
|
|
592
|
-
* Properly typed to use Prisma's generated input types
|
|
593
|
-
*/
|
|
594
|
-
export type UserHooks = {
|
|
595
|
-
resolveInput?: (args:
|
|
596
|
-
| {
|
|
597
|
-
operation: 'create'
|
|
598
|
-
resolvedData: Prisma.UserCreateInput
|
|
599
|
-
item: undefined
|
|
600
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
601
|
-
}
|
|
602
|
-
| {
|
|
603
|
-
operation: 'update'
|
|
604
|
-
resolvedData: Prisma.UserUpdateInput
|
|
605
|
-
item: User
|
|
606
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
607
|
-
}
|
|
608
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
609
|
-
validateInput?: (args: {
|
|
610
|
-
operation: 'create' | 'update'
|
|
611
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
612
|
-
item?: User
|
|
613
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
614
|
-
addValidationError: (msg: string) => void
|
|
615
|
-
}) => Promise<void>
|
|
616
|
-
beforeOperation?: (args: {
|
|
617
|
-
operation: 'create' | 'update' | 'delete'
|
|
618
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
619
|
-
item?: User
|
|
620
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
621
|
-
}) => Promise<void>
|
|
622
|
-
afterOperation?: (args: {
|
|
623
|
-
operation: 'create' | 'update' | 'delete'
|
|
624
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
625
|
-
item?: User
|
|
626
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
627
|
-
}) => Promise<void>
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
/**
|
|
631
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
632
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
633
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
634
|
-
*/
|
|
635
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
636
|
-
'user'
|
|
637
|
-
> & {
|
|
638
|
-
user: {
|
|
639
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
640
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
641
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
642
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
643
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
644
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
645
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
646
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
647
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
648
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
649
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
650
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
651
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
652
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
653
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
654
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
655
|
-
}
|
|
656
|
-
}
|
|
657
|
-
|
|
658
|
-
/**
|
|
659
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
660
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
661
|
-
*/
|
|
662
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
663
|
-
db: CustomDB
|
|
664
|
-
session: TSession
|
|
665
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
666
|
-
sudo: () => Context<TSession>
|
|
667
|
-
}"
|
|
668
|
-
`;
|
|
669
|
-
|
|
670
|
-
exports[`Types Generator > generateTypes > should generate types for multiple lists 1`] = `
|
|
671
|
-
"/**
|
|
672
|
-
* Generated types from OpenSaas configuration
|
|
673
|
-
* DO NOT EDIT - This file is automatically generated
|
|
674
|
-
*/
|
|
675
|
-
|
|
676
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
677
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
678
|
-
import type { PluginServices } from './plugin-types'
|
|
679
|
-
|
|
680
|
-
/**
|
|
681
|
-
* Virtual fields for User - computed fields not in database
|
|
682
|
-
* These are added to query results via resolveOutput hooks
|
|
683
|
-
*/
|
|
684
|
-
export type UserVirtualFields = {
|
|
685
|
-
// No virtual fields defined
|
|
686
|
-
}
|
|
687
|
-
|
|
688
|
-
/**
|
|
689
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
690
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
691
|
-
*/
|
|
692
|
-
export type UserTransformedFields = {
|
|
693
|
-
// No transformed fields defined
|
|
694
|
-
}
|
|
695
|
-
|
|
696
|
-
export type UserOutput = {
|
|
697
|
-
id: string
|
|
698
|
-
name: string | null
|
|
699
|
-
createdAt: Date
|
|
700
|
-
updatedAt: Date
|
|
701
|
-
} & UserVirtualFields
|
|
702
|
-
|
|
703
|
-
export type User = UserOutput
|
|
704
|
-
|
|
705
|
-
export type UserCreateInput = {
|
|
706
|
-
name?: string
|
|
707
|
-
}
|
|
708
|
-
|
|
709
|
-
export type UserUpdateInput = {
|
|
710
|
-
name?: string
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
export type UserWhereInput = {
|
|
714
|
-
id?: string
|
|
715
|
-
AND?: Array<UserWhereInput>
|
|
716
|
-
OR?: Array<UserWhereInput>
|
|
717
|
-
NOT?: UserWhereInput
|
|
718
|
-
name?: { equals?: string, not?: string }
|
|
719
|
-
}
|
|
720
|
-
|
|
721
|
-
/**
|
|
722
|
-
* Hook types for User list
|
|
723
|
-
* Properly typed to use Prisma's generated input types
|
|
724
|
-
*/
|
|
725
|
-
export type UserHooks = {
|
|
726
|
-
resolveInput?: (args:
|
|
727
|
-
| {
|
|
728
|
-
operation: 'create'
|
|
729
|
-
resolvedData: Prisma.UserCreateInput
|
|
730
|
-
item: undefined
|
|
731
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
732
|
-
}
|
|
733
|
-
| {
|
|
734
|
-
operation: 'update'
|
|
735
|
-
resolvedData: Prisma.UserUpdateInput
|
|
736
|
-
item: User
|
|
737
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
738
|
-
}
|
|
739
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
740
|
-
validateInput?: (args: {
|
|
741
|
-
operation: 'create' | 'update'
|
|
742
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
743
|
-
item?: User
|
|
744
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
745
|
-
addValidationError: (msg: string) => void
|
|
746
|
-
}) => Promise<void>
|
|
747
|
-
beforeOperation?: (args: {
|
|
748
|
-
operation: 'create' | 'update' | 'delete'
|
|
749
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
750
|
-
item?: User
|
|
751
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
752
|
-
}) => Promise<void>
|
|
753
|
-
afterOperation?: (args: {
|
|
754
|
-
operation: 'create' | 'update' | 'delete'
|
|
755
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
756
|
-
item?: User
|
|
757
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
758
|
-
}) => Promise<void>
|
|
759
|
-
}
|
|
760
|
-
|
|
761
|
-
/**
|
|
762
|
-
* Virtual fields for Post - computed fields not in database
|
|
763
|
-
* These are added to query results via resolveOutput hooks
|
|
764
|
-
*/
|
|
765
|
-
export type PostVirtualFields = {
|
|
766
|
-
// No virtual fields defined
|
|
767
|
-
}
|
|
768
|
-
|
|
769
|
-
/**
|
|
770
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
771
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
772
|
-
*/
|
|
773
|
-
export type PostTransformedFields = {
|
|
774
|
-
// No transformed fields defined
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
export type PostOutput = {
|
|
778
|
-
id: string
|
|
779
|
-
title: string | null
|
|
780
|
-
createdAt: Date
|
|
781
|
-
updatedAt: Date
|
|
782
|
-
} & PostVirtualFields
|
|
783
|
-
|
|
784
|
-
export type Post = PostOutput
|
|
785
|
-
|
|
786
|
-
export type PostCreateInput = {
|
|
787
|
-
title?: string
|
|
788
|
-
}
|
|
789
|
-
|
|
790
|
-
export type PostUpdateInput = {
|
|
791
|
-
title?: string
|
|
792
|
-
}
|
|
793
|
-
|
|
794
|
-
export type PostWhereInput = {
|
|
795
|
-
id?: string
|
|
796
|
-
AND?: Array<PostWhereInput>
|
|
797
|
-
OR?: Array<PostWhereInput>
|
|
798
|
-
NOT?: PostWhereInput
|
|
799
|
-
title?: { equals?: string, not?: string }
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
/**
|
|
803
|
-
* Hook types for Post list
|
|
804
|
-
* Properly typed to use Prisma's generated input types
|
|
805
|
-
*/
|
|
806
|
-
export type PostHooks = {
|
|
807
|
-
resolveInput?: (args:
|
|
808
|
-
| {
|
|
809
|
-
operation: 'create'
|
|
810
|
-
resolvedData: Prisma.PostCreateInput
|
|
811
|
-
item: undefined
|
|
812
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
813
|
-
}
|
|
814
|
-
| {
|
|
815
|
-
operation: 'update'
|
|
816
|
-
resolvedData: Prisma.PostUpdateInput
|
|
817
|
-
item: Post
|
|
818
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
819
|
-
}
|
|
820
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
821
|
-
validateInput?: (args: {
|
|
822
|
-
operation: 'create' | 'update'
|
|
823
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
824
|
-
item?: Post
|
|
825
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
826
|
-
addValidationError: (msg: string) => void
|
|
827
|
-
}) => Promise<void>
|
|
828
|
-
beforeOperation?: (args: {
|
|
829
|
-
operation: 'create' | 'update' | 'delete'
|
|
830
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
831
|
-
item?: Post
|
|
832
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
833
|
-
}) => Promise<void>
|
|
834
|
-
afterOperation?: (args: {
|
|
835
|
-
operation: 'create' | 'update' | 'delete'
|
|
836
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
837
|
-
item?: Post
|
|
838
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
839
|
-
}) => Promise<void>
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
/**
|
|
843
|
-
* Virtual fields for Comment - computed fields not in database
|
|
844
|
-
* These are added to query results via resolveOutput hooks
|
|
845
|
-
*/
|
|
846
|
-
export type CommentVirtualFields = {
|
|
847
|
-
// No virtual fields defined
|
|
848
|
-
}
|
|
849
|
-
|
|
850
|
-
/**
|
|
851
|
-
* Transformed fields for Comment - fields with resultExtension transformations
|
|
852
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
853
|
-
*/
|
|
854
|
-
export type CommentTransformedFields = {
|
|
855
|
-
// No transformed fields defined
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
export type CommentOutput = {
|
|
859
|
-
id: string
|
|
860
|
-
content: string | null
|
|
861
|
-
createdAt: Date
|
|
862
|
-
updatedAt: Date
|
|
863
|
-
} & CommentVirtualFields
|
|
864
|
-
|
|
865
|
-
export type Comment = CommentOutput
|
|
866
|
-
|
|
867
|
-
export type CommentCreateInput = {
|
|
868
|
-
content?: string
|
|
869
|
-
}
|
|
870
|
-
|
|
871
|
-
export type CommentUpdateInput = {
|
|
872
|
-
content?: string
|
|
873
|
-
}
|
|
874
|
-
|
|
875
|
-
export type CommentWhereInput = {
|
|
876
|
-
id?: string
|
|
877
|
-
AND?: Array<CommentWhereInput>
|
|
878
|
-
OR?: Array<CommentWhereInput>
|
|
879
|
-
NOT?: CommentWhereInput
|
|
880
|
-
content?: { equals?: string, not?: string }
|
|
881
|
-
}
|
|
882
|
-
|
|
883
|
-
/**
|
|
884
|
-
* Hook types for Comment list
|
|
885
|
-
* Properly typed to use Prisma's generated input types
|
|
886
|
-
*/
|
|
887
|
-
export type CommentHooks = {
|
|
888
|
-
resolveInput?: (args:
|
|
889
|
-
| {
|
|
890
|
-
operation: 'create'
|
|
891
|
-
resolvedData: Prisma.CommentCreateInput
|
|
892
|
-
item: undefined
|
|
893
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
894
|
-
}
|
|
895
|
-
| {
|
|
896
|
-
operation: 'update'
|
|
897
|
-
resolvedData: Prisma.CommentUpdateInput
|
|
898
|
-
item: Comment
|
|
899
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
900
|
-
}
|
|
901
|
-
) => Promise<Prisma.CommentCreateInput | Prisma.CommentUpdateInput>
|
|
902
|
-
validateInput?: (args: {
|
|
903
|
-
operation: 'create' | 'update'
|
|
904
|
-
resolvedData: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
|
|
905
|
-
item?: Comment
|
|
906
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
907
|
-
addValidationError: (msg: string) => void
|
|
908
|
-
}) => Promise<void>
|
|
909
|
-
beforeOperation?: (args: {
|
|
910
|
-
operation: 'create' | 'update' | 'delete'
|
|
911
|
-
resolvedData?: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
|
|
912
|
-
item?: Comment
|
|
913
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
914
|
-
}) => Promise<void>
|
|
915
|
-
afterOperation?: (args: {
|
|
916
|
-
operation: 'create' | 'update' | 'delete'
|
|
917
|
-
resolvedData?: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
|
|
918
|
-
item?: Comment
|
|
919
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
920
|
-
}) => Promise<void>
|
|
921
|
-
}
|
|
922
|
-
|
|
923
|
-
/**
|
|
924
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
925
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
926
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
927
|
-
*/
|
|
928
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
929
|
-
'user' | 'post' | 'comment'
|
|
930
|
-
> & {
|
|
931
|
-
user: {
|
|
932
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
933
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
934
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
935
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
936
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
937
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
938
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
939
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
940
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
941
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
942
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
943
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
944
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
945
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
946
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
947
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
948
|
-
}
|
|
949
|
-
post: {
|
|
950
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
951
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
952
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
953
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
954
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
955
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
956
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
957
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
958
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
959
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
960
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
961
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
962
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
963
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
964
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
965
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
966
|
-
}
|
|
967
|
-
comment: {
|
|
968
|
-
findUnique: <T extends Prisma.CommentFindUniqueArgs>(
|
|
969
|
-
args: Prisma.SelectSubset<T, Prisma.CommentFindUniqueArgs>
|
|
970
|
-
) => Promise<(Omit<Prisma.CommentGetPayload<T>, keyof CommentTransformedFields> & CommentTransformedFields & CommentVirtualFields) | null>
|
|
971
|
-
findMany: <T extends Prisma.CommentFindManyArgs>(
|
|
972
|
-
args?: Prisma.SelectSubset<T, Prisma.CommentFindManyArgs>
|
|
973
|
-
) => Promise<Array<Omit<Prisma.CommentGetPayload<T>, keyof CommentTransformedFields> & CommentTransformedFields & CommentVirtualFields>>
|
|
974
|
-
create: <T extends Prisma.CommentCreateArgs>(
|
|
975
|
-
args: Prisma.SelectSubset<T, Prisma.CommentCreateArgs>
|
|
976
|
-
) => Promise<Omit<Prisma.CommentGetPayload<T>, keyof CommentTransformedFields> & CommentTransformedFields & CommentVirtualFields>
|
|
977
|
-
update: <T extends Prisma.CommentUpdateArgs>(
|
|
978
|
-
args: Prisma.SelectSubset<T, Prisma.CommentUpdateArgs>
|
|
979
|
-
) => Promise<(Omit<Prisma.CommentGetPayload<T>, keyof CommentTransformedFields> & CommentTransformedFields & CommentVirtualFields) | null>
|
|
980
|
-
delete: <T extends Prisma.CommentDeleteArgs>(
|
|
981
|
-
args: Prisma.SelectSubset<T, Prisma.CommentDeleteArgs>
|
|
982
|
-
) => Promise<(Omit<Prisma.CommentGetPayload<T>, keyof CommentTransformedFields> & CommentTransformedFields & CommentVirtualFields) | null>
|
|
983
|
-
count: (args?: Prisma.CommentCountArgs) => Promise<number>
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
|
|
987
|
-
/**
|
|
988
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
989
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
990
|
-
*/
|
|
991
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
992
|
-
db: CustomDB
|
|
993
|
-
session: TSession
|
|
994
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
995
|
-
sudo: () => Context<TSession>
|
|
996
|
-
}"
|
|
997
|
-
`;
|
|
998
|
-
|
|
999
|
-
exports[`Types Generator > generateTypes > should handle relationship fields in CreateInput 1`] = `
|
|
1000
|
-
"/**
|
|
1001
|
-
* Generated types from OpenSaas configuration
|
|
1002
|
-
* DO NOT EDIT - This file is automatically generated
|
|
1003
|
-
*/
|
|
1004
|
-
|
|
1005
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
1006
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
1007
|
-
import type { PluginServices } from './plugin-types'
|
|
1008
|
-
|
|
1009
|
-
/**
|
|
1010
|
-
* Virtual fields for Post - computed fields not in database
|
|
1011
|
-
* These are added to query results via resolveOutput hooks
|
|
1012
|
-
*/
|
|
1013
|
-
export type PostVirtualFields = {
|
|
1014
|
-
// No virtual fields defined
|
|
1015
|
-
}
|
|
1016
|
-
|
|
1017
|
-
/**
|
|
1018
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
1019
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1020
|
-
*/
|
|
1021
|
-
export type PostTransformedFields = {
|
|
1022
|
-
// No transformed fields defined
|
|
1023
|
-
}
|
|
1024
|
-
|
|
1025
|
-
export type PostOutput = {
|
|
1026
|
-
id: string
|
|
1027
|
-
title: string | null
|
|
1028
|
-
authorId: string | null
|
|
1029
|
-
author?: UserOutput | null
|
|
1030
|
-
createdAt: Date
|
|
1031
|
-
updatedAt: Date
|
|
1032
|
-
} & PostVirtualFields
|
|
1033
|
-
|
|
1034
|
-
export type Post = PostOutput
|
|
1035
|
-
|
|
1036
|
-
export type PostCreateInput = {
|
|
1037
|
-
title?: string
|
|
1038
|
-
author?: { connect: { id: string } }
|
|
1039
|
-
}
|
|
1040
|
-
|
|
1041
|
-
export type PostUpdateInput = {
|
|
1042
|
-
title?: string
|
|
1043
|
-
author?: { connect: { id: string } } | { disconnect: true }
|
|
1044
|
-
}
|
|
1045
|
-
|
|
1046
|
-
export type PostWhereInput = {
|
|
1047
|
-
id?: string
|
|
1048
|
-
AND?: Array<PostWhereInput>
|
|
1049
|
-
OR?: Array<PostWhereInput>
|
|
1050
|
-
NOT?: PostWhereInput
|
|
1051
|
-
title?: { equals?: string, not?: string }
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
|
-
/**
|
|
1055
|
-
* Hook types for Post list
|
|
1056
|
-
* Properly typed to use Prisma's generated input types
|
|
1057
|
-
*/
|
|
1058
|
-
export type PostHooks = {
|
|
1059
|
-
resolveInput?: (args:
|
|
1060
|
-
| {
|
|
1061
|
-
operation: 'create'
|
|
1062
|
-
resolvedData: Prisma.PostCreateInput
|
|
1063
|
-
item: undefined
|
|
1064
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1065
|
-
}
|
|
1066
|
-
| {
|
|
1067
|
-
operation: 'update'
|
|
1068
|
-
resolvedData: Prisma.PostUpdateInput
|
|
1069
|
-
item: Post
|
|
1070
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1071
|
-
}
|
|
1072
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
1073
|
-
validateInput?: (args: {
|
|
1074
|
-
operation: 'create' | 'update'
|
|
1075
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1076
|
-
item?: Post
|
|
1077
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1078
|
-
addValidationError: (msg: string) => void
|
|
1079
|
-
}) => Promise<void>
|
|
1080
|
-
beforeOperation?: (args: {
|
|
1081
|
-
operation: 'create' | 'update' | 'delete'
|
|
1082
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1083
|
-
item?: Post
|
|
1084
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1085
|
-
}) => Promise<void>
|
|
1086
|
-
afterOperation?: (args: {
|
|
1087
|
-
operation: 'create' | 'update' | 'delete'
|
|
1088
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1089
|
-
item?: Post
|
|
1090
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1091
|
-
}) => Promise<void>
|
|
1092
|
-
}
|
|
1093
|
-
|
|
1094
|
-
/**
|
|
1095
|
-
* Virtual fields for User - computed fields not in database
|
|
1096
|
-
* These are added to query results via resolveOutput hooks
|
|
1097
|
-
*/
|
|
1098
|
-
export type UserVirtualFields = {
|
|
1099
|
-
// No virtual fields defined
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
|
-
/**
|
|
1103
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
1104
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1105
|
-
*/
|
|
1106
|
-
export type UserTransformedFields = {
|
|
1107
|
-
// No transformed fields defined
|
|
1108
|
-
}
|
|
1109
|
-
|
|
1110
|
-
export type UserOutput = {
|
|
1111
|
-
id: string
|
|
1112
|
-
name: string | null
|
|
1113
|
-
createdAt: Date
|
|
1114
|
-
updatedAt: Date
|
|
1115
|
-
} & UserVirtualFields
|
|
1116
|
-
|
|
1117
|
-
export type User = UserOutput
|
|
1118
|
-
|
|
1119
|
-
export type UserCreateInput = {
|
|
1120
|
-
name?: string
|
|
1121
|
-
}
|
|
1122
|
-
|
|
1123
|
-
export type UserUpdateInput = {
|
|
1124
|
-
name?: string
|
|
1125
|
-
}
|
|
1126
|
-
|
|
1127
|
-
export type UserWhereInput = {
|
|
1128
|
-
id?: string
|
|
1129
|
-
AND?: Array<UserWhereInput>
|
|
1130
|
-
OR?: Array<UserWhereInput>
|
|
1131
|
-
NOT?: UserWhereInput
|
|
1132
|
-
name?: { equals?: string, not?: string }
|
|
1133
|
-
}
|
|
1134
|
-
|
|
1135
|
-
/**
|
|
1136
|
-
* Hook types for User list
|
|
1137
|
-
* Properly typed to use Prisma's generated input types
|
|
1138
|
-
*/
|
|
1139
|
-
export type UserHooks = {
|
|
1140
|
-
resolveInput?: (args:
|
|
1141
|
-
| {
|
|
1142
|
-
operation: 'create'
|
|
1143
|
-
resolvedData: Prisma.UserCreateInput
|
|
1144
|
-
item: undefined
|
|
1145
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1146
|
-
}
|
|
1147
|
-
| {
|
|
1148
|
-
operation: 'update'
|
|
1149
|
-
resolvedData: Prisma.UserUpdateInput
|
|
1150
|
-
item: User
|
|
1151
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1152
|
-
}
|
|
1153
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
1154
|
-
validateInput?: (args: {
|
|
1155
|
-
operation: 'create' | 'update'
|
|
1156
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1157
|
-
item?: User
|
|
1158
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1159
|
-
addValidationError: (msg: string) => void
|
|
1160
|
-
}) => Promise<void>
|
|
1161
|
-
beforeOperation?: (args: {
|
|
1162
|
-
operation: 'create' | 'update' | 'delete'
|
|
1163
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1164
|
-
item?: User
|
|
1165
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1166
|
-
}) => Promise<void>
|
|
1167
|
-
afterOperation?: (args: {
|
|
1168
|
-
operation: 'create' | 'update' | 'delete'
|
|
1169
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1170
|
-
item?: User
|
|
1171
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1172
|
-
}) => Promise<void>
|
|
1173
|
-
}
|
|
1174
|
-
|
|
1175
|
-
/**
|
|
1176
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
1177
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
1178
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
1179
|
-
*/
|
|
1180
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
1181
|
-
'post' | 'user'
|
|
1182
|
-
> & {
|
|
1183
|
-
post: {
|
|
1184
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
1185
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
1186
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1187
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
1188
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
1189
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
1190
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
1191
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
1192
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
1193
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
1194
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
1195
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1196
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
1197
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
1198
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1199
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
1200
|
-
}
|
|
1201
|
-
user: {
|
|
1202
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
1203
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
1204
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1205
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
1206
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
1207
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
1208
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
1209
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
1210
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
1211
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
1212
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
1213
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1214
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
1215
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
1216
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1217
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
1218
|
-
}
|
|
1219
|
-
}
|
|
1220
|
-
|
|
1221
|
-
/**
|
|
1222
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
1223
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
1224
|
-
*/
|
|
1225
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
1226
|
-
db: CustomDB
|
|
1227
|
-
session: TSession
|
|
1228
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
1229
|
-
sudo: () => Context<TSession>
|
|
1230
|
-
}"
|
|
1231
|
-
`;
|
|
1232
|
-
|
|
1233
|
-
exports[`Types Generator > generateTypes > should handle relationship fields in UpdateInput 1`] = `
|
|
1234
|
-
"/**
|
|
1235
|
-
* Generated types from OpenSaas configuration
|
|
1236
|
-
* DO NOT EDIT - This file is automatically generated
|
|
1237
|
-
*/
|
|
1238
|
-
|
|
1239
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
1240
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
1241
|
-
import type { PluginServices } from './plugin-types'
|
|
1242
|
-
|
|
1243
|
-
/**
|
|
1244
|
-
* Virtual fields for Post - computed fields not in database
|
|
1245
|
-
* These are added to query results via resolveOutput hooks
|
|
1246
|
-
*/
|
|
1247
|
-
export type PostVirtualFields = {
|
|
1248
|
-
// No virtual fields defined
|
|
1249
|
-
}
|
|
1250
|
-
|
|
1251
|
-
/**
|
|
1252
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
1253
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1254
|
-
*/
|
|
1255
|
-
export type PostTransformedFields = {
|
|
1256
|
-
// No transformed fields defined
|
|
1257
|
-
}
|
|
1258
|
-
|
|
1259
|
-
export type PostOutput = {
|
|
1260
|
-
id: string
|
|
1261
|
-
title: string | null
|
|
1262
|
-
authorId: string | null
|
|
1263
|
-
author?: UserOutput | null
|
|
1264
|
-
createdAt: Date
|
|
1265
|
-
updatedAt: Date
|
|
1266
|
-
} & PostVirtualFields
|
|
1267
|
-
|
|
1268
|
-
export type Post = PostOutput
|
|
1269
|
-
|
|
1270
|
-
export type PostCreateInput = {
|
|
1271
|
-
title?: string
|
|
1272
|
-
author?: { connect: { id: string } }
|
|
1273
|
-
}
|
|
1274
|
-
|
|
1275
|
-
export type PostUpdateInput = {
|
|
1276
|
-
title?: string
|
|
1277
|
-
author?: { connect: { id: string } } | { disconnect: true }
|
|
1278
|
-
}
|
|
1279
|
-
|
|
1280
|
-
export type PostWhereInput = {
|
|
1281
|
-
id?: string
|
|
1282
|
-
AND?: Array<PostWhereInput>
|
|
1283
|
-
OR?: Array<PostWhereInput>
|
|
1284
|
-
NOT?: PostWhereInput
|
|
1285
|
-
title?: { equals?: string, not?: string }
|
|
1286
|
-
}
|
|
1287
|
-
|
|
1288
|
-
/**
|
|
1289
|
-
* Hook types for Post list
|
|
1290
|
-
* Properly typed to use Prisma's generated input types
|
|
1291
|
-
*/
|
|
1292
|
-
export type PostHooks = {
|
|
1293
|
-
resolveInput?: (args:
|
|
1294
|
-
| {
|
|
1295
|
-
operation: 'create'
|
|
1296
|
-
resolvedData: Prisma.PostCreateInput
|
|
1297
|
-
item: undefined
|
|
1298
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1299
|
-
}
|
|
1300
|
-
| {
|
|
1301
|
-
operation: 'update'
|
|
1302
|
-
resolvedData: Prisma.PostUpdateInput
|
|
1303
|
-
item: Post
|
|
1304
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1305
|
-
}
|
|
1306
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
1307
|
-
validateInput?: (args: {
|
|
1308
|
-
operation: 'create' | 'update'
|
|
1309
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1310
|
-
item?: Post
|
|
1311
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1312
|
-
addValidationError: (msg: string) => void
|
|
1313
|
-
}) => Promise<void>
|
|
1314
|
-
beforeOperation?: (args: {
|
|
1315
|
-
operation: 'create' | 'update' | 'delete'
|
|
1316
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1317
|
-
item?: Post
|
|
1318
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1319
|
-
}) => Promise<void>
|
|
1320
|
-
afterOperation?: (args: {
|
|
1321
|
-
operation: 'create' | 'update' | 'delete'
|
|
1322
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1323
|
-
item?: Post
|
|
1324
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1325
|
-
}) => Promise<void>
|
|
1326
|
-
}
|
|
1327
|
-
|
|
1328
|
-
/**
|
|
1329
|
-
* Virtual fields for User - computed fields not in database
|
|
1330
|
-
* These are added to query results via resolveOutput hooks
|
|
1331
|
-
*/
|
|
1332
|
-
export type UserVirtualFields = {
|
|
1333
|
-
// No virtual fields defined
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
/**
|
|
1337
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
1338
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1339
|
-
*/
|
|
1340
|
-
export type UserTransformedFields = {
|
|
1341
|
-
// No transformed fields defined
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
export type UserOutput = {
|
|
1345
|
-
id: string
|
|
1346
|
-
name: string | null
|
|
1347
|
-
createdAt: Date
|
|
1348
|
-
updatedAt: Date
|
|
1349
|
-
} & UserVirtualFields
|
|
1350
|
-
|
|
1351
|
-
export type User = UserOutput
|
|
1352
|
-
|
|
1353
|
-
export type UserCreateInput = {
|
|
1354
|
-
name?: string
|
|
1355
|
-
}
|
|
1356
|
-
|
|
1357
|
-
export type UserUpdateInput = {
|
|
1358
|
-
name?: string
|
|
1359
|
-
}
|
|
1360
|
-
|
|
1361
|
-
export type UserWhereInput = {
|
|
1362
|
-
id?: string
|
|
1363
|
-
AND?: Array<UserWhereInput>
|
|
1364
|
-
OR?: Array<UserWhereInput>
|
|
1365
|
-
NOT?: UserWhereInput
|
|
1366
|
-
name?: { equals?: string, not?: string }
|
|
1367
|
-
}
|
|
1368
|
-
|
|
1369
|
-
/**
|
|
1370
|
-
* Hook types for User list
|
|
1371
|
-
* Properly typed to use Prisma's generated input types
|
|
1372
|
-
*/
|
|
1373
|
-
export type UserHooks = {
|
|
1374
|
-
resolveInput?: (args:
|
|
1375
|
-
| {
|
|
1376
|
-
operation: 'create'
|
|
1377
|
-
resolvedData: Prisma.UserCreateInput
|
|
1378
|
-
item: undefined
|
|
1379
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1380
|
-
}
|
|
1381
|
-
| {
|
|
1382
|
-
operation: 'update'
|
|
1383
|
-
resolvedData: Prisma.UserUpdateInput
|
|
1384
|
-
item: User
|
|
1385
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1386
|
-
}
|
|
1387
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
1388
|
-
validateInput?: (args: {
|
|
1389
|
-
operation: 'create' | 'update'
|
|
1390
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1391
|
-
item?: User
|
|
1392
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1393
|
-
addValidationError: (msg: string) => void
|
|
1394
|
-
}) => Promise<void>
|
|
1395
|
-
beforeOperation?: (args: {
|
|
1396
|
-
operation: 'create' | 'update' | 'delete'
|
|
1397
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1398
|
-
item?: User
|
|
1399
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1400
|
-
}) => Promise<void>
|
|
1401
|
-
afterOperation?: (args: {
|
|
1402
|
-
operation: 'create' | 'update' | 'delete'
|
|
1403
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1404
|
-
item?: User
|
|
1405
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1406
|
-
}) => Promise<void>
|
|
1407
|
-
}
|
|
1408
|
-
|
|
1409
|
-
/**
|
|
1410
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
1411
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
1412
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
1413
|
-
*/
|
|
1414
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
1415
|
-
'post' | 'user'
|
|
1416
|
-
> & {
|
|
1417
|
-
post: {
|
|
1418
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
1419
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
1420
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1421
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
1422
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
1423
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
1424
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
1425
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
1426
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
1427
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
1428
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
1429
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1430
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
1431
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
1432
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1433
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
1434
|
-
}
|
|
1435
|
-
user: {
|
|
1436
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
1437
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
1438
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1439
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
1440
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
1441
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
1442
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
1443
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
1444
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
1445
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
1446
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
1447
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1448
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
1449
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
1450
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1451
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
/**
|
|
1456
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
1457
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
1458
|
-
*/
|
|
1459
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
1460
|
-
db: CustomDB
|
|
1461
|
-
session: TSession
|
|
1462
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
1463
|
-
sudo: () => Context<TSession>
|
|
1464
|
-
}"
|
|
1465
|
-
`;
|
|
1466
|
-
|
|
1467
|
-
exports[`Types Generator > generateTypes > should handle relationship fields in types 1`] = `
|
|
1468
|
-
"/**
|
|
1469
|
-
* Generated types from OpenSaas configuration
|
|
1470
|
-
* DO NOT EDIT - This file is automatically generated
|
|
1471
|
-
*/
|
|
1472
|
-
|
|
1473
|
-
import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB, AccessContext } from '@opensaas/stack-core'
|
|
1474
|
-
import type { PrismaClient, Prisma } from './prisma-client/client'
|
|
1475
|
-
import type { PluginServices } from './plugin-types'
|
|
1476
|
-
|
|
1477
|
-
/**
|
|
1478
|
-
* Virtual fields for User - computed fields not in database
|
|
1479
|
-
* These are added to query results via resolveOutput hooks
|
|
1480
|
-
*/
|
|
1481
|
-
export type UserVirtualFields = {
|
|
1482
|
-
// No virtual fields defined
|
|
1483
|
-
}
|
|
1484
|
-
|
|
1485
|
-
/**
|
|
1486
|
-
* Transformed fields for User - fields with resultExtension transformations
|
|
1487
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1488
|
-
*/
|
|
1489
|
-
export type UserTransformedFields = {
|
|
1490
|
-
// No transformed fields defined
|
|
1491
|
-
}
|
|
1492
|
-
|
|
1493
|
-
export type UserOutput = {
|
|
1494
|
-
id: string
|
|
1495
|
-
name: string | null
|
|
1496
|
-
posts?: PostOutput[]
|
|
1497
|
-
createdAt: Date
|
|
1498
|
-
updatedAt: Date
|
|
1499
|
-
} & UserVirtualFields
|
|
1500
|
-
|
|
1501
|
-
export type User = UserOutput
|
|
1502
|
-
|
|
1503
|
-
export type UserCreateInput = {
|
|
1504
|
-
name?: string
|
|
1505
|
-
posts?: { connect: Array<{ id: string }> }
|
|
1506
|
-
}
|
|
1507
|
-
|
|
1508
|
-
export type UserUpdateInput = {
|
|
1509
|
-
name?: string
|
|
1510
|
-
posts?: { connect: Array<{ id: string }>, disconnect: Array<{ id: string }> }
|
|
1511
|
-
}
|
|
1512
|
-
|
|
1513
|
-
export type UserWhereInput = {
|
|
1514
|
-
id?: string
|
|
1515
|
-
AND?: Array<UserWhereInput>
|
|
1516
|
-
OR?: Array<UserWhereInput>
|
|
1517
|
-
NOT?: UserWhereInput
|
|
1518
|
-
name?: { equals?: string, not?: string }
|
|
1519
|
-
}
|
|
1520
|
-
|
|
1521
|
-
/**
|
|
1522
|
-
* Hook types for User list
|
|
1523
|
-
* Properly typed to use Prisma's generated input types
|
|
1524
|
-
*/
|
|
1525
|
-
export type UserHooks = {
|
|
1526
|
-
resolveInput?: (args:
|
|
1527
|
-
| {
|
|
1528
|
-
operation: 'create'
|
|
1529
|
-
resolvedData: Prisma.UserCreateInput
|
|
1530
|
-
item: undefined
|
|
1531
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1532
|
-
}
|
|
1533
|
-
| {
|
|
1534
|
-
operation: 'update'
|
|
1535
|
-
resolvedData: Prisma.UserUpdateInput
|
|
1536
|
-
item: User
|
|
1537
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1538
|
-
}
|
|
1539
|
-
) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
|
|
1540
|
-
validateInput?: (args: {
|
|
1541
|
-
operation: 'create' | 'update'
|
|
1542
|
-
resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1543
|
-
item?: User
|
|
1544
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1545
|
-
addValidationError: (msg: string) => void
|
|
1546
|
-
}) => Promise<void>
|
|
1547
|
-
beforeOperation?: (args: {
|
|
1548
|
-
operation: 'create' | 'update' | 'delete'
|
|
1549
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1550
|
-
item?: User
|
|
1551
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1552
|
-
}) => Promise<void>
|
|
1553
|
-
afterOperation?: (args: {
|
|
1554
|
-
operation: 'create' | 'update' | 'delete'
|
|
1555
|
-
resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
|
|
1556
|
-
item?: User
|
|
1557
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1558
|
-
}) => Promise<void>
|
|
1559
|
-
}
|
|
1560
|
-
|
|
1561
|
-
/**
|
|
1562
|
-
* Virtual fields for Post - computed fields not in database
|
|
1563
|
-
* These are added to query results via resolveOutput hooks
|
|
1564
|
-
*/
|
|
1565
|
-
export type PostVirtualFields = {
|
|
1566
|
-
// No virtual fields defined
|
|
1567
|
-
}
|
|
1568
|
-
|
|
1569
|
-
/**
|
|
1570
|
-
* Transformed fields for Post - fields with resultExtension transformations
|
|
1571
|
-
* These override Prisma's base types with transformed types via result extensions
|
|
1572
|
-
*/
|
|
1573
|
-
export type PostTransformedFields = {
|
|
1574
|
-
// No transformed fields defined
|
|
1575
|
-
}
|
|
1576
|
-
|
|
1577
|
-
export type PostOutput = {
|
|
1578
|
-
id: string
|
|
1579
|
-
title: string | null
|
|
1580
|
-
authorId: string | null
|
|
1581
|
-
author?: UserOutput | null
|
|
1582
|
-
createdAt: Date
|
|
1583
|
-
updatedAt: Date
|
|
1584
|
-
} & PostVirtualFields
|
|
1585
|
-
|
|
1586
|
-
export type Post = PostOutput
|
|
1587
|
-
|
|
1588
|
-
export type PostCreateInput = {
|
|
1589
|
-
title?: string
|
|
1590
|
-
author?: { connect: { id: string } }
|
|
1591
|
-
}
|
|
1592
|
-
|
|
1593
|
-
export type PostUpdateInput = {
|
|
1594
|
-
title?: string
|
|
1595
|
-
author?: { connect: { id: string } } | { disconnect: true }
|
|
1596
|
-
}
|
|
1597
|
-
|
|
1598
|
-
export type PostWhereInput = {
|
|
1599
|
-
id?: string
|
|
1600
|
-
AND?: Array<PostWhereInput>
|
|
1601
|
-
OR?: Array<PostWhereInput>
|
|
1602
|
-
NOT?: PostWhereInput
|
|
1603
|
-
title?: { equals?: string, not?: string }
|
|
1604
|
-
}
|
|
1605
|
-
|
|
1606
|
-
/**
|
|
1607
|
-
* Hook types for Post list
|
|
1608
|
-
* Properly typed to use Prisma's generated input types
|
|
1609
|
-
*/
|
|
1610
|
-
export type PostHooks = {
|
|
1611
|
-
resolveInput?: (args:
|
|
1612
|
-
| {
|
|
1613
|
-
operation: 'create'
|
|
1614
|
-
resolvedData: Prisma.PostCreateInput
|
|
1615
|
-
item: undefined
|
|
1616
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1617
|
-
}
|
|
1618
|
-
| {
|
|
1619
|
-
operation: 'update'
|
|
1620
|
-
resolvedData: Prisma.PostUpdateInput
|
|
1621
|
-
item: Post
|
|
1622
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1623
|
-
}
|
|
1624
|
-
) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
|
|
1625
|
-
validateInput?: (args: {
|
|
1626
|
-
operation: 'create' | 'update'
|
|
1627
|
-
resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1628
|
-
item?: Post
|
|
1629
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1630
|
-
addValidationError: (msg: string) => void
|
|
1631
|
-
}) => Promise<void>
|
|
1632
|
-
beforeOperation?: (args: {
|
|
1633
|
-
operation: 'create' | 'update' | 'delete'
|
|
1634
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1635
|
-
item?: Post
|
|
1636
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1637
|
-
}) => Promise<void>
|
|
1638
|
-
afterOperation?: (args: {
|
|
1639
|
-
operation: 'create' | 'update' | 'delete'
|
|
1640
|
-
resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
|
|
1641
|
-
item?: Post
|
|
1642
|
-
context: import('@opensaas/stack-core').AccessContext
|
|
1643
|
-
}) => Promise<void>
|
|
1644
|
-
}
|
|
1645
|
-
|
|
1646
|
-
/**
|
|
1647
|
-
* Custom DB type that uses Prisma's conditional types with virtual and transformed field support
|
|
1648
|
-
* Types change based on select/include - relationships only present when explicitly included
|
|
1649
|
-
* Virtual fields and transformed fields are added to the base model type
|
|
1650
|
-
*/
|
|
1651
|
-
export type CustomDB = Omit<AccessControlledDB<PrismaClient>,
|
|
1652
|
-
'user' | 'post'
|
|
1653
|
-
> & {
|
|
1654
|
-
user: {
|
|
1655
|
-
findUnique: <T extends Prisma.UserFindUniqueArgs>(
|
|
1656
|
-
args: Prisma.SelectSubset<T, Prisma.UserFindUniqueArgs>
|
|
1657
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1658
|
-
findMany: <T extends Prisma.UserFindManyArgs>(
|
|
1659
|
-
args?: Prisma.SelectSubset<T, Prisma.UserFindManyArgs>
|
|
1660
|
-
) => Promise<Array<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>>
|
|
1661
|
-
create: <T extends Prisma.UserCreateArgs>(
|
|
1662
|
-
args: Prisma.SelectSubset<T, Prisma.UserCreateArgs>
|
|
1663
|
-
) => Promise<Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields>
|
|
1664
|
-
update: <T extends Prisma.UserUpdateArgs>(
|
|
1665
|
-
args: Prisma.SelectSubset<T, Prisma.UserUpdateArgs>
|
|
1666
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1667
|
-
delete: <T extends Prisma.UserDeleteArgs>(
|
|
1668
|
-
args: Prisma.SelectSubset<T, Prisma.UserDeleteArgs>
|
|
1669
|
-
) => Promise<(Omit<Prisma.UserGetPayload<T>, keyof UserTransformedFields> & UserTransformedFields & UserVirtualFields) | null>
|
|
1670
|
-
count: (args?: Prisma.UserCountArgs) => Promise<number>
|
|
1671
|
-
}
|
|
1672
|
-
post: {
|
|
1673
|
-
findUnique: <T extends Prisma.PostFindUniqueArgs>(
|
|
1674
|
-
args: Prisma.SelectSubset<T, Prisma.PostFindUniqueArgs>
|
|
1675
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1676
|
-
findMany: <T extends Prisma.PostFindManyArgs>(
|
|
1677
|
-
args?: Prisma.SelectSubset<T, Prisma.PostFindManyArgs>
|
|
1678
|
-
) => Promise<Array<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>>
|
|
1679
|
-
create: <T extends Prisma.PostCreateArgs>(
|
|
1680
|
-
args: Prisma.SelectSubset<T, Prisma.PostCreateArgs>
|
|
1681
|
-
) => Promise<Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields>
|
|
1682
|
-
update: <T extends Prisma.PostUpdateArgs>(
|
|
1683
|
-
args: Prisma.SelectSubset<T, Prisma.PostUpdateArgs>
|
|
1684
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1685
|
-
delete: <T extends Prisma.PostDeleteArgs>(
|
|
1686
|
-
args: Prisma.SelectSubset<T, Prisma.PostDeleteArgs>
|
|
1687
|
-
) => Promise<(Omit<Prisma.PostGetPayload<T>, keyof PostTransformedFields> & PostTransformedFields & PostVirtualFields) | null>
|
|
1688
|
-
count: (args?: Prisma.PostCountArgs) => Promise<number>
|
|
1689
|
-
}
|
|
1690
|
-
}
|
|
1691
|
-
|
|
1692
|
-
/**
|
|
1693
|
-
* Context type compatible with AccessContext but with CustomDB for virtual field typing
|
|
1694
|
-
* Extends AccessContext and overrides db property to include virtual fields in output types
|
|
1695
|
-
*/
|
|
1696
|
-
export type Context<TSession extends OpensaasSession = OpensaasSession> = Omit<AccessContext<PrismaClient>, 'db' | 'session'> & {
|
|
1697
|
-
db: CustomDB
|
|
1698
|
-
session: TSession
|
|
1699
|
-
serverAction: (props: ServerActionProps) => Promise<unknown>
|
|
1700
|
-
sudo: () => Context<TSession>
|
|
1701
|
-
}"
|
|
1702
|
-
`;
|