@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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@8ms/helpers",
3
3
  "license": "UNLICENSED",
4
- "version": "1.30.0",
4
+ "version": "1.33.0",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/8millionstories-organisation/8ms-helpers-ts.git"
@@ -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
- }) => void;
3
+ planetScale?: boolean;
4
+ };
5
+ declare const initClient: (props?: InitClient) => void;
10
6
  export default initClient;
@@ -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 = ({ debug } = { debug: false }) => {
4
+ const initClient = (props = {}) => {
11
5
  if (!global.prisma) {
12
- const { Client } = require("@planetscale/database");
13
6
  const { PrismaClient } = require("@prisma/client");
14
- const { PrismaPlanetScale } = require("@prisma/adapter-planetscale");
15
- const client = new Client({
16
- url: process.env.DATABASE_URL
17
- });
18
- const adapter = new PrismaPlanetScale(client);
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: [