From 43c815438176233dbc94374e2419c35842a28635 Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sat, 7 Jan 2023 09:50:04 +0000 Subject: [PATCH 01/11] chore(.gitignore): add clinic (#150) --- .gitignore | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index c1b9a5c..8fda44a 100644 --- a/.gitignore +++ b/.gitignore @@ -135,6 +135,9 @@ dist # macOS files .DS_Store +# Clinic +.clinic + # lock files package-lock.json pnpm-lock.yaml @@ -142,4 +145,4 @@ yarn.lock # editor files .vscode -.idea \ No newline at end of file +.idea From 846f22b8095b267c82e1f8d68a3084c56f799f6b Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Sun, 5 Mar 2023 10:27:26 +0000 Subject: [PATCH 02/11] chore(.gitignore): add bun lockfile (#152) --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 8fda44a..3c21249 100644 --- a/.gitignore +++ b/.gitignore @@ -139,6 +139,7 @@ dist .clinic # lock files +bun.lockb package-lock.json pnpm-lock.yaml yarn.lock From 89f3a5156f9f25beec876289d7c06bf76c5204d2 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 13 Mar 2023 05:01:27 +0000 Subject: [PATCH 03/11] build(deps-dev): bump tsd from 0.25.0 to 0.27.0 (#153) Bumps [tsd](https://github.com/SamVerschueren/tsd) from 0.25.0 to 0.27.0. - [Release notes](https://github.com/SamVerschueren/tsd/releases) - [Commits](https://github.com/SamVerschueren/tsd/compare/v0.25.0...v0.27.0) --- updated-dependencies: - dependency-name: tsd dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 52af880..71f36ee 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "pg-native": "^3.0.0", "standard": "^17.0.0", "tap": "^16.0.0", - "tsd": "^0.25.0", + "tsd": "^0.27.0", "typescript": "^4.4.3" }, "peerDependencies": { From 1b96ac1c8b6ec0ab1658995efd1d91334004fab1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 05:04:18 +0000 Subject: [PATCH 04/11] build(deps-dev): bump typescript from 4.9.5 to 5.0.2 (#154) Bumps [typescript](https://github.com/Microsoft/TypeScript) from 4.9.5 to 5.0.2. - [Release notes](https://github.com/Microsoft/TypeScript/releases) - [Commits](https://github.com/Microsoft/TypeScript/compare/v4.9.5...v5.0.2) --- updated-dependencies: - dependency-name: typescript dependency-type: direct:development update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 71f36ee..7b4e3d3 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,7 @@ "standard": "^17.0.0", "tap": "^16.0.0", "tsd": "^0.27.0", - "typescript": "^4.4.3" + "typescript": "^5.0.2" }, "peerDependencies": { "pg": ">=6.0.0" From 77eb6e961b51d7612638450596dfe5acc231b73c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 20 Mar 2023 05:17:17 +0000 Subject: [PATCH 05/11] build(deps-dev): bump tsd from 0.27.0 to 0.28.0 (#155) Bumps [tsd](https://github.com/SamVerschueren/tsd) from 0.27.0 to 0.28.0. - [Release notes](https://github.com/SamVerschueren/tsd/releases) - [Commits](https://github.com/SamVerschueren/tsd/compare/v0.27.0...v0.28.0) --- updated-dependencies: - dependency-name: tsd dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7b4e3d3..efc282f 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "pg-native": "^3.0.0", "standard": "^17.0.0", "tap": "^16.0.0", - "tsd": "^0.27.0", + "tsd": "^0.28.0", "typescript": "^5.0.2" }, "peerDependencies": { From f2cf0c40d928c7a0678e8d63536e7b333af8be1d Mon Sep 17 00:00:00 2001 From: Tahseen Islam <55749172+tahseenio@users.noreply.github.com> Date: Sat, 8 Apr 2023 05:18:30 +1000 Subject: [PATCH 06/11] fix typo (#156) --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 1ddc7d6..acd70b1 100644 --- a/README.md +++ b/README.md @@ -297,7 +297,7 @@ $ npm test ### Custom Postgres approach -1. Set up a database of your choice oin a postgres server of your choice +1. Set up a database of your choice in a postgres server of your choice 2. Create the required table using ```sql CREATE TABLE users(id serial PRIMARY KEY, username VARCHAR (50) NOT NULL); From cfecf12a2d4ca1459443e2983336885a152cbe4a Mon Sep 17 00:00:00 2001 From: Frazer Smith Date: Fri, 28 Apr 2023 18:27:36 +0100 Subject: [PATCH 07/11] ci: only trigger on pushes to main branches (#158) --- .github/workflows/ci.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7a05045..1ed9c7e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,6 +2,11 @@ name: CI on: push: + branches: + - main + - master + - next + - 'v*' paths-ignore: - 'docs/**' - '*.md' From 2ecc44ef9d2b4cb2e6715985885c457efcd278a4 Mon Sep 17 00:00:00 2001 From: Matteo Collina Date: Mon, 4 Sep 2023 10:53:21 +0200 Subject: [PATCH 08/11] Fix broken test (#161) Signed-off-by: Matteo Collina --- test/helpers.js | 2 +- test/transaction.test.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/test/helpers.js b/test/helpers.js index c068533..4bf3558 100644 --- a/test/helpers.js +++ b/test/helpers.js @@ -1,7 +1,7 @@ 'use strict' const BAD_DB_NAME = 'db_that_does_not_exist' -const connectionString = process.env.DATABASE_TEST_URL || 'postgres://postgres:postgres@localhost/postgres' +const connectionString = process.env.DATABASE_TEST_URL || 'postgres://postgres:postgres@127.0.0.1/postgres' const connectionStringBadDbName = connectionString.replace(/\/[^/]+$/, '/' + BAD_DB_NAME) module.exports = Object.freeze({ diff --git a/test/transaction.test.js b/test/transaction.test.js index 3f9d4cb..de636d6 100644 --- a/test/transaction.test.js +++ b/test/transaction.test.js @@ -13,7 +13,7 @@ const { test('When fastify.pg root namespace is used:', (t) => { t.test('Should be able to use transact util with a callback', (t) => { - t.plan(3) + t.plan(4) const fastify = Fastify() t.teardown(() => fastify.close()) From f9af0120884922339dbb90509cd97a206892f919 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 08:56:50 +0000 Subject: [PATCH 09/11] build(deps-dev): bump tsd from 0.28.1 to 0.29.0 (#160) Bumps [tsd](https://github.com/SamVerschueren/tsd) from 0.28.1 to 0.29.0. - [Release notes](https://github.com/SamVerschueren/tsd/releases) - [Commits](https://github.com/SamVerschueren/tsd/compare/v0.28.1...v0.29.0) --- updated-dependencies: - dependency-name: tsd dependency-type: direct:development update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index efc282f..5c640b0 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "pg-native": "^3.0.0", "standard": "^17.0.0", "tap": "^16.0.0", - "tsd": "^0.28.0", + "tsd": "^0.29.0", "typescript": "^5.0.2" }, "peerDependencies": { From bd81d51b7469aa64f51e0fca927cde52431edb1a Mon Sep 17 00:00:00 2001 From: Luca Rainone Date: Wed, 18 Oct 2023 07:56:57 +0200 Subject: [PATCH 10/11] Fix Tests random failure (#165) --- index.js | 2 +- test/req-initialization.test.js | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index 8add88a..1c5162f 100644 --- a/index.js +++ b/index.js @@ -161,7 +161,7 @@ function fastifyPostgres (fastify, options, next) { } } - client.query('BEGIN') + await client.query('BEGIN') } const onError = (req, reply, error, done) => { diff --git a/test/req-initialization.test.js b/test/req-initialization.test.js index 5bf23e2..5a11b6f 100644 --- a/test/req-initialization.test.js +++ b/test/req-initialization.test.js @@ -16,7 +16,7 @@ test('When we use the fastify-postgres transaction route option', t => { connectionString }) - await fastify.pg.query('TRUNCATE users') + await fastify.pg.query('DELETE FROM "users" WHERE TRUE') fastify.get('/count-users', async (req, reply) => { const result = await fastify.pg.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'pass-opt-in\'') @@ -49,7 +49,7 @@ test('When we use the fastify-postgres transaction route option', t => { name: 'test' }) - await fastify.pg.test.query('TRUNCATE users') + await fastify.pg.test.query('DELETE FROM "users" WHERE TRUE') fastify.get('/count-users', async (req, reply) => { const result = await fastify.pg.test.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'pass-opt-in\'') @@ -82,7 +82,7 @@ test('When we use the fastify-postgres transaction route option', t => { connectionString }) - await fastify.pg.query('TRUNCATE users') + await fastify.pg.query('DELETE FROM "users" WHERE TRUE') fastify.get('/count-users', async (req, reply) => { const result = await fastify.pg.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'fail-opt-in\'') @@ -117,7 +117,7 @@ test('When we use the fastify-postgres transaction route option', t => { name: 'test' }) - await fastify.pg.test.query('TRUNCATE users') + await fastify.pg.test.query('DELETE FROM "users" WHERE TRUE') fastify.get('/count-users', async (req, reply) => { const result = await fastify.pg.test.query('SELECT COUNT(*) AS "userCount" FROM users WHERE username=\'fail-opt-in\'') From b47f841d7e50e7776e37b878cf296afa5eb91c67 Mon Sep 17 00:00:00 2001 From: Manuel Spigolon Date: Wed, 18 Oct 2023 18:46:39 +0200 Subject: [PATCH 11/11] Bumped v5.2.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5c640b0..3be7ef9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fastify/postgres", - "version": "5.2.0", + "version": "5.2.1", "description": "Fastify PostgreSQL connection plugin", "main": "index.js", "types": "index.d.ts",