From bc54d98791d29c9fbb1d5b4fa12adab907a36aa3 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 10 Oct 2023 23:41:08 +0100 Subject: [PATCH] Bump @types/pg from 8.10.3 to 8.10.5 (#1056) * Bump @types/pg from 8.10.3 to 8.10.5 Bumps [@types/pg](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/pg) from 8.10.3 to 8.10.5. - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/pg) --- updated-dependencies: - dependency-name: "@types/pg" dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] * fixed ts issues --------- Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Deepak Prabhakara --- package-lock.json | 8 ++++---- package.json | 2 +- src/_db/commands/up/es.ts | 6 ++++++ src/_db/common.ts | 15 +++++++++++++++ src/models/project/create.ts | 5 +++++ src/models/project/get.ts | 5 +++++ src/models/team/listTeamMembers.ts | 5 +++++ 7 files changed, 41 insertions(+), 5 deletions(-) diff --git a/package-lock.json b/package-lock.json index dd26a79b..5f97c437 100644 --- a/package-lock.json +++ b/package-lock.json @@ -68,7 +68,7 @@ "@types/mocha": "10.0.2", "@types/node": "20.6.3", "@types/nodemailer": "6.4.11", - "@types/pg": "8.10.3", + "@types/pg": "8.10.5", "@types/sinon": "10.0.17", "@types/statsd-client": "0.4.3", "@types/swagger-jsdoc": "6.0.1", @@ -2188,9 +2188,9 @@ } }, "node_modules/@types/pg": { - "version": "8.10.3", - "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.3.tgz", - "integrity": "sha512-BACzsw64lCZesclRpZGu55tnqgFAYcrCBP92xLh1KLypZLCOsvJTSTgaoFVTy3lCys/aZTQzfeDxtjwrvdzL2g==", + "version": "8.10.5", + "resolved": "https://registry.npmjs.org/@types/pg/-/pg-8.10.5.tgz", + "integrity": "sha512-GS3ebGcSJQqKSnq4/WnSH1XQvx0vTDLEmqLENk7onKvTnry9BWPsZiZeUMJlEPw+5bCQDzfxZFhxlUztpNCKgQ==", "dev": true, "dependencies": { "@types/node": "*", diff --git a/package.json b/package.json index 63b21103..89a50d63 100644 --- a/package.json +++ b/package.json @@ -61,7 +61,7 @@ "@types/mocha": "10.0.2", "@types/node": "20.6.3", "@types/nodemailer": "6.4.11", - "@types/pg": "8.10.3", + "@types/pg": "8.10.5", "@types/sinon": "10.0.17", "@types/statsd-client": "0.4.3", "@types/swagger-jsdoc": "6.0.1", diff --git a/src/_db/commands/up/es.ts b/src/_db/commands/up/es.ts index e07a7b82..a70d6bdb 100644 --- a/src/_db/commands/up/es.ts +++ b/src/_db/commands/up/es.ts @@ -49,6 +49,12 @@ export const handler = () => { console.log(picocolors.red(util.inspect(err))); process.exit(1); } + if (!pg) { + notifyError(new Error("Couldn't connect to postgres")); + console.log(picocolors.red("Couldn't connect to postgres")); + process.exit(1); + } + const walker = walk.walk(getSchemaPath(), { followLinks: false, }); diff --git a/src/_db/common.ts b/src/_db/common.ts index f827f24b..8092d769 100644 --- a/src/_db/common.ts +++ b/src/_db/common.ts @@ -23,6 +23,11 @@ const common = { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const q = "select * from actor where id = $1"; const v = [id]; pg.query(q, v, (qerr, result) => { @@ -57,6 +62,11 @@ const common = { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const q = "select * from target where id = $1"; const v = [id]; pg.query(q, v, (qerr, result) => { @@ -91,6 +101,11 @@ const common = { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const q = "select * from group_detail where group_id = $1"; const v = [id]; pg.query(q, v, (qerr, result) => { diff --git a/src/models/project/create.ts b/src/models/project/create.ts index d0d43b64..4a1dfd14 100644 --- a/src/models/project/create.ts +++ b/src/models/project/create.ts @@ -23,6 +23,11 @@ export default function createProject(opts) { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const project = { id: opts.id || uuid.v4().replace(/-/g, ""), name: opts.name, diff --git a/src/models/project/get.ts b/src/models/project/get.ts index c56acca9..5fe9a69a 100644 --- a/src/models/project/get.ts +++ b/src/models/project/get.ts @@ -13,6 +13,11 @@ export default function getProject(projectId): Promise { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const q = "select * from project where id = $1"; const v = [projectId]; pg.query(q, v, (qerr, result) => { diff --git a/src/models/team/listTeamMembers.ts b/src/models/team/listTeamMembers.ts index e2b95521..27729ada 100644 --- a/src/models/team/listTeamMembers.ts +++ b/src/models/team/listTeamMembers.ts @@ -11,6 +11,11 @@ export default function listTeamMembers(opts) { return; } + if (!pg) { + reject(new Error("Couldn't connect to postgres")); + return; + } + const q = ` select retraceduser.id, retraceduser.created, retraceduser.email, retraceduser.last_login,