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 2.1.2 to 2.1.3

3

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

@@ -33,2 +33,3 @@ "main": "src/",

"moment": "^2.18.1",
"moment-timezone": "^0.5.13",
"nconf": "0.8.4",

@@ -35,0 +36,0 @@ "node-slackr": "0.1.3",

@@ -18,3 +18,3 @@ [![Build Status](https://travis-ci.org/apiaryio/pagerduty-overlap-checker.svg?branch=master)](https://travis-ci.org/apiaryio/pagerduty-overlap-checker)

- every `SCHEDULE` should have a `NOTIFICATIONS` section to create a PagerDuty incident or send a Slack message if overlap is found
- `SCHEDULE` can contain a `EXCLUSION_DAYS` key, which specifies days (3 letter abb.) in form of object with optional `start` and `end` time (`hh:mm` format **UTC TIMEZONE**).If `start` or `end` is omitted, whole day is considered excluded.
- `SCHEDULE` can contain a `EXCLUSION_DAYS` key, which specifies days (3 letter abb.) in form of object with optional `start` and `end` time (`hh:mm` format **CET TIMEZONE**).If `start` or `end` is omitted, whole day is considered excluded.
Example below represents current weekend on-call setup.

@@ -55,3 +55,3 @@

},
"EXCLUSION_DAYS": {"Fri": {"start": "16:00", "end": "23:59"}, "Sat": {}, "Sun": {"start": "00:00", "end": "16:00"}}
"EXCLUSION_DAYS": {"Fri": {"start": "18:00", "end": "23:59"}, "Sat": {}, "Sun": {"start": "00:00", "end": "18:00"}}
}]

@@ -58,0 +58,0 @@ }

@@ -6,3 +6,3 @@ const Slack = require('node-slackr');

function toUTCString(moment) {
function toISOstring(moment) {
return moment.format('ddd, D MMM YYYY HH:mm:ss z');

@@ -99,3 +99,3 @@ }

messages.forEach((message) => {
outputMessage += `${message.user}: ${message.schedules[0]} and ${message.schedules[1]} (from ${toUTCString(message.overlapStart)} to ${toUTCString(message.overlapEnd)})\n`;
outputMessage += `${message.user}: ${message.schedules[0]} and ${message.schedules[1]} (from ${toISOstring(message.overlapStart)} to ${toISOstring(message.overlapEnd)})\n`;
});

@@ -106,3 +106,3 @@ break;

messages.forEach((message) => {
outputMessage += `*${message.user}:* \`${message.schedules[0]}\` and \`${message.schedules[1]}\` (from ${toUTCString(message.overlapStart)} to ${toUTCString(message.overlapEnd)})\n`;
outputMessage += `*${message.user}:* \`${message.schedules[0]}\` and \`${message.schedules[1]}\` (from ${toISOstring(message.overlapStart)} to ${toISOstring(message.overlapEnd)})\n`;
});

@@ -116,3 +116,3 @@ break;

if (acc[curr.userId].messages == null) { acc[curr.userId].messages = []; }
acc[curr.userId].messages.push(`${curr.schedules[0]} and ${curr.schedules[1]} (from ${toUTCString(curr.overlapStart)} to ${toUTCString(curr.overlapEnd)})`);
acc[curr.userId].messages.push(`${curr.schedules[0]} and ${curr.schedules[1]} (from ${toISOstring(curr.overlapStart)} to ${toISOstring(curr.overlapEnd)})`);
return acc;

@@ -179,3 +179,3 @@ }

send,
toUTCString,
toISOstring,
};

@@ -33,3 +33,3 @@ const _ = require('underscore');

defaultOptions.qs.limit = 100;
defaultOptions.qs.timezone = 'UTC';
defaultOptions.qs.timezone = 'CET';

@@ -36,0 +36,0 @@ debug('Calling request with: ', defaultOptions);

const async = require('async');
const moment = require('moment');
const moment = require('moment-timezone');
const nconf = require('nconf');

@@ -12,3 +12,3 @@ const _ = require('underscore');

if (nconf.get('WEEKS_TO_CHECK') > 0) {
const timeUntil = moment.utc().add(nconf.get('WEEKS_TO_CHECK'), 'w');
const timeUntil = moment().tz('CET').add(nconf.get('WEEKS_TO_CHECK'), 'w');

@@ -19,3 +19,3 @@ const scheduleOpts = {

until: timeUntil.toISOString(),
since: moment.utc().toISOString(),
since: moment().tz('CET').toISOString(),
},

@@ -109,4 +109,4 @@ };

debug('checking entry: ', JSON.stringify(entry));
const myStart = moment.utc(entry.start);
const myEnd = moment.utc(entry.end);
const myStart = moment.tz(entry.start, 'CET');
const myEnd = moment.tz(entry.end, 'CET');
const myUserId = entry.user.id;

@@ -121,4 +121,4 @@ const myUserName = entry.user.summary;

const crossScheduleId = nconf.get(`schedulesNames:${crossSchedule.id}`);
const crossCheckStart = moment.utc(crossCheckEntry.start);
const crossCheckEnd = moment.utc(crossCheckEntry.end);
const crossCheckStart = moment.tz(crossCheckEntry.start, 'CET');
const crossCheckEnd = moment.tz(crossCheckEntry.end, 'CET');
let message;

@@ -151,6 +151,6 @@ let overlapStart;

const exclusionEndTime = daysArray[overlappingDay].end.split(':');
const exclusionStartDate = moment.utc(day);
const exclusionStartDate = moment(day);
exclusionStartDate.hours(exclusionStartTime[0]);
exclusionStartDate.minutes(exclusionStartTime[1]);
const exclusionEndDate = moment.utc(day);
const exclusionEndDate = moment(day);
exclusionEndDate.hours(exclusionEndTime[0]);

@@ -157,0 +157,0 @@ exclusionEndDate.minutes(exclusionEndTime[1]);

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