@groundbrick/db-postgres 0.3.0 → 0.3.2
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/README.md +77 -127
- package/dist/client.d.ts +4 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +29 -19
- package/dist/client.js.map +1 -1
- package/dist/factory.js +1 -1
- package/dist/factory.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/transaction.d.ts +2 -4
- package/dist/transaction.d.ts.map +1 -1
- package/dist/transaction.js +2 -4
- package/dist/transaction.js.map +1 -1
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
# @groundbrick/db-postgres
|
|
2
2
|
|
|
3
|
-
Cliente PostgreSQL
|
|
3
|
+
Cliente PostgreSQL que implementa o contrato `DatabaseClient` de `@groundbrick/db-core`, com connection pooling, monitoramento de saúde, gerenciamento de transações e sistema de migrações.
|
|
4
4
|
|
|
5
|
-
## Features
|
|
5
|
+
## Features
|
|
6
6
|
|
|
7
|
-
- **🔗 Connection Pooling** - Usando `pg` (node-postgres) com
|
|
8
|
-
- **🏭 Singleton Factory** - Gerenciamento
|
|
9
|
-
- **🔄 Transaction Management** -
|
|
7
|
+
- **🔗 Connection Pooling** - Usando `pg` (node-postgres) com pool configurável
|
|
8
|
+
- **🏭 Singleton Factory** - Gerenciamento de instâncias de clientes por chave de conexão
|
|
9
|
+
- **🔄 Transaction Management** - Commit e rollback automáticos com BaseTransaction
|
|
10
10
|
- **📊 Health Monitoring** - Verificações de saúde com métricas de timing
|
|
11
|
-
- **🗃️ Migration System** -
|
|
11
|
+
- **🗃️ Migration System** - Seções UP/DOWN e checksum
|
|
12
12
|
- **⚙️ TypeScript Support** - Tipagem completa para queries e configurações
|
|
13
13
|
- **🛡️ Error Handling** - Tipos de erro específicos (ConnectionError, QueryError, etc.)
|
|
14
|
-
- **📈 Pool Monitoring** -
|
|
14
|
+
- **📈 Pool Monitoring** - Total de conexões, ociosas e em espera
|
|
15
15
|
|
|
16
16
|
## Instalação
|
|
17
17
|
|
|
@@ -44,8 +44,7 @@ const config: PostgresConfig = {
|
|
|
44
44
|
|
|
45
45
|
// Pool configuration
|
|
46
46
|
max: 10,
|
|
47
|
-
|
|
48
|
-
connectionTimeoutMillis: 60000,
|
|
47
|
+
connectionTimeoutMillis: 2000,
|
|
49
48
|
idleTimeoutMillis: 30000,
|
|
50
49
|
|
|
51
50
|
// SSL configuration (production)
|
|
@@ -85,7 +84,6 @@ process.on('SIGTERM', async () => {
|
|
|
85
84
|
### 3. Transações
|
|
86
85
|
|
|
87
86
|
```typescript
|
|
88
|
-
// Transação automática (recomendado)
|
|
89
87
|
const result = await dbClient.transaction(async (trx) => {
|
|
90
88
|
// Log de auditoria
|
|
91
89
|
await trx.query('INSERT INTO audit_logs (action, user_id) VALUES ($1, $2)',
|
|
@@ -105,20 +103,11 @@ const result = await dbClient.transaction(async (trx) => {
|
|
|
105
103
|
});
|
|
106
104
|
|
|
107
105
|
console.log('Usuário criado:', result);
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
// ou manual (não recomendado)
|
|
111
|
-
|
|
112
|
-
const transaction = await client.transaction();
|
|
113
|
-
try {
|
|
114
|
-
await transaction.query('INSERT INTO logs (event) VALUES ($1)', ['MANUAL_TX']);
|
|
115
|
-
await transaction.query('UPDATE users SET active = true WHERE id = $1', [42]);
|
|
116
|
-
await transaction.commit();
|
|
117
|
-
} catch (error) {
|
|
118
|
-
await transaction.rollback();
|
|
119
|
-
}
|
|
120
106
|
```
|
|
121
107
|
|
|
108
|
+
A transação faz commit quando o callback termina e rollback quando ele lança um erro. A
|
|
109
|
+
conexão volta ao pool; quando o próprio COMMIT ou ROLLBACK falha, ela é destruída.
|
|
110
|
+
|
|
122
111
|
## API Reference
|
|
123
112
|
|
|
124
113
|
### PostgresFactory
|
|
@@ -134,19 +123,18 @@ interface PostgresConfig {
|
|
|
134
123
|
|
|
135
124
|
// Pool de conexões
|
|
136
125
|
max?: number; // Máximo de conexões (padrão: 10)
|
|
137
|
-
|
|
138
|
-
connectionTimeoutMillis?: number; // Timeout de conexão (padrão: 60000)
|
|
126
|
+
connectionTimeoutMillis?: number; // Timeout de conexão (padrão: 2000)
|
|
139
127
|
idleTimeoutMillis?: number; // Timeout de idle (padrão: 30000)
|
|
140
128
|
|
|
141
|
-
// SSL
|
|
129
|
+
// SSL
|
|
142
130
|
ssl?: boolean | {
|
|
143
131
|
rejectUnauthorized?: boolean;
|
|
144
132
|
ca?: string;
|
|
145
133
|
cert?: string;
|
|
146
134
|
key?: string;
|
|
147
135
|
};
|
|
148
|
-
|
|
149
|
-
//
|
|
136
|
+
|
|
137
|
+
// Declaradas no tipo, não repassadas ao pool
|
|
150
138
|
statement_timeout?: number;
|
|
151
139
|
query_timeout?: number;
|
|
152
140
|
application_name?: string;
|
|
@@ -155,14 +143,16 @@ interface PostgresConfig {
|
|
|
155
143
|
// Singleton Factory
|
|
156
144
|
class PostgresDatabaseFactory {
|
|
157
145
|
static getInstance(): PostgresDatabaseFactory;
|
|
158
|
-
getInstance(config: DatabaseConfig, logger?: Logger):
|
|
146
|
+
getInstance(config: DatabaseConfig, logger?: Logger): PostgresClient;
|
|
159
147
|
closeInstance(): Promise<void>;
|
|
160
148
|
}
|
|
161
149
|
|
|
162
|
-
// Instância padrão
|
|
150
|
+
// Instância padrão
|
|
163
151
|
const PostgresFactory: PostgresDatabaseFactory;
|
|
164
152
|
```
|
|
165
153
|
|
|
154
|
+
`min` (de `DatabaseConfig`) também não é repassado ao pool.
|
|
155
|
+
|
|
166
156
|
### PostgresClient
|
|
167
157
|
|
|
168
158
|
```typescript
|
|
@@ -179,22 +169,34 @@ class PostgresClient implements DatabaseClient {
|
|
|
179
169
|
// Monitoramento
|
|
180
170
|
healthCheck(): Promise<HealthCheckResult>;
|
|
181
171
|
getConnectionInfo(): { total: number; idle: number; waiting: number };
|
|
172
|
+
|
|
173
|
+
// Dialeto SQL
|
|
174
|
+
getDatabaseType(): 'postgresql';
|
|
175
|
+
supportsReturning(): boolean; // true
|
|
176
|
+
getSqlAdapter(): SqlAdapter;
|
|
182
177
|
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
`close()` termina o pool. Um `initialize()` posterior volta a abrir o cliente
|
|
181
|
+
com um pool novo, criado a partir da mesma configuração.
|
|
183
182
|
|
|
183
|
+
```typescript
|
|
184
184
|
interface QueryResult<T> {
|
|
185
185
|
rows: T[];
|
|
186
|
-
rowCount: number;
|
|
187
|
-
fields
|
|
186
|
+
rowCount: number | null;
|
|
187
|
+
fields?: Array<{ name: string; dataTypeID?: number }>;
|
|
188
188
|
}
|
|
189
189
|
|
|
190
190
|
interface HealthCheckResult {
|
|
191
|
-
status: 'healthy' | 'unhealthy';
|
|
192
|
-
message
|
|
191
|
+
status: 'healthy' | 'unhealthy' | 'degraded';
|
|
192
|
+
message?: string;
|
|
193
193
|
timestamp: Date;
|
|
194
|
-
responseTime
|
|
194
|
+
responseTime?: number;
|
|
195
195
|
}
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
+
`healthCheck()` executa `SELECT 1` e devolve `healthy` ou `unhealthy`, sem lançar erro.
|
|
199
|
+
|
|
198
200
|
### PostgresTransaction
|
|
199
201
|
|
|
200
202
|
```typescript
|
|
@@ -204,30 +206,24 @@ class PostgresTransaction extends BaseTransaction {
|
|
|
204
206
|
rollback(): Promise<void>;
|
|
205
207
|
isCompleted(): boolean;
|
|
206
208
|
}
|
|
207
|
-
|
|
208
|
-
// Uso manual (não recomendado)
|
|
209
|
-
const trx = await dbClient.transaction();
|
|
210
|
-
try {
|
|
211
|
-
await trx.query('INSERT INTO logs (event) VALUES ($1)', ['START']);
|
|
212
|
-
await trx.query('UPDATE counters SET value = value + 1');
|
|
213
|
-
await trx.commit();
|
|
214
|
-
} catch (error) {
|
|
215
|
-
await trx.rollback();
|
|
216
|
-
throw error;
|
|
217
|
-
}
|
|
218
209
|
```
|
|
219
210
|
|
|
211
|
+
É a instância recebida pelo callback de `transaction()`. Herda também `adaptSql()`,
|
|
212
|
+
`createInsertSql()`, `createUpdateSql()`, `getDatabaseType()` e `supportsReturning()` de
|
|
213
|
+
`BaseTransaction`.
|
|
214
|
+
|
|
220
215
|
## Sistema de Migrações
|
|
221
216
|
|
|
222
217
|
### PostgresMigrator
|
|
223
218
|
|
|
224
219
|
```typescript
|
|
225
220
|
import { PostgresMigrator } from '@groundbrick/db-postgres';
|
|
221
|
+
import { createLogger } from '@groundbrick/logger';
|
|
226
222
|
|
|
227
223
|
const migrator = new PostgresMigrator(
|
|
228
224
|
dbClient,
|
|
229
225
|
'./migrations',
|
|
230
|
-
|
|
226
|
+
createLogger({ context: 'migrator' })
|
|
231
227
|
);
|
|
232
228
|
|
|
233
229
|
// Aplicar todas as migrações pendentes
|
|
@@ -277,11 +273,14 @@ DROP INDEX IF EXISTS idx_users_email;
|
|
|
277
273
|
DROP TABLE IF EXISTS users;
|
|
278
274
|
```
|
|
279
275
|
|
|
280
|
-
**Regras
|
|
281
|
-
-
|
|
282
|
-
-
|
|
283
|
-
-
|
|
276
|
+
**Regras:**
|
|
277
|
+
- O arquivo deve ter seção UP (tudo antes de `-- DOWN`) e seção DOWN (tudo depois de `-- DOWN`), ambas não vazias
|
|
278
|
+
- Se a primeira linha começar com `--`, vira a descrição da migração
|
|
279
|
+
- Todos os arquivos `.sql` do diretório são aplicados em ordem lexicográfica
|
|
284
280
|
- Rollback executa a seção `DOWN` em ordem reversa
|
|
281
|
+
- Cada migração executa em uma transação própria
|
|
282
|
+
- As migrações aplicadas são registradas na tabela `schema_migrations`, com o checksum SHA-256 do arquivo
|
|
283
|
+
- `PostgresMigrator` lança `MigrationError`
|
|
285
284
|
|
|
286
285
|
### Exemplos de Migrações
|
|
287
286
|
|
|
@@ -340,10 +339,9 @@ export const dbConfig: PostgresConfig = {
|
|
|
340
339
|
user: process.env.DB_USER!,
|
|
341
340
|
password: process.env.DB_PASSWORD!,
|
|
342
341
|
|
|
343
|
-
// Pool
|
|
342
|
+
// Pool
|
|
344
343
|
max: parseInt(process.env.DB_POOL_MAX || '10'),
|
|
345
|
-
|
|
346
|
-
connectionTimeoutMillis: parseInt(process.env.DB_CONNECTION_TIMEOUT || '60000'),
|
|
344
|
+
connectionTimeoutMillis: parseInt(process.env.DB_CONNECTION_TIMEOUT || '2000'),
|
|
347
345
|
idleTimeoutMillis: parseInt(process.env.DB_IDLE_TIMEOUT || '30000'),
|
|
348
346
|
|
|
349
347
|
// SSL em produção
|
|
@@ -352,12 +350,7 @@ export const dbConfig: PostgresConfig = {
|
|
|
352
350
|
ca: process.env.DB_SSL_CA,
|
|
353
351
|
cert: process.env.DB_SSL_CERT,
|
|
354
352
|
key: process.env.DB_SSL_KEY
|
|
355
|
-
} : false
|
|
356
|
-
|
|
357
|
-
// Configurações PostgreSQL
|
|
358
|
-
application_name: process.env.APP_NAME || 'microframework-app',
|
|
359
|
-
statement_timeout: 30000,
|
|
360
|
-
query_timeout: 10000
|
|
353
|
+
} : false
|
|
361
354
|
};
|
|
362
355
|
```
|
|
363
356
|
|
|
@@ -365,7 +358,7 @@ export const dbConfig: PostgresConfig = {
|
|
|
365
358
|
|
|
366
359
|
```typescript
|
|
367
360
|
// src/repositories/UserRepository.ts
|
|
368
|
-
import { DatabaseClient
|
|
361
|
+
import { DatabaseClient } from '@groundbrick/db-postgres';
|
|
369
362
|
|
|
370
363
|
export interface User {
|
|
371
364
|
id: number;
|
|
@@ -541,35 +534,34 @@ app.get('/health', async (req, res) => {
|
|
|
541
534
|
### Tipos de Erro Disponíveis
|
|
542
535
|
|
|
543
536
|
```typescript
|
|
544
|
-
import {
|
|
545
|
-
ConnectionError,
|
|
546
|
-
QueryError,
|
|
547
|
-
TransactionError,
|
|
548
|
-
MigrationError
|
|
549
|
-
} from '@groundbrick/db-postgres';
|
|
537
|
+
import { ConnectionError, QueryError, TransactionError } from '@groundbrick/db-core';
|
|
550
538
|
|
|
551
539
|
try {
|
|
552
540
|
await dbClient.query('SELECT * FROM users');
|
|
553
541
|
} catch (error) {
|
|
554
542
|
if (error instanceof ConnectionError) {
|
|
555
543
|
console.error('Erro de conexão:', error.message);
|
|
556
|
-
// Tentar reconectar ou usar fallback
|
|
557
544
|
} else if (error instanceof QueryError) {
|
|
558
545
|
console.error('Erro na query:', error.message);
|
|
559
546
|
} else if (error instanceof TransactionError) {
|
|
560
|
-
// Só o COMMIT/ROLLBACK que falhou chega assim. Um erro lançado dentro do
|
|
561
|
-
// callback de transaction() é relançado tal como está, depois do rollback.
|
|
562
547
|
console.error('Erro na transação:', error.message);
|
|
563
548
|
}
|
|
564
549
|
}
|
|
565
550
|
```
|
|
566
551
|
|
|
552
|
+
- `initialize()` relança o erro do driver quando a conexão falha.
|
|
553
|
+
- `query()` e `transaction()` lançam `ConnectionError` antes de `initialize()`.
|
|
554
|
+
- `query()` lança `QueryError`, com o erro do driver em `cause`.
|
|
555
|
+
- `TransactionError` indica falha no próprio COMMIT/ROLLBACK ou uso de uma transação já terminada.
|
|
556
|
+
- Um erro lançado dentro do callback de `transaction()` é relançado sem alteração depois do rollback.
|
|
557
|
+
|
|
567
558
|
### Padrão Singleton e Múltiplos Clientes
|
|
568
559
|
|
|
569
560
|
```typescript
|
|
570
561
|
// Múltiplos clientes para diferentes bases
|
|
571
562
|
const mainDbClient = PostgresFactory.getInstance({
|
|
572
563
|
host: 'localhost',
|
|
564
|
+
port: 5432,
|
|
573
565
|
database: 'main_app',
|
|
574
566
|
user: 'app_user',
|
|
575
567
|
password: 'secret'
|
|
@@ -577,51 +569,51 @@ const mainDbClient = PostgresFactory.getInstance({
|
|
|
577
569
|
|
|
578
570
|
const analyticsDbClient = PostgresFactory.getInstance({
|
|
579
571
|
host: 'analytics-server',
|
|
572
|
+
port: 5432,
|
|
580
573
|
database: 'analytics',
|
|
581
574
|
user: 'analytics_user',
|
|
582
575
|
password: 'secret'
|
|
583
576
|
});
|
|
584
577
|
|
|
585
|
-
//
|
|
578
|
+
// Um cliente é reutilizado quando host, port, database e user são iguais
|
|
586
579
|
const sameClient = PostgresFactory.getInstance({
|
|
587
580
|
host: 'localhost',
|
|
581
|
+
port: 5432,
|
|
588
582
|
database: 'main_app',
|
|
589
583
|
user: 'app_user',
|
|
590
584
|
password: 'secret'
|
|
591
585
|
}); // Retorna a mesma instância de mainDbClient
|
|
592
586
|
|
|
593
587
|
// Cleanup de todas as conexões
|
|
594
|
-
await
|
|
588
|
+
await PostgresFactory.closeInstance();
|
|
595
589
|
```
|
|
596
590
|
|
|
597
591
|
## Configuração de Ambiente
|
|
598
592
|
|
|
593
|
+
O pacote não lê variáveis de ambiente. Exemplo de `.env` para a configuração acima:
|
|
594
|
+
|
|
599
595
|
```bash
|
|
600
596
|
# .env
|
|
601
597
|
# Configuração do Banco
|
|
602
598
|
DB_HOST=localhost
|
|
603
599
|
DB_PORT=5432
|
|
604
|
-
DB_NAME=
|
|
600
|
+
DB_NAME=myapp
|
|
605
601
|
DB_USER=postgres
|
|
606
602
|
DB_PASSWORD=your_password
|
|
607
603
|
|
|
608
604
|
# SSL (produção)
|
|
609
|
-
DB_SSL=true
|
|
610
605
|
DB_SSL_REJECT_UNAUTHORIZED=true
|
|
611
|
-
DB_SSL_CA
|
|
612
|
-
DB_SSL_CERT
|
|
613
|
-
DB_SSL_KEY
|
|
606
|
+
DB_SSL_CA="-----BEGIN CERTIFICATE-----..."
|
|
607
|
+
DB_SSL_CERT="-----BEGIN CERTIFICATE-----..."
|
|
608
|
+
DB_SSL_KEY="-----BEGIN PRIVATE KEY-----..."
|
|
614
609
|
|
|
615
610
|
# Pool de Conexões
|
|
616
611
|
DB_POOL_MAX=10
|
|
617
|
-
|
|
618
|
-
DB_CONNECTION_TIMEOUT=60000
|
|
612
|
+
DB_CONNECTION_TIMEOUT=2000
|
|
619
613
|
DB_IDLE_TIMEOUT=30000
|
|
620
614
|
|
|
621
615
|
# Configuração da Aplicação
|
|
622
|
-
APP_NAME=microframework-app
|
|
623
616
|
NODE_ENV=production
|
|
624
|
-
LOG_LEVEL=info
|
|
625
617
|
```
|
|
626
618
|
|
|
627
619
|
## Migration CLI Script
|
|
@@ -679,55 +671,13 @@ main().catch(console.error);
|
|
|
679
671
|
}
|
|
680
672
|
```
|
|
681
673
|
|
|
682
|
-
##
|
|
683
|
-
|
|
684
|
-
```typescript
|
|
685
|
-
// src/server.ts - Integração com @groundbrick/express-adapter
|
|
686
|
-
import { ExpressApp } from '@groundbrick/express-adapter';
|
|
687
|
-
import { dbClient } from './database.js';
|
|
688
|
-
|
|
689
|
-
const app = new ExpressApp({
|
|
690
|
-
port: 3000,
|
|
691
|
-
cors: { origin: ['https://app.example.com'], credentials: true }
|
|
692
|
-
});
|
|
693
|
-
|
|
694
|
-
// Middleware de database (personalizado)
|
|
695
|
-
app.getApp().use((req, res, next) => {
|
|
696
|
-
req.db = dbClient;
|
|
697
|
-
next();
|
|
698
|
-
});
|
|
699
|
-
|
|
700
|
-
// Health check endpoint
|
|
701
|
-
app.addRoute({
|
|
702
|
-
method: 'get',
|
|
703
|
-
path: '/health',
|
|
704
|
-
handler: async (req, res) => {
|
|
705
|
-
const health = await checkDatabaseHealth();
|
|
706
|
-
const statusCode = health.database.status === 'healthy' ? 200 : 503;
|
|
707
|
-
res.status(statusCode).json(health);
|
|
708
|
-
}
|
|
709
|
-
});
|
|
674
|
+
## Exports
|
|
710
675
|
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
await migrator.migrate();
|
|
715
|
-
|
|
716
|
-
await app.start();
|
|
717
|
-
```
|
|
676
|
+
- `PostgresClient`, `PostgresTransaction`, `PostgresDatabaseFactory`, `PostgresFactory`, `PostgresMigrator`
|
|
677
|
+
- `createLogger` (de `@groundbrick/logger`)
|
|
678
|
+
- Tipos: `PostgresConfig` e, de `@groundbrick/db-core`, `DatabaseClient`, `QueryResult`, `Transaction`, `Migration`, `MigrationRecord`, `HealthCheckResult`, `ConnectionError`, `QueryError`, `MigrationError`
|
|
718
679
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
1. **Use o padrão Singleton** para evitar múltiplas conexões desnecessárias
|
|
722
|
-
2. **Sempre inicialize** o cliente antes de usar (`await dbClient.initialize()`)
|
|
723
|
-
3. **Use transações** para operações que modificam múltiplas tabelas
|
|
724
|
-
4. **Implemente health checks** para monitoramento de produção
|
|
725
|
-
5. **Configure SSL** adequadamente em produção
|
|
726
|
-
6. **Use Repository pattern** para organizar queries
|
|
727
|
-
7. **Monitore o pool** de conexões em produção
|
|
728
|
-
8. **Teste migrações** em ambiente de desenvolvimento primeiro
|
|
729
|
-
9. **Implemente error handling** específico para cada tipo de erro
|
|
730
|
-
10. **Use TypeScript** para tipagem de queries e configurações
|
|
680
|
+
As classes de erro são reexportadas só como tipos; para `instanceof`, importe-as de `@groundbrick/db-core`.
|
|
731
681
|
|
|
732
682
|
## Dependencies
|
|
733
683
|
|
package/dist/client.d.ts
CHANGED
|
@@ -4,14 +4,17 @@ import { PostgresConfig } from './types.js';
|
|
|
4
4
|
import { PostgresTransaction } from './transaction.js';
|
|
5
5
|
/**
|
|
6
6
|
* Unified PostgreSQL Database Client implementation
|
|
7
|
-
* Follows the exact same interface as MySQL for easy switching
|
|
8
7
|
*/
|
|
9
8
|
export declare class PostgresClient implements DatabaseClient {
|
|
9
|
+
private readonly config;
|
|
10
10
|
private pool;
|
|
11
11
|
private logger;
|
|
12
12
|
private sqlAdapter;
|
|
13
13
|
private isInitialized;
|
|
14
|
+
/** Set by close() once the pool has ended. */
|
|
15
|
+
private poolEnded;
|
|
14
16
|
constructor(config: PostgresConfig, logger: Logger);
|
|
17
|
+
private createPool;
|
|
15
18
|
initialize(): Promise<void>;
|
|
16
19
|
close(): Promise<void>;
|
|
17
20
|
getDatabaseType(): 'postgresql';
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names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AAE,QAAQ,EAAE,CAAC,EAAE,EAAE,mBAAmB,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAwC7E,WAAW,IAAI,OAAO,CAAC,iBAAiB,CAAC;IA+B/C,OAAO,IAAI,OAAO;IAIlB,iBAAiB,IAAI;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE;CAWxE;AAED,OAAO,EAAE,KAAK,cAAc,EAAE,mBAAmB,EAAE,CAAC"}
|
package/dist/client.js
CHANGED
|
@@ -4,36 +4,48 @@ import { PostgresTransaction } from './transaction.js';
|
|
|
4
4
|
import { PostgresSqlAdapter } from './adapter.js';
|
|
5
5
|
/**
|
|
6
6
|
* Unified PostgreSQL Database Client implementation
|
|
7
|
-
* Follows the exact same interface as MySQL for easy switching
|
|
8
7
|
*/
|
|
9
8
|
export class PostgresClient {
|
|
9
|
+
config;
|
|
10
10
|
pool;
|
|
11
11
|
logger;
|
|
12
12
|
sqlAdapter;
|
|
13
13
|
isInitialized = false;
|
|
14
|
+
/** Set by close() once the pool has ended. */
|
|
15
|
+
poolEnded = false;
|
|
14
16
|
constructor(config, logger) {
|
|
17
|
+
this.config = config;
|
|
15
18
|
this.logger = logger.child('postgres-client');
|
|
16
19
|
this.sqlAdapter = new PostgresSqlAdapter();
|
|
17
|
-
this.pool =
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
20
|
+
this.pool = this.createPool();
|
|
21
|
+
}
|
|
22
|
+
createPool() {
|
|
23
|
+
const pool = new Pool({
|
|
24
|
+
host: this.config.host,
|
|
25
|
+
port: this.config.port,
|
|
26
|
+
database: this.config.database,
|
|
27
|
+
user: this.config.user,
|
|
28
|
+
password: this.config.password,
|
|
29
|
+
max: this.config.max || 10,
|
|
30
|
+
idleTimeoutMillis: this.config.idleTimeoutMillis || 30000,
|
|
31
|
+
connectionTimeoutMillis: this.config.connectionTimeoutMillis || 2000,
|
|
32
|
+
ssl: this.config.ssl
|
|
27
33
|
});
|
|
28
|
-
|
|
34
|
+
pool.on('error', (err) => {
|
|
29
35
|
this.logger.error('PostgreSQL pool error', err);
|
|
30
36
|
});
|
|
37
|
+
return pool;
|
|
31
38
|
}
|
|
32
39
|
async initialize() {
|
|
33
40
|
if (this.isInitialized) {
|
|
34
41
|
this.logger.warn('Database already initialized');
|
|
35
42
|
return;
|
|
36
43
|
}
|
|
44
|
+
// A closed client is reopened with a new pool built from the same config.
|
|
45
|
+
if (this.poolEnded) {
|
|
46
|
+
this.pool = this.createPool();
|
|
47
|
+
this.poolEnded = false;
|
|
48
|
+
}
|
|
37
49
|
try {
|
|
38
50
|
// Test connection
|
|
39
51
|
const client = await this.pool.connect();
|
|
@@ -52,6 +64,7 @@ export class PostgresClient {
|
|
|
52
64
|
return;
|
|
53
65
|
try {
|
|
54
66
|
await this.pool.end();
|
|
67
|
+
this.poolEnded = true;
|
|
55
68
|
this.isInitialized = false;
|
|
56
69
|
this.logger.info('PostgreSQL client closed');
|
|
57
70
|
}
|
|
@@ -120,11 +133,9 @@ export class PostgresClient {
|
|
|
120
133
|
return result;
|
|
121
134
|
}
|
|
122
135
|
catch (error) {
|
|
123
|
-
// rollback()
|
|
124
|
-
// BaseTransaction. Rolling back on the raw client instead would never
|
|
125
|
-
// release it, and every failed transaction would leak a connection.
|
|
136
|
+
// rollback() also releases the connection.
|
|
126
137
|
await transaction.rollback().catch(() => {
|
|
127
|
-
/*
|
|
138
|
+
/* a failed rollback is ignored */
|
|
128
139
|
});
|
|
129
140
|
const level = transactionFailureLogLevel(error);
|
|
130
141
|
if (level === 'error') {
|
|
@@ -133,9 +144,8 @@ export class PostgresClient {
|
|
|
133
144
|
else {
|
|
134
145
|
transactionLogger[level]('Transaction rolled back', { error: error.message, code: error.code });
|
|
135
146
|
}
|
|
136
|
-
//
|
|
137
|
-
//
|
|
138
|
-
// already arrives here as a TransactionError from BaseTransaction.
|
|
147
|
+
// Rethrows the callback's error unchanged. A failed COMMIT arrives here as a
|
|
148
|
+
// TransactionError.
|
|
139
149
|
throw error;
|
|
140
150
|
}
|
|
141
151
|
finally {
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,OAAO,EAIH,eAAe,EACf,UAAU,EAEV,0BAA0B,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,IAAI,CAAC;AAE1B,OAAO,EAIH,eAAe,EACf,UAAU,EAEV,0BAA0B,EAC7B,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAElD;;GAEG;AACH,MAAM,OAAO,cAAc;IAQM;IAPrB,IAAI,CAAO;IACX,MAAM,CAAS;IACf,UAAU,CAAa;IACvB,aAAa,GAAG,KAAK,CAAC;IAC9B,8CAA8C;IACtC,SAAS,GAAG,KAAK,CAAC;IAE1B,YAA6B,MAAsB,EAAE,MAAc;QAAtC,WAAM,GAAN,MAAM,CAAgB;QAC/C,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;QAC9C,IAAI,CAAC,UAAU,GAAG,IAAI,kBAAkB,EAAE,CAAC;QAC3C,IAAI,CAAC,IAAI,GAAG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CAAC,aAAa,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC;IACpD,CAAC;IAED,iBAAiB;QACb,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;YACb,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;QAC7C,CAAC;QAED,OAAO;YACH,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU;YAC3B,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,SAAS;YACzB,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,YAAY;SAClC,CAAC;IACN,CAAC;CACJ;AAED,OAAO,EAAuB,mBAAmB,EAAE,CAAC"}
|
package/dist/factory.js
CHANGED
|
@@ -40,6 +40,6 @@ export class PostgresDatabaseFactory {
|
|
|
40
40
|
return `${config.host}:${config.port}:${config.database}:${config.user}`;
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
|
-
// Default factory instance
|
|
43
|
+
// Default factory instance
|
|
44
44
|
export const PostgresFactory = PostgresDatabaseFactory.getInstance();
|
|
45
45
|
//# sourceMappingURL=factory.js.map
|
package/dist/factory.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.js","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAE3D,OAAO,EAAE,cAAc,EAAkB,MAAM,aAAa,CAAC;AAE7D;;;GAGG;AACH,MAAM,OAAO,uBAAuB;IACxB,MAAM,CAAC,QAAQ,GAAmC,IAAI,CAAC;IACvD,OAAO,GAAgC,IAAI,GAAG,EAAE,CAAC;IACjD,aAAa,CAAS;IAE9B;QACI,IAAI,CAAC,aAAa,GAAG,YAAY,CAAC,EAAE,OAAO,EAAE,kBAAkB,EAAE,CAAC,CAAC;IACvE,CAAC;IAED,MAAM,CAAC,WAAW;QACd,IAAI,CAAC,uB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CAAC;IAC5C,CAAC;IAEO,iBAAiB,CAAC,MAAsB;QAC5C,OAAO,GAAG,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,IAAI,IAAI,MAAM,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;IAC7E,CAAC;;AAGL,2BAA2B;AAC3B,MAAM,CAAC,MAAM,eAAe,GAAG,uBAAuB,CAAC,WAAW,EAAE,CAAC"}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACR,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,EACjB,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAGjD,YAAY,EACR,cAAc,EACd,WAAW,EACX,WAAW,EACX,SAAS,EACT,eAAe,EACf,iBAAiB,EACjB,eAAe,EACf,UAAU,EACV,cAAc,EACjB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export { PostgresClient, PostgresTransaction } from './client.js';
|
|
2
2
|
export { PostgresDatabaseFactory, PostgresFactory } from './factory.js';
|
|
3
3
|
export { PostgresMigrator } from './migrator.js';
|
|
4
|
-
// Convenience export for quick setup
|
|
5
4
|
export { createLogger } from '@groundbrick/logger';
|
|
6
5
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAgBjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClE,OAAO,EAAE,uBAAuB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AACxE,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAgBjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC"}
|
package/dist/transaction.d.ts
CHANGED
|
@@ -12,10 +12,8 @@ export declare class PostgresTransaction extends BaseTransaction {
|
|
|
12
12
|
protected doRollback(): Promise<void>;
|
|
13
13
|
/**
|
|
14
14
|
* Returns the connection to the pool. When the COMMIT or ROLLBACK itself
|
|
15
|
-
* failed, the error is passed on
|
|
16
|
-
*
|
|
17
|
-
* transaction, and handing that to the next borrower is worse than losing
|
|
18
|
-
* it. A clean rollback after a failed callback recycles normally.
|
|
15
|
+
* failed, the error is passed on and pg destroys the connection. A clean
|
|
16
|
+
* rollback after a failed callback returns it to the pool.
|
|
19
17
|
*/
|
|
20
18
|
protected doCleanup(erro?: unknown): Promise<void>;
|
|
21
19
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAc,eAAe,EAAE,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAElG;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU,EACnC,MAAM,EAAE,MAAM;IAKZ,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;cA6C9D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C
|
|
1
|
+
{"version":3,"file":"transaction.d.ts","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAC7C,OAAO,EAAc,eAAe,EAAE,WAAW,EAAoB,MAAM,sBAAsB,CAAC;AAElG;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,eAAe;IAEhD,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU,EACnC,MAAM,EAAE,MAAM;IAKZ,KAAK,CAAC,CAAC,GAAG,GAAG,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,GAAE,GAAG,EAAO,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;cA6C9D,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;cAIzB,UAAU,IAAI,OAAO,CAAC,IAAI,CAAC;IAI3C;;;;OAIG;cACa,SAAS,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;CAG3D"}
|
package/dist/transaction.js
CHANGED
|
@@ -52,10 +52,8 @@ export class PostgresTransaction extends BaseTransaction {
|
|
|
52
52
|
}
|
|
53
53
|
/**
|
|
54
54
|
* Returns the connection to the pool. When the COMMIT or ROLLBACK itself
|
|
55
|
-
* failed, the error is passed on
|
|
56
|
-
*
|
|
57
|
-
* transaction, and handing that to the next borrower is worse than losing
|
|
58
|
-
* it. A clean rollback after a failed callback recycles normally.
|
|
55
|
+
* failed, the error is passed on and pg destroys the connection. A clean
|
|
56
|
+
* rollback after a failed callback returns it to the pool.
|
|
59
57
|
*/
|
|
60
58
|
async doCleanup(erro) {
|
|
61
59
|
this.client.release(erro instanceof Error ? erro : undefined);
|
package/dist/transaction.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction.js","sourceRoot":"","sources":["../src/transaction.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAe,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAElG;;GAEG;AACH,MAAM,OAAO,mBAAoB,SAAQ,eAAe;IAE/B;IADrB,YACqB,MAAkB,EACnC,MAAc;QAEd,KAAK,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,mCAAmC;QAH/C,WAAM,GAAN,MAAM,CAAY;IAIvC,CAAC;IAED,KAAK,CAAC,KAAK,CAAU,GAAW,EAAE,SAAgB,EAAE;QAChD,IAAI,IAAI,CAAC,SAAS,EAAE,CAAC;YACjB,MAAM,IAAI,gBAAgB,CAAC,wCAAwC,CAAC,CAAC;QACzE,CAAC;QAED,IAAI,CAAC;YACD,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,EAAE;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U;QACtB,MAAM,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;IACxC,CAAC;IAED;;;;OAIG;IACO,KAAK,CAAC,SAAS,CAAC,IAAc;QACpC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,YAAY,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;IAClE,CAAC;CACJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@groundbrick/db-postgres",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "PostgreSQL database client with connection pooling, migrations, and health monitoring",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"license": "MIT",
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/200Systems/
|
|
33
|
+
"url": "git+https://github.com/200Systems/groundbrick.git",
|
|
34
34
|
"directory": "packages/db-postgres"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@groundbrick/db-core": "^0.
|
|
38
|
-
"@groundbrick/logger": "^0.
|
|
37
|
+
"@groundbrick/db-core": "^0.4.0",
|
|
38
|
+
"@groundbrick/logger": "^0.5.1"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"pg": "^8.11.0"
|