Skip to content

Commit cd4aac7

Browse files
committed
docs: release for v2.16
1 parent c19d7ee commit cd4aac7

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

docs/faq.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,29 @@ No. See [here](./the-complete-guide/part1/4-access-policy/4.1-model-level.md#eva
6464

6565
### Is Prisma's new "prisma-client" generator supported?
6666

67-
No. The feature was add in [Prisma 6.6](https://github.com/prisma/prisma/releases/tag/6.6.0) but it's still in early access. We plan to work on it when Prisma pushes it to GA.
67+
Yes, since v2.16.0. The "prisma-client" generator is introduced in [Prisma 6.6](https://github.com/prisma/prisma/releases/tag/6.6.0). When it's used, Prisma requires you to specify an output folder explicitly, and will generate TypeScript source files (instead of compiled JavaScript files) into the folder. The files should be compiled with your source tree, and you should import `PrismaClient` from that folder instead of `@prisma/client`.
68+
69+
Similarly, you'll need to use the "--output" option when running `zenstack generate` to generate ZenStack files into your source tree and get them compiled together with your source code. And you should import the `enhance` function from there.
70+
71+
ZModel:
72+
```zmodel
73+
generator client {
74+
provider = "prisma-client"
75+
output = "../generated/prisma/client"
76+
moduleFormat = "cjs"
77+
}
78+
```
79+
80+
Running `zenstack generate`:
81+
```bash
82+
npx zenstack generate --output ./generated/zenstack
83+
```
84+
85+
App code:
86+
```ts
87+
import { PrismaClient } from './generated/prisma/client';
88+
import { enhance } from './generated/zenstack/enhance';
89+
90+
const prisma = new PrismaClient();
91+
const db = enhance(prisma, ...);
92+
```

docs/reference/runtime-api.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,10 @@ type CustomEncryption = {
6464
decrypt: (model: string, field: FieldInfo, cipher: string) => Promise<string>;
6565
};
6666

67+
type ValidationOptions = {
68+
inputOnlyValidationForUpdate?: boolean;
69+
};
70+
6771
type EnhancementOptions = {
6872
kinds?: EnhancementKind[];
6973
logPrismaQuery?: boolean;
@@ -72,6 +76,7 @@ type EnhancementOptions = {
7276
transactionTimeout?: number;
7377
transactionIsolationLevel?: TransactionIsolationLevel;
7478
encryption?: SimpleEncryption | CustomEncryption;
79+
validation?: ValidationOptions;
7580
};
7681
```
7782

@@ -84,6 +89,7 @@ type EnhancementOptions = {
8489
| transactionTimeout | The `timeout` option (in ms) passed to `prisma.$transaction()` call for transactions initiated by ZenStack. | Database default |
8590
| transactionIsolationLevel | The `isolationLevel` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack. | Database default |
8691
| encryption | Field encryption settings. Only required when using the [field encryption](../guides/field-encryption.md) feature. | |
92+
| validation.inputOnlyValidationForUpdate | By default, ZenStack validates an entity after "update" operation to ensure the final result satisfies validation rules as a whole. This implies if the record under update doesn't satisfy the rules prior to update, the update operation will fail even if the fields causing validation errors are not affected by the operation. You can set this option to `true` to let ZenStack only validate data contained in the input args. | false |
8793

8894
#### Enhancement Kinds
8995

0 commit comments

Comments
 (0)