Skip to content

Commit 4a3bc18

Browse files
committed
fix build
1 parent 29771e6 commit 4a3bc18

File tree

18 files changed

+0
-4365
lines changed

18 files changed

+0
-4365
lines changed

versioned_docs/version-3.x/reference/runtime-api.md

Lines changed: 0 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -6,125 +6,3 @@ sidebar_label: Runtime API
66

77
# Runtime API Reference
88

9-
This document provides references for runtime APIs exported from the `@zenstackhq/runtime` package.
10-
11-
### enhance
12-
13-
#### Description
14-
15-
Creates an enhanced wrapper for a `PrismaClient`. The return value has the same APIs as the original `PrismaClient`.
16-
17-
#### Signature
18-
19-
```ts
20-
function enhance<DbClient extends object>(
21-
prisma: DbClient,
22-
context?: EnhancementContext,
23-
options?: EnhancementOptions
24-
): DbClient;
25-
```
26-
27-
##### Parameter `prisma`
28-
29-
The PrismaClient instance to enhance.
30-
31-
##### Parameter `context`
32-
33-
The context to for evaluating access policies with the following typing.
34-
35-
```ts
36-
type EnhancementContext = {
37-
user?: Record<string, unknown>
38-
};
39-
```
40-
41-
| Field | Description |
42-
| ----- | ----------- |
43-
| user | The user object that provides value for the `auth()` function call in access policies. If provided. Its shape should be consistent with the `User` model in your ZModel, with all fields optional except for id field(s). Pass `undefined` to represent an anonymous user, and the `auth()` function call will evaluate to `null` in that case. |
44-
45-
##### Parameter `options`
46-
47-
Options with the following typing.
48-
49-
```ts
50-
type TransactionIsolationLevel =
51-
| 'ReadUncommitted'
52-
| 'ReadCommitted'
53-
| 'RepeatableRead'
54-
| 'Snapshot'
55-
| 'Serializable';
56-
57-
type SimpleEncryption = {
58-
encryptionKey: Uint8Array;
59-
decryptionKeys?: Uint8Array[];
60-
}
61-
62-
type CustomEncryption = {
63-
encrypt: (model: string, field: FieldInfo, plain: string) => Promise<string>;
64-
decrypt: (model: string, field: FieldInfo, cipher: string) => Promise<string>;
65-
};
66-
67-
type ValidationOptions = {
68-
inputOnlyValidationForUpdate?: boolean;
69-
};
70-
71-
type EnhancementOptions = {
72-
kinds?: EnhancementKind[];
73-
logPrismaQuery?: boolean;
74-
errorTransformer?: ErrorTransformer;
75-
transactionMaxWait?: number;
76-
transactionTimeout?: number;
77-
transactionIsolationLevel?: TransactionIsolationLevel;
78-
encryption?: SimpleEncryption | CustomEncryption;
79-
validation?: ValidationOptions;
80-
};
81-
```
82-
83-
| Field | Description | Default |
84-
| ------------------------- | ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------- |
85-
| kinds | The kinds of enhancements to apply. By default all enhancements are applied. See [the next section](#enhancement-kinds) for more details. | All enhancement kinds |
86-
| logPrismaQuery | Whether to log queries sent to Prisma client. Log will be emitted with "info" level, so please make sure you [turn that level on](https://www.prisma.io/docs/concepts/components/prisma-client/working-with-prismaclient/logging#log-to-stdout) when creating Prisma client | false |
87-
| errorTransformer | A function for transforming error thrown by the enhanced `PrismaClient` into a custom one. | |
88-
| transactionMaxWait | The `maxWait` option (in ms) passed to `prisma.$transaction()` call for transactions initiated by ZenStack. | Database default |
89-
| transactionTimeout | The `timeout` option (in ms) passed to `prisma.$transaction()` call for transactions initiated by ZenStack. | Database default |
90-
| transactionIsolationLevel | The `isolationLevel` option passed to `prisma.$transaction()` call for transactions initiated by ZenStack. | Database default |
91-
| 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 |
93-
94-
#### Enhancement Kinds
95-
96-
Here are the kinds of enhancements available:
97-
98-
- `policy`
99-
100-
Enforces model-level and field-level access policies defined with `@@allow`, `@@deny`, `@allow`, and `@deny`.
101-
102-
- `validation`
103-
104-
Validates create and update input data against rules defined with [data validation attributes](../reference/zmodel-language#data-validation).
105-
106-
- `delegate`
107-
108-
Support for modeling [polymorphic relations](../guides/polymorphism) with delegated types pattern.
109-
110-
- `password`
111-
112-
Automatically hashes fields marked with the `@password` attribute using `bcryptjs` before saving to the database.
113-
114-
- `omit`
115-
116-
Automatically omits fields marked with the `@omit` attribute from read results.
117-
118-
- `encryption`
119-
120-
Transparently encrypt and decrypt fields marked with the `@encrypted` attribute. See [this guide](../guides/field-encryption.md) for more details.
121-
122-
#### Example
123-
124-
```ts
125-
const session = getSession();
126-
const enhancedClient = enhance(prisma,
127-
{ user: session.user },
128-
{ kinds: ['policy', 'password']}
129-
);
130-
```

versioned_docs/version-3.x/reference/server-adapters/_category_.yml

Lines changed: 0 additions & 7 deletions
This file was deleted.

versioned_docs/version-3.x/reference/server-adapters/_error-handling.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

versioned_docs/version-3.x/reference/server-adapters/_options.mdx

Lines changed: 0 additions & 66 deletions
This file was deleted.

versioned_docs/version-3.x/reference/server-adapters/_using-api.mdx

Lines changed: 0 additions & 137 deletions
This file was deleted.

versioned_docs/version-3.x/reference/server-adapters/api-handlers/_data_type_serialization.md

Lines changed: 0 additions & 16 deletions
This file was deleted.

versioned_docs/version-3.x/reference/server-adapters/api-handlers/index.mdx

Lines changed: 0 additions & 31 deletions
This file was deleted.

0 commit comments

Comments
 (0)