@koalarx/nest 1.16.2 → 1.17.1

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.
@@ -10,19 +10,28 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.PrismaService = void 0;
13
+ exports.setPrismaClientOptions = setPrismaClientOptions;
13
14
  const env_service_1 = require("../../env/env.service");
14
15
  const common_1 = require("@nestjs/common");
15
16
  const client_1 = require("@prisma/client");
17
+ let globalPrismaOptions = {};
18
+ function setPrismaClientOptions(options) {
19
+ globalPrismaOptions = options;
20
+ }
16
21
  let PrismaService = class PrismaService extends client_1.PrismaClient {
17
22
  env;
18
23
  constructor(env) {
19
- super({
24
+ const defaultOptions = {
20
25
  log: [
21
26
  {
22
27
  emit: 'event',
23
28
  level: 'query',
24
29
  },
25
30
  ],
31
+ };
32
+ super({
33
+ ...defaultOptions,
34
+ ...globalPrismaOptions,
26
35
  });
27
36
  this.env = env;
28
37
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "1.16.2",
3
+ "version": "1.17.1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -22,7 +22,8 @@
22
22
  "@nestjs/passport": "^11.0.5",
23
23
  "@nestjs/platform-express": "^11.0.12",
24
24
  "@nestjs/swagger": "^11.0.7",
25
- "@prisma/client": "^6.5.0",
25
+ "@prisma/adapter-pg": "^7.2.0",
26
+ "@prisma/client": "^7.2.0",
26
27
  "@scalar/nestjs-api-reference": "^0.4.3",
27
28
  "consola": "^3.4.2",
28
29
  "dotenv": "^16.0.3",
@@ -1 +1,2 @@
1
- export declare function dropE2EDatabase(schemaId: string): import(".prisma/client").Prisma.PrismaPromise<number>;
1
+ import 'dotenv/config';
2
+ export declare function dropE2EDatabase(schemaId: string): Promise<number>;
@@ -1,7 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropE2EDatabase = dropE2EDatabase;
4
+ require("dotenv/config");
4
5
  const client_1 = require("@prisma/client");
6
+ const adapter_pg_1 = require("@prisma/adapter-pg");
7
+ const pg_1 = require("pg");
5
8
  function dropE2EDatabase(schemaId) {
6
- return new client_1.PrismaClient().$executeRawUnsafe(`DROP SCHEMA IF EXISTS "${schemaId}" CASCADE`);
9
+ const pool = new pg_1.Pool({
10
+ connectionString: process.env.DATABASE_URL,
11
+ });
12
+ const adapter = new adapter_pg_1.PrismaPg(pool);
13
+ const prisma = new client_1.PrismaClient({ adapter });
14
+ return prisma
15
+ .$executeRawUnsafe(`DROP SCHEMA IF EXISTS "${schemaId}" CASCADE`)
16
+ .finally(() => prisma.$disconnect());
7
17
  }