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

postgrejs

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postgrejs - npm Package Compare versions

Comparing version 2.21.0 to 2.21.1

28

CHANGELOG.md

@@ -0,1 +1,29 @@

# v2.21.1
[2024-09-20]
### Fixes
* fix: Fixed error messages not showing issue ([`b1ac9be`](https://github.com/panates/postgrejs/commit/b1ac9be100941cf4a400ec0203934f23fd8189ba))
* fix: unix socket connection issue ([`1653631`](https://github.com/panates/postgrejs/commit/1653631567361b244b21acb7fcd6c863c7fd747a))
### Changes
* chore: Move CI from circleci to GitHub Actions ([`e5e6d4d`](https://github.com/panates/postgrejs/commit/e5e6d4daaab6a25fee2d9ebf5ecd8eb0c88b279f))
* chore: updated dependencies ([`0166983`](https://github.com/panates/postgrejs/commit/0166983503a6349adca87ca486b01e3215e185f9))
* chore: updated ci urls ([`f8ccd6f`](https://github.com/panates/postgrejs/commit/f8ccd6fabce1ded8b787974d2b9d0362e058eadd))
* chore: Move CI from circleci to GitHub Actions #13 ([`31e94bb`](https://github.com/panates/postgrejs/commit/31e94bb6e75bf645774ae06da3a0e1f4e73f0ea4))
* chore: Added coveralls support ([`9deda5f`](https://github.com/panates/postgrejs/commit/9deda5fe53f9b8d7a7b07ce17942b23d862395ea))
* chore: Move CI from circleci to GitHub Actions #8 ([`d5e2af2`](https://github.com/panates/postgrejs/commit/d5e2af29acc116fe2ad9cb91cda7fac3b11662bc))
* chore: Move CI from circleci to GitHub Actions #12 ([`2088d6a`](https://github.com/panates/postgrejs/commit/2088d6a8ff268af072d6d511979c8d4812972520))
* chore: Move CI from circleci to GitHub Actions #7 ([`8bacf98`](https://github.com/panates/postgrejs/commit/8bacf988825ef623a1c61a2471b83a685f66e924))
* chore: Move CI from circleci to GitHub Actions #9 ([`b7211e9`](https://github.com/panates/postgrejs/commit/b7211e9e3a62d1eb3af0b87c0fb536f03a32979d))
* chore: Move CI from circleci to GitHub Actions #6 ([`af38576`](https://github.com/panates/postgrejs/commit/af385760348e5f1fe60313115ff170c848ddc4ce))
* chore: Move CI from circleci to GitHub Actions #4 ([`6c260f5`](https://github.com/panates/postgrejs/commit/6c260f5d40893433684743ab55f707d0a63c0b76))
* chore: Move CI from circleci to GitHub Actions #5 ([`dbe687e`](https://github.com/panates/postgrejs/commit/dbe687e7f8719eb3d25ef24f9b4dc790917e8c2d))
* chore: Added node 16, 20, pg 16 ([`7458917`](https://github.com/panates/postgrejs/commit/74589172982861911968f93e6d5418f12dc17c63))
* chore: Move CI from circleci to GitHub Actions #10 ([`8144035`](https://github.com/panates/postgrejs/commit/814403556531dc79ac5d1fb46e7620123b4f2766))
* chore: Move CI from circleci to GitHub Actions #11 ([`a758c38`](https://github.com/panates/postgrejs/commit/a758c3806eb0cb80ac4d1ffac0cdde47b54d9c8a))
* chore: Move CI from circleci to GitHub Actions ([`485c398`](https://github.com/panates/postgrejs/commit/485c398fee7e45d4ab623157e1d601003b44b3f1))
* chore: Move CI from circleci to GitHub Actions #3 ([`187f12f`](https://github.com/panates/postgrejs/commit/187f12f2fe3364aa758147dbebad062f60bfc690))
# v2.21.0

@@ -2,0 +30,0 @@ [2024-09-14]

13

cjs/connection/connection.js

@@ -272,6 +272,11 @@ "use strict";

if (e instanceof Error && stack) {
e.stack = stack
.split('\n')
.filter(x => !x.includes('Connection._captureErrorStack'))
.join('\n');
if (e.stack && stack) {
e.stack =
e.stack.substring(0, e.stack.indexOf('\n')) +
'\n' +
stack
.split('\n')
.filter((x, i) => i && !x.includes('._captureErrorStack'))
.join('\n');
}
}

@@ -278,0 +283,0 @@ throw e;

@@ -5,6 +5,7 @@ "use strict";

const tslib_1 = require("tslib");
const crypto_1 = tslib_1.__importDefault(require("crypto"));
const net_1 = tslib_1.__importDefault(require("net"));
const node_crypto_1 = tslib_1.__importDefault(require("node:crypto"));
const node_net_1 = tslib_1.__importDefault(require("node:net"));
const node_path_1 = tslib_1.__importDefault(require("node:path"));
const node_tls_1 = tslib_1.__importDefault(require("node:tls"));
const putil_promisify_1 = tslib_1.__importDefault(require("putil-promisify"));
const tls_1 = tslib_1.__importDefault(require("tls"));
const constants_js_1 = require("../constants.js");

@@ -48,3 +49,3 @@ const safe_event_emitter_js_1 = require("../safe-event-emitter.js");

const options = this.options;
const socket = (this._socket = new net_1.default.Socket());
const socket = (this._socket = new node_net_1.default.Socket());
const errorHandler = (err) => {

@@ -67,5 +68,5 @@ this._state = constants_js_1.ConnectionState.CLOSED;

const tslOptions = { ...options.ssl, socket };
if (options.host && net_1.default.isIP(options.host) === 0)
if (options.host && node_net_1.default.isIP(options.host) === 0)
tslOptions.servername = options.host;
const tlsSocket = (this._socket = tls_1.default.connect(tslOptions));
const tlsSocket = (this._socket = node_tls_1.default.connect(tslOptions));
tlsSocket.once('error', errorHandler);

@@ -94,4 +95,6 @@ tlsSocket.once('secureConnect', () => {

this.emit('connecting');
if (options.host && options.host.startsWith('/'))
socket.connect(options.host);
const port = options.port || DEFAULT_PORT_NUMBER;
if (options.host && options.host.startsWith('/')) {
socket.connect(node_path_1.default.join(options.host, '/.s.PGSQL.' + port));
}
else

@@ -300,3 +303,3 @@ socket.connect(options.port || DEFAULT_PORT_NUMBER, options.host || 'localhost');

this._resolvePassword(password => {
const md5 = (x) => crypto_1.default.createHash('md5').update(x, 'utf8').digest('hex');
const md5 = (x) => node_crypto_1.default.createHash('md5').update(x, 'utf8').digest('hex');
const l = md5(password + this.options.user);

@@ -303,0 +306,0 @@ const r = md5(Buffer.concat([Buffer.from(l), msg.salt]));

@@ -269,6 +269,11 @@ import { ConnectionState } from '../constants.js';

if (e instanceof Error && stack) {
e.stack = stack
.split('\n')
.filter(x => !x.includes('Connection._captureErrorStack'))
.join('\n');
if (e.stack && stack) {
e.stack =
e.stack.substring(0, e.stack.indexOf('\n')) +
'\n' +
stack
.split('\n')
.filter((x, i) => i && !x.includes('._captureErrorStack'))
.join('\n');
}
}

@@ -275,0 +280,0 @@ throw e;

@@ -1,5 +0,6 @@

import crypto from 'crypto';
import net from 'net';
import crypto from 'node:crypto';
import net from 'node:net';
import path from 'node:path';
import tls from 'node:tls';
import promisify from 'putil-promisify';
import tls from 'tls';
import { ConnectionState } from '../constants.js';

@@ -87,4 +88,6 @@ import { SafeEventEmitter } from '../safe-event-emitter.js';

this.emit('connecting');
if (options.host && options.host.startsWith('/'))
socket.connect(options.host);
const port = options.port || DEFAULT_PORT_NUMBER;
if (options.host && options.host.startsWith('/')) {
socket.connect(path.join(options.host, '/.s.PGSQL.' + port));
}
else

@@ -91,0 +94,0 @@ socket.connect(options.port || DEFAULT_PORT_NUMBER, options.host || 'localhost');

{
"name": "postgrejs",
"description": "Professional PostgreSQL client NodeJS",
"version": "2.21.0",
"version": "2.21.1",
"author": "Panates",

@@ -6,0 +6,0 @@ "license": "MIT",

@@ -10,7 +10,7 @@ <!--suppress HtmlDeprecatedAttribute -->

[![NPM Downloads][downloads-image]][downloads-url]
[![CircleCI][circleci-image]][circleci-url]
[![CI Tests][ci-test-image]][ci-test-url]
[![Test Coverage][coveralls-image]][coveralls-url]
PostgreJS is a enterprise-level PostgreSQL client for Node.js.
PostgreJS is an enterprise-level PostgreSQL client for Node.js.
It is designed to provide a robust and efficient interface to PostgreSQL databases,

@@ -67,3 +67,3 @@ ensuring high performance and reliability for enterprise applications.

```ts
import {Connection} from 'postgrejs';
import { Connection } from 'postgrejs';
// Create connection

@@ -87,3 +87,3 @@ const connection = new Connection('postgres://localhost');

```ts
import {Pool} from 'postgrejs';
import { Pool } from 'postgrejs';

@@ -120,3 +120,3 @@ // Create connection pool

```ts
import {DataTypeOIDs} from 'postgrejs';
import { DataTypeOIDs } from 'postgrejs';

@@ -203,8 +203,8 @@ // .....

## License
postgrejs is available under [MIT](LICENSE) license.
PostgreJS is available under [MIT](LICENSE) license.
[npm-image]: https://img.shields.io/npm/v/postgrejs
[npm-url]: https://npmjs.org/package/postgrejs
[circleci-image]: https://circleci.com/gh/panates/postgrejs/tree/master.svg?style=shield
[circleci-url]: https://circleci.com/gh/panates/postgrejs/tree/master
[ci-test-image]: https://github.com/panates/postgrejs/actions/workflows/test.yml/badge.svg
[ci-test-url]: https://github.com/panates/postgrejs/actions/workflows/test.yml
[coveralls-image]: https://img.shields.io/coveralls/panates/postgrejs/master.svg

@@ -211,0 +211,0 @@ [coveralls-url]: https://coveralls.io/r/panates/postgrejs

@@ -1,2 +0,2 @@

import { OID } from '../types.js';
import type { OID } from '../types.js';
export declare class BindParam {

@@ -3,0 +3,0 @@ oid: OID;

import { ConnectionState } from '../constants.js';
import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
import { QueryOptions } from '../interfaces/query-options.js';
import { QueryResult } from '../interfaces/query-result.js';
import { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
import { ScriptResult } from '../interfaces/script-result.js';
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import { DatabaseError } from '../protocol/database-error.js';
import { Protocol } from '../protocol/protocol.js';
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import type { QueryResult } from '../interfaces/query-result.js';
import type { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
import type { ScriptResult } from '../interfaces/script-result.js';
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import type { DatabaseError } from '../protocol/database-error.js';
import type { Protocol } from '../protocol/protocol.js';
import { SafeEventEmitter } from '../safe-event-emitter.js';
import { Maybe } from '../types.js';
import type { Maybe } from '../types.js';
import { IntlConnection } from './intl-connection.js';

@@ -13,0 +13,0 @@ import type { Pool } from './pool.js';

@@ -1,7 +0,7 @@

import { FieldInfo } from '../interfaces/field-info.js';
import { QueryOptions } from '../interfaces/query-options.js';
import type { FieldInfo } from '../interfaces/field-info.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import { SafeEventEmitter } from '../safe-event-emitter.js';
import { AnyParseFunction, Maybe, Row } from '../types.js';
import { Portal } from './portal.js';
import { PreparedStatement } from './prepared-statement.js';
import type { AnyParseFunction, Maybe, Row } from '../types.js';
import type { Portal } from './portal.js';
import type { PreparedStatement } from './prepared-statement.js';
export declare class Cursor extends SafeEventEmitter implements AsyncDisposable {

@@ -8,0 +8,0 @@ private readonly _statement;

import { Pool as LightningPool } from 'lightning-pool';
import { PoolConfiguration } from '../interfaces/database-connection-params.js';
import { QueryOptions } from '../interfaces/query-options.js';
import { QueryResult } from '../interfaces/query-result.js';
import { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
import { ScriptResult } from '../interfaces/script-result.js';
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import type { PoolConfiguration } from '../interfaces/database-connection-params.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import type { QueryResult } from '../interfaces/query-result.js';
import type { ScriptExecuteOptions } from '../interfaces/script-execute-options.js';
import type { ScriptResult } from '../interfaces/script-result.js';
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import { SafeEventEmitter } from '../safe-event-emitter.js';
import { Connection, NotificationCallback } from './connection.js';
import { Connection, type NotificationCallback } from './connection.js';
import { IntlConnection } from './intl-connection.js';
import { PreparedStatement } from './prepared-statement.js';
import type { PreparedStatement } from './prepared-statement.js';
export declare class Pool extends SafeEventEmitter {

@@ -13,0 +13,0 @@ protected readonly _pool: LightningPool<IntlConnection>;

@@ -1,5 +0,5 @@

import { QueryOptions } from '../interfaces/query-options.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import { Protocol } from '../protocol/protocol.js';
import { Maybe } from '../types.js';
import { Connection } from './connection.js';
import type { Maybe } from '../types.js';
import type { Connection } from './connection.js';
import type { PreparedStatement } from './prepared-statement.js';

@@ -6,0 +6,0 @@ export interface PortalExecuteResult {

@@ -1,7 +0,7 @@

import { QueryOptions } from '../interfaces/query-options.js';
import { QueryResult } from '../interfaces/query-result.js';
import { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import type { QueryResult } from '../interfaces/query-result.js';
import type { StatementPrepareOptions } from '../interfaces/statement-prepare-options.js';
import { SafeEventEmitter } from '../safe-event-emitter.js';
import { Maybe, OID } from '../types.js';
import { Connection } from './connection.js';
import type { Maybe, OID } from '../types.js';
import type { Connection } from './connection.js';
export declare class PreparedStatement extends SafeEventEmitter implements AsyncDisposable {

@@ -8,0 +8,0 @@ private readonly _connection;

@@ -1,3 +0,3 @@

import { DataType } from '../interfaces/data-type.js';
import type { DataType } from '../interfaces/data-type.js';
export declare const BoolType: DataType;
export declare const ArrayBoolType: DataType;

@@ -1,2 +0,2 @@

import { Row } from '../types.js';
import type { Row } from '../types.js';
import type { FieldInfo } from './field-info.js';

@@ -3,0 +3,0 @@ export interface CommandResult {

@@ -1,3 +0,2 @@

import type { DecodeBinaryFunction, EncodeAsNullFunction, EncodeBinaryFunction, EncodeTextFunction, OID, ParseTextFunction } from '../types.js';
import { EncodeCalculateDimFunction } from '../types.js';
import type { DecodeBinaryFunction, EncodeAsNullFunction, EncodeBinaryFunction, EncodeCalculateDimFunction, EncodeTextFunction, OID, ParseTextFunction } from '../types.js';
export interface DataType {

@@ -4,0 +3,0 @@ oid: OID;

import { DataTypeMap } from '../data-type-map.js';
import { QueryOptions } from '../interfaces/query-options.js';
import { Maybe, OID } from '../types.js';
import { SASL } from './sasl.js';
import { SmartBufferConfig } from './smart-buffer.js';
import type { QueryOptions } from '../interfaces/query-options.js';
import type { Maybe, OID } from '../types.js';
import type { SASL } from './sasl.js';
import { type SmartBufferConfig } from './smart-buffer.js';
export interface FrontendOptions {

@@ -7,0 +7,0 @@ buffer?: SmartBufferConfig;

import { ConnectionState } from '../constants.js';
import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
import { SafeEventEmitter } from '../safe-event-emitter.js';
import { Callback, Maybe } from '../types.js';
import type { Callback, Maybe } from '../types.js';
import { Frontend } from './frontend.js';

@@ -6,0 +6,0 @@ import { Protocol } from './protocol.js';

@@ -1,2 +0,2 @@

import { Nullable } from '../types.js';
import type { Nullable } from '../types.js';
export declare namespace Protocol {

@@ -3,0 +3,0 @@ const VERSION_MAJOR = 3;

@@ -1,2 +0,2 @@

import { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
import type { ConnectionConfiguration } from '../interfaces/database-connection-params.js';
export declare function configFromEnv(): ConnectionConfiguration;

@@ -1,2 +0,2 @@

import { FieldInfo } from '../interfaces/field-info.js';
import type { FieldInfo } from '../interfaces/field-info.js';
export declare function convertRowToObject(fields: FieldInfo[], row: any[]): any;

@@ -1,3 +0,3 @@

import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { DecodeBinaryFunction, Nullable } from '../types.js';
export declare function decodeBinaryArray<T = any>(buf: Buffer, decoder: DecodeBinaryFunction, options?: DataMappingOptions): Nullable<T[]>;
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { SmartBuffer } from '../protocol/smart-buffer.js';
import type { EncodeBinaryFunction, OID } from '../types.js';
import { EncodeCalculateDimFunction } from '../types.js';
import type { EncodeBinaryFunction, EncodeCalculateDimFunction, OID } from '../types.js';
export declare function encodeBinaryArray(io: SmartBuffer, value: any[], itemOid: OID, options: DataMappingOptions, encode: EncodeBinaryFunction, encodeCalculateDimFn?: EncodeCalculateDimFunction): void;

@@ -1,4 +0,4 @@

import { DataTypeMap } from '../data-type-map.js';
import { Protocol } from '../protocol/protocol.js';
import { AnyParseFunction } from '../types.js';
import type { DataTypeMap } from '../data-type-map.js';
import type { Protocol } from '../protocol/protocol.js';
import type { AnyParseFunction } from '../types.js';
export declare function getParsers(typeMap: DataTypeMap, fields: Protocol.RowDescription[]): AnyParseFunction[];

@@ -1,3 +0,3 @@

import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import { AnyParseFunction } from '../types.js';
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { AnyParseFunction } from '../types.js';
export declare function parseRow(parsers: AnyParseFunction[], row: any[], options: DataMappingOptions): void;

@@ -1,3 +0,3 @@

import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import { EncodeTextFunction } from '../types.js';
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { EncodeTextFunction } from '../types.js';
export declare function stringifyArrayLiteral(value: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string;

@@ -1,4 +0,4 @@

import { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import { EncodeTextFunction } from '../types.js';
import type { DataMappingOptions } from '../interfaces/data-mapping-options.js';
import type { EncodeTextFunction } from '../types.js';
export declare function stringifyArrayForSQL(v: any[], options?: DataMappingOptions, encode?: EncodeTextFunction): string;
export declare function stringifyValueForSQL(v: any, options?: DataMappingOptions, encode?: EncodeTextFunction): string;
import { DataFormat } from '../constants.js';
import { DataTypeMap } from '../data-type-map.js';
import { FieldInfo } from '../interfaces/field-info.js';
import { Protocol } from '../protocol/protocol.js';
import type { DataTypeMap } from '../data-type-map.js';
import type { FieldInfo } from '../interfaces/field-info.js';
import type { Protocol } from '../protocol/protocol.js';
export declare function wrapRowDescription(typeMap: DataTypeMap, fields: Protocol.RowDescription[], columnFormat: DataFormat | DataFormat[]): FieldInfo[];
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