@@ -32,60 +32,64 @@ export type TransactionIsolationLevel =
32
32
| 'Snapshot'
33
33
| 'Serializable' ;
34
34
35
- /**
36
- * Options for {@link createEnhancement}
37
- */
38
35
export type EnhancementOptions = {
39
36
/**
40
- * Policy definition
37
+ * The kinds of enhancements to apply. By default all enhancements are applied.
41
38
*/
42
- policy : PolicyDef ;
39
+ kinds ?: EnhancementKind [ ] ;
43
40
44
41
/**
45
- * Model metadata
42
+ * Whether to log Prisma query
46
43
*/
47
- modelMeta : ModelMeta ;
44
+ logPrismaQuery ?: boolean ;
48
45
49
46
/**
50
- * Zod schemas for validation
47
+ * Hook for transforming errors before they are thrown to the caller.
51
48
*/
52
- zodSchemas ?: ZodSchemas ;
49
+ errorTransformer ?: ErrorTransformer ;
53
50
54
51
/**
55
- * Whether to log Prisma query
52
+ * The `maxWait` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
56
53
*/
57
- logPrismaQuery ?: boolean ;
54
+ transactionMaxWait ?: number ;
58
55
59
56
/**
60
- * The Node module that contains PrismaClient
57
+ * The `timeout` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
61
58
*/
62
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63
- prismaModule : any ;
59
+ transactionTimeout ?: number ;
64
60
65
61
/**
66
- * The kinds of enhancements to apply. By default all enhancements are applied .
62
+ * The `isolationLevel` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack .
67
63
*/
68
- kinds ?: EnhancementKind [ ] ;
64
+ transactionIsolationLevel ?: TransactionIsolationLevel ;
65
+ } ;
69
66
67
+ /**
68
+ * Options for {@link createEnhancement}
69
+ *
70
+ * @private
71
+ */
72
+ export type InternalEnhancementOptions = EnhancementOptions & {
70
73
/**
71
- * Hook for transforming errors before they are thrown to the caller.
74
+ * Policy definition
72
75
*/
73
- errorTransformer ?: ErrorTransformer ;
76
+ policy : PolicyDef ;
74
77
75
78
/**
76
- * The `maxWait` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
79
+ * Model metadata
77
80
*/
78
- transactionMaxWait ?: number ;
81
+ modelMeta : ModelMeta ;
79
82
80
83
/**
81
- * The `timeout` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
84
+ * Zod schemas for validation
82
85
*/
83
- transactionTimeout ?: number ;
86
+ zodSchemas ?: ZodSchemas ;
84
87
85
88
/**
86
- * The `isolationLevel` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
89
+ * The Node module that contains PrismaClient
87
90
*/
88
- transactionIsolationLevel ?: TransactionIsolationLevel ;
91
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92
+ prismaModule : any ;
89
93
} ;
90
94
91
95
/**
@@ -103,13 +107,15 @@ let hasDefaultAuth: boolean | undefined = undefined;
103
107
* Gets a Prisma client enhanced with all enhancement behaviors, including access
104
108
* policy, field validation, field omission and password hashing.
105
109
*
110
+ * @private
111
+ *
106
112
* @param prisma The Prisma client to enhance.
107
113
* @param context Context.
108
114
* @param options Options.
109
115
*/
110
116
export function createEnhancement < DbClient extends object > (
111
117
prisma : DbClient ,
112
- options : EnhancementOptions ,
118
+ options : InternalEnhancementOptions ,
113
119
context ?: EnhancementContext
114
120
) {
115
121
if ( ! prisma ) {
0 commit comments