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

@sqb/postgres

Package Overview
Dependencies
Maintainers
1
Versions
117
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sqb/postgres - npm Package Compare versions

Comparing version 4.0.1-alpha.19 to 4.0.1-alpha.20

1

dist/PgAdapter.d.ts

@@ -8,2 +8,3 @@ import { Adapter, ClientConfiguration, DataType } from '@sqb/connect';

cursor: boolean;
schema: boolean;
fetchAsString: DataType[];

@@ -10,0 +11,0 @@ };

@@ -14,2 +14,3 @@ "use strict";

cursor: true,
schema: true,
fetchAsString: [connect_1.DataType.DATE, connect_1.DataType.TIMESTAMP, connect_1.DataType.TIMESTAMPTZ]

@@ -16,0 +17,0 @@ };

4

dist/PgConnection.d.ts
import { Adapter, QueryRequest } from '@sqb/connect';
import { Connection, FieldInfo } from 'postgresql-client';
export declare class PgConnection implements Adapter.Connection {
private readonly intlcon;
private intlcon?;
constructor(conn: Connection);

@@ -13,2 +13,4 @@ get sessionId(): any;

test(): Promise<void>;
getSchema(): Promise<string>;
setSchema(schema: string): Promise<void>;
onGenerateQuery(request: QueryRequest): void;

@@ -15,0 +17,0 @@ execute(query: QueryRequest): Promise<Adapter.Response>;

"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PgConnection = void 0;
const assert_1 = __importDefault(require("assert"));
const connect_1 = require("@sqb/connect");

@@ -29,6 +33,9 @@ const postgresql_client_1 = require("postgresql-client");

get sessionId() {
return this.intlcon.processID;
return this.intlcon && this.intlcon.processID;
}
async close() {
if (!this.intlcon)
return;
await this.intlcon.close(0);
this.intlcon = undefined;
}

@@ -39,18 +46,37 @@ async reset() {

async startTransaction() {
assert_1.default.ok(this.intlcon, 'Can not start transaction for a closed db session');
await this.intlcon.startTransaction();
}
async commit() {
assert_1.default.ok(this.intlcon, 'Can not commit transaction for a closed db session');
await this.intlcon.commit();
}
async rollback() {
if (!this.intlcon)
return;
await this.intlcon.rollback();
}
async test() {
assert_1.default.ok(this.intlcon, 'DB session is closed');
await this.intlcon.query('select 1');
}
async getSchema() {
assert_1.default.ok(this.intlcon, 'DB session is closed');
const r = await this.intlcon.query('SHOW search_path');
if (r && r.rows && r.rows[0])
return r.rows[0][0];
return '';
}
async setSchema(schema) {
assert_1.default.ok(this.intlcon, 'Can not set schema of a closed db session');
await this.intlcon.execute('SET search_path TO ' + schema);
}
onGenerateQuery(request) {
// eslint-disable-next-line dot-notation
request.dialectVersion = this.intlcon.sessionParameters['server_version'];
if (this.intlcon) {
// eslint-disable-next-line dot-notation
request.dialectVersion = this.intlcon.sessionParameters['server_version'];
}
}
async execute(query) {
assert_1.default.ok(this.intlcon, 'Can not execute query with a closed db session');
const opts = {

@@ -57,0 +83,0 @@ autoCommit: query.autoCommit,

{
"name": "@sqb/postgres",
"description": "SQB serialization extension for PostgreSQL database",
"version": "4.0.1-alpha.19",
"version": "4.0.1-alpha.20",
"author": "Panates Ltd.",

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

"postgresql-client": "^1.13.0",
"@sqb/postgres-dialect": "^4.0.1-alpha.19"
"@sqb/postgres-dialect": "^4.0.1-alpha.20"
},

@@ -37,0 +37,0 @@ "main": "dist/index.js",

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