@8ms/helpers 1.30.0 → 1.33.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/prisma/initClient.d.ts +4 -8
- package/prisma/initClient.js +11 -14
package/package.json
CHANGED
package/prisma/initClient.d.ts
CHANGED
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
* Prevent too many connections
|
|
3
|
-
* https://github.com/prisma/prisma/issues/1983#issuecomment-620621213
|
|
4
|
-
* https://next-auth.js.org/schemas/adapters
|
|
5
|
-
* Library: @prisma/client, prisma-query-log
|
|
6
|
-
*/
|
|
7
|
-
declare const initClient: ({ debug }?: {
|
|
1
|
+
type InitClient = {
|
|
8
2
|
debug?: boolean;
|
|
9
|
-
|
|
3
|
+
planetScale?: boolean;
|
|
4
|
+
};
|
|
5
|
+
declare const initClient: (props?: InitClient) => void;
|
|
10
6
|
export default initClient;
|
package/prisma/initClient.js
CHANGED
|
@@ -1,23 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
/**
|
|
3
|
-
* Prevent too many connections
|
|
4
|
-
* https://github.com/prisma/prisma/issues/1983#issuecomment-620621213
|
|
5
|
-
* https://next-auth.js.org/schemas/adapters
|
|
6
|
-
* Library: @prisma/client, prisma-query-log
|
|
7
|
-
*/
|
|
8
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
3
|
global.prisma = null;
|
|
10
|
-
const initClient = (
|
|
4
|
+
const initClient = (props = {}) => {
|
|
11
5
|
if (!global.prisma) {
|
|
12
|
-
const { Client } = require("@planetscale/database");
|
|
13
6
|
const { PrismaClient } = require("@prisma/client");
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
7
|
+
let adapter;
|
|
8
|
+
if (props?.planetScale) {
|
|
9
|
+
const { Client } = require("@planetscale/database");
|
|
10
|
+
const client = new Client({
|
|
11
|
+
url: process.env.DATABASE_URL
|
|
12
|
+
});
|
|
13
|
+
const { PrismaPlanetScale } = require("@prisma/adapter-planetscale");
|
|
14
|
+
adapter = new PrismaPlanetScale(client);
|
|
15
|
+
}
|
|
19
16
|
// Show the full query if debugging
|
|
20
|
-
if (debug) {
|
|
17
|
+
if (props?.debug) {
|
|
21
18
|
global.prisma = new PrismaClient({
|
|
22
19
|
adapter,
|
|
23
20
|
log: [
|