Socket
Socket
Sign inDemoInstall

dynatrace

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

dynatrace - npm Package Compare versions

Comparing version 1.0.1-beta1 to 1.1.1-beta1

56

lib/synthetic/client.js

@@ -21,23 +21,34 @@ var request = require('request');

var self = this;
var xml = {};
var headers = {};
options = options || {};
// Add SOAP headers to request body
var xml = {
'soap12:Envelope': {
'$': {
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap12': 'http://www.w3.org/2003/05/soap-envelope'
},
'soap12:Header': {},
'soap12:Body': options.soapBody
}
};
if (options.bodyType === 'soap') {
xml = options.body;
} else {
// Add SOAP headers to request body
xml = {
'soap12:Envelope': {
'$': {
'xmlns:xsi': 'http://www.w3.org/2001/XMLSchema-instance',
'xmlns:xsd': 'http://www.w3.org/2001/XMLSchema',
'xmlns:soap12': 'http://www.w3.org/2003/05/soap-envelope'
},
'soap12:Header': {},
'soap12:Body': options.soapBody
}
};
}
if (options.headers) {
headers = options.headers;
} else {
headers = {'Content-Type': 'application/soap+xml; charset=utf-8' };
}
var reqOptions = {
url: options.url,
method: 'POST',
headers: {
'Content-Type': 'application/soap+xml; charset=utf-8'
},
headers: headers,
body: this._xmlBuilder.buildObject(xml)

@@ -55,5 +66,16 @@ };

try {
var soapBody = result['soap:Envelope']['soap:Body'];
var base = result;
return callback(null, soapBody, res);
if (options.response.parse) {
var contentPath = options.response.contentPath.split('/');
// traverse xml object
contentPath.forEach(function(node) {
base = base[node];
});
} else {
base = result['soap:Envelope']['soap:Body'];
}
return callback(null, base, res);
} catch(e) {

@@ -60,0 +82,0 @@ return callback(null, result, res);

@@ -78,2 +78,50 @@ var async = require('async');

/**
* Synthetic.accountsShowDetails
*
* @desc Shows account detail information.
*
*
* @param {callback} callback - The callback that handles the response.
* @return {object} Request object
*/
Synthetic.prototype.accountsShowDetails = function(callback) {
var options = {
url: 'http://gpn.webservice.gomez.com/AccountManagementService40/AccountManagementWS.svc',
headers: {
'SOAPAction': 'http://gomeznetworks.com/webservices/Retrieve',
'Content-type': 'text/xml;charset=UTF-8'
},
bodyType: 'soap',
body: {
'soapenv:Envelope': {
'$': {
'xmlns:soapenv': 'http://schemas.xmlsoap.org/soap/envelope/',
'xmlns:web': 'http://gomeznetworks.com/webservices'
},
'soapenv:Header': {},
'soapenv:Body': {
'web:Retrieve': {
'web:request': {
'web:user': {
'web:username': this.username,
'web:password': this.password
}
}
}
}
}
},
response: {
parse: true,
statusPath: 's:Envelope/s:Body/RetrieveResponse/RetrieveResult/StatusType',
contentPath: 's:Envelope/s:Body/RetrieveResponse/RetrieveResult/GPNData/Accounts'
}
};
return this._client.request(options, callback);
};
/**
* Synthetic.nodesList

@@ -80,0 +128,0 @@ *

{
"name": "dynatrace",
"version": "1.0.1-beta1",
"version": "1.1.1-beta1",
"description": "Dynatrace API client library for Node.js",

@@ -5,0 +5,0 @@ "main": "./lib/dynatrace.js",

@@ -7,2 +7,6 @@ var assert = require('assert');

var synthetic = new dynatrace.Synthetic({
username: 'stefan.karytko',
password: 'G@mezps1'
});

@@ -13,12 +17,5 @@ describe('account', function() {

var synthetic = new dynatrace.Synthetic({
username: 'stefan.karytko',
password: 'G@mezps1'
});
synthetic.authenticate(function(err, result, res) {
if (err) throw err;
console.log(result);
assert.equal(typeof result, 'object');

@@ -32,5 +29,5 @@ done();

synthetic.accountsShow(function(err, result, res) {
synthetic.accountsShowDetails(function(err, result, res) {
if (err) throw err;
assert.equal(typeof result, 'object');

@@ -74,3 +71,2 @@ done();

console.log(result);
assert.equal(typeof result, 'object');

@@ -82,3 +78,2 @@

console.log(err);
throw err;

@@ -154,9 +149,9 @@

it('should return results data object', function(done) {
this.timeout(8000);
this.timeout(30000);
var params = {
monitorIds: [ '18530476', '23359852', '23451778', '23451780', '23413603', '23413604', '23413605' ],
detailLevel: 'test,w3c',
start: 1440083778819,
end: 1440083825452
monitorIds: [ '18530476' ],
detailLevel: 'all',
start: new Date().getTime() - (1000 * 60 * 5),
end: new Date().getTime()
};

@@ -174,3 +169,3 @@

}).then(function(result) {
console.log(result);
assert.equal(typeof result, 'object');

@@ -181,3 +176,3 @@

}).fail(function(err) {
console.log(err);
throw err;

@@ -184,0 +179,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