This commit is contained in:
eric sciple 2020-01-24 12:21:24 -05:00
parent fc725ba36b
commit 422b9fdb15
7395 changed files with 1786235 additions and 3476 deletions

156
node_modules/node-notifier/notifiers/balloon.js generated vendored Normal file
View file

@ -0,0 +1,156 @@
/**
* Wrapper for the notifu 1.6 (http://www.paralint.com/projects/notifu/)
Usage
/t <value> The type of message to display values are:
info The message is an informational message
warn The message is an warning message
error The message is an error message
/d <value> The number of milliseconds to display (omit or 0 for infinit)
/p <value> The title (or prompt) of the ballon
/m <value> The message text
/i <value> Specify an icon to use ("parent" uses the icon of the parent process)
/e Enable ballon tips in the registry (for this user only)
/q Do not play a sound when the tooltip is displayed
/w Show the tooltip even if the user is in the quiet period that follows his very first login (Windows 7 and up)
/xp Use IUserNotification interface event when IUserNotification2 is available
// Kill codes:
2 = Timeout
3 = Clicked
4 = Closed or faded out
*/
var path = require('path');
var notifier = path.resolve(__dirname, '../vendor/notifu/notifu');
var checkGrowl = require('../lib/checkGrowl');
var utils = require('../lib/utils');
var Toaster = require('./toaster');
var Growl = require('./growl');
var os = require('os');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var hasGrowl = void 0;
module.exports = WindowsBalloon;
function WindowsBalloon(options) {
options = utils.clone(options || {});
if (!(this instanceof WindowsBalloon)) {
return new WindowsBalloon(options);
}
this.options = options;
EventEmitter.call(this);
}
util.inherits(WindowsBalloon, EventEmitter);
function noop() {}
WindowsBalloon.prototype.notify = function(options, callback) {
var fallback;
var notifierOptions = this.options;
options = utils.clone(options || {});
callback = callback || noop;
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
}
var actionJackedCallback = utils.actionJackerDecorator(
this,
options,
callback,
function(data) {
if (data === 'activate') {
return 'click';
}
if (data === 'timeout') {
return 'timeout';
}
return false;
}
);
if (!!this.options.withFallback && utils.isWin8()) {
fallback = fallback || new Toaster(notifierOptions);
return fallback.notify(options, callback);
}
if (
!!this.options.withFallback &&
(!utils.isLessThanWin8() || hasGrowl === true)
) {
fallback = fallback || new Growl(notifierOptions);
return fallback.notify(options, callback);
}
if (!this.options.withFallback || hasGrowl === false) {
doNotification(options, notifierOptions, actionJackedCallback);
return this;
}
checkGrowl(notifierOptions, function(_, hasGrowlResult) {
hasGrowl = hasGrowlResult;
if (hasGrowl) {
fallback = fallback || new Growl(notifierOptions);
return fallback.notify(options, callback);
}
doNotification(options, notifierOptions, actionJackedCallback);
});
return this;
};
var allowedArguments = ['t', 'd', 'p', 'm', 'i', 'e', 'q', 'w', 'xp'];
function doNotification(options, notifierOptions, callback) {
var is64Bit = os.arch() === 'x64';
options = options || {};
options = utils.mapToNotifu(options);
options.p = options.p || 'Node Notification:';
var fullNotifierPath = notifier + (is64Bit ? '64' : '') + '.exe';
var localNotifier = notifierOptions.customPath || fullNotifierPath;
if (!options.m) {
callback(new Error('Message is required.'));
return this;
}
var argsList = utils.constructArgumentList(options, {
wrapper: '',
noEscape: true,
explicitTrue: true,
allowedArguments: allowedArguments
});
if (options.wait) {
return utils.fileCommand(localNotifier, argsList, function(error, data) {
var action = fromErrorCodeToAction(error.code);
if (action === 'error') return callback(error, data);
return callback(null, action);
});
}
utils.immediateFileCommand(localNotifier, argsList, callback);
}
function fromErrorCodeToAction(errorCode) {
switch (errorCode) {
case 2:
return 'timeout';
case 3:
case 6:
case 7:
return 'activate';
case 4:
return 'close';
default:
return 'error';
}
}

76
node_modules/node-notifier/notifiers/growl.js generated vendored Normal file
View file

@ -0,0 +1,76 @@
/**
* Wrapper for the growly module
*/
var checkGrowl = require('../lib/checkGrowl');
var utils = require('../lib/utils');
var growly = require('growly');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var errorMessageNotFound =
"Couldn't connect to growl (might be used as a fallback). Make sure it is running";
module.exports = Growl;
var hasGrowl = void 0;
function Growl(options) {
options = utils.clone(options || {});
if (!(this instanceof Growl)) {
return new Growl(options);
}
growly.appname = options.name || 'Node';
this.options = options;
EventEmitter.call(this);
}
util.inherits(Growl, EventEmitter);
Growl.prototype.notify = function(options, callback) {
growly.setHost(this.options.host, this.options.port);
options = utils.clone(options || {});
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
}
callback = utils.actionJackerDecorator(this, options, callback, function(
data
) {
if (data === 'click') {
return 'click';
}
if (data === 'timedout') {
return 'timeout';
}
return false;
});
options = utils.mapToGrowl(options);
if (!options.message) {
callback(new Error('Message is required.'));
return this;
}
options.title = options.title || 'Node Notification:';
if (hasGrowl || !!options.wait) {
var localCallback = options.wait ? callback : noop;
growly.notify(options.message, options, localCallback);
if (!options.wait) callback();
return this;
}
checkGrowl(growly, function(_, didHaveGrowl) {
hasGrowl = didHaveGrowl;
if (!didHaveGrowl) return callback(new Error(errorMessageNotFound));
growly.notify(options.message, options);
callback();
});
return this;
};
function noop() {}

View file

@ -0,0 +1,100 @@
/**
* A Node.js wrapper for terminal-notify (with fallback).
*/
var utils = require('../lib/utils');
var Growl = require('./growl');
var path = require('path');
var notifier = path.join(
__dirname,
'../vendor/mac.noindex/terminal-notifier.app/Contents/MacOS/terminal-notifier'
);
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var errorMessageOsX =
'You need Mac OS X 10.8 or above to use NotificationCenter,' +
' or use Growl fallback with constructor option {withFallback: true}.';
module.exports = NotificationCenter;
function NotificationCenter(options) {
options = utils.clone(options || {});
if (!(this instanceof NotificationCenter)) {
return new NotificationCenter(options);
}
this.options = options;
EventEmitter.call(this);
}
util.inherits(NotificationCenter, EventEmitter);
var activeId = null;
function noop() {}
NotificationCenter.prototype.notify = function(options, callback) {
var fallbackNotifier;
var id = identificator();
options = utils.clone(options || {});
activeId = id;
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
}
callback = callback || noop;
if (typeof callback !== 'function') {
throw new TypeError(
'The second argument must be a function callback. You have passed ' +
typeof fn
);
}
var actionJackedCallback = utils.actionJackerDecorator(
this,
options,
callback,
function(data) {
if (activeId !== id) return false;
if (data === 'activate') {
return 'click';
}
if (data === 'timeout') {
return 'timeout';
}
if (data === 'replied') {
return 'replied';
}
return false;
}
);
options = utils.mapToMac(options);
if (!options.message && !options.group && !options.list && !options.remove) {
callback(new Error('Message, group, remove or list property is required.'));
return this;
}
var argsList = utils.constructArgumentList(options);
if (utils.isMountainLion()) {
utils.fileCommandJson(
this.options.customPath || notifier,
argsList,
actionJackedCallback
);
return this;
}
if (fallbackNotifier || !!this.options.withFallback) {
fallbackNotifier = fallbackNotifier || new Growl(this.options);
return fallbackNotifier.notify(options, callback);
}
callback(new Error(errorMessageOsX));
return this;
};
function identificator() {
return { _ref: 'val' };
}

94
node_modules/node-notifier/notifiers/notifysend.js generated vendored Normal file
View file

@ -0,0 +1,94 @@
/**
* Node.js wrapper for "notify-send".
*/
var os = require('os');
var which = require('which');
var utils = require('../lib/utils');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var notifier = 'notify-send';
var hasNotifier = void 0;
module.exports = NotifySend;
function NotifySend(options) {
options = utils.clone(options || {});
if (!(this instanceof NotifySend)) {
return new NotifySend(options);
}
this.options = options;
EventEmitter.call(this);
}
util.inherits(NotifySend, EventEmitter);
function noop() {}
NotifySend.prototype.notify = function(options, callback) {
options = utils.clone(options || {});
callback = callback || noop;
if (typeof callback !== 'function') {
throw new TypeError(
'The second argument must be a function callback. You have passed ' +
typeof callback
);
}
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
}
if (!options.message) {
callback(new Error('Message is required.'));
return this;
}
if (os.type() !== 'Linux' && !os.type().match(/BSD$/)) {
callback(new Error('Only supported on Linux and *BSD systems'));
return this;
}
if (hasNotifier === false) {
callback(new Error('notify-send must be installed on the system.'));
return this;
}
if (hasNotifier || !!this.options.suppressOsdCheck) {
doNotification(options, callback);
return this;
}
try {
hasNotifier = !!which.sync(notifier);
doNotification(options, callback);
} catch (err) {
hasNotifier = false;
return callback(err);
}
return this;
};
var allowedArguments = ['urgency', 'expire-time', 'icon', 'category', 'hint'];
function doNotification(options, callback) {
var initial, argsList;
options = utils.mapToNotifySend(options);
options.title = options.title || 'Node Notification:';
initial = [options.title, options.message];
delete options.title;
delete options.message;
argsList = utils.constructArgumentList(options, {
initial: initial,
keyExtra: '-',
allowedArguments: allowedArguments
});
utils.command(notifier, argsList, callback);
}

100
node_modules/node-notifier/notifiers/toaster.js generated vendored Normal file
View file

@ -0,0 +1,100 @@
/**
* Wrapper for the toaster (https://github.com/nels-o/toaster)
*/
var path = require('path');
var notifier = path.resolve(__dirname, '../vendor/snoreToast/SnoreToast.exe');
var utils = require('../lib/utils');
var Balloon = require('./balloon');
var EventEmitter = require('events').EventEmitter;
var util = require('util');
var fallback = void 0;
module.exports = WindowsToaster;
function WindowsToaster(options) {
options = utils.clone(options || {});
if (!(this instanceof WindowsToaster)) {
return new WindowsToaster(options);
}
this.options = options;
EventEmitter.call(this);
}
util.inherits(WindowsToaster, EventEmitter);
function noop() {}
var timeoutMessage = 'the toast has timed out';
var successMessage = 'user clicked on the toast';
function hasText(str, txt) {
return str && str.indexOf(txt) !== -1;
}
WindowsToaster.prototype.notify = function(options, callback) {
options = utils.clone(options || {});
callback = callback || noop;
if (typeof options === 'string') {
options = { title: 'node-notifier', message: options };
}
if (typeof callback !== 'function') {
throw new TypeError(
'The second argument must be a function callback. You have passed ' +
typeof fn
);
}
var actionJackedCallback = utils.actionJackerDecorator(
this,
options,
function cb(err, data) {
// Needs to filter out timeout. Not an actual error.
if (err && hasText(data, timeoutMessage)) {
return callback(null, data);
}
callback(err, data);
},
function mapper(data) {
if (hasText(data, successMessage)) {
return 'click';
}
if (hasText(data, timeoutMessage)) {
return 'timeout';
}
return false;
}
);
options.title = options.title || 'Node Notification:';
if (
typeof options.message === 'undefined' &&
typeof options.close === 'undefined'
) {
callback(new Error('Message or ID to close is required.'));
return this;
}
if (!utils.isWin8() && !utils.isWSL() && !!this.options.withFallback) {
fallback = fallback || new Balloon(this.options);
return fallback.notify(options, callback);
}
options = utils.mapToWin8(options);
var argsList = utils.constructArgumentList(options, {
explicitTrue: true,
wrapper: '',
keepNewlines: true,
noEscape: true
});
utils.fileCommand(
this.options.customPath || notifier,
argsList,
actionJackedCallback
);
return this;
};