🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

leo-connector-postgres

Package Overview
Dependencies
Maintainers
8
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

leo-connector-postgres - npm Package Compare versions

Comparing version

to
4.0.14-beta

0

index.js

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ const pg = require("pg");

@@ -0,0 +0,0 @@ "use strict";

8

lib/connect.js

@@ -644,4 +644,8 @@ const {

return '\\N';
} else if (typeof v === 'string' && v.search(/\r/) !== -1) {
return v.replace(/\r\n?/g, '\n');
} else if (typeof v === 'string' && (v.search(/\r/) !== -1 || v.search(/\n/) !== -1)) {
if (config.version !== 'redshift') {
return v.replace(/\r\n?/g, '\n');
} else {
return v.replace(/\r\n?/g, '\n').slice(0, -1).replace(/\n/g, `\\n`) + v.slice(-1);
}
} else {

@@ -648,0 +652,0 @@ return v;

@@ -0,0 +0,0 @@ 'use strict';

@@ -236,3 +236,2 @@ 'use strict';

} else {
columns = columns.concat([columnConfig._auditdate, columnConfig._deleted]);
let naturalKeyLowerBound;

@@ -276,12 +275,7 @@ let naturalKeyFilter;

// Set audit date for staged data
tasks.push(done => {
connection.query(`UPDATE ${qualifiedStagingTable}
SET ${columnConfig._auditdate} = ${dwClient.auditdate};`, done);
});
// Retreive copy of existing data
tasks.push(done => {
connection.query(`INSERT INTO ${qualifiedStagingTablePrevious} (${columns.map(column => `${column}`).join(`, `)})
SELECT ${columns.map(column => `${column}`).join(`, `)}
connection.query(`INSERT INTO ${qualifiedStagingTablePrevious} (${columns.map(column => `${column}`).join(`, `)}, ${columnConfig._deleted})
SELECT ${columns.map(column => `${column}`).join(`, `)},
${columnConfig._deleted}
FROM ${qualifiedTable} AS base

@@ -298,3 +292,4 @@ WHERE EXISTS ( SELECT *

connection.query(`UPDATE ${qualifiedStagingTable} AS staging
SET ${columns.map(column => `${column} = COALESCE(staging.${column}, prev.${column})`).join(`,`)}
SET ${columns.map(column => `${column} = COALESCE(staging.${column}, prev.${column})`).join(`,`)},
${columnConfig._deleted} = COALESCE(prev.${columnConfig._deleted}, false)
FROM ${qualifiedStagingTablePrevious} AS prev

@@ -304,2 +299,9 @@ WHERE ${ids.map(id => `prev.${id} = staging.${id}`).join(` AND `)}`, done);

// Set auditdate and _deleted for stage data
tasks.push(done => {
connection.query(`UPDATE ${qualifiedStagingTable}
SET ${columnConfig._auditdate} = ${dwClient.auditdate},
${columnConfig._deleted} = COALESCE(${columnConfig._deleted}, false); `, done);
});
// Delete and reinsert data - avoids costly updates on large tables

@@ -313,4 +315,6 @@ tasks.push(done => {

tasks.push(done => {
connection.query(`INSERT INTO ${qualifiedTable} (${columns.map(column => `${column}`).join(`, `)})
SELECT ${columns.map(column => `${column}`).join(`, `)}
connection.query(`INSERT INTO ${qualifiedTable} (${columns.map(column => `${column}`).join(`, `)}, ${columnConfig._auditdate}, ${columnConfig._deleted})
SELECT ${columns.map(column => `${column}`).join(`, `)},
${columnConfig._auditdate},
${columnConfig._deleted}
FROM ${qualifiedStagingTable}; `, done);

@@ -317,0 +321,0 @@ });

@@ -0,0 +0,0 @@ // upper and lower is bigger

@@ -0,0 +0,0 @@ /*

{
"name": "leo-connector-postgres",
"version": "4.0.13-beta",
"version": "4.0.14-beta",
"description": "A Postgres database connector for use with Leo Platform",

@@ -5,0 +5,0 @@ "repository": {

@@ -0,0 +0,0 @@ # Documentation

@@ -0,0 +0,0 @@ "use strict";