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

pagerduty-overlap-checker

Package Overview
Dependencies
Maintainers
2
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pagerduty-overlap-checker - npm Package Compare versions

Comparing version 1.0.3 to 1.0.4

61

lib/pagerduty.js
// Generated by CoffeeScript 1.10.0
var _, async, checkSchedulesIds, debug, getSchedule, getSchedulesIds, nconf, notify, pdGet, processSchedules, processSchedulesFromConfig, request, sendNotification;
var _, async, checkSchedulesIds, debug, getSchedule, getSchedulesIds, getUserId, nconf, notify, overrideUser, pdGet, processSchedules, processSchedulesFromConfig, request, sendNotification;

@@ -183,2 +183,57 @@ async = require('async');

getUserId = function(email, cb) {
var userOptions;
userOptions = {
form: {
query: email
}
};
return pdGet("/users", userOptions, function(err, res, body) {
var userId;
if (res.statusCode !== 200) {
return cb(new Error("Entries returned status code " + res.statusCode));
}
userId = body.users[0].id;
return cb(err, userId);
});
};
overrideUser = function(userId, scheduleId, durationInMinutes, cb) {
var duration, endDate, sharedOptions, startDate;
if (durationInMinutes == null) {
durationInMinutes = 30;
}
if (userId && scheduleId) {
duration = durationInMinutes * 60 * 1000;
startDate = new Date();
endDate = new Date(startDate.getTime() + duration);
sharedOptions = {
uri: nconf.get('PAGERDUTY_API_URL') + ("/schedules/" + scheduleId + "/overrides"),
method: 'POST',
headers: {
'Authorization': 'Token token=' + nconf.get('PAGERDUTY_TOKEN')
},
form: {
override: {
"user_id": userId,
"start": startDate.toISOString(),
"end": endDate.toISOString()
}
}
};
debug('Calling request with: ', sharedOptions);
return request(sharedOptions, function(err, res, body) {
var reponseObject;
if (err) {
return cb(err);
}
if (res.statusCode !== 201) {
return cb(new Error("Entries returned status code " + res.statusCode));
}
reponseObject = JSON.parse(body);
return cb(err, reponseObject.override);
});
}
};
module.exports = {

@@ -190,3 +245,5 @@ pdGet: pdGet,

processSchedulesFromConfig: processSchedulesFromConfig,
sendNotification: sendNotification
sendNotification: sendNotification,
getUserId: getUserId,
overrideUser: overrideUser
};

2

package.json
{
"name": "pagerduty-overlap-checker",
"version": "1.0.3",
"version": "1.0.4",
"description": "PagerDuty Overlap Duties Checker",

@@ -5,0 +5,0 @@ "main": "lib/",

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