@opensaas/stack-cli 0.1.6 → 0.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/CHANGELOG.md +215 -0
  3. package/CLAUDE.md +60 -12
  4. package/dist/commands/generate.d.ts.map +1 -1
  5. package/dist/commands/generate.js +10 -1
  6. package/dist/commands/generate.js.map +1 -1
  7. package/dist/commands/mcp.d.ts +6 -0
  8. package/dist/commands/mcp.d.ts.map +1 -0
  9. package/dist/commands/mcp.js +116 -0
  10. package/dist/commands/mcp.js.map +1 -0
  11. package/dist/generator/context.d.ts.map +1 -1
  12. package/dist/generator/context.js +21 -3
  13. package/dist/generator/context.js.map +1 -1
  14. package/dist/generator/index.d.ts +3 -0
  15. package/dist/generator/index.d.ts.map +1 -1
  16. package/dist/generator/index.js +3 -0
  17. package/dist/generator/index.js.map +1 -1
  18. package/dist/generator/lists.d.ts +31 -0
  19. package/dist/generator/lists.d.ts.map +1 -0
  20. package/dist/generator/lists.js +91 -0
  21. package/dist/generator/lists.js.map +1 -0
  22. package/dist/generator/plugin-types.d.ts +10 -0
  23. package/dist/generator/plugin-types.d.ts.map +1 -0
  24. package/dist/generator/plugin-types.js +122 -0
  25. package/dist/generator/plugin-types.js.map +1 -0
  26. package/dist/generator/prisma-config.d.ts +17 -0
  27. package/dist/generator/prisma-config.d.ts.map +1 -0
  28. package/dist/generator/prisma-config.js +40 -0
  29. package/dist/generator/prisma-config.js.map +1 -0
  30. package/dist/generator/prisma.d.ts.map +1 -1
  31. package/dist/generator/prisma.js +1 -2
  32. package/dist/generator/prisma.js.map +1 -1
  33. package/dist/generator/types.d.ts.map +1 -1
  34. package/dist/generator/types.js +53 -1
  35. package/dist/generator/types.js.map +1 -1
  36. package/dist/index.js +3 -0
  37. package/dist/index.js.map +1 -1
  38. package/dist/mcp/lib/documentation-provider.d.ts +43 -0
  39. package/dist/mcp/lib/documentation-provider.d.ts.map +1 -0
  40. package/dist/mcp/lib/documentation-provider.js +163 -0
  41. package/dist/mcp/lib/documentation-provider.js.map +1 -0
  42. package/dist/mcp/lib/features/catalog.d.ts +26 -0
  43. package/dist/mcp/lib/features/catalog.d.ts.map +1 -0
  44. package/dist/mcp/lib/features/catalog.js +291 -0
  45. package/dist/mcp/lib/features/catalog.js.map +1 -0
  46. package/dist/mcp/lib/generators/feature-generator.d.ts +35 -0
  47. package/dist/mcp/lib/generators/feature-generator.d.ts.map +1 -0
  48. package/dist/mcp/lib/generators/feature-generator.js +546 -0
  49. package/dist/mcp/lib/generators/feature-generator.js.map +1 -0
  50. package/dist/mcp/lib/types.d.ts +80 -0
  51. package/dist/mcp/lib/types.d.ts.map +1 -0
  52. package/dist/mcp/lib/types.js +5 -0
  53. package/dist/mcp/lib/types.js.map +1 -0
  54. package/dist/mcp/lib/wizards/wizard-engine.d.ts +71 -0
  55. package/dist/mcp/lib/wizards/wizard-engine.d.ts.map +1 -0
  56. package/dist/mcp/lib/wizards/wizard-engine.js +356 -0
  57. package/dist/mcp/lib/wizards/wizard-engine.js.map +1 -0
  58. package/dist/mcp/server/index.d.ts +8 -0
  59. package/dist/mcp/server/index.d.ts.map +1 -0
  60. package/dist/mcp/server/index.js +202 -0
  61. package/dist/mcp/server/index.js.map +1 -0
  62. package/dist/mcp/server/stack-mcp-server.d.ts +92 -0
  63. package/dist/mcp/server/stack-mcp-server.d.ts.map +1 -0
  64. package/dist/mcp/server/stack-mcp-server.js +265 -0
  65. package/dist/mcp/server/stack-mcp-server.js.map +1 -0
  66. package/package.json +9 -7
  67. package/src/commands/__snapshots__/generate.test.ts.snap +61 -21
  68. package/src/commands/dev.test.ts +0 -1
  69. package/src/commands/generate.test.ts +18 -8
  70. package/src/commands/generate.ts +12 -0
  71. package/src/commands/mcp.ts +135 -0
  72. package/src/generator/__snapshots__/context.test.ts.snap +8 -8
  73. package/src/generator/__snapshots__/prisma.test.ts.snap +8 -16
  74. package/src/generator/__snapshots__/types.test.ts.snap +605 -9
  75. package/src/generator/context.test.ts +13 -8
  76. package/src/generator/context.ts +21 -3
  77. package/src/generator/index.ts +3 -0
  78. package/src/generator/lists.test.ts +335 -0
  79. package/src/generator/lists.ts +102 -0
  80. package/src/generator/plugin-types.ts +147 -0
  81. package/src/generator/prisma-config.ts +46 -0
  82. package/src/generator/prisma.test.ts +0 -10
  83. package/src/generator/prisma.ts +1 -2
  84. package/src/generator/types.test.ts +0 -12
  85. package/src/generator/types.ts +56 -1
  86. package/src/index.ts +4 -0
  87. package/src/mcp/lib/documentation-provider.ts +203 -0
  88. package/src/mcp/lib/features/catalog.ts +301 -0
  89. package/src/mcp/lib/generators/feature-generator.ts +598 -0
  90. package/src/mcp/lib/types.ts +89 -0
  91. package/src/mcp/lib/wizards/wizard-engine.ts +427 -0
  92. package/src/mcp/server/index.ts +240 -0
  93. package/src/mcp/server/stack-mcp-server.ts +301 -0
  94. package/tsconfig.tsbuildinfo +1 -1
@@ -7,7 +7,8 @@ exports[`Types Generator > generateTypes > should generate Context type with all
7
7
  */
8
8
 
9
9
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
10
- import type { PrismaClient } from './prisma-client'
10
+ import type { PrismaClient, Prisma } from './prisma-client/client'
11
+ import type { PluginServices } from './plugin-types'
11
12
 
12
13
  export type User = {
13
14
  id: string
@@ -32,12 +33,55 @@ export type UserWhereInput = {
32
33
  name?: { equals?: string, not?: string }
33
34
  }
34
35
 
36
+ /**
37
+ * Hook types for User list
38
+ * Properly typed to use Prisma's generated input types
39
+ */
40
+ export type UserHooks = {
41
+ resolveInput?: (args:
42
+ | {
43
+ operation: 'create'
44
+ resolvedData: Prisma.UserCreateInput
45
+ item: undefined
46
+ context: import('@opensaas/stack-core').AccessContext
47
+ }
48
+ | {
49
+ operation: 'update'
50
+ resolvedData: Prisma.UserUpdateInput
51
+ item: User
52
+ context: import('@opensaas/stack-core').AccessContext
53
+ }
54
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
55
+ validateInput?: (args: {
56
+ operation: 'create' | 'update'
57
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
58
+ item?: User
59
+ context: import('@opensaas/stack-core').AccessContext
60
+ addValidationError: (msg: string) => void
61
+ }) => Promise<void>
62
+ beforeOperation?: (args: {
63
+ operation: 'create' | 'update' | 'delete'
64
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
65
+ item?: User
66
+ context: import('@opensaas/stack-core').AccessContext
67
+ }) => Promise<void>
68
+ afterOperation?: (args: {
69
+ operation: 'create' | 'update' | 'delete'
70
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
71
+ item?: User
72
+ context: import('@opensaas/stack-core').AccessContext
73
+ }) => Promise<void>
74
+ }
75
+
35
76
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
36
77
  db: AccessControlledDB<PrismaClient>
37
78
  session: TSession
38
79
  prisma: PrismaClient
39
80
  storage: StorageUtils
81
+ plugins: PluginServices
40
82
  serverAction: (props: ServerActionProps) => Promise<unknown>
83
+ sudo: () => Context<TSession>
84
+ _isSudo: boolean
41
85
  }"
42
86
  `;
43
87
 
@@ -48,7 +92,8 @@ exports[`Types Generator > generateTypes > should generate CreateInput type 1`]
48
92
  */
49
93
 
50
94
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
51
- import type { PrismaClient } from './prisma-client'
95
+ import type { PrismaClient, Prisma } from './prisma-client/client'
96
+ import type { PluginServices } from './plugin-types'
52
97
 
53
98
  export type Post = {
54
99
  id: string
@@ -77,12 +122,55 @@ export type PostWhereInput = {
77
122
  content?: { equals?: string, not?: string }
78
123
  }
79
124
 
125
+ /**
126
+ * Hook types for Post list
127
+ * Properly typed to use Prisma's generated input types
128
+ */
129
+ export type PostHooks = {
130
+ resolveInput?: (args:
131
+ | {
132
+ operation: 'create'
133
+ resolvedData: Prisma.PostCreateInput
134
+ item: undefined
135
+ context: import('@opensaas/stack-core').AccessContext
136
+ }
137
+ | {
138
+ operation: 'update'
139
+ resolvedData: Prisma.PostUpdateInput
140
+ item: Post
141
+ context: import('@opensaas/stack-core').AccessContext
142
+ }
143
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
144
+ validateInput?: (args: {
145
+ operation: 'create' | 'update'
146
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
147
+ item?: Post
148
+ context: import('@opensaas/stack-core').AccessContext
149
+ addValidationError: (msg: string) => void
150
+ }) => Promise<void>
151
+ beforeOperation?: (args: {
152
+ operation: 'create' | 'update' | 'delete'
153
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
154
+ item?: Post
155
+ context: import('@opensaas/stack-core').AccessContext
156
+ }) => Promise<void>
157
+ afterOperation?: (args: {
158
+ operation: 'create' | 'update' | 'delete'
159
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
160
+ item?: Post
161
+ context: import('@opensaas/stack-core').AccessContext
162
+ }) => Promise<void>
163
+ }
164
+
80
165
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
81
166
  db: AccessControlledDB<PrismaClient>
82
167
  session: TSession
83
168
  prisma: PrismaClient
84
169
  storage: StorageUtils
170
+ plugins: PluginServices
85
171
  serverAction: (props: ServerActionProps) => Promise<unknown>
172
+ sudo: () => Context<TSession>
173
+ _isSudo: boolean
86
174
  }"
87
175
  `;
88
176
 
@@ -93,7 +181,8 @@ exports[`Types Generator > generateTypes > should generate UpdateInput type 1`]
93
181
  */
94
182
 
95
183
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
96
- import type { PrismaClient } from './prisma-client'
184
+ import type { PrismaClient, Prisma } from './prisma-client/client'
185
+ import type { PluginServices } from './plugin-types'
97
186
 
98
187
  export type Post = {
99
188
  id: string
@@ -122,12 +211,55 @@ export type PostWhereInput = {
122
211
  content?: { equals?: string, not?: string }
123
212
  }
124
213
 
214
+ /**
215
+ * Hook types for Post list
216
+ * Properly typed to use Prisma's generated input types
217
+ */
218
+ export type PostHooks = {
219
+ resolveInput?: (args:
220
+ | {
221
+ operation: 'create'
222
+ resolvedData: Prisma.PostCreateInput
223
+ item: undefined
224
+ context: import('@opensaas/stack-core').AccessContext
225
+ }
226
+ | {
227
+ operation: 'update'
228
+ resolvedData: Prisma.PostUpdateInput
229
+ item: Post
230
+ context: import('@opensaas/stack-core').AccessContext
231
+ }
232
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
233
+ validateInput?: (args: {
234
+ operation: 'create' | 'update'
235
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
236
+ item?: Post
237
+ context: import('@opensaas/stack-core').AccessContext
238
+ addValidationError: (msg: string) => void
239
+ }) => Promise<void>
240
+ beforeOperation?: (args: {
241
+ operation: 'create' | 'update' | 'delete'
242
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
243
+ item?: Post
244
+ context: import('@opensaas/stack-core').AccessContext
245
+ }) => Promise<void>
246
+ afterOperation?: (args: {
247
+ operation: 'create' | 'update' | 'delete'
248
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
249
+ item?: Post
250
+ context: import('@opensaas/stack-core').AccessContext
251
+ }) => Promise<void>
252
+ }
253
+
125
254
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
126
255
  db: AccessControlledDB<PrismaClient>
127
256
  session: TSession
128
257
  prisma: PrismaClient
129
258
  storage: StorageUtils
259
+ plugins: PluginServices
130
260
  serverAction: (props: ServerActionProps) => Promise<unknown>
261
+ sudo: () => Context<TSession>
262
+ _isSudo: boolean
131
263
  }"
132
264
  `;
133
265
 
@@ -138,7 +270,8 @@ exports[`Types Generator > generateTypes > should generate WhereInput type 1`] =
138
270
  */
139
271
 
140
272
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
141
- import type { PrismaClient } from './prisma-client'
273
+ import type { PrismaClient, Prisma } from './prisma-client/client'
274
+ import type { PluginServices } from './plugin-types'
142
275
 
143
276
  export type User = {
144
277
  id: string
@@ -163,12 +296,55 @@ export type UserWhereInput = {
163
296
  name?: { equals?: string, not?: string }
164
297
  }
165
298
 
299
+ /**
300
+ * Hook types for User list
301
+ * Properly typed to use Prisma's generated input types
302
+ */
303
+ export type UserHooks = {
304
+ resolveInput?: (args:
305
+ | {
306
+ operation: 'create'
307
+ resolvedData: Prisma.UserCreateInput
308
+ item: undefined
309
+ context: import('@opensaas/stack-core').AccessContext
310
+ }
311
+ | {
312
+ operation: 'update'
313
+ resolvedData: Prisma.UserUpdateInput
314
+ item: User
315
+ context: import('@opensaas/stack-core').AccessContext
316
+ }
317
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
318
+ validateInput?: (args: {
319
+ operation: 'create' | 'update'
320
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
321
+ item?: User
322
+ context: import('@opensaas/stack-core').AccessContext
323
+ addValidationError: (msg: string) => void
324
+ }) => Promise<void>
325
+ beforeOperation?: (args: {
326
+ operation: 'create' | 'update' | 'delete'
327
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
328
+ item?: User
329
+ context: import('@opensaas/stack-core').AccessContext
330
+ }) => Promise<void>
331
+ afterOperation?: (args: {
332
+ operation: 'create' | 'update' | 'delete'
333
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
334
+ item?: User
335
+ context: import('@opensaas/stack-core').AccessContext
336
+ }) => Promise<void>
337
+ }
338
+
166
339
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
167
340
  db: AccessControlledDB<PrismaClient>
168
341
  session: TSession
169
342
  prisma: PrismaClient
170
343
  storage: StorageUtils
344
+ plugins: PluginServices
171
345
  serverAction: (props: ServerActionProps) => Promise<unknown>
346
+ sudo: () => Context<TSession>
347
+ _isSudo: boolean
172
348
  }"
173
349
  `;
174
350
 
@@ -179,7 +355,8 @@ exports[`Types Generator > generateTypes > should generate type definitions for
179
355
  */
180
356
 
181
357
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
182
- import type { PrismaClient } from './prisma-client'
358
+ import type { PrismaClient, Prisma } from './prisma-client/client'
359
+ import type { PluginServices } from './plugin-types'
183
360
 
184
361
  export type User = {
185
362
  id: string
@@ -208,12 +385,55 @@ export type UserWhereInput = {
208
385
  email?: { equals?: string, not?: string }
209
386
  }
210
387
 
388
+ /**
389
+ * Hook types for User list
390
+ * Properly typed to use Prisma's generated input types
391
+ */
392
+ export type UserHooks = {
393
+ resolveInput?: (args:
394
+ | {
395
+ operation: 'create'
396
+ resolvedData: Prisma.UserCreateInput
397
+ item: undefined
398
+ context: import('@opensaas/stack-core').AccessContext
399
+ }
400
+ | {
401
+ operation: 'update'
402
+ resolvedData: Prisma.UserUpdateInput
403
+ item: User
404
+ context: import('@opensaas/stack-core').AccessContext
405
+ }
406
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
407
+ validateInput?: (args: {
408
+ operation: 'create' | 'update'
409
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
410
+ item?: User
411
+ context: import('@opensaas/stack-core').AccessContext
412
+ addValidationError: (msg: string) => void
413
+ }) => Promise<void>
414
+ beforeOperation?: (args: {
415
+ operation: 'create' | 'update' | 'delete'
416
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
417
+ item?: User
418
+ context: import('@opensaas/stack-core').AccessContext
419
+ }) => Promise<void>
420
+ afterOperation?: (args: {
421
+ operation: 'create' | 'update' | 'delete'
422
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
423
+ item?: User
424
+ context: import('@opensaas/stack-core').AccessContext
425
+ }) => Promise<void>
426
+ }
427
+
211
428
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
212
429
  db: AccessControlledDB<PrismaClient>
213
430
  session: TSession
214
431
  prisma: PrismaClient
215
432
  storage: StorageUtils
433
+ plugins: PluginServices
216
434
  serverAction: (props: ServerActionProps) => Promise<unknown>
435
+ sudo: () => Context<TSession>
436
+ _isSudo: boolean
217
437
  }"
218
438
  `;
219
439
 
@@ -224,7 +444,8 @@ exports[`Types Generator > generateTypes > should generate types for multiple li
224
444
  */
225
445
 
226
446
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
227
- import type { PrismaClient } from './prisma-client'
447
+ import type { PrismaClient, Prisma } from './prisma-client/client'
448
+ import type { PluginServices } from './plugin-types'
228
449
 
229
450
  export type User = {
230
451
  id: string
@@ -249,6 +470,46 @@ export type UserWhereInput = {
249
470
  name?: { equals?: string, not?: string }
250
471
  }
251
472
 
473
+ /**
474
+ * Hook types for User list
475
+ * Properly typed to use Prisma's generated input types
476
+ */
477
+ export type UserHooks = {
478
+ resolveInput?: (args:
479
+ | {
480
+ operation: 'create'
481
+ resolvedData: Prisma.UserCreateInput
482
+ item: undefined
483
+ context: import('@opensaas/stack-core').AccessContext
484
+ }
485
+ | {
486
+ operation: 'update'
487
+ resolvedData: Prisma.UserUpdateInput
488
+ item: User
489
+ context: import('@opensaas/stack-core').AccessContext
490
+ }
491
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
492
+ validateInput?: (args: {
493
+ operation: 'create' | 'update'
494
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
495
+ item?: User
496
+ context: import('@opensaas/stack-core').AccessContext
497
+ addValidationError: (msg: string) => void
498
+ }) => Promise<void>
499
+ beforeOperation?: (args: {
500
+ operation: 'create' | 'update' | 'delete'
501
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
502
+ item?: User
503
+ context: import('@opensaas/stack-core').AccessContext
504
+ }) => Promise<void>
505
+ afterOperation?: (args: {
506
+ operation: 'create' | 'update' | 'delete'
507
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
508
+ item?: User
509
+ context: import('@opensaas/stack-core').AccessContext
510
+ }) => Promise<void>
511
+ }
512
+
252
513
  export type Post = {
253
514
  id: string
254
515
  title: string | null
@@ -272,6 +533,46 @@ export type PostWhereInput = {
272
533
  title?: { equals?: string, not?: string }
273
534
  }
274
535
 
536
+ /**
537
+ * Hook types for Post list
538
+ * Properly typed to use Prisma's generated input types
539
+ */
540
+ export type PostHooks = {
541
+ resolveInput?: (args:
542
+ | {
543
+ operation: 'create'
544
+ resolvedData: Prisma.PostCreateInput
545
+ item: undefined
546
+ context: import('@opensaas/stack-core').AccessContext
547
+ }
548
+ | {
549
+ operation: 'update'
550
+ resolvedData: Prisma.PostUpdateInput
551
+ item: Post
552
+ context: import('@opensaas/stack-core').AccessContext
553
+ }
554
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
555
+ validateInput?: (args: {
556
+ operation: 'create' | 'update'
557
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
558
+ item?: Post
559
+ context: import('@opensaas/stack-core').AccessContext
560
+ addValidationError: (msg: string) => void
561
+ }) => Promise<void>
562
+ beforeOperation?: (args: {
563
+ operation: 'create' | 'update' | 'delete'
564
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
565
+ item?: Post
566
+ context: import('@opensaas/stack-core').AccessContext
567
+ }) => Promise<void>
568
+ afterOperation?: (args: {
569
+ operation: 'create' | 'update' | 'delete'
570
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
571
+ item?: Post
572
+ context: import('@opensaas/stack-core').AccessContext
573
+ }) => Promise<void>
574
+ }
575
+
275
576
  export type Comment = {
276
577
  id: string
277
578
  content: string | null
@@ -295,12 +596,55 @@ export type CommentWhereInput = {
295
596
  content?: { equals?: string, not?: string }
296
597
  }
297
598
 
599
+ /**
600
+ * Hook types for Comment list
601
+ * Properly typed to use Prisma's generated input types
602
+ */
603
+ export type CommentHooks = {
604
+ resolveInput?: (args:
605
+ | {
606
+ operation: 'create'
607
+ resolvedData: Prisma.CommentCreateInput
608
+ item: undefined
609
+ context: import('@opensaas/stack-core').AccessContext
610
+ }
611
+ | {
612
+ operation: 'update'
613
+ resolvedData: Prisma.CommentUpdateInput
614
+ item: Comment
615
+ context: import('@opensaas/stack-core').AccessContext
616
+ }
617
+ ) => Promise<Prisma.CommentCreateInput | Prisma.CommentUpdateInput>
618
+ validateInput?: (args: {
619
+ operation: 'create' | 'update'
620
+ resolvedData: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
621
+ item?: Comment
622
+ context: import('@opensaas/stack-core').AccessContext
623
+ addValidationError: (msg: string) => void
624
+ }) => Promise<void>
625
+ beforeOperation?: (args: {
626
+ operation: 'create' | 'update' | 'delete'
627
+ resolvedData?: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
628
+ item?: Comment
629
+ context: import('@opensaas/stack-core').AccessContext
630
+ }) => Promise<void>
631
+ afterOperation?: (args: {
632
+ operation: 'create' | 'update' | 'delete'
633
+ resolvedData?: Prisma.CommentCreateInput | Prisma.CommentUpdateInput
634
+ item?: Comment
635
+ context: import('@opensaas/stack-core').AccessContext
636
+ }) => Promise<void>
637
+ }
638
+
298
639
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
299
640
  db: AccessControlledDB<PrismaClient>
300
641
  session: TSession
301
642
  prisma: PrismaClient
302
643
  storage: StorageUtils
644
+ plugins: PluginServices
303
645
  serverAction: (props: ServerActionProps) => Promise<unknown>
646
+ sudo: () => Context<TSession>
647
+ _isSudo: boolean
304
648
  }"
305
649
  `;
306
650
 
@@ -311,7 +655,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
311
655
  */
312
656
 
313
657
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
314
- import type { PrismaClient } from './prisma-client'
658
+ import type { PrismaClient, Prisma } from './prisma-client/client'
659
+ import type { PluginServices } from './plugin-types'
315
660
 
316
661
  export type Post = {
317
662
  id: string
@@ -340,6 +685,46 @@ export type PostWhereInput = {
340
685
  title?: { equals?: string, not?: string }
341
686
  }
342
687
 
688
+ /**
689
+ * Hook types for Post list
690
+ * Properly typed to use Prisma's generated input types
691
+ */
692
+ export type PostHooks = {
693
+ resolveInput?: (args:
694
+ | {
695
+ operation: 'create'
696
+ resolvedData: Prisma.PostCreateInput
697
+ item: undefined
698
+ context: import('@opensaas/stack-core').AccessContext
699
+ }
700
+ | {
701
+ operation: 'update'
702
+ resolvedData: Prisma.PostUpdateInput
703
+ item: Post
704
+ context: import('@opensaas/stack-core').AccessContext
705
+ }
706
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
707
+ validateInput?: (args: {
708
+ operation: 'create' | 'update'
709
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
710
+ item?: Post
711
+ context: import('@opensaas/stack-core').AccessContext
712
+ addValidationError: (msg: string) => void
713
+ }) => Promise<void>
714
+ beforeOperation?: (args: {
715
+ operation: 'create' | 'update' | 'delete'
716
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
717
+ item?: Post
718
+ context: import('@opensaas/stack-core').AccessContext
719
+ }) => Promise<void>
720
+ afterOperation?: (args: {
721
+ operation: 'create' | 'update' | 'delete'
722
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
723
+ item?: Post
724
+ context: import('@opensaas/stack-core').AccessContext
725
+ }) => Promise<void>
726
+ }
727
+
343
728
  export type User = {
344
729
  id: string
345
730
  name: string | null
@@ -363,12 +748,55 @@ export type UserWhereInput = {
363
748
  name?: { equals?: string, not?: string }
364
749
  }
365
750
 
751
+ /**
752
+ * Hook types for User list
753
+ * Properly typed to use Prisma's generated input types
754
+ */
755
+ export type UserHooks = {
756
+ resolveInput?: (args:
757
+ | {
758
+ operation: 'create'
759
+ resolvedData: Prisma.UserCreateInput
760
+ item: undefined
761
+ context: import('@opensaas/stack-core').AccessContext
762
+ }
763
+ | {
764
+ operation: 'update'
765
+ resolvedData: Prisma.UserUpdateInput
766
+ item: User
767
+ context: import('@opensaas/stack-core').AccessContext
768
+ }
769
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
770
+ validateInput?: (args: {
771
+ operation: 'create' | 'update'
772
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
773
+ item?: User
774
+ context: import('@opensaas/stack-core').AccessContext
775
+ addValidationError: (msg: string) => void
776
+ }) => Promise<void>
777
+ beforeOperation?: (args: {
778
+ operation: 'create' | 'update' | 'delete'
779
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
780
+ item?: User
781
+ context: import('@opensaas/stack-core').AccessContext
782
+ }) => Promise<void>
783
+ afterOperation?: (args: {
784
+ operation: 'create' | 'update' | 'delete'
785
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
786
+ item?: User
787
+ context: import('@opensaas/stack-core').AccessContext
788
+ }) => Promise<void>
789
+ }
790
+
366
791
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
367
792
  db: AccessControlledDB<PrismaClient>
368
793
  session: TSession
369
794
  prisma: PrismaClient
370
795
  storage: StorageUtils
796
+ plugins: PluginServices
371
797
  serverAction: (props: ServerActionProps) => Promise<unknown>
798
+ sudo: () => Context<TSession>
799
+ _isSudo: boolean
372
800
  }"
373
801
  `;
374
802
 
@@ -379,7 +807,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
379
807
  */
380
808
 
381
809
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
382
- import type { PrismaClient } from './prisma-client'
810
+ import type { PrismaClient, Prisma } from './prisma-client/client'
811
+ import type { PluginServices } from './plugin-types'
383
812
 
384
813
  export type Post = {
385
814
  id: string
@@ -408,6 +837,46 @@ export type PostWhereInput = {
408
837
  title?: { equals?: string, not?: string }
409
838
  }
410
839
 
840
+ /**
841
+ * Hook types for Post list
842
+ * Properly typed to use Prisma's generated input types
843
+ */
844
+ export type PostHooks = {
845
+ resolveInput?: (args:
846
+ | {
847
+ operation: 'create'
848
+ resolvedData: Prisma.PostCreateInput
849
+ item: undefined
850
+ context: import('@opensaas/stack-core').AccessContext
851
+ }
852
+ | {
853
+ operation: 'update'
854
+ resolvedData: Prisma.PostUpdateInput
855
+ item: Post
856
+ context: import('@opensaas/stack-core').AccessContext
857
+ }
858
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
859
+ validateInput?: (args: {
860
+ operation: 'create' | 'update'
861
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
862
+ item?: Post
863
+ context: import('@opensaas/stack-core').AccessContext
864
+ addValidationError: (msg: string) => void
865
+ }) => Promise<void>
866
+ beforeOperation?: (args: {
867
+ operation: 'create' | 'update' | 'delete'
868
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
869
+ item?: Post
870
+ context: import('@opensaas/stack-core').AccessContext
871
+ }) => Promise<void>
872
+ afterOperation?: (args: {
873
+ operation: 'create' | 'update' | 'delete'
874
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
875
+ item?: Post
876
+ context: import('@opensaas/stack-core').AccessContext
877
+ }) => Promise<void>
878
+ }
879
+
411
880
  export type User = {
412
881
  id: string
413
882
  name: string | null
@@ -431,12 +900,55 @@ export type UserWhereInput = {
431
900
  name?: { equals?: string, not?: string }
432
901
  }
433
902
 
903
+ /**
904
+ * Hook types for User list
905
+ * Properly typed to use Prisma's generated input types
906
+ */
907
+ export type UserHooks = {
908
+ resolveInput?: (args:
909
+ | {
910
+ operation: 'create'
911
+ resolvedData: Prisma.UserCreateInput
912
+ item: undefined
913
+ context: import('@opensaas/stack-core').AccessContext
914
+ }
915
+ | {
916
+ operation: 'update'
917
+ resolvedData: Prisma.UserUpdateInput
918
+ item: User
919
+ context: import('@opensaas/stack-core').AccessContext
920
+ }
921
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
922
+ validateInput?: (args: {
923
+ operation: 'create' | 'update'
924
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
925
+ item?: User
926
+ context: import('@opensaas/stack-core').AccessContext
927
+ addValidationError: (msg: string) => void
928
+ }) => Promise<void>
929
+ beforeOperation?: (args: {
930
+ operation: 'create' | 'update' | 'delete'
931
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
932
+ item?: User
933
+ context: import('@opensaas/stack-core').AccessContext
934
+ }) => Promise<void>
935
+ afterOperation?: (args: {
936
+ operation: 'create' | 'update' | 'delete'
937
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
938
+ item?: User
939
+ context: import('@opensaas/stack-core').AccessContext
940
+ }) => Promise<void>
941
+ }
942
+
434
943
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
435
944
  db: AccessControlledDB<PrismaClient>
436
945
  session: TSession
437
946
  prisma: PrismaClient
438
947
  storage: StorageUtils
948
+ plugins: PluginServices
439
949
  serverAction: (props: ServerActionProps) => Promise<unknown>
950
+ sudo: () => Context<TSession>
951
+ _isSudo: boolean
440
952
  }"
441
953
  `;
442
954
 
@@ -447,7 +959,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
447
959
  */
448
960
 
449
961
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
450
- import type { PrismaClient } from './prisma-client'
962
+ import type { PrismaClient, Prisma } from './prisma-client/client'
963
+ import type { PluginServices } from './plugin-types'
451
964
 
452
965
  export type User = {
453
966
  id: string
@@ -475,6 +988,46 @@ export type UserWhereInput = {
475
988
  name?: { equals?: string, not?: string }
476
989
  }
477
990
 
991
+ /**
992
+ * Hook types for User list
993
+ * Properly typed to use Prisma's generated input types
994
+ */
995
+ export type UserHooks = {
996
+ resolveInput?: (args:
997
+ | {
998
+ operation: 'create'
999
+ resolvedData: Prisma.UserCreateInput
1000
+ item: undefined
1001
+ context: import('@opensaas/stack-core').AccessContext
1002
+ }
1003
+ | {
1004
+ operation: 'update'
1005
+ resolvedData: Prisma.UserUpdateInput
1006
+ item: User
1007
+ context: import('@opensaas/stack-core').AccessContext
1008
+ }
1009
+ ) => Promise<Prisma.UserCreateInput | Prisma.UserUpdateInput>
1010
+ validateInput?: (args: {
1011
+ operation: 'create' | 'update'
1012
+ resolvedData: Prisma.UserCreateInput | Prisma.UserUpdateInput
1013
+ item?: User
1014
+ context: import('@opensaas/stack-core').AccessContext
1015
+ addValidationError: (msg: string) => void
1016
+ }) => Promise<void>
1017
+ beforeOperation?: (args: {
1018
+ operation: 'create' | 'update' | 'delete'
1019
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
1020
+ item?: User
1021
+ context: import('@opensaas/stack-core').AccessContext
1022
+ }) => Promise<void>
1023
+ afterOperation?: (args: {
1024
+ operation: 'create' | 'update' | 'delete'
1025
+ resolvedData?: Prisma.UserCreateInput | Prisma.UserUpdateInput
1026
+ item?: User
1027
+ context: import('@opensaas/stack-core').AccessContext
1028
+ }) => Promise<void>
1029
+ }
1030
+
478
1031
  export type Post = {
479
1032
  id: string
480
1033
  title: string | null
@@ -502,11 +1055,54 @@ export type PostWhereInput = {
502
1055
  title?: { equals?: string, not?: string }
503
1056
  }
504
1057
 
1058
+ /**
1059
+ * Hook types for Post list
1060
+ * Properly typed to use Prisma's generated input types
1061
+ */
1062
+ export type PostHooks = {
1063
+ resolveInput?: (args:
1064
+ | {
1065
+ operation: 'create'
1066
+ resolvedData: Prisma.PostCreateInput
1067
+ item: undefined
1068
+ context: import('@opensaas/stack-core').AccessContext
1069
+ }
1070
+ | {
1071
+ operation: 'update'
1072
+ resolvedData: Prisma.PostUpdateInput
1073
+ item: Post
1074
+ context: import('@opensaas/stack-core').AccessContext
1075
+ }
1076
+ ) => Promise<Prisma.PostCreateInput | Prisma.PostUpdateInput>
1077
+ validateInput?: (args: {
1078
+ operation: 'create' | 'update'
1079
+ resolvedData: Prisma.PostCreateInput | Prisma.PostUpdateInput
1080
+ item?: Post
1081
+ context: import('@opensaas/stack-core').AccessContext
1082
+ addValidationError: (msg: string) => void
1083
+ }) => Promise<void>
1084
+ beforeOperation?: (args: {
1085
+ operation: 'create' | 'update' | 'delete'
1086
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
1087
+ item?: Post
1088
+ context: import('@opensaas/stack-core').AccessContext
1089
+ }) => Promise<void>
1090
+ afterOperation?: (args: {
1091
+ operation: 'create' | 'update' | 'delete'
1092
+ resolvedData?: Prisma.PostCreateInput | Prisma.PostUpdateInput
1093
+ item?: Post
1094
+ context: import('@opensaas/stack-core').AccessContext
1095
+ }) => Promise<void>
1096
+ }
1097
+
505
1098
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
506
1099
  db: AccessControlledDB<PrismaClient>
507
1100
  session: TSession
508
1101
  prisma: PrismaClient
509
1102
  storage: StorageUtils
1103
+ plugins: PluginServices
510
1104
  serverAction: (props: ServerActionProps) => Promise<unknown>
1105
+ sudo: () => Context<TSession>
1106
+ _isSudo: boolean
511
1107
  }"
512
1108
  `;