@koalarx/nest 1.16.1 → 1.17.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.
@@ -56,8 +56,8 @@ export declare class KoalaApp {
56
56
  setInternalUserName(name: string): this;
57
57
  setDbTransactionContext(transactionContext: Type<PrismaTransactionalClient>): this;
58
58
  build(): Promise<INestApplication<any>>;
59
- serve(): Promise<void>;
60
- buildAndServe(): Promise<void>;
59
+ serve(host?: string): Promise<void>;
60
+ buildAndServe(host?: string): Promise<void>;
61
61
  private showListeningMessage;
62
62
  }
63
63
  export {};
package/core/koala-app.js CHANGED
@@ -219,26 +219,26 @@ class KoalaApp {
219
219
  }
220
220
  return this.app;
221
221
  }
222
- async serve() {
222
+ async serve(host) {
223
223
  const envService = this.app.get(env_service_1.EnvService);
224
224
  const port = envService.get('PORT') ?? 3000;
225
- this.app.listen(port).then(() => this.showListeningMessage(port));
225
+ this.app.listen(port).then(() => this.showListeningMessage(port, host));
226
226
  }
227
- async buildAndServe() {
227
+ async buildAndServe(host) {
228
228
  await this.build();
229
- await this.serve();
229
+ await this.serve(host);
230
230
  }
231
- showListeningMessage(port) {
231
+ showListeningMessage(port, host = 'localhost') {
232
232
  const envService = this.app.get(env_service_1.EnvService);
233
233
  console.log('------------------------------');
234
234
  if (this._apiReferenceEndpoint) {
235
- consola.info('API Reference:', `http://localhost:${port}${this._apiReferenceEndpoint}`);
235
+ consola.info('API Reference:', `http://${host}:${port}${this._apiReferenceEndpoint}`);
236
236
  }
237
- consola.info('Health Check:', `http://localhost:${port}/health`);
238
- consola.info('Internal Host:', `http://localhost:${port}`);
237
+ consola.info('Health Check:', `http://${host}:${port}/health`);
238
+ consola.info('Internal Host:', `http://${host}:${port}`);
239
239
  if (this._ngrokUrl) {
240
240
  consola.info('External Host:', this._ngrokUrl);
241
- consola.info('External Inspect:', 'http://localhost:4040/inspect/http');
241
+ consola.info('External Inspect:', `http://${host}:4040/inspect/http`);
242
242
  }
243
243
  consola.box('Environment:', envService.get('NODE_ENV'));
244
244
  console.log('------------------------------');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
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
  }