{"_id":"@200systems/mf-db-postgres","_rev":"13-6c68fa19109ad403559a883e85f531e2","name":"@200systems/mf-db-postgres","dist-tags":{"latest":"1.1.7"},"versions":{"1.0.1":{"name":"@200systems/mf-db-postgres","version":"1.0.1","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.0.1","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"0a942a376495a704bf3863a1c1d82d7ea71c80d3","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.0.1.tgz","fileCount":26,"integrity":"sha512-m3ZCJrI7KA73R3S65QW/Mcpn98NR4H8nWWMRHVoWbK4Cy34BhfbyOXd7jrJNJdurln/TDE8xCziBmiZcZkCzvw==","signatures":[{"sig":"MEYCIQClvonKXFaCfZBgCVSKhH9eszAz8JdRf/MF3r+8VVJv0wIhANXGf67SpBkzjMOXyToUN/11Q7WeuirYPg8Q02/1OQPE","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66609},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"b23d0aca4444d3727bef596b99d52f845ee6bdd8","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.0.1_1750937020142_0.5351093676707213","host":"s3://npm-registry-packages-npm-production"}},"1.0.2":{"name":"@200systems/mf-db-postgres","version":"1.0.2","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.0.2","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"0fb5def51925aa0aa869ee3efb6402a5f2dcb370","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.0.2.tgz","fileCount":26,"integrity":"sha512-WdPP6+DOwIncfoAEeXXdl5h0D5reKmjQzfn6j6y+kxYfTDXMLCR4VManUPFsWbORLrM73zTUQRXOmDfmyJwEAg==","signatures":[{"sig":"MEUCIC8TpXhfhXTxtkj1jc5trwCQS0H8S5vYaB9IRwnI9Ru2AiEA6ti4/Y7HuJlX0ShudfCZEFUY6RwOPK2puGWcoC19bzE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65785},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"3b9df0fba14ad311035a103071c895f780597d75","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.0.2_1751014413385_0.07169289754680763","host":"s3://npm-registry-packages-npm-production"}},"1.0.3":{"name":"@200systems/mf-db-postgres","version":"1.0.3","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.0.3","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"39f63d0517ae0e996fe396549fc2a0e11b4d130e","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.0.3.tgz","fileCount":26,"integrity":"sha512-nDadrF6l4lMwIXmWToBwp1nSHL4g8TooOaAz/fpEXsILahzGgwq2fj6xFnpGwRzz6okB5lC6W4PKPlZ5FL4OZg==","signatures":[{"sig":"MEYCIQCKmuABdng3/Rqjd86zlJXPLkZ6g1VRb304xus7vNCM+wIhAKmzQOlmeVtSDdQnP6Bg0wVNDYKg/2Qr+SiMDmwf5E2L","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65785},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"17e3ce1150d8a91f15ba15d4208a96a40cf211b9","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.0.3_1751056785443_0.9700401674170429","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@200systems/mf-db-postgres","version":"1.0.4","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.0.4","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"488f3de1284df234628e291983842cd5eea44290","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.0.4.tgz","fileCount":26,"integrity":"sha512-cKJgkkhCXGwBuZwS/MWAlp9ZhTmIiwQ8j+ucquMwyeoILyy1c2SsBNuJ0RT1ApGV41MQbWanJj6LL4fBeVDzuw==","signatures":[{"sig":"MEUCIQCAqDJGnXy/6Snk8W1lqeRmPMdQH0s6q1p54kQtdI2zSAIge1jHfkMWEdufojcjYxaf0q2TTI1hP6GJW4cqeCwVxhc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65785},"main":"./dist/index.js","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"d7bb90f291b6b532083319fa040cfeb43eae8ad7","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.0.4_1751058906783_0.5979400216850477","host":"s3://npm-registry-packages-npm-production"}},"1.0.5":{"name":"@200systems/mf-db-postgres","version":"1.0.5","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.0.5","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"0e6dfb6b4d2e045199d70d78663e02248c132963","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.0.5.tgz","fileCount":26,"integrity":"sha512-CCFiSMclPscT9o5UYKqWa/916jHTfIzd2+9n1ixM9ZYkDiVswpN02/riGZTvwfTodL3rJsUwQeYdCW/eVy2c5A==","signatures":[{"sig":"MEYCIQDyxXyW+/uX9+cqrol0Ba2v26zNi1s/HJqulm7GLg2xCwIhAJIW/UQyIFW8ootwAkDC6JlAn/m6b/WhlRTjcgBOh+zf","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":65807},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"d7bb90f291b6b532083319fa040cfeb43eae8ad7","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.0.5_1751059743705_0.6374940126829629","host":"s3://npm-registry-packages-npm-production"}},"1.1.0":{"name":"@200systems/mf-db-postgres","version":"1.1.0","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.0","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"3b037cccf4545d523cc78958aff654b65d3d7b58","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.0.tgz","fileCount":30,"integrity":"sha512-HvS4W8bg/7xE2WYd5sGyTWUNVj8X/OX+/TJQIFe/x1y8Si7gneFpj9hCUOavQA3vzDhRQJspf25N5DmuVXiJ0w==","signatures":[{"sig":"MEYCIQDtxGolhlCgcJS65MDI9lu/hMiM7TOBXI0FYlnWxhPt+wIhAONd6eXg45NCNakDvY5JXfk46VSyyfWRZVh+BEORUJ/Y","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66097},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"f17262551117147d336d909a4af42a3520922708","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.0_1751215930105_0.1748290619140409","host":"s3://npm-registry-packages-npm-production"}},"1.1.1":{"name":"@200systems/mf-db-postgres","version":"1.1.1","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.1","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"1cb529e9d8d0d51b3dad3efb73cc9a67fa42932f","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.1.tgz","fileCount":30,"integrity":"sha512-HqLsCBUfuNZkF2E0Mfep6cxN+GjnUBmADmsdrjHLNwjl6ZvLZNEfNvvBlL2rcd84vYgW+exMOE3ERn5h5f5SuA==","signatures":[{"sig":"MEYCIQDvv8DBO0RaKZdFURSEZDcCMJ/1ManB32kbZKjelby2mQIhAOfv+Eq+05p1GyNJR93wFalJaPVZ+Vn+Lsv9I1iobDXA","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66097},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"b2e1d0a164c5cfd355a044b56b7ec48c88def397","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.1_1751223523921_0.9067470133254432","host":"s3://npm-registry-packages-npm-production"}},"1.1.2":{"name":"@200systems/mf-db-postgres","version":"1.1.2","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.2","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"238a51fe0c846a35fa09c67e33ee91972f75cee2","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.2.tgz","fileCount":30,"integrity":"sha512-ozFOWBYrC3AZw2J0V2YM0iT8wLEDBWtuA7eNsxceCwGeUbmfCmHtfzm3/VIhzRgwfDkx8TH6eJd/xAh9ZLY4qw==","signatures":[{"sig":"MEQCH3c2DR1nTv0A01t1nGDioud7HjAagCHsWUMij5jll4MCIQDUYilT4i+ec3ewwiAMRkFawTnBniz2ahPJVHMUikDGHA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66160},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"b2e1d0a164c5cfd355a044b56b7ec48c88def397","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.2_1751224225787_0.10144021325806807","host":"s3://npm-registry-packages-npm-production"}},"1.1.3":{"name":"@200systems/mf-db-postgres","version":"1.1.3","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.3","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"ae76dc93cd97f22671f909a96aca24b32e63b520","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.3.tgz","fileCount":30,"integrity":"sha512-a4tTmbzaykTRuwOv7saff1oO302ZGK6wtD6cOzCFd5Xjo58ESZLIR8C+qzumO7ehkvARZuNddo0PdM/mVDGtQg==","signatures":[{"sig":"MEQCIDamkJrjmsd40YxXwIZPuNywiG7CuBwDHvaI9JrtxmanAiAWQR4qkNCmZpYyKvnzLWsOxlN+tgkUs6e1+OR6PXMYQw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66160},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"c3deab4b45525f101f4f82799966e87052d244a7","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.3_1751388926947_0.09480854213171308","host":"s3://npm-registry-packages-npm-production"}},"1.1.4":{"name":"@200systems/mf-db-postgres","version":"1.1.4","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.4","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"526b17b0e5018d5d24657ea258c3498a0b3c7c3f","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.4.tgz","fileCount":30,"integrity":"sha512-B6LXcQ4HjMkphimvn1yGvC2EOn4KVtsehNTqnzsXtLLTSUmun9qWnJmjzPHN01rHqtJ+3h79TK2sgWYsiGUX/w==","signatures":[{"sig":"MEYCIQCNniyJmyEqSpsRbKpBDEWEwTZkD4MVQsMgCwdeWNMvJwIhAK11OjcfyjA9+qAPKehMOJ8/tc1ZxoX4FbsYptvCdsmF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66460},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"23dcee4f5721e057c3d9625f10e1823f834a466d","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.4_1751472517039_0.20395348284558446","host":"s3://npm-registry-packages-npm-production"}},"1.1.5":{"name":"@200systems/mf-db-postgres","version":"1.1.5","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.5","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"a18bf5ec6b71412c368a5a0a244edf7c8cf3bd4e","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.5.tgz","fileCount":30,"integrity":"sha512-tzaUYvqR8P+A7hDPHmR4VJmBu2M8KWm8rV2zls409e8Z6RiqjJG4ilfDHDtutiE93eiWfFLgvZoEpv4eziCC3Q==","signatures":[{"sig":"MEUCIBS5YVVaQgUvoLprbfwUxMJlEof528Fv/Oe/958gPXIZAiEAr3gkKeRB0TmzURckO5JL5aZsWMoVVlMcuQN7ldl1kcA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66460},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"23dcee4f5721e057c3d9625f10e1823f834a466d","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.5_1751473968456_0.8644212129115345","host":"s3://npm-registry-packages-npm-production"}},"1.1.6":{"name":"@200systems/mf-db-postgres","version":"1.1.6","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","_id":"@200systems/mf-db-postgres@1.1.6","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"dist":{"shasum":"d474290cf6e31dfd6c00aef3e4a324c819ee0661","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.6.tgz","fileCount":30,"integrity":"sha512-5DL2wCcS9V/nF4Xn09kvfvMIKDS6Bm28lw/CIr8Hb9kLkBNomE7sZtH0qo3Ae26NVQNLaa8qpctuZZov0CAXEQ==","signatures":[{"sig":"MEYCIQCi3qLr8lgM8iJndLf5f6uGF+Smc+dri8SGnBL04tiIEAIhAI9aGy/KfOw8FK06wU62SMvNi/8no6kbQcOcS3PaEPS1","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":66460},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.js"}},"gitHead":"23dcee4f5721e057c3d9625f10e1823f834a466d","scripts":{"dev":"tsc --watch","lint":"eslint src/**/*.ts","build":"tsc","clean":"rm -rf dist *.tsbuildinfo","lint:fix":"eslint src/**/*.ts --fix"},"_npmUser":{"name":"200systems","actor":{"name":"200systems","type":"user","email":"cleiton.marques@200.systems"},"email":"cleiton.marques@200.systems"},"repository":{"url":"git+https://github.com/200Systems/bitbrick-microframework.git","type":"git","directory":"packages/db-postgres"},"_npmVersion":"10.8.1","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","directories":{},"_nodeVersion":"22.3.0","dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"pg":"^8.11.0","@types/pg":"^8.10.0","typescript":"^5.8.3","@types/node":"^20.10.0"},"peerDependencies":{"pg":"^8.11.0"},"_npmOperationalInternal":{"tmp":"tmp/mf-db-postgres_1.1.6_1751474241792_0.6549749945221184","host":"s3://npm-registry-packages-npm-production"}},"1.1.7":{"name":"@200systems/mf-db-postgres","version":"1.1.7","description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","require":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc","dev":"tsc --watch","clean":"rm -rf dist *.tsbuildinfo","lint":"eslint src/**/*.ts","lint:fix":"eslint src/**/*.ts --fix"},"keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/200Systems/bitbrick-microframework.git","directory":"packages/db-postgres"},"dependencies":{"@200systems/mf-logger":"^1.0.0","@200systems/mf-db-core":"^1.0.0"},"peerDependencies":{"pg":"^8.11.0"},"devDependencies":{"@types/node":"^20.10.0","@types/pg":"^8.10.0","pg":"^8.11.0","typescript":"^5.8.3"},"engines":{"node":">=18.0.0"},"publishConfig":{"access":"public"},"_id":"@200systems/mf-db-postgres@1.1.7","gitHead":"23dcee4f5721e057c3d9625f10e1823f834a466d","bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"homepage":"https://github.com/200Systems/bitbrick-microframework#readme","_nodeVersion":"22.3.0","_npmVersion":"10.8.1","dist":{"integrity":"sha512-NBjlSjV/IzAGFEyEsjg13PmqrF8kCAjt/ETaha/h7PgmyJG6t1Y7ATch8mUgynyG8xmvDUhX+UD9s6vZky77sA==","shasum":"0d73670d3e0964f728a88290cbbd43f375c110fb","tarball":"https://registry.npmjs.org/@200systems/mf-db-postgres/-/mf-db-postgres-1.1.7.tgz","fileCount":30,"unpackedSize":66476,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDdnMC6yJp9KDH5kLgeiPYTDu7xv3Ju2dzaJ4CDirsKnwIgEa97zKzDcJtVm3VDwJl6WxtaqRCnibpHYt7FUWxirkQ="}]},"_npmUser":{"name":"200systems","email":"cleiton.marques@200.systems","actor":{"name":"200systems","email":"cleiton.marques@200.systems","type":"user"}},"directories":{},"maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/mf-db-postgres_1.1.7_1751475251397_0.6383040773588287"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-26T11:23:40.020Z","modified":"2025-07-02T16:54:11.749Z","1.0.1":"2025-06-26T11:23:40.318Z","1.0.2":"2025-06-27T08:53:33.571Z","1.0.3":"2025-06-27T20:39:45.616Z","1.0.4":"2025-06-27T21:15:06.970Z","1.0.5":"2025-06-27T21:29:03.887Z","1.1.0":"2025-06-29T16:52:10.298Z","1.1.1":"2025-06-29T18:58:44.115Z","1.1.2":"2025-06-29T19:10:25.980Z","1.1.3":"2025-07-01T16:55:27.130Z","1.1.4":"2025-07-02T16:08:37.203Z","1.1.5":"2025-07-02T16:32:48.639Z","1.1.6":"2025-07-02T16:37:21.976Z","1.1.7":"2025-07-02T16:54:11.593Z"},"bugs":{"url":"https://github.com/200Systems/bitbrick-microframework/issues"},"author":{"name":"Cleiton Marques","email":"cleiton.marques@200.systems"},"license":"MIT","homepage":"https://github.com/200Systems/bitbrick-microframework#readme","keywords":["typescript","postgresql","database","migrations","connection-pooling","microframework","health-monitoring"],"repository":{"type":"git","url":"git+https://github.com/200Systems/bitbrick-microframework.git","directory":"packages/db-postgres"},"description":"PostgreSQL database client with connection pooling, migrations, and health monitoring","maintainers":[{"name":"200systems","email":"cleiton.marques@200.systems"}],"readme":"# @200systems/mf-db-postgres\n\nCliente PostgreSQL para o microframework TypeScript com connection pooling, monitoramento de saúde, gerenciamento de transações e sistema de migrações completo.\n\n## Features Implementadas\n\n- **🔗 Connection Pooling** - Usando `pg` (node-postgres) com configuração avançada\n- **🏭 Singleton Factory** - Gerenciamento centralizado de instâncias de clientes \n- **🔄 Transaction Management** - Transações automáticas e manuais com BaseTransaction\n- **📊 Health Monitoring** - Verificações de saúde com métricas de timing\n- **🗃️ Migration System** - Sistema completo com UP/DOWN scripts e checksum\n- **⚙️ TypeScript Support** - Tipagem completa para queries e configurações\n- **🛡️ Error Handling** - Tipos de erro específicos (ConnectionError, QueryError, etc.)\n- **📈 Pool Monitoring** - Informações detalhadas sobre estado do pool de conexões\n\n## Instalação\n\n```bash\nnpm install @200systems/mf-db-postgres\n```\n\n### Peer Dependencies\n\n```bash\nnpm install pg\nnpm install --save-dev @types/pg\n```\n\n## Quick Start\n\n### 1. Configuração Básica\n\n```typescript\n// src/database.ts\nimport { PostgresFactory, PostgresConfig } from '@200systems/mf-db-postgres';\nimport { createLogger } from '@200systems/mf-logger';\n\nconst config: PostgresConfig = {\n  host: process.env.DB_HOST || 'localhost',\n  port: parseInt(process.env.DB_PORT || '5432'),\n  database: process.env.DB_NAME || 'myapp',\n  user: process.env.DB_USER || 'postgres',\n  password: process.env.DB_PASSWORD || 'secret',\n  \n  // Pool configuration\n  max: 10,\n  min: 2,\n  connectionTimeoutMillis: 60000,\n  idleTimeoutMillis: 30000,\n  \n  // SSL configuration (production)\n  ssl: process.env.NODE_ENV === 'production' ? {\n    rejectUnauthorized: true\n  } : false\n};\n\nconst logger = createLogger({ context: 'database' });\nexport const dbClient = PostgresFactory.getInstance(config, logger);\n```\n\n### 2. Inicialização e Queries\n\n```typescript\n// src/server.ts\nimport { dbClient } from './database.js';\n\n// Inicializar conexão\nawait dbClient.initialize();\n\n// Query simples\nconst users = await dbClient.query<{ id: number; name: string; email: string }>(\n  'SELECT id, name, email FROM users WHERE active = $1',\n  [true]\n);\n\nconsole.log(`Found ${users.rowCount} users:`, users.rows);\n\n// Cleanup gracioso\nprocess.on('SIGTERM', async () => {\n  await dbClient.close();\n  process.exit(0);\n});\n```\n\n### 3. Transações\n\n```typescript\n// Transação automática (recomendado)\nconst result = await dbClient.transaction(async (trx) => {\n  // Log de auditoria\n  await trx.query('INSERT INTO audit_logs (action, user_id) VALUES ($1, $2)', \n    ['USER_CREATED', 123]);\n\n  // Criar usuário\n  const user = await trx.query<{ id: number }>(\n    'INSERT INTO users (name, email) VALUES ($1, $2) RETURNING id',\n    ['João Silva', 'joao@example.com']\n  );\n\n  // Criar perfil associado\n  await trx.query('INSERT INTO user_profiles (user_id, settings) VALUES ($1, $2)', \n    [user.rows[0].id, '{}']);\n\n  return user.rows[0];\n});\n\nconsole.log('Usuário criado:', result);\n\n\n// ou manual (não recomendado)\n\nconst transaction = await client.transaction();\ntry {\n  await transaction.query('INSERT INTO logs (event) VALUES ($1)', ['MANUAL_TX']);\n  await transaction.query('UPDATE users SET active = true WHERE id = $1', [42]);\n  await transaction.commit();\n} catch (error) {\n  await transaction.rollback();\n}\n```\n\n## API Reference\n\n### PostgresFactory\n\n```typescript\ninterface PostgresConfig {\n  // Conexão básica\n  host: string;\n  port: number;\n  database: string;\n  user: string;\n  password: string;\n  \n  // Pool de conexões\n  max?: number;                    // Máximo de conexões (padrão: 10)\n  min?: number;                    // Mínimo de conexões (padrão: 2)\n  connectionTimeoutMillis?: number; // Timeout de conexão (padrão: 60000)\n  idleTimeoutMillis?: number;      // Timeout de idle (padrão: 30000)\n  \n  // SSL (produção)\n  ssl?: boolean | {\n    rejectUnauthorized?: boolean;\n    ca?: string;\n    cert?: string;\n    key?: string;\n  };\n  \n  // PostgreSQL específico\n  statement_timeout?: number;\n  query_timeout?: number;\n  application_name?: string;\n}\n\n// Singleton Factory\nclass PostgresDatabaseFactory {\n  static getInstance(): PostgresDatabaseFactory;\n  getInstance(config: DatabaseConfig, logger?: Logger): DatabaseClient;\n  closeInstance(): Promise<void>;\n}\n\n// Instância padrão para conveniência\nconst PostgresFactory: PostgresDatabaseFactory;\n```\n\n### PostgresClient\n\n```typescript\nclass PostgresClient implements DatabaseClient {\n  // Ciclo de vida\n  initialize(): Promise<void>;\n  close(): Promise<void>;\n  isReady(): boolean;\n  \n  // Queries\n  query<T>(sql: string, params?: any[]): Promise<QueryResult<T>>;\n  transaction<T>(callback: (trx: PostgresTransaction) => Promise<T>): Promise<T>;\n  \n  // Monitoramento\n  healthCheck(): Promise<HealthCheckResult>;\n  getConnectionInfo(): { total: number; idle: number; waiting: number };\n}\n\ninterface QueryResult<T> {\n  rows: T[];\n  rowCount: number;\n  fields: Array<{ name: string; dataTypeID: number }>;\n}\n\ninterface HealthCheckResult {\n  status: 'healthy' | 'unhealthy';\n  message: string;\n  timestamp: Date;\n  responseTime: number;\n}\n```\n\n### PostgresTransaction\n\n```typescript\nclass PostgresTransaction extends BaseTransaction {\n  query<T>(sql: string, params?: any[]): Promise<QueryResult<T>>;\n  commit(): Promise<void>;\n  rollback(): Promise<void>;\n  isCompleted(): boolean;\n}\n\n// Uso manual (não recomendado)\nconst trx = await dbClient.transaction();\ntry {\n  await trx.query('INSERT INTO logs (event) VALUES ($1)', ['START']);\n  await trx.query('UPDATE counters SET value = value + 1');\n  await trx.commit();\n} catch (error) {\n  await trx.rollback();\n  throw error;\n}\n```\n\n## Sistema de Migrações\n\n### PostgresMigrator\n\n```typescript\nimport { PostgresMigrator } from '@200systems/mf-db-postgres';\n\nconst migrator = new PostgresMigrator(\n  dbClient,\n  './migrations',\n  logger.child('migrator')\n);\n\n// Aplicar todas as migrações pendentes\nawait migrator.migrate();\n\n// Rollback das últimas N migrações\nawait migrator.rollback(2);\n\n// Verificar status\nconst status = await migrator.getStatus();\nconsole.log(`Migrações: ${status.applied}/${status.total} aplicadas`);\nconsole.log('Pendentes:', status.pending);\n\n// Listar migrações aplicadas\nconst applied = await migrator.getApplied();\nconsole.log('Aplicadas:', applied.map(m => `${m.id} - ${m.description}`));\n```\n\n### Estrutura de Arquivos de Migração\n\n```\nmigrations/\n├── 20241201_001_create_users_table.sql\n├── 20241201_002_add_user_profiles.sql\n├── 20241202_001_add_indexes.sql\n└── 20241203_001_add_audit_logs.sql\n```\n\n### Formato de Arquivo de Migração\n\n```sql\n-- Criar tabela de usuários\nCREATE TABLE users (\n  id SERIAL PRIMARY KEY,\n  name VARCHAR(100) NOT NULL,\n  email VARCHAR(100) UNIQUE NOT NULL,\n  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),\n  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n);\n\nCREATE INDEX idx_users_email ON users(email);\nCREATE INDEX idx_users_created_at ON users(created_at);\n\n-- DOWN\nDROP INDEX IF EXISTS idx_users_created_at;\nDROP INDEX IF EXISTS idx_users_email;\nDROP TABLE IF EXISTS users;\n```\n\n**Regras importantes:**\n- Arquivo deve ter seção `UP` (antes de `-- DOWN`) e seção `DOWN` (após `-- DOWN`)\n- Primeira linha com `--` vira a descrição da migração\n- Arquivos aplicados em ordem lexicográfica\n- Rollback executa a seção `DOWN` em ordem reversa\n\n### Exemplos de Migrações\n\n```sql\n-- migrations/20241201_001_create_users_table.sql\n-- Criar tabela inicial de usuários\nCREATE TABLE users (\n  id SERIAL PRIMARY KEY,\n  name VARCHAR(100) NOT NULL,\n  email VARCHAR(100) UNIQUE NOT NULL,\n  password_hash VARCHAR(255) NOT NULL,\n  role VARCHAR(20) DEFAULT 'user',\n  active BOOLEAN DEFAULT true,\n  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),\n  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n);\n\n-- DOWN\nDROP TABLE IF EXISTS users;\n```\n\n```sql\n-- migrations/20241201_002_add_user_profiles.sql\n-- Adicionar tabela de perfis de usuário\nCREATE TABLE user_profiles (\n  id SERIAL PRIMARY KEY,\n  user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,\n  first_name VARCHAR(50),\n  last_name VARCHAR(50),\n  phone VARCHAR(20),\n  avatar_url TEXT,\n  settings JSONB DEFAULT '{}',\n  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),\n  updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()\n);\n\nCREATE UNIQUE INDEX idx_user_profiles_user_id ON user_profiles(user_id);\n\n-- DOWN\nDROP INDEX IF EXISTS idx_user_profiles_user_id;\nDROP TABLE IF EXISTS user_profiles;\n```\n\n## Exemplos Práticos\n\n### Configuração com Variáveis de Ambiente\n\n```typescript\n// src/config/database.ts\nimport { PostgresConfig } from '@200systems/mf-db-postgres';\n\nexport const dbConfig: PostgresConfig = {\n  host: process.env.DB_HOST || 'localhost',\n  port: parseInt(process.env.DB_PORT || '5432'),\n  database: process.env.DB_NAME!,\n  user: process.env.DB_USER!,\n  password: process.env.DB_PASSWORD!,\n  \n  // Pool otimizado para produção\n  max: parseInt(process.env.DB_POOL_MAX || '10'),\n  min: parseInt(process.env.DB_POOL_MIN || '2'),\n  connectionTimeoutMillis: parseInt(process.env.DB_CONNECTION_TIMEOUT || '60000'),\n  idleTimeoutMillis: parseInt(process.env.DB_IDLE_TIMEOUT || '30000'),\n  \n  // SSL em produção\n  ssl: process.env.NODE_ENV === 'production' ? {\n    rejectUnauthorized: process.env.DB_SSL_REJECT_UNAUTHORIZED === 'true',\n    ca: process.env.DB_SSL_CA,\n    cert: process.env.DB_SSL_CERT,\n    key: process.env.DB_SSL_KEY\n  } : false,\n  \n  // Configurações PostgreSQL\n  application_name: process.env.APP_NAME || 'microframework-app',\n  statement_timeout: 30000,\n  query_timeout: 10000\n};\n```\n\n### Repository Pattern\n\n```typescript\n// src/repositories/UserRepository.ts\nimport { DatabaseClient, QueryResult } from '@200systems/mf-db-postgres';\n\nexport interface User {\n  id: number;\n  name: string;\n  email: string;\n  active: boolean;\n  created_at: Date;\n}\n\nexport class UserRepository {\n  constructor(private db: DatabaseClient) {}\n\n  async findById(id: number): Promise<User | null> {\n    const result = await this.db.query<User>(\n      'SELECT * FROM users WHERE id = $1',\n      [id]\n    );\n    return result.rows[0] || null;\n  }\n\n  async findByEmail(email: string): Promise<User | null> {\n    const result = await this.db.query<User>(\n      'SELECT * FROM users WHERE email = $1',\n      [email]\n    );\n    return result.rows[0] || null;\n  }\n\n  async findPaginated(limit: number, offset: number): Promise<{ users: User[]; total: number }> {\n    const [usersResult, countResult] = await Promise.all([\n      this.db.query<User>(\n        'SELECT * FROM users ORDER BY created_at DESC LIMIT $1 OFFSET $2',\n        [limit, offset]\n      ),\n      this.db.query<{ count: string }>(\n        'SELECT COUNT(*) as count FROM users'\n      )\n    ]);\n\n    return {\n      users: usersResult.rows,\n      total: parseInt(countResult.rows[0].count)\n    };\n  }\n\n  async create(userData: Omit<User, 'id' | 'created_at'>): Promise<User> {\n    const result = await this.db.query<User>(\n      `INSERT INTO users (name, email, active) \n       VALUES ($1, $2, $3) \n       RETURNING *`,\n      [userData.name, userData.email, userData.active]\n    );\n    return result.rows[0];\n  }\n\n  async update(id: number, userData: Partial<Omit<User, 'id' | 'created_at'>>): Promise<User | null> {\n    const setClause = Object.keys(userData)\n      .map((key, index) => `${key} = $${index + 2}`)\n      .join(', ');\n    \n    const values = [id, ...Object.values(userData)];\n    \n    const result = await this.db.query<User>(\n      `UPDATE users SET ${setClause}, updated_at = NOW() \n       WHERE id = $1 \n       RETURNING *`,\n      values\n    );\n    return result.rows[0] || null;\n  }\n\n  async delete(id: number): Promise<boolean> {\n    const result = await this.db.query(\n      'DELETE FROM users WHERE id = $1',\n      [id]\n    );\n    return (result.rowCount || 0) > 0;\n  }\n}\n```\n\n### Service com Transações\n\n```typescript\n// src/services/UserService.ts\nimport { DatabaseClient } from '@200systems/mf-db-postgres';\nimport { UserRepository } from '../repositories/UserRepository.js';\n\nexport class UserService {\n  constructor(\n    private db: DatabaseClient,\n    private userRepo: UserRepository\n  ) {}\n\n  async createUserWithProfile(userData: {\n    name: string;\n    email: string;\n    firstName: string;\n    lastName: string;\n  }): Promise<{ user: User; profile: UserProfile }> {\n    return this.db.transaction(async (trx) => {\n      // Criar usuário\n      const user = await trx.query<User>(\n        'INSERT INTO users (name, email) VALUES ($1, $2) RETURNING *',\n        [userData.name, userData.email]\n      );\n\n      // Criar perfil\n      const profile = await trx.query<UserProfile>(\n        `INSERT INTO user_profiles (user_id, first_name, last_name) \n         VALUES ($1, $2, $3) RETURNING *`,\n        [user.rows[0].id, userData.firstName, userData.lastName]\n      );\n\n      // Log de auditoria\n      await trx.query(\n        'INSERT INTO audit_logs (action, entity_type, entity_id, details) VALUES ($1, $2, $3, $4)',\n        ['CREATE', 'user', user.rows[0].id, JSON.stringify(userData)]\n      );\n\n      return {\n        user: user.rows[0],\n        profile: profile.rows[0]\n      };\n    });\n  }\n}\n```\n\n### Health Check e Monitoring\n\n```typescript\n// src/health.ts\nimport { dbClient } from './database.js';\n\nexport async function checkDatabaseHealth() {\n  const health = await dbClient.healthCheck();\n  const connectionInfo = dbClient.getConnectionInfo();\n  \n  return {\n    database: {\n      status: health.status,\n      message: health.message,\n      responseTime: health.responseTime,\n      timestamp: health.timestamp\n    },\n    connectionPool: {\n      total: connectionInfo.total,\n      idle: connectionInfo.idle,\n      waiting: connectionInfo.waiting,\n      utilization: `${Math.round((connectionInfo.total - connectionInfo.idle) / connectionInfo.total * 100)}%`\n    }\n  };\n}\n\n// src/routes/health.ts (Express)\napp.get('/health', async (req, res) => {\n  try {\n    const health = await checkDatabaseHealth();\n    const statusCode = health.database.status === 'healthy' ? 200 : 503;\n    res.status(statusCode).json(health);\n  } catch (error) {\n    res.status(503).json({\n      database: { status: 'unhealthy', message: error.message },\n      connectionPool: { total: 0, idle: 0, waiting: 0, utilization: '0%' }\n    });\n  }\n});\n```\n\n## Error Handling\n\n### Tipos de Erro Disponíveis\n\n```typescript\nimport { \n  ConnectionError, \n  QueryError, \n  TransactionError, \n  MigrationError \n} from '@200systems/mf-db-postgres';\n\ntry {\n  await dbClient.query('SELECT * FROM users');\n} catch (error) {\n  if (error instanceof ConnectionError) {\n    console.error('Erro de conexão:', error.message);\n    // Tentar reconectar ou usar fallback\n  } else if (error instanceof QueryError) {\n    console.error('Erro na query:', error.message);\n    console.error('SQL:', error.sql);\n    console.error('Params:', error.params);\n  } else if (error instanceof TransactionError) {\n    console.error('Erro na transação:', error.message);\n    // Transaction já foi automaticamente revertida\n  }\n}\n```\n\n### Padrão Singleton e Múltiplos Clientes\n\n```typescript\n// Múltiplos clientes para diferentes bases\nconst mainDbClient = PostgresFactory.getInstance({\n  host: 'localhost',\n  database: 'main_app',\n  user: 'app_user',\n  password: 'secret'\n});\n\nconst analyticsDbClient = PostgresFactory.getInstance({\n  host: 'analytics-server',\n  database: 'analytics',\n  user: 'analytics_user', \n  password: 'secret'\n});\n\n// Clients são automaticamente reutilizados se config for idêntica\nconst sameClient = PostgresFactory.getInstance({\n  host: 'localhost',\n  database: 'main_app',\n  user: 'app_user',\n  password: 'secret'\n}); // Retorna a mesma instância de mainDbClient\n\n// Cleanup de todas as conexões\nawait PostgresDatabaseFactory.getInstance().closeInstance();\n```\n\n## Configuração de Ambiente\n\n```bash\n# .env\n# Configuração do Banco\nDB_HOST=localhost\nDB_PORT=5432\nDB_NAME=microframework_app\nDB_USER=postgres\nDB_PASSWORD=your_password\n\n# SSL (produção)\nDB_SSL=true\nDB_SSL_REJECT_UNAUTHORIZED=true\nDB_SSL_CA=/path/to/ca.pem\nDB_SSL_CERT=/path/to/cert.pem\nDB_SSL_KEY=/path/to/key.pem\n\n# Pool de Conexões\nDB_POOL_MAX=10\nDB_POOL_MIN=2\nDB_CONNECTION_TIMEOUT=60000\nDB_IDLE_TIMEOUT=30000\n\n# Configuração da Aplicação\nAPP_NAME=microframework-app\nNODE_ENV=production\nLOG_LEVEL=info\n```\n\n## Migration CLI Script\n\n```typescript\n// scripts/migrate.ts\nimport { dbClient } from '../src/database.js';\nimport { PostgresMigrator } from '@200systems/mf-db-postgres';\nimport { createLogger } from '@200systems/mf-logger';\n\nconst logger = createLogger({ context: 'migration-cli' });\nconst migrator = new PostgresMigrator(dbClient, './migrations', logger);\n\nasync function main() {\n  const command = process.argv[2];\n  \n  await dbClient.initialize();\n  \n  try {\n    switch (command) {\n      case 'up':\n        await migrator.migrate();\n        break;\n      case 'down':\n        const steps = parseInt(process.argv[3]) || 1;\n        await migrator.rollback(steps);\n        break;\n      case 'status':\n        const status = await migrator.getStatus();\n        console.log(`Migrations: ${status.applied}/${status.total}`);\n        if (status.pending.length > 0) {\n          console.log('Pending:', status.pending);\n        }\n        break;\n      default:\n        console.log('Usage: npm run migrate [up|down|status] [steps]');\n    }\n  } finally {\n    await dbClient.close();\n  }\n}\n\nmain().catch(console.error);\n```\n\n```json\n// package.json scripts\n{\n  \"scripts\": {\n    \"migrate\": \"tsx scripts/migrate.ts\",\n    \"migrate:up\": \"npm run migrate up\",\n    \"migrate:down\": \"npm run migrate down\",\n    \"migrate:status\": \"npm run migrate status\"\n  }\n}\n```\n\n## Integração com Express Adapter\n\n```typescript\n// src/server.ts - Integração com @200systems/mf-express-adapter\nimport { ExpressApp } from '@200systems/mf-express-adapter';\nimport { dbClient } from './database.js';\n\nconst app = new ExpressApp({\n  port: 3000,\n  cors: { origin: true }\n});\n\n// Middleware de database (personalizado)\napp.getApp().use((req, res, next) => {\n  req.db = dbClient;\n  next();\n});\n\n// Health check endpoint\napp.addRoute({\n  method: 'get',\n  path: '/health',\n  handler: async (req, res) => {\n    const health = await checkDatabaseHealth();\n    const statusCode = health.database.status === 'healthy' ? 200 : 503;\n    res.status(statusCode).json(health);\n  }\n});\n\n// Aplicar migrações na inicialização\nconst migrator = new PostgresMigrator(dbClient, './migrations', logger);\nawait dbClient.initialize();\nawait migrator.migrate();\n\nawait app.start();\n```\n\n## Melhores Práticas\n\n1. **Use o padrão Singleton** para evitar múltiplas conexões desnecessárias\n2. **Sempre inicialize** o cliente antes de usar (`await dbClient.initialize()`)\n3. **Use transações** para operações que modificam múltiplas tabelas\n4. **Implemente health checks** para monitoramento de produção\n5. **Configure SSL** adequadamente em produção\n6. **Use Repository pattern** para organizar queries\n7. **Monitore o pool** de conexões em produção\n8. **Teste migrações** em ambiente de desenvolvimento primeiro\n9. **Implemente error handling** específico para cada tipo de erro\n10. **Use TypeScript** para tipagem de queries e configurações\n\n## Dependencies\n\n### Required\n- `@200systems/mf-logger` - Sistema de logging\n- `@200systems/mf-db-core` - Abstrações de banco de dados\n\n### Peer Dependencies\n- `pg` - Driver PostgreSQL para Node.js (^8.11.0)\n\n### Dev Dependencies\n- `@types/pg` - Tipos TypeScript para pg\n\n## License\n\nMIT","readmeFilename":"README.md"}