@opensaas/stack-cli 0.1.7 → 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 +207 -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 +51 -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 +57 -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 +587 -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 +54 -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,11 +33,52 @@ 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>
41
83
  sudo: () => Context<TSession>
42
84
  _isSudo: boolean
@@ -50,7 +92,8 @@ exports[`Types Generator > generateTypes > should generate CreateInput type 1`]
50
92
  */
51
93
 
52
94
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
53
- import type { PrismaClient } from './prisma-client'
95
+ import type { PrismaClient, Prisma } from './prisma-client/client'
96
+ import type { PluginServices } from './plugin-types'
54
97
 
55
98
  export type Post = {
56
99
  id: string
@@ -79,11 +122,52 @@ export type PostWhereInput = {
79
122
  content?: { equals?: string, not?: string }
80
123
  }
81
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
+
82
165
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
83
166
  db: AccessControlledDB<PrismaClient>
84
167
  session: TSession
85
168
  prisma: PrismaClient
86
169
  storage: StorageUtils
170
+ plugins: PluginServices
87
171
  serverAction: (props: ServerActionProps) => Promise<unknown>
88
172
  sudo: () => Context<TSession>
89
173
  _isSudo: boolean
@@ -97,7 +181,8 @@ exports[`Types Generator > generateTypes > should generate UpdateInput type 1`]
97
181
  */
98
182
 
99
183
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
100
- import type { PrismaClient } from './prisma-client'
184
+ import type { PrismaClient, Prisma } from './prisma-client/client'
185
+ import type { PluginServices } from './plugin-types'
101
186
 
102
187
  export type Post = {
103
188
  id: string
@@ -126,11 +211,52 @@ export type PostWhereInput = {
126
211
  content?: { equals?: string, not?: string }
127
212
  }
128
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
+
129
254
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
130
255
  db: AccessControlledDB<PrismaClient>
131
256
  session: TSession
132
257
  prisma: PrismaClient
133
258
  storage: StorageUtils
259
+ plugins: PluginServices
134
260
  serverAction: (props: ServerActionProps) => Promise<unknown>
135
261
  sudo: () => Context<TSession>
136
262
  _isSudo: boolean
@@ -144,7 +270,8 @@ exports[`Types Generator > generateTypes > should generate WhereInput type 1`] =
144
270
  */
145
271
 
146
272
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
147
- import type { PrismaClient } from './prisma-client'
273
+ import type { PrismaClient, Prisma } from './prisma-client/client'
274
+ import type { PluginServices } from './plugin-types'
148
275
 
149
276
  export type User = {
150
277
  id: string
@@ -169,11 +296,52 @@ export type UserWhereInput = {
169
296
  name?: { equals?: string, not?: string }
170
297
  }
171
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
+
172
339
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
173
340
  db: AccessControlledDB<PrismaClient>
174
341
  session: TSession
175
342
  prisma: PrismaClient
176
343
  storage: StorageUtils
344
+ plugins: PluginServices
177
345
  serverAction: (props: ServerActionProps) => Promise<unknown>
178
346
  sudo: () => Context<TSession>
179
347
  _isSudo: boolean
@@ -187,7 +355,8 @@ exports[`Types Generator > generateTypes > should generate type definitions for
187
355
  */
188
356
 
189
357
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
190
- import type { PrismaClient } from './prisma-client'
358
+ import type { PrismaClient, Prisma } from './prisma-client/client'
359
+ import type { PluginServices } from './plugin-types'
191
360
 
192
361
  export type User = {
193
362
  id: string
@@ -216,11 +385,52 @@ export type UserWhereInput = {
216
385
  email?: { equals?: string, not?: string }
217
386
  }
218
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
+
219
428
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
220
429
  db: AccessControlledDB<PrismaClient>
221
430
  session: TSession
222
431
  prisma: PrismaClient
223
432
  storage: StorageUtils
433
+ plugins: PluginServices
224
434
  serverAction: (props: ServerActionProps) => Promise<unknown>
225
435
  sudo: () => Context<TSession>
226
436
  _isSudo: boolean
@@ -234,7 +444,8 @@ exports[`Types Generator > generateTypes > should generate types for multiple li
234
444
  */
235
445
 
236
446
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
237
- import type { PrismaClient } from './prisma-client'
447
+ import type { PrismaClient, Prisma } from './prisma-client/client'
448
+ import type { PluginServices } from './plugin-types'
238
449
 
239
450
  export type User = {
240
451
  id: string
@@ -259,6 +470,46 @@ export type UserWhereInput = {
259
470
  name?: { equals?: string, not?: string }
260
471
  }
261
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
+
262
513
  export type Post = {
263
514
  id: string
264
515
  title: string | null
@@ -282,6 +533,46 @@ export type PostWhereInput = {
282
533
  title?: { equals?: string, not?: string }
283
534
  }
284
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
+
285
576
  export type Comment = {
286
577
  id: string
287
578
  content: string | null
@@ -305,11 +596,52 @@ export type CommentWhereInput = {
305
596
  content?: { equals?: string, not?: string }
306
597
  }
307
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
+
308
639
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
309
640
  db: AccessControlledDB<PrismaClient>
310
641
  session: TSession
311
642
  prisma: PrismaClient
312
643
  storage: StorageUtils
644
+ plugins: PluginServices
313
645
  serverAction: (props: ServerActionProps) => Promise<unknown>
314
646
  sudo: () => Context<TSession>
315
647
  _isSudo: boolean
@@ -323,7 +655,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
323
655
  */
324
656
 
325
657
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
326
- import type { PrismaClient } from './prisma-client'
658
+ import type { PrismaClient, Prisma } from './prisma-client/client'
659
+ import type { PluginServices } from './plugin-types'
327
660
 
328
661
  export type Post = {
329
662
  id: string
@@ -352,6 +685,46 @@ export type PostWhereInput = {
352
685
  title?: { equals?: string, not?: string }
353
686
  }
354
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
+
355
728
  export type User = {
356
729
  id: string
357
730
  name: string | null
@@ -375,11 +748,52 @@ export type UserWhereInput = {
375
748
  name?: { equals?: string, not?: string }
376
749
  }
377
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
+
378
791
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
379
792
  db: AccessControlledDB<PrismaClient>
380
793
  session: TSession
381
794
  prisma: PrismaClient
382
795
  storage: StorageUtils
796
+ plugins: PluginServices
383
797
  serverAction: (props: ServerActionProps) => Promise<unknown>
384
798
  sudo: () => Context<TSession>
385
799
  _isSudo: boolean
@@ -393,7 +807,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
393
807
  */
394
808
 
395
809
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
396
- import type { PrismaClient } from './prisma-client'
810
+ import type { PrismaClient, Prisma } from './prisma-client/client'
811
+ import type { PluginServices } from './plugin-types'
397
812
 
398
813
  export type Post = {
399
814
  id: string
@@ -422,6 +837,46 @@ export type PostWhereInput = {
422
837
  title?: { equals?: string, not?: string }
423
838
  }
424
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
+
425
880
  export type User = {
426
881
  id: string
427
882
  name: string | null
@@ -445,11 +900,52 @@ export type UserWhereInput = {
445
900
  name?: { equals?: string, not?: string }
446
901
  }
447
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
+
448
943
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
449
944
  db: AccessControlledDB<PrismaClient>
450
945
  session: TSession
451
946
  prisma: PrismaClient
452
947
  storage: StorageUtils
948
+ plugins: PluginServices
453
949
  serverAction: (props: ServerActionProps) => Promise<unknown>
454
950
  sudo: () => Context<TSession>
455
951
  _isSudo: boolean
@@ -463,7 +959,8 @@ exports[`Types Generator > generateTypes > should handle relationship fields in
463
959
  */
464
960
 
465
961
  import type { Session as OpensaasSession, StorageUtils, ServerActionProps, AccessControlledDB } from '@opensaas/stack-core'
466
- import type { PrismaClient } from './prisma-client'
962
+ import type { PrismaClient, Prisma } from './prisma-client/client'
963
+ import type { PluginServices } from './plugin-types'
467
964
 
468
965
  export type User = {
469
966
  id: string
@@ -491,6 +988,46 @@ export type UserWhereInput = {
491
988
  name?: { equals?: string, not?: string }
492
989
  }
493
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
+
494
1031
  export type Post = {
495
1032
  id: string
496
1033
  title: string | null
@@ -518,11 +1055,52 @@ export type PostWhereInput = {
518
1055
  title?: { equals?: string, not?: string }
519
1056
  }
520
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
+
521
1098
  export type Context<TSession extends OpensaasSession = OpensaasSession> = {
522
1099
  db: AccessControlledDB<PrismaClient>
523
1100
  session: TSession
524
1101
  prisma: PrismaClient
525
1102
  storage: StorageUtils
1103
+ plugins: PluginServices
526
1104
  serverAction: (props: ServerActionProps) => Promise<unknown>
527
1105
  sudo: () => Context<TSession>
528
1106
  _isSudo: boolean