@@ -32,60 +32,64 @@ export type TransactionIsolationLevel =
3232 | 'Snapshot'
3333 | 'Serializable' ;
3434
35- /**
36- * Options for {@link createEnhancement}
37- */
3835export type EnhancementOptions = {
3936 /**
40- * Policy definition
37+ * The kinds of enhancements to apply. By default all enhancements are applied.
4138 */
42- policy : PolicyDef ;
39+ kinds ?: EnhancementKind [ ] ;
4340
4441 /**
45- * Model metadata
42+ * Whether to log Prisma query
4643 */
47- modelMeta : ModelMeta ;
44+ logPrismaQuery ?: boolean ;
4845
4946 /**
50- * Zod schemas for validation
47+ * Hook for transforming errors before they are thrown to the caller.
5148 */
52- zodSchemas ?: ZodSchemas ;
49+ errorTransformer ?: ErrorTransformer ;
5350
5451 /**
55- * Whether to log Prisma query
52+ * The `maxWait` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
5653 */
57- logPrismaQuery ?: boolean ;
54+ transactionMaxWait ?: number ;
5855
5956 /**
60- * The Node module that contains PrismaClient
57+ * The `timeout` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
6158 */
62- // eslint-disable-next-line @typescript-eslint/no-explicit-any
63- prismaModule : any ;
59+ transactionTimeout ?: number ;
6460
6561 /**
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 .
6763 */
68- kinds ?: EnhancementKind [ ] ;
64+ transactionIsolationLevel ?: TransactionIsolationLevel ;
65+ } ;
6966
67+ /**
68+ * Options for {@link createEnhancement}
69+ *
70+ * @private
71+ */
72+ export type InternalEnhancementOptions = EnhancementOptions & {
7073 /**
71- * Hook for transforming errors before they are thrown to the caller.
74+ * Policy definition
7275 */
73- errorTransformer ?: ErrorTransformer ;
76+ policy : PolicyDef ;
7477
7578 /**
76- * The `maxWait` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
79+ * Model metadata
7780 */
78- transactionMaxWait ?: number ;
81+ modelMeta : ModelMeta ;
7982
8083 /**
81- * The `timeout` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
84+ * Zod schemas for validation
8285 */
83- transactionTimeout ?: number ;
86+ zodSchemas ?: ZodSchemas ;
8487
8588 /**
86- * The `isolationLevel` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack.
89+ * The Node module that contains PrismaClient
8790 */
88- transactionIsolationLevel ?: TransactionIsolationLevel ;
91+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
92+ prismaModule : any ;
8993} ;
9094
9195/**
@@ -103,13 +107,15 @@ let hasDefaultAuth: boolean | undefined = undefined;
103107 * Gets a Prisma client enhanced with all enhancement behaviors, including access
104108 * policy, field validation, field omission and password hashing.
105109 *
110+ * @private
111+ *
106112 * @param prisma The Prisma client to enhance.
107113 * @param context Context.
108114 * @param options Options.
109115 */
110116export function createEnhancement < DbClient extends object > (
111117 prisma : DbClient ,
112- options : EnhancementOptions ,
118+ options : InternalEnhancementOptions ,
113119 context ?: EnhancementContext
114120) {
115121 if ( ! prisma ) {
0 commit comments