From 8f049c071538bb08346443f0c96823aa67ae6122 Mon Sep 17 00:00:00 2001 From: Hugues Chocart Date: Tue, 19 Mar 2024 15:51:02 -0300 Subject: [PATCH 1/3] Update index.d.ts --- types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/index.d.ts b/types/index.d.ts index 8989ff47..0b18897e 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -71,7 +71,7 @@ interface BaseOptions> { * Called when a notice is received * @default console.log */ - onnotice: (notice: postgres.Notice) => void; + onnotice: false | (notice: postgres.Notice) => void; /** (key; value) when a server param change */ onparameter: (key: string, value: any) => void; /** Is called with (connection; query; parameters) */ From 018b284d07c9bcb190a858d7e2951c14d13a543c Mon Sep 17 00:00:00 2001 From: Hugues Chocart Date: Tue, 19 Mar 2024 15:51:28 -0300 Subject: [PATCH 2/3] Update index.d.ts --- deno/types/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno/types/index.d.ts b/deno/types/index.d.ts index 6f96fe97..621a6afa 100644 --- a/deno/types/index.d.ts +++ b/deno/types/index.d.ts @@ -73,7 +73,7 @@ interface BaseOptions> { * Called when a notice is received * @default console.log */ - onnotice: (notice: postgres.Notice) => void; + onnotice: false | (notice: postgres.Notice) => void; /** (key; value) when a server param change */ onparameter: (key: string, value: any) => void; /** Is called with (connection; query; parameters) */ From 11a4202abcda5e9a480349f81a54e02a75b52530 Mon Sep 17 00:00:00 2001 From: Hugues Chocart Date: Tue, 19 Mar 2024 15:56:32 -0300 Subject: [PATCH 3/3] Update connection.js --- src/connection.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/connection.js b/src/connection.js index a5694183..d847bcbf 100644 --- a/src/connection.js +++ b/src/connection.js @@ -887,6 +887,9 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose } function NoticeResponse(x) { + if (onnotice === false) { + return + } onnotice ? onnotice(parseError(x)) : console.log(parseError(x)) // eslint-disable-line