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

postgresql-client

Package Overview
Dependencies
Maintainers
1
Versions
106
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgresql-client - npm Package Compare versions

Comparing version 2.11.2 to 2.12.0

12

CHANGELOG.md

@@ -0,1 +1,13 @@

# v2.12.0
[2024-07-12]
### Changes
* Update dependencies ([`acdf4dd`](https://github.com/panates/postgresql-client/commit/acdf4ddbb6759b6a3ca65036f08a24a2c4685cea))
* Implemented `sqlmode` query parameter for connection string and added `requireSSL` option to connection options. Now the driver tries SSL connection as a first choice. ([`5fc7e31`](https://github.com/panates/postgresql-client/commit/5fc7e3144382d455aeeadb72b7301ec03e93f223))
* Update dependencies ([`3055d79`](https://github.com/panates/postgresql-client/commit/3055d7959c9c959ac06fd5ee6b8741a10a013c84))
* Update dependencies ([`e58cc44`](https://github.com/panates/postgresql-client/commit/e58cc443f7a0c774a5be546a950a9bcf6628a11f))
* Added executor: node/default ([`2932861`](https://github.com/panates/postgresql-client/commit/2932861c0e552361208aaceed16e94fbcf1a9456))
* Added root ([`81c1028`](https://github.com/panates/postgresql-client/commit/81c10284d45f53e807a153813c5b4f38594869bc))
# v2.11.2

@@ -2,0 +14,0 @@ [2024-06-29]

47

cjs/protocol/pg-socket.js

@@ -60,26 +60,27 @@ "use strict";

socket.setKeepAlive(true);
if (options.ssl) {
socket.write(this._frontend.getSSLRequestMessage());
socket.once('data', x => {
socket.write(this._frontend.getSSLRequestMessage());
socket.once('data', x => {
this._removeListeners();
if (x.toString() === 'S') {
const tslOptions = { ...options.ssl, socket };
if (options.host && net_1.default.isIP(options.host) === 0)
tslOptions.servername = options.host;
const tlsSocket = (this._socket = tls_1.default.connect(tslOptions));
tlsSocket.once('error', errorHandler);
tlsSocket.once('secureConnect', () => {
this._removeListeners();
this._handleConnect();
});
return;
}
if (x.toString() === 'N') {
if (options.requireSSL) {
return errorHandler(new Error('Server does not support SSL connections'));
}
this._removeListeners();
if (x.toString() === 'S') {
const tslOptions = { ...options.ssl, socket };
if (options.host && net_1.default.isIP(options.host) === 0)
tslOptions.servername = options.host;
const tlsSocket = (this._socket = tls_1.default.connect(tslOptions));
tlsSocket.once('error', errorHandler);
tlsSocket.once('secureConnect', () => {
this._removeListeners();
this._handleConnect();
});
return;
}
if (x.toString() === 'N')
return errorHandler(new Error('Server does not support SSL connections'));
return errorHandler(new Error('There was an error establishing an SSL connection'));
});
}
else {
this._handleConnect();
}
this._handleConnect();
return;
}
return errorHandler(new Error('There was an error establishing an SSL connection'));
});
};

@@ -86,0 +87,0 @@ socket.setNoDelay(true);

@@ -60,4 +60,5 @@ "use strict";

cfg.password = parsed.password;
cfg.requireSSL = parsed.searchParams.get('sslmode') === 'require';
return cfg;
}
exports.parseConnectionString = parseConnectionString;

@@ -56,26 +56,27 @@ import crypto from 'crypto';

socket.setKeepAlive(true);
if (options.ssl) {
socket.write(this._frontend.getSSLRequestMessage());
socket.once('data', x => {
socket.write(this._frontend.getSSLRequestMessage());
socket.once('data', x => {
this._removeListeners();
if (x.toString() === 'S') {
const tslOptions = { ...options.ssl, socket };
if (options.host && net.isIP(options.host) === 0)
tslOptions.servername = options.host;
const tlsSocket = (this._socket = tls.connect(tslOptions));
tlsSocket.once('error', errorHandler);
tlsSocket.once('secureConnect', () => {
this._removeListeners();
this._handleConnect();
});
return;
}
if (x.toString() === 'N') {
if (options.requireSSL) {
return errorHandler(new Error('Server does not support SSL connections'));
}
this._removeListeners();
if (x.toString() === 'S') {
const tslOptions = { ...options.ssl, socket };
if (options.host && net.isIP(options.host) === 0)
tslOptions.servername = options.host;
const tlsSocket = (this._socket = tls.connect(tslOptions));
tlsSocket.once('error', errorHandler);
tlsSocket.once('secureConnect', () => {
this._removeListeners();
this._handleConnect();
});
return;
}
if (x.toString() === 'N')
return errorHandler(new Error('Server does not support SSL connections'));
return errorHandler(new Error('There was an error establishing an SSL connection'));
});
}
else {
this._handleConnect();
}
this._handleConnect();
return;
}
return errorHandler(new Error('There was an error establishing an SSL connection'));
});
};

@@ -82,0 +83,0 @@ socket.setNoDelay(true);

@@ -55,3 +55,4 @@ import merge from 'putil-merge';

cfg.password = parsed.password;
cfg.requireSSL = parsed.searchParams.get('sslmode') === 'require';
return cfg;
}
{
"name": "postgresql-client",
"description": "Enterprise level PostgreSQL client for JavaScript",
"version": "2.11.2",
"version": "2.12.0",
"author": "Panates",

@@ -22,3 +22,3 @@ "contributors": [

"postgres-bytea": "^3.0.0",
"power-tasks": "^1.7.3",
"power-tasks": "^1.7.4",
"putil-merge": "^3.12.1",

@@ -25,0 +25,0 @@ "putil-promisify": "^1.10.1",

@@ -13,2 +13,3 @@ /// <reference types="node" />

applicationName?: string;
requireSSL?: boolean;
ssl?: TlsConnectionOptions;

@@ -15,0 +16,0 @@ timezone?: string;

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