@8ms/helpers 1.30.0 → 1.32.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 -2
- package/prisma/initClient.js +6 -3
package/package.json
CHANGED
package/prisma/initClient.d.ts
CHANGED
|
@@ -4,7 +4,9 @@
|
|
|
4
4
|
* https://next-auth.js.org/schemas/adapters
|
|
5
5
|
* Library: @prisma/client, prisma-query-log
|
|
6
6
|
*/
|
|
7
|
-
|
|
7
|
+
type InitClient = {
|
|
8
8
|
debug?: boolean;
|
|
9
|
-
|
|
9
|
+
planetScale?: boolean;
|
|
10
|
+
};
|
|
11
|
+
declare const initClient: (props?: InitClient) => void;
|
|
10
12
|
export default initClient;
|
package/prisma/initClient.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
global.prisma = null;
|
|
10
|
-
const initClient = (
|
|
10
|
+
const initClient = (props = {}) => {
|
|
11
11
|
if (!global.prisma) {
|
|
12
12
|
const { Client } = require("@planetscale/database");
|
|
13
13
|
const { PrismaClient } = require("@prisma/client");
|
|
@@ -15,9 +15,12 @@ const initClient = ({ debug } = { debug: false }) => {
|
|
|
15
15
|
const client = new Client({
|
|
16
16
|
url: process.env.DATABASE_URL
|
|
17
17
|
});
|
|
18
|
-
|
|
18
|
+
let adapter;
|
|
19
|
+
if (props?.planetScale) {
|
|
20
|
+
adapter = new PrismaPlanetScale(client);
|
|
21
|
+
}
|
|
19
22
|
// Show the full query if debugging
|
|
20
|
-
if (debug) {
|
|
23
|
+
if (props?.debug) {
|
|
21
24
|
global.prisma = new PrismaClient({
|
|
22
25
|
adapter,
|
|
23
26
|
log: [
|