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

aws-xray-sdk-postgres

Package Overview
Dependencies
Maintainers
15
Versions
63
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aws-xray-sdk-postgres - npm Package Compare versions

Comparing version 2.1.0 to 2.2.0

40

lib/postgres_p.js

@@ -40,3 +40,3 @@ /**

args.values = argsObj[0].values;
args.callback = argsObj[1] || argsObj[0].submit;
args.callback = argsObj[1] || argsObj[0].callback;
} else {

@@ -48,3 +48,3 @@ args.sql = argsObj[0];

args.segment = (argsObj[argsObj.length-1].constructor && (argsObj[argsObj.length-1].constructor.name === 'Segment' ||
args.segment = (argsObj[argsObj.length-1] != null && argsObj[argsObj.length-1].constructor && (argsObj[argsObj.length-1].constructor.name === 'Segment' ||
argsObj[argsObj.length-1].constructor.name === 'Subsegment')) ? argsObj[argsObj.length-1] : null;

@@ -66,2 +66,3 @@ }

var subsegment = parent.addNewSubsegment(this.database + '@' + this.host);
subsegment.namespace = 'remote';

@@ -92,4 +93,4 @@ if (args.callback) {

var query = result;
if (query instanceof Promise && this._queryable && !this._ending) {
if (this._queryable && !this._ending) {
var query;
// To get the actual query object, we have to extract it from the

@@ -103,24 +104,23 @@ // owning connection object. The query will either be the last one in

}
}
if (!args.callback && query.on instanceof Function) {
query.on('end', function() {
subsegment.close();
});
if (!args.callback && query.on instanceof Function) {
query.on('end', function() {
subsegment.close();
});
var errorCapturer = function (err) {
subsegment.close(err);
var errorCapturer = function (err) {
subsegment.close(err);
if (this._events && this._events.error && this._events.error.length === 1) {
this.removeListener('error', errorCapturer);
this.emit('error', err);
}
};
if (this._events && this._events.error && this._events.error.length === 1) {
this.removeListener('error', errorCapturer);
this.emit('error', err);
}
};
query.on('error', errorCapturer);
query.on('error', errorCapturer);
}
subsegment.addSqlData(createSqlData(this.connectionParameters, query));
}
subsegment.addSqlData(createSqlData(this.connectionParameters, query));
subsegment.namespace = 'remote';
return result;

@@ -127,0 +127,0 @@ }

{
"name": "aws-xray-sdk-postgres",
"version": "2.1.0",
"version": "2.2.0",
"description": "AWS X-Ray Patcher for Postgres (Javascript)",

@@ -11,3 +11,3 @@ "author": "Amazon Web Services",

"engines": {
"node": ">= 4.x <= 10.x"
"node": ">= 4.x"
},

@@ -18,6 +18,6 @@ "directories": {

"peerDependencies": {
"aws-xray-sdk-core": "^2.1.0"
"aws-xray-sdk-core": "^2.2.0"
},
"devDependencies": {
"aws-xray-sdk-core": "^2.1.0",
"aws-xray-sdk-core": "^2.2.0",
"chai": "^3.5.0",

@@ -46,4 +46,3 @@ "eslint": "^3.10.2",

"license": "Apache-2.0",
"repository": "https://github.com/aws/aws-xray-sdk-node/tree/master/packages/postgres",
"gitHead": "f662e21a7c18be5278e23a64c1c608ebae79a6ec"
"repository": "https://github.com/aws/aws-xray-sdk-node/tree/master/packages/postgres"
}

@@ -57,2 +57,4 @@ var assert = require('chai').assert;

postgres.__query = function(args, values, callback) {
this._queryable = true;
this.queryQueue = [ null, null, queryObj ];
queryObj.callback = callback;

@@ -97,3 +99,3 @@ return queryObj;

query.call(postgres, { sql: 'sql here', submit: function() {} });
query.call(postgres, { sql: 'sql here', callback: function() {} });
assert.equal(queryObj.callback.name, 'autoContext');

@@ -140,2 +142,8 @@ queryObj.callback();

});
it('should start a new automatic context when last query paramater is null', function() {
query.call(postgres, 'sql here', [], function() {}, null);
assert.equal(queryObj.callback.name, 'autoContext');
});
});

@@ -142,0 +150,0 @@

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