mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-08-25 08:08:00 +00:00
1ada95e04a
- Convert project to Javascript/Typescript - Allow custom headers to be passed in (optional) - Allow body to be optional
493 lines
14 KiB
JavaScript
493 lines
14 KiB
JavaScript
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var keys = require('object-keys').shim();
|
|
delete keys.shim;
|
|
|
|
var assign = require('./');
|
|
|
|
module.exports = assign.shim();
|
|
|
|
delete assign.shim;
|
|
|
|
},{"./":3,"object-keys":9}],2:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
// modified from https://github.com/es-shims/es6-shim
|
|
var keys = require('object-keys');
|
|
var bind = require('function-bind');
|
|
var canBeObject = function (obj) {
|
|
return typeof obj !== 'undefined' && obj !== null;
|
|
};
|
|
var hasSymbols = require('has-symbols/shams')();
|
|
var toObject = Object;
|
|
var push = bind.call(Function.call, Array.prototype.push);
|
|
var propIsEnumerable = bind.call(Function.call, Object.prototype.propertyIsEnumerable);
|
|
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
|
|
|
|
module.exports = function assign(target, source1) {
|
|
if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
|
|
var objTarget = toObject(target);
|
|
var s, source, i, props, syms, value, key;
|
|
for (s = 1; s < arguments.length; ++s) {
|
|
source = toObject(arguments[s]);
|
|
props = keys(source);
|
|
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
|
|
if (getSymbols) {
|
|
syms = getSymbols(source);
|
|
for (i = 0; i < syms.length; ++i) {
|
|
key = syms[i];
|
|
if (propIsEnumerable(source, key)) {
|
|
push(props, key);
|
|
}
|
|
}
|
|
}
|
|
for (i = 0; i < props.length; ++i) {
|
|
key = props[i];
|
|
value = source[key];
|
|
if (propIsEnumerable(source, key)) {
|
|
objTarget[key] = value;
|
|
}
|
|
}
|
|
}
|
|
return objTarget;
|
|
};
|
|
|
|
},{"function-bind":7,"has-symbols/shams":8,"object-keys":9}],3:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var defineProperties = require('define-properties');
|
|
|
|
var implementation = require('./implementation');
|
|
var getPolyfill = require('./polyfill');
|
|
var shim = require('./shim');
|
|
|
|
var polyfill = getPolyfill();
|
|
|
|
defineProperties(polyfill, {
|
|
getPolyfill: getPolyfill,
|
|
implementation: implementation,
|
|
shim: shim
|
|
});
|
|
|
|
module.exports = polyfill;
|
|
|
|
},{"./implementation":2,"./polyfill":11,"./shim":12,"define-properties":4}],4:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var keys = require('object-keys');
|
|
var foreach = require('foreach');
|
|
var hasSymbols = typeof Symbol === 'function' && typeof Symbol() === 'symbol';
|
|
|
|
var toStr = Object.prototype.toString;
|
|
|
|
var isFunction = function (fn) {
|
|
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
|
|
};
|
|
|
|
var arePropertyDescriptorsSupported = function () {
|
|
var obj = {};
|
|
try {
|
|
Object.defineProperty(obj, 'x', { enumerable: false, value: obj });
|
|
/* eslint-disable no-unused-vars, no-restricted-syntax */
|
|
for (var _ in obj) { return false; }
|
|
/* eslint-enable no-unused-vars, no-restricted-syntax */
|
|
return obj.x === obj;
|
|
} catch (e) { /* this is IE 8. */
|
|
return false;
|
|
}
|
|
};
|
|
var supportsDescriptors = Object.defineProperty && arePropertyDescriptorsSupported();
|
|
|
|
var defineProperty = function (object, name, value, predicate) {
|
|
if (name in object && (!isFunction(predicate) || !predicate())) {
|
|
return;
|
|
}
|
|
if (supportsDescriptors) {
|
|
Object.defineProperty(object, name, {
|
|
configurable: true,
|
|
enumerable: false,
|
|
value: value,
|
|
writable: true
|
|
});
|
|
} else {
|
|
object[name] = value;
|
|
}
|
|
};
|
|
|
|
var defineProperties = function (object, map) {
|
|
var predicates = arguments.length > 2 ? arguments[2] : {};
|
|
var props = keys(map);
|
|
if (hasSymbols) {
|
|
props = props.concat(Object.getOwnPropertySymbols(map));
|
|
}
|
|
foreach(props, function (name) {
|
|
defineProperty(object, name, map[name], predicates[name]);
|
|
});
|
|
};
|
|
|
|
defineProperties.supportsDescriptors = !!supportsDescriptors;
|
|
|
|
module.exports = defineProperties;
|
|
|
|
},{"foreach":5,"object-keys":9}],5:[function(require,module,exports){
|
|
|
|
var hasOwn = Object.prototype.hasOwnProperty;
|
|
var toString = Object.prototype.toString;
|
|
|
|
module.exports = function forEach (obj, fn, ctx) {
|
|
if (toString.call(fn) !== '[object Function]') {
|
|
throw new TypeError('iterator must be a function');
|
|
}
|
|
var l = obj.length;
|
|
if (l === +l) {
|
|
for (var i = 0; i < l; i++) {
|
|
fn.call(ctx, obj[i], i, obj);
|
|
}
|
|
} else {
|
|
for (var k in obj) {
|
|
if (hasOwn.call(obj, k)) {
|
|
fn.call(ctx, obj[k], k, obj);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
|
|
|
|
},{}],6:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
/* eslint no-invalid-this: 1 */
|
|
|
|
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
|
|
var slice = Array.prototype.slice;
|
|
var toStr = Object.prototype.toString;
|
|
var funcType = '[object Function]';
|
|
|
|
module.exports = function bind(that) {
|
|
var target = this;
|
|
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
|
|
throw new TypeError(ERROR_MESSAGE + target);
|
|
}
|
|
var args = slice.call(arguments, 1);
|
|
|
|
var bound;
|
|
var binder = function () {
|
|
if (this instanceof bound) {
|
|
var result = target.apply(
|
|
this,
|
|
args.concat(slice.call(arguments))
|
|
);
|
|
if (Object(result) === result) {
|
|
return result;
|
|
}
|
|
return this;
|
|
} else {
|
|
return target.apply(
|
|
that,
|
|
args.concat(slice.call(arguments))
|
|
);
|
|
}
|
|
};
|
|
|
|
var boundLength = Math.max(0, target.length - args.length);
|
|
var boundArgs = [];
|
|
for (var i = 0; i < boundLength; i++) {
|
|
boundArgs.push('$' + i);
|
|
}
|
|
|
|
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
|
|
|
|
if (target.prototype) {
|
|
var Empty = function Empty() {};
|
|
Empty.prototype = target.prototype;
|
|
bound.prototype = new Empty();
|
|
Empty.prototype = null;
|
|
}
|
|
|
|
return bound;
|
|
};
|
|
|
|
},{}],7:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var implementation = require('./implementation');
|
|
|
|
module.exports = Function.prototype.bind || implementation;
|
|
|
|
},{"./implementation":6}],8:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
/* eslint complexity: [2, 17], max-statements: [2, 33] */
|
|
module.exports = function hasSymbols() {
|
|
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
|
|
if (typeof Symbol.iterator === 'symbol') { return true; }
|
|
|
|
var obj = {};
|
|
var sym = Symbol('test');
|
|
var symObj = Object(sym);
|
|
if (typeof sym === 'string') { return false; }
|
|
|
|
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
|
|
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
|
|
|
|
// temp disabled per https://github.com/ljharb/object.assign/issues/17
|
|
// if (sym instanceof Symbol) { return false; }
|
|
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
|
|
// if (!(symObj instanceof Symbol)) { return false; }
|
|
|
|
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
|
|
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
|
|
|
|
var symVal = 42;
|
|
obj[sym] = symVal;
|
|
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
|
|
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
|
|
|
|
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
|
|
|
|
var syms = Object.getOwnPropertySymbols(obj);
|
|
if (syms.length !== 1 || syms[0] !== sym) { return false; }
|
|
|
|
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
|
|
|
|
if (typeof Object.getOwnPropertyDescriptor === 'function') {
|
|
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
|
|
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
|
|
}
|
|
|
|
return true;
|
|
};
|
|
|
|
},{}],9:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
// modified from https://github.com/es-shims/es5-shim
|
|
var has = Object.prototype.hasOwnProperty;
|
|
var toStr = Object.prototype.toString;
|
|
var slice = Array.prototype.slice;
|
|
var isArgs = require('./isArguments');
|
|
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
|
|
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
|
|
var dontEnums = [
|
|
'toString',
|
|
'toLocaleString',
|
|
'valueOf',
|
|
'hasOwnProperty',
|
|
'isPrototypeOf',
|
|
'propertyIsEnumerable',
|
|
'constructor'
|
|
];
|
|
var equalsConstructorPrototype = function (o) {
|
|
var ctor = o.constructor;
|
|
return ctor && ctor.prototype === o;
|
|
};
|
|
var excludedKeys = {
|
|
$console: true,
|
|
$external: true,
|
|
$frame: true,
|
|
$frameElement: true,
|
|
$frames: true,
|
|
$innerHeight: true,
|
|
$innerWidth: true,
|
|
$outerHeight: true,
|
|
$outerWidth: true,
|
|
$pageXOffset: true,
|
|
$pageYOffset: true,
|
|
$parent: true,
|
|
$scrollLeft: true,
|
|
$scrollTop: true,
|
|
$scrollX: true,
|
|
$scrollY: true,
|
|
$self: true,
|
|
$webkitIndexedDB: true,
|
|
$webkitStorageInfo: true,
|
|
$window: true
|
|
};
|
|
var hasAutomationEqualityBug = (function () {
|
|
/* global window */
|
|
if (typeof window === 'undefined') { return false; }
|
|
for (var k in window) {
|
|
try {
|
|
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
try {
|
|
equalsConstructorPrototype(window[k]);
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
} catch (e) {
|
|
return true;
|
|
}
|
|
}
|
|
return false;
|
|
}());
|
|
var equalsConstructorPrototypeIfNotBuggy = function (o) {
|
|
/* global window */
|
|
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
|
|
return equalsConstructorPrototype(o);
|
|
}
|
|
try {
|
|
return equalsConstructorPrototype(o);
|
|
} catch (e) {
|
|
return false;
|
|
}
|
|
};
|
|
|
|
var keysShim = function keys(object) {
|
|
var isObject = object !== null && typeof object === 'object';
|
|
var isFunction = toStr.call(object) === '[object Function]';
|
|
var isArguments = isArgs(object);
|
|
var isString = isObject && toStr.call(object) === '[object String]';
|
|
var theKeys = [];
|
|
|
|
if (!isObject && !isFunction && !isArguments) {
|
|
throw new TypeError('Object.keys called on a non-object');
|
|
}
|
|
|
|
var skipProto = hasProtoEnumBug && isFunction;
|
|
if (isString && object.length > 0 && !has.call(object, 0)) {
|
|
for (var i = 0; i < object.length; ++i) {
|
|
theKeys.push(String(i));
|
|
}
|
|
}
|
|
|
|
if (isArguments && object.length > 0) {
|
|
for (var j = 0; j < object.length; ++j) {
|
|
theKeys.push(String(j));
|
|
}
|
|
} else {
|
|
for (var name in object) {
|
|
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
|
theKeys.push(String(name));
|
|
}
|
|
}
|
|
}
|
|
|
|
if (hasDontEnumBug) {
|
|
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
|
|
for (var k = 0; k < dontEnums.length; ++k) {
|
|
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
|
theKeys.push(dontEnums[k]);
|
|
}
|
|
}
|
|
}
|
|
return theKeys;
|
|
};
|
|
|
|
keysShim.shim = function shimObjectKeys() {
|
|
if (Object.keys) {
|
|
var keysWorksWithArguments = (function () {
|
|
// Safari 5.0 bug
|
|
return (Object.keys(arguments) || '').length === 2;
|
|
}(1, 2));
|
|
if (!keysWorksWithArguments) {
|
|
var originalKeys = Object.keys;
|
|
Object.keys = function keys(object) {
|
|
if (isArgs(object)) {
|
|
return originalKeys(slice.call(object));
|
|
} else {
|
|
return originalKeys(object);
|
|
}
|
|
};
|
|
}
|
|
} else {
|
|
Object.keys = keysShim;
|
|
}
|
|
return Object.keys || keysShim;
|
|
};
|
|
|
|
module.exports = keysShim;
|
|
|
|
},{"./isArguments":10}],10:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var toStr = Object.prototype.toString;
|
|
|
|
module.exports = function isArguments(value) {
|
|
var str = toStr.call(value);
|
|
var isArgs = str === '[object Arguments]';
|
|
if (!isArgs) {
|
|
isArgs = str !== '[object Array]' &&
|
|
value !== null &&
|
|
typeof value === 'object' &&
|
|
typeof value.length === 'number' &&
|
|
value.length >= 0 &&
|
|
toStr.call(value.callee) === '[object Function]';
|
|
}
|
|
return isArgs;
|
|
};
|
|
|
|
},{}],11:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var implementation = require('./implementation');
|
|
|
|
var lacksProperEnumerationOrder = function () {
|
|
if (!Object.assign) {
|
|
return false;
|
|
}
|
|
// v8, specifically in node 4.x, has a bug with incorrect property enumeration order
|
|
// note: this does not detect the bug unless there's 20 characters
|
|
var str = 'abcdefghijklmnopqrst';
|
|
var letters = str.split('');
|
|
var map = {};
|
|
for (var i = 0; i < letters.length; ++i) {
|
|
map[letters[i]] = letters[i];
|
|
}
|
|
var obj = Object.assign({}, map);
|
|
var actual = '';
|
|
for (var k in obj) {
|
|
actual += k;
|
|
}
|
|
return str !== actual;
|
|
};
|
|
|
|
var assignHasPendingExceptions = function () {
|
|
if (!Object.assign || !Object.preventExtensions) {
|
|
return false;
|
|
}
|
|
// Firefox 37 still has "pending exception" logic in its Object.assign implementation,
|
|
// which is 72% slower than our shim, and Firefox 40's native implementation.
|
|
var thrower = Object.preventExtensions({ 1: 2 });
|
|
try {
|
|
Object.assign(thrower, 'xy');
|
|
} catch (e) {
|
|
return thrower[1] === 'y';
|
|
}
|
|
return false;
|
|
};
|
|
|
|
module.exports = function getPolyfill() {
|
|
if (!Object.assign) {
|
|
return implementation;
|
|
}
|
|
if (lacksProperEnumerationOrder()) {
|
|
return implementation;
|
|
}
|
|
if (assignHasPendingExceptions()) {
|
|
return implementation;
|
|
}
|
|
return Object.assign;
|
|
};
|
|
|
|
},{"./implementation":2}],12:[function(require,module,exports){
|
|
'use strict';
|
|
|
|
var define = require('define-properties');
|
|
var getPolyfill = require('./polyfill');
|
|
|
|
module.exports = function shimAssign() {
|
|
var polyfill = getPolyfill();
|
|
define(
|
|
Object,
|
|
{ assign: polyfill },
|
|
{ assign: function () { return Object.assign !== polyfill; } }
|
|
);
|
|
return polyfill;
|
|
};
|
|
|
|
},{"./polyfill":11,"define-properties":4}]},{},[1]);
|