Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-notify

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-notify - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

29

cjs/src/pg-notify.js

@@ -6,5 +6,3 @@ const EventEmitter = require('node:events')

const sjson = require('secure-json-parse')
const Debug = require('debug')
const debug = Debug('pg-notify')
const sleep = util.promisify(setTimeout)

@@ -31,2 +29,4 @@

this.channels = {}
/* c8 ignore next */
this.debug = process.env.DEBUG && process.env.DEBUG.includes('pg-notify')
}

@@ -49,5 +49,5 @@

debug('[emit] channel: ', channel)
debug('[emit] payload: ', payload)
debug('[emit] state: ', this.state)
this._debug('[emit] channel: ', channel)
this._debug('[emit] payload: ', payload)
this._debug('[emit] state: ', this.state)

@@ -58,3 +58,3 @@ return this.client.query(`NOTIFY ${format.ident(channel)}, ${parsedPayload}`)

async on (channel, listener) {
debug('[subscribe]', channel)
this._debug('[subscribe]', channel)
if (this.state !== states.connected) {

@@ -114,3 +114,3 @@ throw new Error('[PGPubSub]: not connected')

async _reconnect (force) {
debug('[_reconnect] state: ', this.state)
this._debug('[_reconnect] state: ', this.state)

@@ -149,3 +149,3 @@ if (!this.reconnectMaxRetries) {

this.client.on('notification', (message) => {
debug('[_setupClient] notification', message)
this._debug('[_setupClient] notification', message)

@@ -160,3 +160,3 @@ try {

this.client.on('error', err => {
debug('[_setupClient] error')
this._debug('[_setupClient] error')

@@ -171,3 +171,3 @@ if (this.reconnectRetries > this.reconnectMaxRetries) {

debug('[_setupClient] init listeners')
this._debug('[_setupClient] init listeners')
if (Object.keys(this.channels).length) {

@@ -181,6 +181,13 @@ for (const channel in this.channels) {

this.reconnectRetries = 0
debug('[_setupClient] init listeners done')
this._debug('[_setupClient] init listeners done')
}
_debug (...args) {
/* c8 ignore next 3 */
if (this.debug) {
console.log(...args)
}
}
}
module.exports = PGPubSub
{
"name": "pg-notify",
"version": "1.0.1",
"version": "1.0.2",
"description": "Postgres pubsub client",

@@ -44,3 +44,2 @@ "type": "module",

"dependencies": {
"debug": "^4.3.4",
"pg": "^8.11.3",

@@ -52,3 +51,3 @@ "pg-format": "^1.0.4",

"@types/pg": "^8.10.9",
"ava": "^5.3.1",
"ava": "^6.0.1",
"benchmark": "^2.1.4",

@@ -59,3 +58,3 @@ "c8": "8.0.1",

"standard": "^17.1.0",
"tsd": "^0.29.0"
"tsd": "^0.30.1"
},

@@ -62,0 +61,0 @@ "tsd": {

@@ -6,5 +6,3 @@ import EventEmitter from 'node:events'

import sjson from 'secure-json-parse'
import Debug from 'debug'
const debug = Debug('pg-notify')
const sleep = util.promisify(setTimeout)

@@ -31,2 +29,4 @@

this.channels = {}
/* c8 ignore next */
this.debug = process.env.DEBUG && process.env.DEBUG.includes('pg-notify')
}

@@ -49,5 +49,5 @@

debug('[emit] channel: ', channel)
debug('[emit] payload: ', payload)
debug('[emit] state: ', this.state)
this._debug('[emit] channel: ', channel)
this._debug('[emit] payload: ', payload)
this._debug('[emit] state: ', this.state)

@@ -58,3 +58,3 @@ return this.client.query(`NOTIFY ${format.ident(channel)}, ${parsedPayload}`)

async on (channel, listener) {
debug('[subscribe]', channel)
this._debug('[subscribe]', channel)
if (this.state !== states.connected) {

@@ -114,3 +114,3 @@ throw new Error('[PGPubSub]: not connected')

async _reconnect (force) {
debug('[_reconnect] state: ', this.state)
this._debug('[_reconnect] state: ', this.state)

@@ -149,3 +149,3 @@ if (!this.reconnectMaxRetries) {

this.client.on('notification', (message) => {
debug('[_setupClient] notification', message)
this._debug('[_setupClient] notification', message)

@@ -160,3 +160,3 @@ try {

this.client.on('error', err => {
debug('[_setupClient] error')
this._debug('[_setupClient] error')

@@ -171,3 +171,3 @@ if (this.reconnectRetries > this.reconnectMaxRetries) {

debug('[_setupClient] init listeners')
this._debug('[_setupClient] init listeners')
if (Object.keys(this.channels).length) {

@@ -181,6 +181,13 @@ for (const channel in this.channels) {

this.reconnectRetries = 0
debug('[_setupClient] init listeners done')
this._debug('[_setupClient] init listeners done')
}
_debug (...args) {
/* c8 ignore next 3 */
if (this.debug) {
console.log(...args)
}
}
}
export default PGPubSub
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc