@koalarx/nest 1.18.3 → 1.18.5

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.
@@ -1,4 +1,4 @@
1
- import { QueryDirectionType } from '..';
1
+ import type { QueryDirectionType } from '..';
2
2
  export declare const QUERY_FILTER_PARAMS: {
3
3
  direction: QueryDirectionType;
4
4
  page: number;
@@ -1,4 +1,4 @@
1
- import { QueryDirectionType } from '..';
1
+ import type { QueryDirectionType } from '..';
2
2
  export type PaginatedRequestProps<T extends PaginationRequest> = Omit<{
3
3
  [K in keyof T as T[K] extends Function ? never : K]: T[K];
4
4
  }, '_id'>;
@@ -0,0 +1,2 @@
1
+ export declare function setPrismaClient(prismaClientClass: any): void;
2
+ export declare function getPrismaClientClass(): any;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setPrismaClient = setPrismaClient;
4
+ exports.getPrismaClientClass = getPrismaClientClass;
5
+ const path = require("path");
6
+ const fs = require("fs");
7
+ let cachedPrismaClient = null;
8
+ function findPrismaClient() {
9
+ const possiblePaths = [
10
+ path.join(process.cwd(), 'prisma/generated/client.js'),
11
+ path.join(__dirname, '../../../../../prisma/generated/client.js'),
12
+ path.join(process.cwd(), 'prisma/generated/client.ts'),
13
+ path.join(__dirname, '../../../../../prisma/generated/client.ts'),
14
+ ...(require.main?.filename
15
+ ? [
16
+ path.join(path.dirname(require.main.filename), '../prisma/generated/client.js'),
17
+ path.join(path.dirname(require.main.filename), '../prisma/generated/client.ts'),
18
+ ]
19
+ : []),
20
+ ];
21
+ for (const prismaPath of possiblePaths) {
22
+ if (fs.existsSync(prismaPath)) {
23
+ return prismaPath;
24
+ }
25
+ }
26
+ return null;
27
+ }
28
+ async function resolvePrismaClient() {
29
+ if (cachedPrismaClient) {
30
+ return cachedPrismaClient;
31
+ }
32
+ const prismaPath = findPrismaClient();
33
+ if (!prismaPath) {
34
+ throw new Error(`
35
+ Não foi possível carregar o Prisma Client automaticamente.
36
+
37
+ Certifique-se de que você:
38
+ 1. Executou 'bunx prisma generate' no seu projeto
39
+ 2. Tem a pasta 'prisma/generated/client' no seu projeto
40
+ 3. A lib @koalarx/nest está instalada como dependência
41
+
42
+ Se o problema persistir, você pode registrar manualmente o Prisma Client:
43
+
44
+ import { setPrismaClient } from '@koalarx/nest'
45
+ import { PrismaClient } from './prisma/generated/client'
46
+
47
+ setPrismaClient(PrismaClient)
48
+ `.trim());
49
+ }
50
+ try {
51
+ const module = await Promise.resolve(`${prismaPath}`).then(s => require(s));
52
+ cachedPrismaClient = module.PrismaClient || module.default || module;
53
+ return cachedPrismaClient;
54
+ }
55
+ catch (error) {
56
+ throw new Error(`
57
+ Erro ao carregar o Prisma Client de ${prismaPath}:
58
+ ${error instanceof Error ? error.message : String(error)}
59
+
60
+ Certifique-se de que 'bunx prisma generate' foi executado com sucesso.
61
+ `.trim());
62
+ }
63
+ }
64
+ let manualPrismaClient = null;
65
+ function setPrismaClient(prismaClientClass) {
66
+ manualPrismaClient = prismaClientClass;
67
+ cachedPrismaClient = null;
68
+ }
69
+ function getPrismaClientClass() {
70
+ if (manualPrismaClient) {
71
+ return manualPrismaClient;
72
+ }
73
+ return resolvePrismaClient();
74
+ }
@@ -1,17 +1,25 @@
1
1
  import { EnvService } from '@koalarx/nest/env/env.service';
2
2
  import { OnModuleDestroy, OnModuleInit } from '@nestjs/common';
3
3
  import { PrismaClientWithCustomTransaction } from './prisma-client-with-custom-transaction.interface';
4
- import { Prisma, PrismaClient } from 'prisma/generated/client';
5
- import { PrismaClientOptions } from 'prisma/generated/internal/prismaNamespace';
4
+ import type { Prisma } from 'prisma/generated/client';
5
+ import type { PrismaClientOptions } from 'prisma/generated/internal/prismaNamespace';
6
6
  export declare function setPrismaClientOptions(options: PrismaClientOptions): void;
7
- export declare class PrismaService extends PrismaClient implements OnModuleInit, OnModuleDestroy, PrismaClientWithCustomTransaction {
7
+ export declare class PrismaService implements OnModuleInit, OnModuleDestroy, PrismaClientWithCustomTransaction {
8
8
  private readonly env;
9
+ private prismaInstance;
9
10
  constructor(env: EnvService);
10
- onModuleInit(): Promise<void>;
11
- onModuleDestroy(): Promise<void>;
11
+ initialize(): Promise<void>;
12
+ onModuleInit(): Promise<any>;
13
+ onModuleDestroy(): any;
12
14
  withTransaction<F>(fn: (prisma: Prisma.TransactionClient) => Promise<F>, options?: {
13
15
  maxWait?: number;
14
16
  timeout?: number;
15
17
  isolationLevel?: Prisma.TransactionIsolationLevel;
16
18
  }): Promise<F>;
19
+ [Symbol.toPrimitive](): any;
20
+ toString(): string;
21
+ get $connect(): any;
22
+ get $disconnect(): any;
23
+ get $transaction(): any;
24
+ get $on(): any;
17
25
  }
@@ -13,37 +13,89 @@ exports.PrismaService = void 0;
13
13
  exports.setPrismaClientOptions = setPrismaClientOptions;
14
14
  const env_service_1 = require("../../env/env.service");
15
15
  const common_1 = require("@nestjs/common");
16
- const client_1 = require("../../../../../prisma/generated/client");
16
+ const prisma_resolver_1 = require("./prisma-resolver");
17
17
  let globalPrismaOptions = {};
18
18
  function setPrismaClientOptions(options) {
19
19
  globalPrismaOptions = options;
20
20
  }
21
- let PrismaService = class PrismaService extends client_1.PrismaClient {
21
+ let PrismaClientClass = null;
22
+ async function loadPrismaClient() {
23
+ if (!PrismaClientClass) {
24
+ PrismaClientClass = await (0, prisma_resolver_1.getPrismaClientClass)();
25
+ }
26
+ return PrismaClientClass;
27
+ }
28
+ let PrismaService = class PrismaService {
22
29
  env;
30
+ prismaInstance;
23
31
  constructor(env) {
24
- super({
32
+ this.env = env;
33
+ return new Proxy(this, {
34
+ get: (target, prop, receiver) => {
35
+ if (prop in target) {
36
+ const value = Reflect.get(target, prop, receiver);
37
+ if (typeof value === 'function') {
38
+ return value.bind(target);
39
+ }
40
+ return value;
41
+ }
42
+ if (target.prismaInstance && typeof prop === 'string') {
43
+ const value = target.prismaInstance[prop];
44
+ if (typeof value === 'function') {
45
+ return value.bind(target.prismaInstance);
46
+ }
47
+ return value;
48
+ }
49
+ return Reflect.get(target, prop, receiver);
50
+ },
51
+ });
52
+ }
53
+ async initialize() {
54
+ const PrismaClientType = await loadPrismaClient();
55
+ this.prismaInstance = new PrismaClientType({
25
56
  log: [{ emit: 'event', level: 'query' }],
26
57
  ...globalPrismaOptions,
27
58
  });
28
- this.env = env;
29
59
  }
30
60
  async onModuleInit() {
61
+ await this.initialize();
31
62
  if (this.env.get('PRISMA_QUERY_LOG')) {
32
- this.$on('query', async (e) => {
63
+ this.prismaInstance?.$on?.('query', async (e) => {
33
64
  console.log(`${e.query} ${e.params}`);
34
65
  });
35
66
  }
36
- return this.$connect();
67
+ return this.prismaInstance?.$connect?.();
37
68
  }
38
69
  onModuleDestroy() {
39
- return this.$disconnect();
70
+ return this.prismaInstance?.$disconnect?.();
40
71
  }
41
- withTransaction(fn, options) {
42
- return this.$transaction(fn, options ?? {
72
+ async withTransaction(fn, options) {
73
+ return this.prismaInstance?.$transaction?.(fn, options ?? {
43
74
  maxWait: 20000,
44
75
  timeout: 20000,
45
76
  });
46
77
  }
78
+ [Symbol.toPrimitive]() {
79
+ return this.prismaInstance;
80
+ }
81
+ toString() {
82
+ return '[PrismaService]';
83
+ }
84
+ get $connect() {
85
+ return this.prismaInstance?.$connect?.bind(this.prismaInstance);
86
+ }
87
+ get $disconnect() {
88
+ return this.prismaInstance?.$disconnect?.bind(this.prismaInstance);
89
+ }
90
+ get $transaction() {
91
+ return this.prismaInstance?.$transaction?.bind(this.prismaInstance);
92
+ }
93
+ get $on() {
94
+ return this.prismaInstance?.$on?.bind(this.prismaInstance);
95
+ }
96
+ [Symbol.for('nodejs.util.inspect.custom')]() {
97
+ return this.prismaInstance;
98
+ }
47
99
  };
48
100
  exports.PrismaService = PrismaService;
49
101
  exports.PrismaService = PrismaService = __decorate([
@@ -1,4 +1,4 @@
1
- import { QueryDirectionType } from '..';
1
+ import type { QueryDirectionType } from '..';
2
2
  export declare class PaginationDto {
3
3
  page?: number;
4
4
  limit?: number;
package/core/index.d.ts CHANGED
@@ -14,3 +14,5 @@ export type FileResponse = {
14
14
  base64: string;
15
15
  };
16
16
  export type QueryDirectionType = 'asc' | 'desc';
17
+ export { setPrismaClient } from './database/prisma-resolver';
18
+ export { setPrismaClientOptions } from './database/prisma.service';
package/core/index.js CHANGED
@@ -1,2 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.setPrismaClientOptions = exports.setPrismaClient = void 0;
4
+ var prisma_resolver_1 = require("./database/prisma-resolver");
5
+ Object.defineProperty(exports, "setPrismaClient", { enumerable: true, get: function () { return prisma_resolver_1.setPrismaClient; } });
6
+ var prisma_service_1 = require("./database/prisma.service");
7
+ Object.defineProperty(exports, "setPrismaClientOptions", { enumerable: true, get: function () { return prisma_service_1.setPrismaClientOptions; } });
@@ -42,6 +42,8 @@ export declare class KoalaApp {
42
42
  private _ngrokKey;
43
43
  private _ngrokUrl;
44
44
  constructor(app: INestApplication<any>);
45
+ private showListeningMessage;
46
+ private startJobs;
45
47
  addGlobalGuard(Guard: Type<CanActivate>): this;
46
48
  addCronJob(job: CronJobClass): this;
47
49
  addEventJob(eventJob: EventJobClass): this;
@@ -58,6 +60,5 @@ export declare class KoalaApp {
58
60
  build(): Promise<INestApplication<any>>;
59
61
  serve(host?: string): Promise<void>;
60
62
  buildAndServe(host?: string): Promise<void>;
61
- private showListeningMessage;
62
63
  }
63
64
  export {};
package/core/koala-app.js CHANGED
@@ -16,6 +16,7 @@ const ilogging_service_1 = require("../services/logging/ilogging.service");
16
16
  const koala_global_vars_1 = require("./koala-global-vars");
17
17
  const env_config_1 = require("./utils/env.config");
18
18
  const instanciate_class_with_dependencies_injection_1 = require("./utils/instanciate-class-with-dependencies-injection");
19
+ const utils_1 = require("@koalarx/utils");
19
20
  class KoalaApp {
20
21
  app;
21
22
  _globalExceptionFilter;
@@ -39,6 +40,32 @@ class KoalaApp {
39
40
  this._domainExceptionFilter = new domain_errors_filter_1.DomainErrorsFilter(loggingService);
40
41
  this._zodExceptionFilter = new zod_errors_filter_1.ZodErrorsFilter(loggingService);
41
42
  }
43
+ showListeningMessage(port, host = 'localhost') {
44
+ const envService = this.app.get(env_service_1.EnvService);
45
+ console.log('------------------------------');
46
+ if (this._apiReferenceEndpoint) {
47
+ consola.info('API Reference:', `http://${host}:${port}${this._apiReferenceEndpoint}`);
48
+ }
49
+ consola.info('Health Check:', `http://${host}:${port}/health`);
50
+ consola.info('Internal Host:', `http://${host}:${port}`);
51
+ if (this._ngrokUrl) {
52
+ consola.info('External Host:', this._ngrokUrl);
53
+ consola.info('External Inspect:', `http://${host}:4040/inspect/http`);
54
+ }
55
+ consola.box('Environment:', envService.get('NODE_ENV'));
56
+ console.log('------------------------------');
57
+ }
58
+ async startJobs() {
59
+ await (0, utils_1.delay)(5000);
60
+ const cronJobs = await Promise.all(this._cronJobs.map((job) => this.app.resolve(job)));
61
+ for (const cronJob of cronJobs) {
62
+ cronJob.start();
63
+ }
64
+ const eventJobs = await Promise.all(this._eventJobs.map((job) => this.app.resolve(job)));
65
+ for (const eventJob of eventJobs) {
66
+ eventJob.setupSubscriptions();
67
+ }
68
+ }
42
69
  addGlobalGuard(Guard) {
43
70
  this._guards.push((0, instanciate_class_with_dependencies_injection_1.instanciateClassWithDependenciesInjection)(this.app, Guard));
44
71
  return this;
@@ -194,14 +221,6 @@ class KoalaApp {
194
221
  this.app.useGlobalFilters(this._prismaValidationExceptionFilter);
195
222
  }
196
223
  this.app.useGlobalFilters(this._globalExceptionFilter, this._domainExceptionFilter, this._zodExceptionFilter);
197
- const cronJobs = await Promise.all(this._cronJobs.map((job) => this.app.resolve(job)));
198
- for (const cronJob of cronJobs) {
199
- cronJob.start();
200
- }
201
- const eventJobs = await Promise.all(this._eventJobs.map((job) => this.app.resolve(job)));
202
- for (const eventJob of eventJobs) {
203
- eventJob.setupSubscriptions();
204
- }
205
224
  for (const guard of this._guards) {
206
225
  this.app.useGlobalGuards(guard);
207
226
  }
@@ -217,6 +236,7 @@ class KoalaApp {
217
236
  this._ngrokUrl = url;
218
237
  });
219
238
  }
239
+ this.startJobs();
220
240
  return this.app;
221
241
  }
222
242
  async serve(host) {
@@ -228,20 +248,5 @@ class KoalaApp {
228
248
  await this.build();
229
249
  await this.serve(host);
230
250
  }
231
- showListeningMessage(port, host = 'localhost') {
232
- const envService = this.app.get(env_service_1.EnvService);
233
- console.log('------------------------------');
234
- if (this._apiReferenceEndpoint) {
235
- consola.info('API Reference:', `http://${host}:${port}${this._apiReferenceEndpoint}`);
236
- }
237
- consola.info('Health Check:', `http://${host}:${port}/health`);
238
- consola.info('Internal Host:', `http://${host}:${port}`);
239
- if (this._ngrokUrl) {
240
- consola.info('External Host:', this._ngrokUrl);
241
- consola.info('External Inspect:', `http://${host}:4040/inspect/http`);
242
- }
243
- consola.box('Environment:', envService.get('NODE_ENV'));
244
- console.log('------------------------------');
245
- }
246
251
  }
247
252
  exports.KoalaApp = KoalaApp;
@@ -10,6 +10,7 @@ interface AutoMappingGetContext {
10
10
  export declare class AutoMappingList {
11
11
  private static _mappedPropList;
12
12
  private static _mappingProfileList;
13
+ private static initializeLists;
13
14
  static add(source: Type<any>, target: Type<any>, ...forMember: ForMemberDefinition<any, any>): void;
14
15
  static get(source: Type<any>, target: Type<any>): AutoMappingGetContext;
15
16
  static getSourceByName(sourceName: string): Type<any> | undefined;
@@ -6,9 +6,18 @@ const auto_mapping_class_context_1 = require("./auto-mapping-class-context");
6
6
  const auto_mapping_context_1 = require("./auto-mapping-context");
7
7
  const find_on_list_1 = require("../utils/find-on-list");
8
8
  class AutoMappingList {
9
- static _mappedPropList = new list_1.List(auto_mapping_class_context_1.AutoMappingClassContext);
10
- static _mappingProfileList = new list_1.List(auto_mapping_context_1.AutoMappingContext);
9
+ static _mappedPropList;
10
+ static _mappingProfileList;
11
+ static initializeLists() {
12
+ if (!this._mappedPropList) {
13
+ this._mappedPropList = new list_1.List(auto_mapping_class_context_1.AutoMappingClassContext);
14
+ }
15
+ if (!this._mappingProfileList) {
16
+ this._mappingProfileList = new list_1.List(auto_mapping_context_1.AutoMappingContext);
17
+ }
18
+ }
11
19
  static add(source, target, ...forMember) {
20
+ this.initializeLists();
12
21
  this._mappingProfileList.add(new auto_mapping_context_1.AutoMappingContext(source, target, forMember));
13
22
  this._mappedPropList.add(new auto_mapping_class_context_1.AutoMappingClassContext(source));
14
23
  this._mappedPropList.add(new auto_mapping_class_context_1.AutoMappingClassContext(target));
@@ -16,6 +25,7 @@ class AutoMappingList {
16
25
  this.addExtendedPropsIntoSubClass(target);
17
26
  }
18
27
  static get(source, target) {
28
+ this.initializeLists();
19
29
  return {
20
30
  mapContext: (0, find_on_list_1.findOnList)(this._mappingProfileList, (mp) => mp.source.name === source.name && mp.target.name === target.name, (mp) => Object.getPrototypeOf(mp.source.prototype.constructor) === source &&
21
31
  mp.target.name === target.name),
@@ -24,22 +34,23 @@ class AutoMappingList {
24
34
  };
25
35
  }
26
36
  static getSourceByName(sourceName) {
37
+ this.initializeLists();
27
38
  return this._mappedPropList.find((mp) => mp.source.name === sourceName)
28
39
  ?.source;
29
40
  }
30
41
  static getPropDefinitions(source, propName) {
31
- return this._mappedPropList
32
- .find((mp) => mp.source.name === source.name)
33
- ?.props.find((prop) => prop.name === propName);
42
+ this.initializeLists();
43
+ return this._mappedPropList.find((mp) => mp.source.name === source.name)?.props.find((prop) => prop.name === propName);
34
44
  }
35
45
  static getTargets(source) {
36
- return this._mappingProfileList
37
- .filter((mp) => mp.source.name === source.name ||
46
+ this.initializeLists();
47
+ return this._mappingProfileList.filter((mp) => mp.source.name === source.name ||
38
48
  Object.getPrototypeOf(mp.source.prototype.constructor) === source)
39
49
  .map((mp) => mp.target)
40
50
  .toArray();
41
51
  }
42
52
  static addMappedProp(source, propName) {
53
+ this.initializeLists();
43
54
  let mappedClass = this._mappedPropList.find((mp) => mp.source.name === source.name);
44
55
  if (!mappedClass) {
45
56
  mappedClass = new auto_mapping_class_context_1.AutoMappingClassContext(source);
@@ -61,6 +72,7 @@ class AutoMappingList {
61
72
  });
62
73
  }
63
74
  static addExtendedPropsIntoSubClass(source) {
75
+ this.initializeLists();
64
76
  const mappedExtendedClass = this._mappedPropList.find((mp) => mp.source === Object.getPrototypeOf(source.prototype.constructor));
65
77
  if (mappedExtendedClass) {
66
78
  const mappedClass = this._mappedPropList.find((mp) => mp.source.name === source.name);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koalarx/nest",
3
- "version": "1.18.3",
3
+ "version": "1.18.5",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,2 +1,2 @@
1
1
  import 'dotenv/config';
2
- export declare function createE2EDatabase(): `${string}-${string}-${string}-${string}-${string}`;
2
+ export declare function createE2EDatabase(runtime?: 'node' | 'bun'): Promise<`${string}-${string}-${string}-${string}-${string}`>;
@@ -4,6 +4,7 @@ exports.createE2EDatabase = createE2EDatabase;
4
4
  require("dotenv/config");
5
5
  const node_child_process_1 = require("node:child_process");
6
6
  const node_crypto_1 = require("node:crypto");
7
+ const pg_1 = require("pg");
7
8
  function generateUniqueDatabaseURL() {
8
9
  const schemaId = (0, node_crypto_1.randomUUID)();
9
10
  if (!process.env.DATABASE_URL) {
@@ -16,11 +17,31 @@ function generateUniqueDatabaseURL() {
16
17
  schemaId,
17
18
  };
18
19
  }
19
- function createE2EDatabase() {
20
+ async function createE2EDatabase(runtime = 'node') {
20
21
  const { url, schemaId } = generateUniqueDatabaseURL();
21
22
  process.env.DATABASE_URL = url;
22
23
  process.env.DIRECT_URL = url;
23
24
  process.env.PRISMA_SCHEMA_DISABLE_ADVISORY_LOCK = 'true';
24
- (0, node_child_process_1.execSync)('npx prisma migrate deploy', {});
25
+ try {
26
+ const baseUrl = new URL(process.env.DATABASE_URL);
27
+ baseUrl.pathname = '/postgres';
28
+ const pool = new pg_1.Pool({ connectionString: baseUrl.toString() });
29
+ try {
30
+ await pool.query(`CREATE DATABASE "${schemaId}"`);
31
+ }
32
+ finally {
33
+ await pool.end();
34
+ }
35
+ const env = { ...process.env, DATABASE_URL: url, DIRECT_URL: url };
36
+ (0, node_child_process_1.execSync)(`${runtime}x prisma migrate deploy`, {
37
+ cwd: process.cwd(),
38
+ env,
39
+ stdio: 'inherit',
40
+ });
41
+ }
42
+ catch (error) {
43
+ console.error('Erro ao criar banco de dados e2e:', error);
44
+ throw error;
45
+ }
25
46
  return schemaId;
26
47
  }
@@ -1,2 +1,2 @@
1
1
  import 'dotenv/config';
2
- export declare function dropE2EDatabase(schemaId: string): Promise<number>;
2
+ export declare function dropE2EDatabase(schemaId: string): Promise<void>;
@@ -1,17 +1,33 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dropE2EDatabase = dropE2EDatabase;
4
- const adapter_pg_1 = require("@prisma/adapter-pg");
5
4
  require("dotenv/config");
6
5
  const pg_1 = require("pg");
7
- const client_1 = require("../../../../../prisma/generated/client");
8
- function dropE2EDatabase(schemaId) {
6
+ async function dropE2EDatabase(schemaId) {
7
+ await new Promise((resolve) => setTimeout(resolve, 1000));
8
+ const baseUrl = new URL(process.env.DATABASE_URL || '');
9
+ baseUrl.pathname = '/postgres';
9
10
  const pool = new pg_1.Pool({
10
- connectionString: process.env.DATABASE_URL,
11
+ connectionString: baseUrl.toString(),
12
+ idleTimeoutMillis: 100,
11
13
  });
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());
14
+ try {
15
+ await pool.query(`
16
+ SELECT pg_terminate_backend(pg_stat_activity.pid)
17
+ FROM pg_stat_activity
18
+ WHERE pg_stat_activity.datname = '${schemaId}'
19
+ AND pid <> pg_backend_pid()
20
+ `);
21
+ await new Promise((resolve) => setTimeout(resolve, 500));
22
+ await pool.query(`DROP DATABASE IF EXISTS "${schemaId}"`);
23
+ }
24
+ catch {
25
+ }
26
+ finally {
27
+ try {
28
+ await pool.end();
29
+ }
30
+ catch {
31
+ }
32
+ }
17
33
  }