You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+30Lines changed: 30 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,6 +30,27 @@ const client = new PrismaClient();
30
30
client.$use(stableSortMiddleware(client));
31
31
```
32
32
33
+
### Usage with a custom Prisma Client output path
34
+
35
+
If your Prisma schema generates the client to a custom location, import your generated client from that location and pass it to the middleware as usual.
This package does not import `@prisma/client/runtime/library`; it only requires a generated Prisma client instance that exposes Prisma's runtime data model.
53
+
33
54
## License
34
55
35
56
The project is licensed under the MIT license.
@@ -43,3 +64,12 @@ The project is licensed under the MIT license.
`Could not access Prisma runtime data model on the provided client. Ensure you pass a generated Prisma client instance that exposes "_runtimeDataModel".`,
it("throws a clear error when the runtime data model is missing",()=>{
5
+
expect(()=>stableSortMiddleware({})).toThrow(
6
+
'Could not access Prisma runtime data model on the provided client. Ensure you pass a generated Prisma client instance that exposes "_runtimeDataModel".',
7
+
);
8
+
});
9
+
10
+
it("adds a unique id field to stabilize sorting when orderBy is not unique",async()=>{
0 commit comments