diff --git a/build/src/common.js b/build/src/common.js index 500460b..a6082d2 100644 --- a/build/src/common.js +++ b/build/src/common.js @@ -51,11 +51,35 @@ const retryTimeoutPromise = (milliseconds) => { return new Promise(resolve => setTimeout(resolve, milliseconds)); }; function userAgentHeader() { - if (browser_or_node_1.isBrowser) + if (browser_or_node_1.isNode) { + return { + 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`, + }; + } + else if (browser_or_node_1.isWebWorker) { + return { + 'User-Agent': `pdjs/${VERSION} (WebWorker)`, + }; + } + else if (browser_or_node_1.isJsDom) { + return { + 'User-Agent': `pdjs/${VERSION} (JsDom)`, + }; + } + else if (browser_or_node_1.isDeno) { + return { + 'User-Agent': `pdjs/${VERSION} (Deno)`, + }; + } + else if (browser_or_node_1.isBrowser) { + return { + // Note: This will not work consistently for all browsers as some silently drop the userAgent Header. + 'User-Agent': `pdjs/${VERSION} (${window.navigator.userAgent})`, + }; + } + else { return {}; - return { - 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`, - }; + } } function applyParameters(url, queryParameters) { if (!queryParameters) diff --git a/build/src/common.js.map b/build/src/common.js.map index 65d60ca..7b26c71 100644 --- a/build/src/common.js.map +++ b/build/src/common.js.map @@ -1 +1 @@ -{"version":3,"file":"common.js","sourceRoot":"","sources":["../../src/common.ts"],"names":[],"mappings":";;;AAAA,kCAAkC;AAClC,6CAA2C;AAC3C,qDAA0C;AAC1C,gCAAgC;AAEhC,MAAM,OAAO,GAAG,OAAO,CAAC;AAaxB,SAAgB,OAAO,CACrB,GAAiB,EACjB,UAA0B,EAAE;IAE5B,MAAM,EAAC,eAAe,EAAE,cAAc,GAAG,KAAK,EAAC,GAAG,OAAO,CAAC;IAE1D,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,CAAC,QAAQ,EAAE,CAAC,CAAC;IAC9B,GAAG,GAAG,eAAe,CAAC,GAAG,EAAE,eAAe,CAAC,CAAC;IAC5C,OAAO,GAAG,YAAY,CAAC,OAAO,EAA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AAkB,GAAG,GAAG,CAAC,YAAY,CAAC;IAE5C,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE;QAC9C,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,EAAE;YAC5B,0DAA0D;YAC1D,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;gBACvB,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YACvC,CAAC,CAAC,CAAC;SACJ;aAAM;YACL,kBAAkB,CAAC,MAAM,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;SAC3C;KACF;IAED,GAAG,CAAC,MAAM,GAAG,kBAAkB,CAAC,QAAQ,EAAE,CAAC;IAC3C,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,YAAY,CAAC,IAAoB,EAAE,OAAgB;IAC1D,IAAI,CAAC,OAAO;QAAE,OAAO,IAAI,CAAC;IAC1B,MAAM,KAAK,GAAG,UAAU,CAAC,GAAG,EAAE,GAAE,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5C,OAAO;QACL,GAAG,IAAI;QACP,YAAY,EAAE,KAAK;KACpB,CAAC;AACJ,CAAC"} \ No newline at end of file diff --git a/dist/pdjs-legacy.js b/dist/pdjs-legacy.js index b5eb822..699e52c 100644 --- a/dist/pdjs-legacy.js +++ b/dist/pdjs-legacy.js @@ -1,2 +1,2 @@ -var PagerDuty;(()=>{var e={818:(e,t)=>{"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n="undefined"!=typeof window&&void 0!==window.document;"object"===("undefined"==typeof self?"undefined":r(self))&&self.constructor&&self.constructor.name,"undefined"!=typeof process&&null!=process.versions&&process.versions.node;t.jU=n},98:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function f(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function y(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function h(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function d(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function m(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=b(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=y(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?y(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(d)}),this.text=function(){var e,t,r,n=y(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=h(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function g(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})},m.call(O.prototype),m.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var j=[301,302,303,307,308];w.redirect=function(e,t){if(-1===j.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function P(e,r){return new Promise((function(n,i){var s=new O(e,r);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new w(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}P.polyfill=!0,e.fetch||(e.fetch=P,e.Headers=l,e.Request=O,e.Response=w),t.Headers=l,t.Request=O,t.Response=w,t.fetch=P,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{acknowledge:()=>B,api:()=>j,change:()=>R,event:()=>_,resolve:()=>U,trigger:()=>D});var e=r(98),t=r.n(e),o=r(818);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=r,o=n.queryParameters,i=n.requestTimeout,a=void 0===i?3e4:i;return t=l(t=new URL(t.toString()),o),r=y(r,a),c(t.toString(),3,s(s({},r),{},{headers:new e.Headers(s(s({"Content-Type":"application/json; charset=utf-8"},p()),r.headers))}))}function c(e,r,n){return new Promise((function(o,i){t()(e,n).then((function(t){if(0===r)return o(t);if(429===t.status){var s=n.retryTimeout;f(void 0===s?2e4:s).then((function(){c(e,r-1,n).then(o).catch(i)}))}else clearTimeout(n.requestTimer),o(t)})).catch(i)}))}var f=function(e){return new Promise((function(t){return setTimeout(t,e)}))};function p(){return o.jU?{}:{"User-Agent":"pdjs/".concat("2.0.0"," (").concat(process.version,"/").concat(process.platform,")")}}function l(e,t){if(!t)return e;for(var r=e.searchParams,n=function(){var e=i[o],n=t[e];Array.isArray(n)?n.forEach((function(t){r.append(e,t)})):r.append(e,n)},o=0,i=Object.keys(t);o]+)>/g,(function(e,t){return"$"+i[t]})))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!==d(e[e.length-1])&&(e=[].slice.call(e)).push(n(e,s)),o.apply(this,e)}))}return e[Symbol.replace].call(this,r,o)},b.apply(this,arguments)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&v(e,t)}function v(e,t){return v=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},v(e,t)}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function g(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,h),b=g(g({method:"GET"},d),{},{headers:g({Accept:"application/vnd.pagerduty+json;version=".concat(l),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[c]).concat(a)},d.headers)});return r=b.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?b.queryParameters=null!==(t=b.queryParameters)&&void 0!==t?t:y:b.body=JSON.stringify(y),P(null!=f?f:"https://".concat(s,"/").concat(o.replace(/^\/+/,"")),b)}function P(e,t){return u(e,t).then((function(r){var n=r;return n.response=r,204===r.status?Promise.resolve(n):r.json().then((function(r){var o=function(e,t){var r=e.match(b(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));if(r){var n=r[1];return t&&"get"===t.toLowerCase()?n:n.endsWith("ies")?n.slice(0,-3)+"y":n.endsWith("s")?n.slice(0,-1):n}return null}(e,t.method);return n.next=function(e,t,r){if(function(e){return void 0!==e.offset}(r)){if(null!=r&&r.more&&void 0!==d(r.offset)&&r.limit)return function(){return P(e,g(g({},t),{},{queryParameters:g(g({},t.queryParameters),{},{limit:r.limit.toString(),offset:(r.limit+r.offset).toString()})}))}}else if(function(e){return void 0!==e.cursor}(r)&&null!=r&&r.cursor)return function(){return P(e,g(g({},t),{},{queryParameters:g(g({},t.queryParameters),{},{cursor:r.cursor,limit:r.limit.toString()})}))}}(e,t,r),n.data=r,n.resource=o?r[o]:null,n})).catch((function(){return Promise.reject(n)}))}))}var E=["server","type","data"];function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function x(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,E),a="https://".concat(r,"/v2/enqueue");return"change"===o&&(a="https://".concat(r,"/v2/change/enqueue")),function(e,t){return u(e,t).then((function(e){var t=e;return e.json().then((function(r){return t.data=r,t.response=e,t}))}))}(a,x({method:"POST",body:JSON.stringify(i)},s))}var A=function(e){return function(t){return _(x(x({},t),{},{data:x(x({},t.data),{},T({},"event_action",e))}))}},D=A("trigger"),B=A("acknowledge"),U=A("resolve"),R=function(e){return _(x(x({},e),{},{type:"change"}))}})(),PagerDuty=n})(); +var PagerDuty;(()=>{var e={818:(e,t)=>{"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},n="undefined"!=typeof window&&void 0!==window.document,o="undefined"!=typeof process&&null!=process.versions&&null!=process.versions.node,i="object"===("undefined"==typeof self?"undefined":r(self))&&self.constructor&&"DedicatedWorkerGlobalScope"===self.constructor.name,s="undefined"!=typeof window&&"nodejs"===window.name||"undefined"!=typeof navigator&&(navigator.userAgent.includes("Node.js")||navigator.userAgent.includes("jsdom")),a="undefined"!=typeof Deno&&void 0!==Deno.core;t.jU=n,t.n2=i,t.UG=o,t.f7=s,t.co=a},98:function(e,t){var r="undefined"!=typeof self?self:this,n=function(){function e(){this.fetch=!1,this.DOMException=r.DOMException}return e.prototype=r,new e}();!function(e){!function(t){var r="URLSearchParams"in e,n="Symbol"in e&&"iterator"in Symbol,o="FileReader"in e&&"Blob"in e&&function(){try{return new Blob,!0}catch(e){return!1}}(),i="FormData"in e,s="ArrayBuffer"in e;if(s)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],u=ArrayBuffer.isView||function(e){return e&&a.indexOf(Object.prototype.toString.call(e))>-1};function c(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(e))throw new TypeError("Invalid character in header field name");return e.toLowerCase()}function f(e){return"string"!=typeof e&&(e=String(e)),e}function p(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n&&(t[Symbol.iterator]=function(){return t}),t}function l(e){this.map={},e instanceof l?e.forEach((function(e,t){this.append(t,e)}),this):Array.isArray(e)?e.forEach((function(e){this.append(e[0],e[1])}),this):e&&Object.getOwnPropertyNames(e).forEach((function(t){this.append(t,e[t])}),this)}function y(e){if(e.bodyUsed)return Promise.reject(new TypeError("Already read"));e.bodyUsed=!0}function d(e){return new Promise((function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}}))}function h(e){var t=new FileReader,r=d(t);return t.readAsArrayBuffer(e),r}function b(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(e){var t;this._bodyInit=e,e?"string"==typeof e?this._bodyText=e:o&&Blob.prototype.isPrototypeOf(e)?this._bodyBlob=e:i&&FormData.prototype.isPrototypeOf(e)?this._bodyFormData=e:r&&URLSearchParams.prototype.isPrototypeOf(e)?this._bodyText=e.toString():s&&o&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=b(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):s&&(ArrayBuffer.prototype.isPrototypeOf(e)||u(e))?this._bodyArrayBuffer=b(e):this._bodyText=e=Object.prototype.toString.call(e):this._bodyText="",this.headers.get("content-type")||("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):r&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var e=y(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?y(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(h)}),this.text=function(){var e,t,r,n=y(this);if(n)return n;if(this._bodyBlob)return e=this._bodyBlob,r=d(t=new FileReader),t.readAsText(e),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=new Array(t.length),n=0;n-1?n:r),this.mode=t.mode||this.mode||null,this.signal=t.signal||this.signal,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&o)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(o)}function O(e){var t=new FormData;return e.trim().split("&").forEach((function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(o))}})),t}function w(e,t){t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in t?t.statusText:"OK",this.headers=new l(t.headers),this.url=t.url||"",this._initBody(e)}g.prototype.clone=function(){return new g(this,{body:this._bodyInit})},v.call(g.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new l(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:0,statusText:""});return e.type="error",e};var j=[301,302,303,307,308];w.redirect=function(e,t){if(-1===j.indexOf(t))throw new RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},t.DOMException=e.DOMException;try{new t.DOMException}catch(e){t.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},t.DOMException.prototype=Object.create(Error.prototype),t.DOMException.prototype.constructor=t.DOMException}function P(e,r){return new Promise((function(n,i){var s=new g(e,r);if(s.signal&&s.signal.aborted)return i(new t.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function u(){a.abort()}a.onload=function(){var e,t,r={status:a.status,statusText:a.statusText,headers:(e=a.getAllResponseHeaders()||"",t=new l,e.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(e){var r=e.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();t.append(n,o)}})),t)};r.url="responseURL"in a?a.responseURL:r.headers.get("X-Request-URL");var o="response"in a?a.response:a.responseText;n(new w(o,r))},a.onerror=function(){i(new TypeError("Network request failed"))},a.ontimeout=function(){i(new TypeError("Network request failed"))},a.onabort=function(){i(new t.DOMException("Aborted","AbortError"))},a.open(s.method,s.url,!0),"include"===s.credentials?a.withCredentials=!0:"omit"===s.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),s.headers.forEach((function(e,t){a.setRequestHeader(t,e)})),s.signal&&(s.signal.addEventListener("abort",u),a.onreadystatechange=function(){4===a.readyState&&s.signal.removeEventListener("abort",u)}),a.send(void 0===s._bodyInit?null:s._bodyInit)}))}P.polyfill=!0,e.fetch||(e.fetch=P,e.Headers=l,e.Request=g,e.Response=w),t.Headers=l,t.Request=g,t.Response=w,t.fetch=P,Object.defineProperty(t,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(t=o.fetch).default=o.fetch,t.fetch=o.fetch,t.Headers=o.Headers,t.Request=o.Request,t.Response=o.Response,e.exports=t}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var i=t[n]={exports:{}};return e[n].call(i.exports,i,i.exports,r),i.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{acknowledge:()=>B,api:()=>P,change:()=>k,event:()=>_,resolve:()=>R,trigger:()=>U});var e=r(98),t=r.n(e),o=r(818);function i(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function s(e){for(var t=1;t1&&void 0!==arguments[1]?arguments[1]:{},n=r,o=n.queryParameters,i=n.requestTimeout,a=void 0===i?3e4:i;return t=y(t=new URL(t.toString()),o),r=d(r,a),f(t.toString(),3,s(s({},r),{},{headers:new e.Headers(s(s({"Content-Type":"application/json; charset=utf-8"},l()),r.headers))}))}function f(e,r,n){return new Promise((function(o,i){t()(e,n).then((function(t){if(0===r)return o(t);if(429===t.status){var s=n.retryTimeout;p(void 0===s?2e4:s).then((function(){f(e,r-1,n).then(o).catch(i)}))}else clearTimeout(n.requestTimer),o(t)})).catch(i)}))}var p=function(e){return new Promise((function(t){return setTimeout(t,e)}))};function l(){return o.UG?{"User-Agent":"pdjs/".concat(u," (").concat(process.version,"/").concat(process.platform,")")}:o.n2?{"User-Agent":"pdjs/".concat(u," (WebWorker)")}:o.f7?{"User-Agent":"pdjs/".concat(u," (JsDom)")}:o.co?{"User-Agent":"pdjs/".concat(u," (Deno)")}:o.jU?{"User-Agent":"pdjs/".concat(u," (").concat(window.navigator.userAgent,")")}:{}}function y(e,t){if(!t)return e;for(var r=e.searchParams,n=function(){var e=i[o],n=t[e];Array.isArray(n)?n.forEach((function(t){r.append(e,t)})):r.append(e,n)},o=0,i=Object.keys(t);o]+)>/g,(function(e,t){return"$"+i[t]})))}if("function"==typeof o){var s=this;return e[Symbol.replace].call(this,r,(function(){var e=arguments;return"object"!==b(e[e.length-1])&&(e=[].slice.call(e)).push(n(e,s)),o.apply(this,e)}))}return e[Symbol.replace].call(this,r,o)},v.apply(this,arguments)}function m(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&g(e,t)}function g(e,t){return g=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},g(e,t)}function O(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function w(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,h),b=w(w({method:"GET"},d),{},{headers:w({Accept:"application/vnd.pagerduty+json;version=".concat(l),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[c]).concat(a)},d.headers)});return r=b.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?b.queryParameters=null!==(t=b.queryParameters)&&void 0!==t?t:y:b.body=JSON.stringify(y),E(null!=f?f:"https://".concat(s,"/").concat(o.replace(/^\/+/,"")),b)}function E(e,t){return c(e,t).then((function(r){var n=r;return n.response=r,204===r.status?Promise.resolve(n):r.json().then((function(r){var o=function(e,t){var r=e.match(v(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));if(r){var n=r[1];return t&&"get"===t.toLowerCase()?n:n.endsWith("ies")?n.slice(0,-3)+"y":n.endsWith("s")?n.slice(0,-1):n}return null}(e,t.method);return n.next=function(e,t,r){if(function(e){return void 0!==e.offset}(r)){if(null!=r&&r.more&&void 0!==b(r.offset)&&r.limit)return function(){return E(e,w(w({},t),{},{queryParameters:w(w({},t.queryParameters),{},{limit:r.limit.toString(),offset:(r.limit+r.offset).toString()})}))}}else if(function(e){return void 0!==e.cursor}(r)&&null!=r&&r.cursor)return function(){return E(e,w(w({},t),{},{queryParameters:w(w({},t.queryParameters),{},{cursor:r.cursor,limit:r.limit.toString()})}))}}(e,t,r),n.data=r,n.resource=o?r[o]:null,n})).catch((function(){return Promise.reject(n)}))}))}var S=["server","type","data"];function x(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function T(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,S),a="https://".concat(r,"/v2/enqueue");return"change"===o&&(a="https://".concat(r,"/v2/change/enqueue")),function(e,t){return c(e,t).then((function(e){var t=e;return e.json().then((function(r){return t.data=r,t.response=e,t}))}))}(a,T({method:"POST",body:JSON.stringify(i)},s))}var D=function(e){return function(t){return _(T(T({},t),{},{data:T(T({},t.data),{},A({},"event_action",e))}))}},U=D("trigger"),B=D("acknowledge"),R=D("resolve"),k=function(e){return _(T(T({},e),{},{type:"change"}))}})(),PagerDuty=n})(); //# sourceMappingURL=pdjs-legacy.js.map \ No newline at end of file diff --git a/dist/pdjs-legacy.js.map b/dist/pdjs-legacy.js.map index e979727..4237c33 100644 --- a/dist/pdjs-legacy.js.map +++ b/dist/pdjs-legacy.js.map @@ -1 +1 @@ -{"version":3,"file":"pdjs-legacy.js","mappings":"oDAMA,IAAIA,EAA4B,mBAAXC,QAAoD,iBAApBA,OAAOC,SAAwB,SAAUC,GAAO,cAAcA,GAAS,SAAUA,GAAO,OAAOA,GAAyB,mBAAXF,QAAyBE,EAAIC,cAAgBH,QAAUE,IAAQF,OAAOI,UAAY,gBAAkBF,GAIlQG,EAA8B,oBAAXC,aAAqD,IAApBA,OAAOC,SAGmB,YAA/C,oBAATC,KAAuB,YAAcT,EAAQS,QAAuBA,KAAKL,aAAeK,KAAKL,YAAYM,KAGnG,oBAAZC,SAA+C,MAApBA,QAAQC,UAAoBD,QAAQC,SAASC,KAW5FC,EAAQ,GAAYR,G,iBC3BpB,IAAIS,EAAyB,oBAATN,KAAuBA,KAAOO,KAC9CC,EAAW,WACf,SAASC,IACTF,KAAKG,OAAQ,EACbH,KAAKI,aAAeL,EAAOK,aAG3B,OADAF,EAAEb,UAAYU,EACP,IAAIG,EANI,IAQf,SAAUT,IAEQ,SAAUK,GAE1B,IAAIO,EACY,oBAAqBZ,EADjCY,EAEQ,WAAYZ,GAAQ,aAAcR,OAF1CoB,EAIA,eAAgBZ,GAChB,SAAUA,GACV,WACE,IAEE,OADA,IAAIa,MACG,EACP,MAAOC,GACP,OAAO,GALX,GANAF,EAcQ,aAAcZ,EAdtBY,EAeW,gBAAiBZ,EAOhC,GAAIY,EACF,IAAIG,EAAc,CAChB,qBACA,sBACA,6BACA,sBACA,uBACA,sBACA,uBACA,wBACA,yBAGEC,EACFC,YAAYC,QACZ,SAASxB,GACP,OAAOA,GAAOqB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pB2C,EAAS,SAACL,GAAD,OACpBD,EAAM,OAAIC,GAAL,IAAsB5K,KAAM,c","sources":["webpack://PagerDuty/./node_modules/browser-or-node/lib/index.js","webpack://PagerDuty/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://PagerDuty/webpack/bootstrap","webpack://PagerDuty/webpack/runtime/compat get default export","webpack://PagerDuty/webpack/runtime/define property getters","webpack://PagerDuty/webpack/runtime/hasOwnProperty shorthand","webpack://PagerDuty/webpack/runtime/make namespace object","webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n/* global window self */\n\nvar isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n\n/* eslint-disable no-restricted-globals */\nvar isWebWorker = (typeof self === 'undefined' ? 'undefined' : _typeof(self)) === 'object' && self.constructor && self.constructor.name === 'DedicatedWorkerGlobalScope';\n/* eslint-enable no-restricted-globals */\n\nvar isNode = typeof process !== 'undefined' && process.versions != null && process.versions.node != null;\n\n/**\n * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0\n * @see https://github.com/jsdom/jsdom/issues/1537\n */\n/* eslint-disable no-undef */\nvar isJsDom = function isJsDom() {\n return typeof window !== 'undefined' && window.name === 'nodejs' || navigator.userAgent.includes('Node.js') || navigator.userAgent.includes('jsdom');\n};\n\nexports.isBrowser = isBrowser;\nexports.isWebWorker = isWebWorker;\nexports.isNode = isNode;\nexports.isJsDom = isJsDom;","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n}({}));\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* LEGACY-BROWSER-SUPPORT-START */\nimport fetch, {Headers} from 'cross-fetch';\nimport {isBrowser} from 'browser-or-node';\n/* LEGACY-BROWSER-SUPPORT-END */\n\nconst VERSION = '2.0.0';\n\ntype QueryParameter = Record>;\n\nexport interface RequestOptions extends RequestInit {\n queryParameters?: QueryParameter;\n retryCount?: number;\n requestTimeout?: number;\n requestTimer?: any;\n retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000} = options;\n\n url = new URL(url.toString());\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...options,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* LEGACY-BROWSER-SUPPORT-START */\n ...userAgentHeader(),\n /* LEGACY-BROWSER-SUPPORT-END */\n ...options.headers,\n }),\n });\n}\n\nfunction fetch_retry(\n url: string,\n retries: number,\n options: RequestOptions\n): Promise {\n return new Promise((resolve, reject) => {\n fetch(url, options)\n .then(response => {\n // We don't want to `reject` when retries have finished\n // Instead simply stop trying and return.\n if (retries === 0) return resolve(response);\n if (response.status === 429) {\n const {retryTimeout = 20000} = options;\n retryTimeoutPromise(retryTimeout).then(() => {\n fetch_retry(url, retries - 1, options)\n .then(resolve)\n .catch(reject);\n });\n } else {\n clearTimeout(options.requestTimer);\n resolve(response);\n }\n })\n .catch(reject);\n });\n}\n\nconst retryTimeoutPromise = (milliseconds: number) => {\n return new Promise(resolve => setTimeout(resolve, milliseconds));\n};\n\nfunction userAgentHeader(): object {\n if (isBrowser) return {};\n\n return {\n 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`,\n };\n}\n\nfunction applyParameters(url: URL, queryParameters?: QueryParameter): URL {\n if (!queryParameters) return url;\n\n const combinedParameters = url.searchParams;\n\n for (const key of Object.keys(queryParameters)) {\n const parameter = queryParameters[key];\n if (Array.isArray(parameter)) {\n // Support for array based keys like `additional_fields[]`\n parameter.forEach(item => {\n combinedParameters.append(key, item);\n });\n } else {\n combinedParameters.append(key, parameter);\n }\n }\n\n url.search = combinedParameters.toString();\n return url;\n}\n\nfunction applyTimeout(init: RequestOptions, timeout?: number): RequestOptions {\n if (!timeout) return init;\n const timer = setTimeout(() => {}, timeout);\n return {\n ...init,\n requestTimer: timer,\n };\n}\n","import {request, RequestOptions} from './common';\n\nexport interface ShorthandCall {\n (res: string, apiParameters?: Partial): APIPromise;\n}\n\nexport interface PartialCall {\n (apiParameters: APIParameters): APIPromise;\n (apiParameters: Partial): PartialCall;\n get: ShorthandCall;\n post: ShorthandCall;\n put: ShorthandCall;\n patch: ShorthandCall;\n delete: ShorthandCall;\n all: ShorthandCall;\n}\n\nexport type APIParameters = RequestOptions & {\n endpoint?: string;\n url?: string;\n data?: object;\n token?: string;\n tokenType?: string;\n server?: string;\n version?: number;\n} & ({endpoint: string} | {url: string});\n\nexport type APIPromise = Promise;\n\nexport interface APIResponse extends Response {\n data: any;\n resource: any;\n response: Response;\n next?: () => APIPromise;\n}\n\nexport function api(apiParameters: APIParameters): APIPromise;\nexport function api(apiParameters: Partial): PartialCall;\nexport function api(\n apiParameters: Partial\n): APIPromise | PartialCall {\n // If the apiParameters don't include `endpoint` treat it as a partial\n // application.\n if (!apiParameters.endpoint && !apiParameters.url) {\n return partialCall(apiParameters);\n }\n\n // allows for Token and Bearer token types to be used in Authorization\n type typeMap = {\n [key: string]: string;\n };\n\n const types: typeMap = {\n bearer: 'Bearer ',\n token: 'Token token=',\n };\n\n const {\n endpoint,\n server = 'api.pagerduty.com',\n token,\n tokenType = apiParameters.tokenType || 'token',\n url,\n version = 2,\n data,\n ...rest\n } = apiParameters;\n\n const config: RequestOptions = {\n method: 'GET',\n ...rest,\n headers: {\n Accept: `application/vnd.pagerduty+json;version=${version}`,\n Authorization: `${types[tokenType]}${token!}`,\n ...rest.headers,\n },\n };\n\n // Allow `data` for `queryParameters` for requests without bodies.\n if (isReadonlyRequest(config.method!) && data) {\n config.queryParameters =\n config.queryParameters ?? (data as Record);\n } else {\n config.body = JSON.stringify(data);\n }\n\n return apiRequest(\n url ?? `https://${server}/${endpoint!.replace(/^\\/+/, '')}`,\n config\n );\n}\n\nfunction apiRequest(url: string, options: RequestOptions): APIPromise {\n return request(url, options).then(\n (response: Response): APIPromise => {\n const apiResponse = response as APIResponse;\n apiResponse.response = response;\n\n if (response.status === 204) {\n return Promise.resolve(apiResponse);\n }\n\n return response\n .json()\n .then(\n (data): APIResponse => {\n const resource = resourceKey(url, options.method);\n apiResponse.next = nextFunc(url, options, data);\n apiResponse.data = data;\n apiResponse.resource = resource ? data[resource] : null;\n return apiResponse;\n }\n )\n .catch(() => Promise.reject(apiResponse));\n }\n );\n}\n\nfunction resourceKey(url: string, method?: string) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n const resourceName = resource[1];\n if (method && method.toLowerCase() === 'get') {\n return resourceName;\n }\n if (resourceName.endsWith('ies')) {\n return resourceName.slice(0, -3) + 'y';\n } else if (resourceName.endsWith('s')) {\n return resourceName.slice(0, -1);\n }\n return resourceName;\n }\n return null;\n}\n\nfunction isReadonlyRequest(method: string) {\n return !['PUT', 'POST', 'DELETE', 'PATCH'].includes(\n method.toUpperCase() ?? 'GET'\n );\n}\n\ninterface OffsetPagination {\n type: 'offset';\n more?: boolean;\n offset?: number;\n limit?: number;\n}\n\ninterface CursorPagination {\n type: 'cursor';\n cursor?: string;\n limit?: number;\n}\n\nfunction isOffsetPagination(\n data: OffsetPagination | CursorPagination\n): data is OffsetPagination {\n if ((data as OffsetPagination).offset !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction isCursorPagination(\n data: OffsetPagination | CursorPagination\n): data is CursorPagination {\n if ((data as CursorPagination).cursor !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction nextFunc(\n url: string,\n options: RequestOptions,\n data: OffsetPagination | CursorPagination\n) {\n if (isOffsetPagination(data)) {\n if (data?.more && typeof data.offset !== undefined && data.limit) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n limit: data.limit!.toString(),\n offset: (data.limit! + data.offset!).toString(),\n },\n });\n }\n } else if (isCursorPagination(data)) {\n if (data?.cursor) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n cursor: data.cursor!,\n limit: data.limit!.toString(),\n },\n });\n }\n }\n\n return undefined;\n}\n\nfunction partialCall(apiParameters: Partial) {\n const partialParameters = apiParameters;\n const partial = ((apiParameters: Partial) =>\n api({...partialParameters, ...apiParameters})) as PartialCall;\n\n const shorthand = (method: string) => (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise =>\n api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise;\n\n partial.get = shorthand('get');\n partial.post = shorthand('post');\n partial.put = shorthand('put');\n partial.patch = shorthand('patch');\n partial.delete = shorthand('delete');\n\n partial.all = (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise => {\n function allInner(responses: APIResponse[]): Promise {\n const response = responses[responses.length - 1];\n if (!response.next) {\n // Base case, resolve and return all responses.\n return Promise.resolve(responses);\n }\n // If there are still more resources to get then concat and repeat.\n return response\n .next()\n .then(response => allInner(responses.concat([response])));\n }\n\n function repackResponses(responses: APIResponse[]): APIPromise {\n // Repack the responses object to make it more user friendly.\n const repackedResponse = responses.shift() as APIResponse; // Use the first response to build the standard response object\n repackedResponse.data = [repackedResponse.data];\n responses.forEach(response => {\n repackedResponse.data = repackedResponse.data.concat(response.data);\n repackedResponse.resource = repackedResponse.resource.concat(\n response.resource\n );\n });\n return Promise.resolve(repackedResponse);\n }\n\n const method = 'get';\n return (api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise)\n .then(response => allInner([response]))\n .then(responses => repackResponses(responses));\n };\n\n return partial;\n}\n","import {request, RequestOptions} from './common';\n\nexport type Action = 'trigger' | 'acknowledge' | 'resolve';\n\nexport type EventPromise = Promise;\n\nexport interface EventResponse extends Response {\n data: any;\n response: Response;\n}\n\nexport type Severity = 'critical' | 'error' | 'warning' | 'info';\n\nexport interface Image {\n src: string;\n href?: string;\n alt?: string;\n}\n\nexport interface Link {\n href: string;\n text?: string;\n}\n\nexport interface EventPayloadV2 {\n routing_key: string;\n event_action: Action;\n dedup_key?: string;\n payload: {\n summary: string;\n source: string;\n severity: Severity;\n timestamp?: string;\n component?: string;\n group?: string;\n class?: string;\n custom_details?: object;\n };\n images?: Array;\n links?: Array;\n}\n\nexport interface EventParameters extends RequestOptions {\n data: EventPayloadV2;\n type?: string;\n server?: string;\n}\n\nexport interface ChangePayload {\n routing_key: string;\n payload: {\n summary: string;\n source?: string;\n timestamp: string;\n custom_details: object;\n };\n links: Array;\n}\nexport interface ChangeParameters extends RequestOptions {\n data: ChangePayload;\n server?: string;\n}\n\nexport function event(eventParameters: EventParameters): EventPromise {\n const {\n server = 'events.pagerduty.com',\n type = 'event',\n data,\n ...config\n } = eventParameters;\n\n let url = `https://${server}/v2/enqueue`;\n if (type === 'change') {\n url = `https://${server}/v2/change/enqueue`;\n }\n\n return eventFetch(url, {\n method: 'POST',\n body: JSON.stringify(data),\n ...config,\n });\n}\n\nconst shorthand = (action: Action) => (\n eventParameters: EventParameters\n): EventPromise => {\n const typeField = 'event_action';\n\n return event({\n ...eventParameters,\n data: {\n ...eventParameters.data,\n [typeField]: action,\n },\n });\n};\n\nexport const trigger = shorthand('trigger');\nexport const acknowledge = shorthand('acknowledge');\nexport const resolve = shorthand('resolve');\nexport const change = (eventParameters: EventParameters) =>\n event({...eventParameters, type: 'change'});\n\nfunction eventFetch(url: string, options: RequestOptions): EventPromise {\n return request(url, options).then(\n (response: Response): EventPromise => {\n const apiResponse = response as EventResponse;\n return response.json().then(\n (data): EventResponse => {\n apiResponse.data = data;\n apiResponse.response = response;\n return apiResponse;\n }\n );\n }\n );\n}\n"],"names":["_typeof","Symbol","iterator","obj","constructor","prototype","isBrowser","window","document","self","name","process","versions","node","exports","global","this","__self__","F","fetch","DOMException","support","Blob","e","viewClasses","isArrayBufferView","ArrayBuffer","isView","indexOf","Object","toString","call","normalizeName","String","test","TypeError","toLowerCase","normalizeValue","value","iteratorFor","items","next","shift","done","undefined","Headers","headers","map","forEach","append","Array","isArray","header","getOwnPropertyNames","consumed","body","bodyUsed","Promise","reject","fileReaderReady","reader","resolve","onload","result","onerror","error","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","set","buffer","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","get","type","rejected","Error","arrayBuffer","then","text","readAsText","chars","length","i","fromCharCode","join","readArrayBufferAsText","formData","decode","json","JSON","parse","oldValue","has","hasOwnProperty","callback","thisArg","keys","push","values","entries","methods","Request","input","options","method","upcased","url","credentials","mode","signal","toUpperCase","referrer","form","trim","split","bytes","replace","decodeURIComponent","Response","bodyInit","status","ok","statusText","clone","response","redirectStatuses","redirect","RangeError","location","err","message","stack","create","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","key","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","defineProperty","ponyfill","ctx","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","enumerable","prop","r","toStringTag","queryParameters","requestTimeout","applyParameters","URL","applyTimeout","fetch_retry","userAgentHeader","retries","retryTimeout","retryTimeoutPromise","clearTimeout","requestTimer","milliseconds","setTimeout","version","platform","combinedParameters","searchParams","parameter","item","search","timeout","timer","api","apiParameters","endpoint","partialParameters","partial","shorthand","shorthandParameters","post","put","patch","all","allInner","responses","concat","repackedResponse","data","resource","repackResponses","partialCall","server","token","tokenType","rest","config","Accept","Authorization","bearer","includes","stringify","apiRequest","apiResponse","match","resourceName","endsWith","resourceKey","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","eventFetch","action","trigger","acknowledge","change"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"pdjs-legacy.js","mappings":"oDAMA,IAAIA,EAA4B,mBAAXC,QAAoD,iBAApBA,OAAOC,SAAwB,SAAUC,GAAO,cAAcA,GAAS,SAAUA,GAAO,OAAOA,GAAyB,mBAAXF,QAAyBE,EAAIC,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AAM,OACD2B,EAAgB3B,MADjB,QAJY,eAMD6B,SAKNC,EAAUxC,EAAU,WACpByC,EAAczC,EAAU,eACxBrK,EAAUqK,EAAU,WACpB0C,EAAS,SAACL,GAAD,OACpBD,EAAM,OAAIC,GAAL,IAAsB5K,KAAM,c","sources":["webpack://PagerDuty/./node_modules/browser-or-node/lib/index.js","webpack://PagerDuty/./node_modules/cross-fetch/dist/browser-ponyfill.js","webpack://PagerDuty/webpack/bootstrap","webpack://PagerDuty/webpack/runtime/compat get default export","webpack://PagerDuty/webpack/runtime/define property getters","webpack://PagerDuty/webpack/runtime/hasOwnProperty shorthand","webpack://PagerDuty/webpack/runtime/make namespace object","webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts"],"sourcesContent":["\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar isBrowser = typeof window !== \"undefined\" && typeof window.document !== \"undefined\";\n\nvar isNode = typeof process !== \"undefined\" && process.versions != null && process.versions.node != null;\n\nvar isWebWorker = (typeof self === \"undefined\" ? \"undefined\" : _typeof(self)) === \"object\" && self.constructor && self.constructor.name === \"DedicatedWorkerGlobalScope\";\n\n/**\n * @see https://github.com/jsdom/jsdom/releases/tag/12.0.0\n * @see https://github.com/jsdom/jsdom/issues/1537\n */\nvar isJsDom = typeof window !== \"undefined\" && window.name === \"nodejs\" || typeof navigator !== \"undefined\" && (navigator.userAgent.includes(\"Node.js\") || navigator.userAgent.includes(\"jsdom\"));\n\nvar isDeno = typeof Deno !== \"undefined\" && typeof Deno.core !== \"undefined\";\n\nexports.isBrowser = isBrowser;\nexports.isWebWorker = isWebWorker;\nexports.isNode = isNode;\nexports.isJsDom = isJsDom;\nexports.isDeno = isDeno;","var global = typeof self !== 'undefined' ? self : this;\nvar __self__ = (function () {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = global.DOMException\n}\nF.prototype = global;\nreturn new F();\n})();\n(function(self) {\n\nvar irrelevant = (function (exports) {\n\n var support = {\n searchParams: 'URLSearchParams' in self,\n iterable: 'Symbol' in self && 'iterator' in Symbol,\n blob:\n 'FileReader' in self &&\n 'Blob' in self &&\n (function() {\n try {\n new Blob();\n return true\n } catch (e) {\n return false\n }\n })(),\n formData: 'FormData' in self,\n arrayBuffer: 'ArrayBuffer' in self\n };\n\n function isDataView(obj) {\n return obj && DataView.prototype.isPrototypeOf(obj)\n }\n\n if (support.arrayBuffer) {\n var viewClasses = [\n '[object Int8Array]',\n '[object Uint8Array]',\n '[object Uint8ClampedArray]',\n '[object Int16Array]',\n '[object Uint16Array]',\n '[object Int32Array]',\n '[object Uint32Array]',\n '[object Float32Array]',\n '[object Float64Array]'\n ];\n\n var isArrayBufferView =\n ArrayBuffer.isView ||\n function(obj) {\n return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1\n };\n }\n\n function normalizeName(name) {\n if (typeof name !== 'string') {\n name = String(name);\n }\n if (/[^a-z0-9\\-#$%&'*+.^_`|~]/i.test(name)) {\n throw new TypeError('Invalid character in header field name')\n }\n return name.toLowerCase()\n }\n\n function normalizeValue(value) {\n if (typeof value !== 'string') {\n value = String(value);\n }\n return value\n }\n\n // Build a destructive iterator for the value list\n function iteratorFor(items) {\n var iterator = {\n next: function() {\n var value = items.shift();\n return {done: value === undefined, value: value}\n }\n };\n\n if (support.iterable) {\n iterator[Symbol.iterator] = function() {\n return iterator\n };\n }\n\n return iterator\n }\n\n function Headers(headers) {\n this.map = {};\n\n if (headers instanceof Headers) {\n headers.forEach(function(value, name) {\n this.append(name, value);\n }, this);\n } else if (Array.isArray(headers)) {\n headers.forEach(function(header) {\n this.append(header[0], header[1]);\n }, this);\n } else if (headers) {\n Object.getOwnPropertyNames(headers).forEach(function(name) {\n this.append(name, headers[name]);\n }, this);\n }\n }\n\n Headers.prototype.append = function(name, value) {\n name = normalizeName(name);\n value = normalizeValue(value);\n var oldValue = this.map[name];\n this.map[name] = oldValue ? oldValue + ', ' + value : value;\n };\n\n Headers.prototype['delete'] = function(name) {\n delete this.map[normalizeName(name)];\n };\n\n Headers.prototype.get = function(name) {\n name = normalizeName(name);\n return this.has(name) ? this.map[name] : null\n };\n\n Headers.prototype.has = function(name) {\n return this.map.hasOwnProperty(normalizeName(name))\n };\n\n Headers.prototype.set = function(name, value) {\n this.map[normalizeName(name)] = normalizeValue(value);\n };\n\n Headers.prototype.forEach = function(callback, thisArg) {\n for (var name in this.map) {\n if (this.map.hasOwnProperty(name)) {\n callback.call(thisArg, this.map[name], name, this);\n }\n }\n };\n\n Headers.prototype.keys = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push(name);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.values = function() {\n var items = [];\n this.forEach(function(value) {\n items.push(value);\n });\n return iteratorFor(items)\n };\n\n Headers.prototype.entries = function() {\n var items = [];\n this.forEach(function(value, name) {\n items.push([name, value]);\n });\n return iteratorFor(items)\n };\n\n if (support.iterable) {\n Headers.prototype[Symbol.iterator] = Headers.prototype.entries;\n }\n\n function consumed(body) {\n if (body.bodyUsed) {\n return Promise.reject(new TypeError('Already read'))\n }\n body.bodyUsed = true;\n }\n\n function fileReaderReady(reader) {\n return new Promise(function(resolve, reject) {\n reader.onload = function() {\n resolve(reader.result);\n };\n reader.onerror = function() {\n reject(reader.error);\n };\n })\n }\n\n function readBlobAsArrayBuffer(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsArrayBuffer(blob);\n return promise\n }\n\n function readBlobAsText(blob) {\n var reader = new FileReader();\n var promise = fileReaderReady(reader);\n reader.readAsText(blob);\n return promise\n }\n\n function readArrayBufferAsText(buf) {\n var view = new Uint8Array(buf);\n var chars = new Array(view.length);\n\n for (var i = 0; i < view.length; i++) {\n chars[i] = String.fromCharCode(view[i]);\n }\n return chars.join('')\n }\n\n function bufferClone(buf) {\n if (buf.slice) {\n return buf.slice(0)\n } else {\n var view = new Uint8Array(buf.byteLength);\n view.set(new Uint8Array(buf));\n return view.buffer\n }\n }\n\n function Body() {\n this.bodyUsed = false;\n\n this._initBody = function(body) {\n this._bodyInit = body;\n if (!body) {\n this._bodyText = '';\n } else if (typeof body === 'string') {\n this._bodyText = body;\n } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {\n this._bodyBlob = body;\n } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {\n this._bodyFormData = body;\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this._bodyText = body.toString();\n } else if (support.arrayBuffer && support.blob && isDataView(body)) {\n this._bodyArrayBuffer = bufferClone(body.buffer);\n // IE 10-11 can't handle a DataView body.\n this._bodyInit = new Blob([this._bodyArrayBuffer]);\n } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {\n this._bodyArrayBuffer = bufferClone(body);\n } else {\n this._bodyText = body = Object.prototype.toString.call(body);\n }\n\n if (!this.headers.get('content-type')) {\n if (typeof body === 'string') {\n this.headers.set('content-type', 'text/plain;charset=UTF-8');\n } else if (this._bodyBlob && this._bodyBlob.type) {\n this.headers.set('content-type', this._bodyBlob.type);\n } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {\n this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');\n }\n }\n };\n\n if (support.blob) {\n this.blob = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return Promise.resolve(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(new Blob([this._bodyArrayBuffer]))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as blob')\n } else {\n return Promise.resolve(new Blob([this._bodyText]))\n }\n };\n\n this.arrayBuffer = function() {\n if (this._bodyArrayBuffer) {\n return consumed(this) || Promise.resolve(this._bodyArrayBuffer)\n } else {\n return this.blob().then(readBlobAsArrayBuffer)\n }\n };\n }\n\n this.text = function() {\n var rejected = consumed(this);\n if (rejected) {\n return rejected\n }\n\n if (this._bodyBlob) {\n return readBlobAsText(this._bodyBlob)\n } else if (this._bodyArrayBuffer) {\n return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))\n } else if (this._bodyFormData) {\n throw new Error('could not read FormData body as text')\n } else {\n return Promise.resolve(this._bodyText)\n }\n };\n\n if (support.formData) {\n this.formData = function() {\n return this.text().then(decode)\n };\n }\n\n this.json = function() {\n return this.text().then(JSON.parse)\n };\n\n return this\n }\n\n // HTTP methods whose capitalization should be normalized\n var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];\n\n function normalizeMethod(method) {\n var upcased = method.toUpperCase();\n return methods.indexOf(upcased) > -1 ? upcased : method\n }\n\n function Request(input, options) {\n options = options || {};\n var body = options.body;\n\n if (input instanceof Request) {\n if (input.bodyUsed) {\n throw new TypeError('Already read')\n }\n this.url = input.url;\n this.credentials = input.credentials;\n if (!options.headers) {\n this.headers = new Headers(input.headers);\n }\n this.method = input.method;\n this.mode = input.mode;\n this.signal = input.signal;\n if (!body && input._bodyInit != null) {\n body = input._bodyInit;\n input.bodyUsed = true;\n }\n } else {\n this.url = String(input);\n }\n\n this.credentials = options.credentials || this.credentials || 'same-origin';\n if (options.headers || !this.headers) {\n this.headers = new Headers(options.headers);\n }\n this.method = normalizeMethod(options.method || this.method || 'GET');\n this.mode = options.mode || this.mode || null;\n this.signal = options.signal || this.signal;\n this.referrer = null;\n\n if ((this.method === 'GET' || this.method === 'HEAD') && body) {\n throw new TypeError('Body not allowed for GET or HEAD requests')\n }\n this._initBody(body);\n }\n\n Request.prototype.clone = function() {\n return new Request(this, {body: this._bodyInit})\n };\n\n function decode(body) {\n var form = new FormData();\n body\n .trim()\n .split('&')\n .forEach(function(bytes) {\n if (bytes) {\n var split = bytes.split('=');\n var name = split.shift().replace(/\\+/g, ' ');\n var value = split.join('=').replace(/\\+/g, ' ');\n form.append(decodeURIComponent(name), decodeURIComponent(value));\n }\n });\n return form\n }\n\n function parseHeaders(rawHeaders) {\n var headers = new Headers();\n // Replace instances of \\r\\n and \\n followed by at least one space or horizontal tab with a space\n // https://tools.ietf.org/html/rfc7230#section-3.2\n var preProcessedHeaders = rawHeaders.replace(/\\r?\\n[\\t ]+/g, ' ');\n preProcessedHeaders.split(/\\r?\\n/).forEach(function(line) {\n var parts = line.split(':');\n var key = parts.shift().trim();\n if (key) {\n var value = parts.join(':').trim();\n headers.append(key, value);\n }\n });\n return headers\n }\n\n Body.call(Request.prototype);\n\n function Response(bodyInit, options) {\n if (!options) {\n options = {};\n }\n\n this.type = 'default';\n this.status = options.status === undefined ? 200 : options.status;\n this.ok = this.status >= 200 && this.status < 300;\n this.statusText = 'statusText' in options ? options.statusText : 'OK';\n this.headers = new Headers(options.headers);\n this.url = options.url || '';\n this._initBody(bodyInit);\n }\n\n Body.call(Response.prototype);\n\n Response.prototype.clone = function() {\n return new Response(this._bodyInit, {\n status: this.status,\n statusText: this.statusText,\n headers: new Headers(this.headers),\n url: this.url\n })\n };\n\n Response.error = function() {\n var response = new Response(null, {status: 0, statusText: ''});\n response.type = 'error';\n return response\n };\n\n var redirectStatuses = [301, 302, 303, 307, 308];\n\n Response.redirect = function(url, status) {\n if (redirectStatuses.indexOf(status) === -1) {\n throw new RangeError('Invalid status code')\n }\n\n return new Response(null, {status: status, headers: {location: url}})\n };\n\n exports.DOMException = self.DOMException;\n try {\n new exports.DOMException();\n } catch (err) {\n exports.DOMException = function(message, name) {\n this.message = message;\n this.name = name;\n var error = Error(message);\n this.stack = error.stack;\n };\n exports.DOMException.prototype = Object.create(Error.prototype);\n exports.DOMException.prototype.constructor = exports.DOMException;\n }\n\n function fetch(input, init) {\n return new Promise(function(resolve, reject) {\n var request = new Request(input, init);\n\n if (request.signal && request.signal.aborted) {\n return reject(new exports.DOMException('Aborted', 'AbortError'))\n }\n\n var xhr = new XMLHttpRequest();\n\n function abortXhr() {\n xhr.abort();\n }\n\n xhr.onload = function() {\n var options = {\n status: xhr.status,\n statusText: xhr.statusText,\n headers: parseHeaders(xhr.getAllResponseHeaders() || '')\n };\n options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');\n var body = 'response' in xhr ? xhr.response : xhr.responseText;\n resolve(new Response(body, options));\n };\n\n xhr.onerror = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.ontimeout = function() {\n reject(new TypeError('Network request failed'));\n };\n\n xhr.onabort = function() {\n reject(new exports.DOMException('Aborted', 'AbortError'));\n };\n\n xhr.open(request.method, request.url, true);\n\n if (request.credentials === 'include') {\n xhr.withCredentials = true;\n } else if (request.credentials === 'omit') {\n xhr.withCredentials = false;\n }\n\n if ('responseType' in xhr && support.blob) {\n xhr.responseType = 'blob';\n }\n\n request.headers.forEach(function(value, name) {\n xhr.setRequestHeader(name, value);\n });\n\n if (request.signal) {\n request.signal.addEventListener('abort', abortXhr);\n\n xhr.onreadystatechange = function() {\n // DONE (success or failure)\n if (xhr.readyState === 4) {\n request.signal.removeEventListener('abort', abortXhr);\n }\n };\n }\n\n xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);\n })\n }\n\n fetch.polyfill = true;\n\n if (!self.fetch) {\n self.fetch = fetch;\n self.Headers = Headers;\n self.Request = Request;\n self.Response = Response;\n }\n\n exports.Headers = Headers;\n exports.Request = Request;\n exports.Response = Response;\n exports.fetch = fetch;\n\n Object.defineProperty(exports, '__esModule', { value: true });\n\n return exports;\n\n}({}));\n})(__self__);\n__self__.fetch.ponyfill = true;\n// Remove \"polyfill\" property added by whatwg-fetch\ndelete __self__.fetch.polyfill;\n// Choose between native implementation (global) or custom implementation (__self__)\n// var ctx = global.fetch ? global : __self__;\nvar ctx = __self__; // this line disable service worker support temporarily\nexports = ctx.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = ctx.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = ctx.Headers\nexports.Request = ctx.Request\nexports.Response = ctx.Response\nmodule.exports = exports\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// getDefaultExport function for compatibility with non-harmony modules\n__webpack_require__.n = (module) => {\n\tvar getter = module && module.__esModule ?\n\t\t() => (module['default']) :\n\t\t() => (module);\n\t__webpack_require__.d(getter, { a: getter });\n\treturn getter;\n};","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* LEGACY-BROWSER-SUPPORT-START */\nimport fetch, {Headers} from 'cross-fetch';\nimport {isBrowser, isNode, isWebWorker, isJsDom, isDeno} from 'browser-or-node';\n/* LEGACY-BROWSER-SUPPORT-END */\n\nconst VERSION = '2.0.0';\n\ntype QueryParameter = Record>;\n\nexport interface RequestOptions extends RequestInit {\n queryParameters?: QueryParameter;\n retryCount?: number;\n requestTimeout?: number;\n requestTimer?: any;\n retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000} = options;\n\n url = new URL(url.toString());\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...options,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* LEGACY-BROWSER-SUPPORT-START */\n ...userAgentHeader(),\n /* LEGACY-BROWSER-SUPPORT-END */\n ...options.headers,\n }),\n });\n}\n\nfunction fetch_retry(\n url: string,\n retries: number,\n options: RequestOptions\n): Promise {\n return new Promise((resolve, reject) => {\n fetch(url, options)\n .then(response => {\n // We don't want to `reject` when retries have finished\n // Instead simply stop trying and return.\n if (retries === 0) return resolve(response);\n if (response.status === 429) {\n const {retryTimeout = 20000} = options;\n retryTimeoutPromise(retryTimeout).then(() => {\n fetch_retry(url, retries - 1, options)\n .then(resolve)\n .catch(reject);\n });\n } else {\n clearTimeout(options.requestTimer);\n resolve(response);\n }\n })\n .catch(reject);\n });\n}\n\nconst retryTimeoutPromise = (milliseconds: number) => {\n return new Promise(resolve => setTimeout(resolve, milliseconds));\n};\n\nfunction userAgentHeader(): object {\n if (isNode) {\n return {\n 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`,\n };\n } else if (isWebWorker) {\n return {\n 'User-Agent': `pdjs/${VERSION} (WebWorker)`,\n };\n } else if (isJsDom) {\n return {\n 'User-Agent': `pdjs/${VERSION} (JsDom)`,\n };\n } else if (isDeno) {\n return {\n 'User-Agent': `pdjs/${VERSION} (Deno)`,\n };\n } else if (isBrowser) {\n return {\n // Note: This will not work consistently for all browsers as some silently drop the userAgent Header.\n 'User-Agent': `pdjs/${VERSION} (${window.navigator.userAgent})`,\n };\n } else {\n return {};\n }\n}\n\nfunction applyParameters(url: URL, queryParameters?: QueryParameter): URL {\n if (!queryParameters) return url;\n\n const combinedParameters = url.searchParams;\n\n for (const key of Object.keys(queryParameters)) {\n const parameter = queryParameters[key];\n if (Array.isArray(parameter)) {\n // Support for array based keys like `additional_fields[]`\n parameter.forEach(item => {\n combinedParameters.append(key, item);\n });\n } else {\n combinedParameters.append(key, parameter);\n }\n }\n\n url.search = combinedParameters.toString();\n return url;\n}\n\nfunction applyTimeout(init: RequestOptions, timeout?: number): RequestOptions {\n if (!timeout) return init;\n const timer = setTimeout(() => {}, timeout);\n return {\n ...init,\n requestTimer: timer,\n };\n}\n","import {request, RequestOptions} from './common';\n\nexport interface ShorthandCall {\n (res: string, apiParameters?: Partial): APIPromise;\n}\n\nexport interface PartialCall {\n (apiParameters: APIParameters): APIPromise;\n (apiParameters: Partial): PartialCall;\n get: ShorthandCall;\n post: ShorthandCall;\n put: ShorthandCall;\n patch: ShorthandCall;\n delete: ShorthandCall;\n all: ShorthandCall;\n}\n\nexport type APIParameters = RequestOptions & {\n endpoint?: string;\n url?: string;\n data?: object;\n token?: string;\n tokenType?: string;\n server?: string;\n version?: number;\n} & ({endpoint: string} | {url: string});\n\nexport type APIPromise = Promise;\n\nexport interface APIResponse extends Response {\n data: any;\n resource: any;\n response: Response;\n next?: () => APIPromise;\n}\n\nexport function api(apiParameters: APIParameters): APIPromise;\nexport function api(apiParameters: Partial): PartialCall;\nexport function api(\n apiParameters: Partial\n): APIPromise | PartialCall {\n // If the apiParameters don't include `endpoint` treat it as a partial\n // application.\n if (!apiParameters.endpoint && !apiParameters.url) {\n return partialCall(apiParameters);\n }\n\n // allows for Token and Bearer token types to be used in Authorization\n type typeMap = {\n [key: string]: string;\n };\n\n const types: typeMap = {\n bearer: 'Bearer ',\n token: 'Token token=',\n };\n\n const {\n endpoint,\n server = 'api.pagerduty.com',\n token,\n tokenType = apiParameters.tokenType || 'token',\n url,\n version = 2,\n data,\n ...rest\n } = apiParameters;\n\n const config: RequestOptions = {\n method: 'GET',\n ...rest,\n headers: {\n Accept: `application/vnd.pagerduty+json;version=${version}`,\n Authorization: `${types[tokenType]}${token!}`,\n ...rest.headers,\n },\n };\n\n // Allow `data` for `queryParameters` for requests without bodies.\n if (isReadonlyRequest(config.method!) && data) {\n config.queryParameters =\n config.queryParameters ?? (data as Record);\n } else {\n config.body = JSON.stringify(data);\n }\n\n return apiRequest(\n url ?? `https://${server}/${endpoint!.replace(/^\\/+/, '')}`,\n config\n );\n}\n\nfunction apiRequest(url: string, options: RequestOptions): APIPromise {\n return request(url, options).then(\n (response: Response): APIPromise => {\n const apiResponse = response as APIResponse;\n apiResponse.response = response;\n\n if (response.status === 204) {\n return Promise.resolve(apiResponse);\n }\n\n return response\n .json()\n .then(\n (data): APIResponse => {\n const resource = resourceKey(url, options.method);\n apiResponse.next = nextFunc(url, options, data);\n apiResponse.data = data;\n apiResponse.resource = resource ? data[resource] : null;\n return apiResponse;\n }\n )\n .catch(() => Promise.reject(apiResponse));\n }\n );\n}\n\nfunction resourceKey(url: string, method?: string) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n const resourceName = resource[1];\n if (method && method.toLowerCase() === 'get') {\n return resourceName;\n }\n if (resourceName.endsWith('ies')) {\n return resourceName.slice(0, -3) + 'y';\n } else if (resourceName.endsWith('s')) {\n return resourceName.slice(0, -1);\n }\n return resourceName;\n }\n return null;\n}\n\nfunction isReadonlyRequest(method: string) {\n return !['PUT', 'POST', 'DELETE', 'PATCH'].includes(\n method.toUpperCase() ?? 'GET'\n );\n}\n\ninterface OffsetPagination {\n type: 'offset';\n more?: boolean;\n offset?: number;\n limit?: number;\n}\n\ninterface CursorPagination {\n type: 'cursor';\n cursor?: string;\n limit?: number;\n}\n\nfunction isOffsetPagination(\n data: OffsetPagination | CursorPagination\n): data is OffsetPagination {\n if ((data as OffsetPagination).offset !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction isCursorPagination(\n data: OffsetPagination | CursorPagination\n): data is CursorPagination {\n if ((data as CursorPagination).cursor !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction nextFunc(\n url: string,\n options: RequestOptions,\n data: OffsetPagination | CursorPagination\n) {\n if (isOffsetPagination(data)) {\n if (data?.more && typeof data.offset !== undefined && data.limit) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n limit: data.limit!.toString(),\n offset: (data.limit! + data.offset!).toString(),\n },\n });\n }\n } else if (isCursorPagination(data)) {\n if (data?.cursor) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n cursor: data.cursor!,\n limit: data.limit!.toString(),\n },\n });\n }\n }\n\n return undefined;\n}\n\nfunction partialCall(apiParameters: Partial) {\n const partialParameters = apiParameters;\n const partial = ((apiParameters: Partial) =>\n api({...partialParameters, ...apiParameters})) as PartialCall;\n\n const shorthand = (method: string) => (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise =>\n api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise;\n\n partial.get = shorthand('get');\n partial.post = shorthand('post');\n partial.put = shorthand('put');\n partial.patch = shorthand('patch');\n partial.delete = shorthand('delete');\n\n partial.all = (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise => {\n function allInner(responses: APIResponse[]): Promise {\n const response = responses[responses.length - 1];\n if (!response.next) {\n // Base case, resolve and return all responses.\n return Promise.resolve(responses);\n }\n // If there are still more resources to get then concat and repeat.\n return response\n .next()\n .then(response => allInner(responses.concat([response])));\n }\n\n function repackResponses(responses: APIResponse[]): APIPromise {\n // Repack the responses object to make it more user friendly.\n const repackedResponse = responses.shift() as APIResponse; // Use the first response to build the standard response object\n repackedResponse.data = [repackedResponse.data];\n responses.forEach(response => {\n repackedResponse.data = repackedResponse.data.concat(response.data);\n repackedResponse.resource = repackedResponse.resource.concat(\n response.resource\n );\n });\n return Promise.resolve(repackedResponse);\n }\n\n const method = 'get';\n return (api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise)\n .then(response => allInner([response]))\n .then(responses => repackResponses(responses));\n };\n\n return partial;\n}\n","import {request, RequestOptions} from './common';\n\nexport type Action = 'trigger' | 'acknowledge' | 'resolve';\n\nexport type EventPromise = Promise;\n\nexport interface EventResponse extends Response {\n data: any;\n response: Response;\n}\n\nexport type Severity = 'critical' | 'error' | 'warning' | 'info';\n\nexport interface Image {\n src: string;\n href?: string;\n alt?: string;\n}\n\nexport interface Link {\n href: string;\n text?: string;\n}\n\nexport interface EventPayloadV2 {\n routing_key: string;\n event_action: Action;\n dedup_key?: string;\n payload: {\n summary: string;\n source: string;\n severity: Severity;\n timestamp?: string;\n component?: string;\n group?: string;\n class?: string;\n custom_details?: object;\n };\n images?: Array;\n links?: Array;\n}\n\nexport interface EventParameters extends RequestOptions {\n data: EventPayloadV2;\n type?: string;\n server?: string;\n}\n\nexport interface ChangePayload {\n routing_key: string;\n payload: {\n summary: string;\n source?: string;\n timestamp: string;\n custom_details: object;\n };\n links: Array;\n}\nexport interface ChangeParameters extends RequestOptions {\n data: ChangePayload;\n server?: string;\n}\n\nexport function event(eventParameters: EventParameters): EventPromise {\n const {\n server = 'events.pagerduty.com',\n type = 'event',\n data,\n ...config\n } = eventParameters;\n\n let url = `https://${server}/v2/enqueue`;\n if (type === 'change') {\n url = `https://${server}/v2/change/enqueue`;\n }\n\n return eventFetch(url, {\n method: 'POST',\n body: JSON.stringify(data),\n ...config,\n });\n}\n\nconst shorthand = (action: Action) => (\n eventParameters: EventParameters\n): EventPromise => {\n const typeField = 'event_action';\n\n return event({\n ...eventParameters,\n data: {\n ...eventParameters.data,\n [typeField]: action,\n },\n });\n};\n\nexport const trigger = shorthand('trigger');\nexport const acknowledge = shorthand('acknowledge');\nexport const resolve = shorthand('resolve');\nexport const change = (eventParameters: EventParameters) =>\n event({...eventParameters, type: 'change'});\n\nfunction eventFetch(url: string, options: RequestOptions): EventPromise {\n return request(url, options).then(\n (response: Response): EventPromise => {\n const apiResponse = response as EventResponse;\n return response.json().then(\n (data): EventResponse => {\n apiResponse.data = data;\n apiResponse.response = response;\n return apiResponse;\n }\n );\n }\n );\n}\n"],"names":["_typeof","Symbol","iterator","obj","constructor","prototype","isBrowser","window","document","isNode","process","versions","node","isWebWorker","self","name","isJsDom","navigator","userAgent","includes","isDeno","Deno","core","exports","global","this","__self__","F","fetch","DOMException","support","Blob","e","viewClasses","isArrayBufferView","ArrayBuffer","isView","indexOf","Object","toString","call","normalizeName","String","test","TypeError","toLowerCase","normalizeValue","value","iteratorFor","items","next","shift","done","undefined","Headers","headers","map","forEach","append","Array","isArray","header","getOwnPropertyNames","consumed","body","bodyUsed","Promise","reject","fileReaderReady","reader","resolve","onload","result","onerror","error","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","slice","view","Uint8Array","byteLength","set","buffer","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","get","type","rejected","Error","arrayBuffer","then","text","readAsText","chars","length","i","fromCharCode","join","readArrayBufferAsText","formData","decode","json","JSON","parse","oldValue","has","hasOwnProperty","callback","thisArg","keys","push","values","entries","methods","Request","input","options","method","upcased","url","credentials","mode","signal","toUpperCase","referrer","form","trim","split","bytes","replace","decodeURIComponent","Response","bodyInit","status","ok","statusText","clone","response","redirectStatuses","redirect","RangeError","location","err","message","stack","create","init","request","aborted","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","key","responseURL","responseText","ontimeout","onabort","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","removeEventListener","send","polyfill","defineProperty","ponyfill","ctx","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","o","enumerable","prop","r","toStringTag","VERSION","queryParameters","requestTimeout","applyParameters","URL","applyTimeout","fetch_retry","userAgentHeader","retries","retryTimeout","retryTimeoutPromise","clearTimeout","requestTimer","milliseconds","setTimeout","version","platform","combinedParameters","searchParams","parameter","item","search","timeout","timer","api","apiParameters","endpoint","partialParameters","partial","shorthand","shorthandParameters","post","put","patch","all","allInner","responses","concat","repackedResponse","data","resource","repackResponses","partialCall","server","token","tokenType","rest","config","Accept","Authorization","bearer","stringify","apiRequest","apiResponse","match","resourceName","endsWith","resourceKey","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","eventFetch","action","trigger","acknowledge","change"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pdjs.js.map b/dist/pdjs.js.map index 05fffae..72d12c1 100644 --- a/dist/pdjs.js.map +++ b/dist/pdjs.js.map @@ -1 +1 @@ -{"version":3,"file":"pdjs.js","mappings":"iCACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC,IAAKN,EAAWC,MCJ3EH,EAAwB,CAACS,EAAKC,IAAUL,OAAOM,UAAUC,eAAeC,KAAKJ,EAAKC,GCClFV,EAAyBC,IACH,oBAAXa,QAA0BA,OAAOC,aAC1CV,OAAOC,eAAeL,EAASa,OAAOC,YAAa,CAAEC,MAAO,WAE7DX,OAAOC,eAAeL,EAAS,aAAc,CAAEe,OAAO,M,4rBCUhD,SAASC,EACdC,GAEmB,IADnBC,EACmB,uDADO,GAE1B,EAAkDA,EAA3CC,EAAP,EAAOA,gBAAP,IAAwBC,eAAAA,OAAxB,MAAyC,IAAzC,EAMA,OAHAH,EAAMI,EADNJ,EAAM,IAAIK,IAAIL,EAAIM,YACSJ,GAC3BD,EAAUM,EAAaN,EAASE,GAEzBK,EAAYR,EAAIM,WAAY,EAAjB,OACbL,GADa,IAEhBQ,QAAS,IAAIC,QAAJ,GACP,eAAgB,mCAEbT,EAAQQ,aAKjB,SAASD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strap","webpack://PagerDuty/webpack/runtime/define property getters","webpack://PagerDuty/webpack/runtime/hasOwnProperty shorthand","webpack://PagerDuty/webpack/runtime/make namespace object","webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* webpack-strip-block:removed */\n\nconst VERSION = '2.0.0';\n\ntype QueryParameter = Record>;\n\nexport interface RequestOptions extends RequestInit {\n queryParameters?: QueryParameter;\n retryCount?: number;\n requestTimeout?: number;\n requestTimer?: any;\n retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000} = options;\n\n url = new URL(url.toString());\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...options,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* webpack-strip-block:removed */\n ...options.headers,\n }),\n });\n}\n\nfunction fetch_retry(\n url: string,\n retries: number,\n options: RequestOptions\n): Promise {\n return new Promise((resolve, reject) => {\n fetch(url, options)\n .then(response => {\n // We don't want to `reject` when retries have finished\n // Instead simply stop trying and return.\n if (retries === 0) return resolve(response);\n if (response.status === 429) {\n const {retryTimeout = 20000} = options;\n retryTimeoutPromise(retryTimeout).then(() => {\n fetch_retry(url, retries - 1, options)\n .then(resolve)\n .catch(reject);\n });\n } else {\n clearTimeout(options.requestTimer);\n resolve(response);\n }\n })\n .catch(reject);\n });\n}\n\nconst retryTimeoutPromise = (milliseconds: number) => {\n return new Promise(resolve => setTimeout(resolve, milliseconds));\n};\n\nfunction userAgentHeader(): object {\n if (isBrowser) return {};\n\n return {\n 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`,\n };\n}\n\nfunction applyParameters(url: URL, queryParameters?: QueryParameter): URL {\n if (!queryParameters) return url;\n\n const combinedParameters = url.searchParams;\n\n for (const key of Object.keys(queryParameters)) {\n const parameter = queryParameters[key];\n if (Array.isArray(parameter)) {\n // Support for array based keys like `additional_fields[]`\n parameter.forEach(item => {\n combinedParameters.append(key, item);\n });\n } else {\n combinedParameters.append(key, parameter);\n }\n }\n\n url.search = combinedParameters.toString();\n return url;\n}\n\nfunction applyTimeout(init: RequestOptions, timeout?: number): RequestOptions {\n if (!timeout) return init;\n const timer = setTimeout(() => {}, timeout);\n return {\n ...init,\n requestTimer: timer,\n };\n}\n","import {request, RequestOptions} from './common';\n\nexport interface ShorthandCall {\n (res: string, apiParameters?: Partial): APIPromise;\n}\n\nexport interface PartialCall {\n (apiParameters: APIParameters): APIPromise;\n (apiParameters: Partial): PartialCall;\n get: ShorthandCall;\n post: ShorthandCall;\n put: ShorthandCall;\n patch: ShorthandCall;\n delete: ShorthandCall;\n all: ShorthandCall;\n}\n\nexport type APIParameters = RequestOptions & {\n endpoint?: string;\n url?: string;\n data?: object;\n token?: string;\n tokenType?: string;\n server?: string;\n version?: number;\n} & ({endpoint: string} | {url: string});\n\nexport type APIPromise = Promise;\n\nexport interface APIResponse extends Response {\n data: any;\n resource: any;\n response: Response;\n next?: () => APIPromise;\n}\n\nexport function api(apiParameters: APIParameters): APIPromise;\nexport function api(apiParameters: Partial): PartialCall;\nexport function api(\n apiParameters: Partial\n): APIPromise | PartialCall {\n // If the apiParameters don't include `endpoint` treat it as a partial\n // application.\n if (!apiParameters.endpoint && !apiParameters.url) {\n return partialCall(apiParameters);\n }\n\n // allows for Token and Bearer token types to be used in Authorization\n type typeMap = {\n [key: string]: string;\n };\n\n const types: typeMap = {\n bearer: 'Bearer ',\n token: 'Token token=',\n };\n\n const {\n endpoint,\n server = 'api.pagerduty.com',\n token,\n tokenType = apiParameters.tokenType || 'token',\n url,\n version = 2,\n data,\n ...rest\n } = apiParameters;\n\n const config: RequestOptions = {\n method: 'GET',\n ...rest,\n headers: {\n Accept: `application/vnd.pagerduty+json;version=${version}`,\n Authorization: `${types[tokenType]}${token!}`,\n ...rest.headers,\n },\n };\n\n // Allow `data` for `queryParameters` for requests without bodies.\n if (isReadonlyRequest(config.method!) && data) {\n config.queryParameters =\n config.queryParameters ?? (data as Record);\n } else {\n config.body = JSON.stringify(data);\n }\n\n return apiRequest(\n url ?? `https://${server}/${endpoint!.replace(/^\\/+/, '')}`,\n config\n );\n}\n\nfunction apiRequest(url: string, options: RequestOptions): APIPromise {\n return request(url, options).then(\n (response: Response): APIPromise => {\n const apiResponse = response as APIResponse;\n apiResponse.response = response;\n\n if (response.status === 204) {\n return Promise.resolve(apiResponse);\n }\n\n return response\n .json()\n .then(\n (data): APIResponse => {\n const resource = resourceKey(url, options.method);\n apiResponse.next = nextFunc(url, options, data);\n apiResponse.data = data;\n apiResponse.resource = resource ? data[resource] : null;\n return apiResponse;\n }\n )\n .catch(() => Promise.reject(apiResponse));\n }\n );\n}\n\nfunction resourceKey(url: string, method?: string) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n const resourceName = resource[1];\n if (method && method.toLowerCase() === 'get') {\n return resourceName;\n }\n if (resourceName.endsWith('ies')) {\n return resourceName.slice(0, -3) + 'y';\n } else if (resourceName.endsWith('s')) {\n return resourceName.slice(0, -1);\n }\n return resourceName;\n }\n return null;\n}\n\nfunction isReadonlyRequest(method: string) {\n return !['PUT', 'POST', 'DELETE', 'PATCH'].includes(\n method.toUpperCase() ?? 'GET'\n );\n}\n\ninterface OffsetPagination {\n type: 'offset';\n more?: boolean;\n offset?: number;\n limit?: number;\n}\n\ninterface CursorPagination {\n type: 'cursor';\n cursor?: string;\n limit?: number;\n}\n\nfunction isOffsetPagination(\n data: OffsetPagination | CursorPagination\n): data is OffsetPagination {\n if ((data as OffsetPagination).offset !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction isCursorPagination(\n data: OffsetPagination | CursorPagination\n): data is CursorPagination {\n if ((data as CursorPagination).cursor !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction nextFunc(\n url: string,\n options: RequestOptions,\n data: OffsetPagination | CursorPagination\n) {\n if (isOffsetPagination(data)) {\n if (data?.more && typeof data.offset !== undefined && data.limit) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n limit: data.limit!.toString(),\n offset: (data.limit! + data.offset!).toString(),\n },\n });\n }\n } else if (isCursorPagination(data)) {\n if (data?.cursor) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n cursor: data.cursor!,\n limit: data.limit!.toString(),\n },\n });\n }\n }\n\n return undefined;\n}\n\nfunction partialCall(apiParameters: Partial) {\n const partialParameters = apiParameters;\n const partial = ((apiParameters: Partial) =>\n api({...partialParameters, ...apiParameters})) as PartialCall;\n\n const shorthand = (method: string) => (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise =>\n api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise;\n\n partial.get = shorthand('get');\n partial.post = shorthand('post');\n partial.put = shorthand('put');\n partial.patch = shorthand('patch');\n partial.delete = shorthand('delete');\n\n partial.all = (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise => {\n function allInner(responses: APIResponse[]): Promise {\n const response = responses[responses.length - 1];\n if (!response.next) {\n // Base case, resolve and return all responses.\n return Promise.resolve(responses);\n }\n // If there are still more resources to get then concat and repeat.\n return response\n .next()\n .then(response => allInner(responses.concat([response])));\n }\n\n function repackResponses(responses: APIResponse[]): APIPromise {\n // Repack the responses object to make it more user friendly.\n const repackedResponse = responses.shift() as APIResponse; // Use the first response to build the standard response object\n repackedResponse.data = [repackedResponse.data];\n responses.forEach(response => {\n repackedResponse.data = repackedResponse.data.concat(response.data);\n repackedResponse.resource = repackedResponse.resource.concat(\n response.resource\n );\n });\n return Promise.resolve(repackedResponse);\n }\n\n const method = 'get';\n return (api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise)\n .then(response => allInner([response]))\n .then(responses => repackResponses(responses));\n };\n\n return partial;\n}\n","import {request, RequestOptions} from './common';\n\nexport type Action = 'trigger' | 'acknowledge' | 'resolve';\n\nexport type EventPromise = Promise;\n\nexport interface EventResponse extends Response {\n data: any;\n response: Response;\n}\n\nexport type Severity = 'critical' | 'error' | 'warning' | 'info';\n\nexport interface Image {\n src: string;\n href?: string;\n alt?: string;\n}\n\nexport interface Link {\n href: string;\n text?: string;\n}\n\nexport interface EventPayloadV2 {\n routing_key: string;\n event_action: Action;\n dedup_key?: string;\n payload: {\n summary: string;\n source: string;\n severity: Severity;\n timestamp?: string;\n component?: string;\n group?: string;\n class?: string;\n custom_details?: object;\n };\n images?: Array;\n links?: Array;\n}\n\nexport interface EventParameters extends RequestOptions {\n data: EventPayloadV2;\n type?: string;\n server?: string;\n}\n\nexport interface ChangePayload {\n routing_key: string;\n payload: {\n summary: string;\n source?: string;\n timestamp: string;\n custom_details: object;\n };\n links: Array;\n}\nexport interface ChangeParameters extends RequestOptions {\n data: ChangePayload;\n server?: string;\n}\n\nexport function event(eventParameters: EventParameters): EventPromise {\n const {\n server = 'events.pagerduty.com',\n type = 'event',\n data,\n ...config\n } = eventParameters;\n\n let url = `https://${server}/v2/enqueue`;\n if (type === 'change') {\n url = `https://${server}/v2/change/enqueue`;\n }\n\n return eventFetch(url, {\n method: 'POST',\n body: JSON.stringify(data),\n ...config,\n });\n}\n\nconst shorthand = (action: Action) => (\n eventParameters: EventParameters\n): EventPromise => {\n const typeField = 'event_action';\n\n return event({\n ...eventParameters,\n data: {\n ...eventParameters.data,\n [typeField]: action,\n },\n });\n};\n\nexport const trigger = shorthand('trigger');\nexport const acknowledge = shorthand('acknowledge');\nexport const resolve = shorthand('resolve');\nexport const change = (eventParameters: EventParameters) =>\n event({...eventParameters, type: 'change'});\n\nfunction eventFetch(url: string, options: RequestOptions): EventPromise {\n return request(url, options).then(\n (response: Response): EventPromise => {\n const apiResponse = response as EventResponse;\n return response.json().then(\n (data): EventResponse => {\n apiResponse.data = data;\n apiResponse.response = response;\n return apiResponse;\n }\n );\n }\n );\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","request","url","options","queryParameters","requestTimeout","applyParameters","URL","toString","applyTimeout","fetch_retry","headers","Headers","retries","Promise","resolve","reject","fetch","then","response","status","retryTimeout","retryTimeoutPromise","clearTimeout","requestTimer","milliseconds","setTimeout","combinedParameters","searchParams","parameter","Array","isArray","forEach","item","append","keys","search","init","timeout","timer","api","apiParameters","endpoint","partialParameters","partial","shorthand","method","shorthandParameters","post","put","patch","all","allInner","responses","length","next","concat","repackedResponse","shift","data","resource","repackResponses","partialCall","server","token","tokenType","version","rest","config","Accept","Authorization","bearer","includes","toUpperCase","body","JSON","stringify","apiRequest","replace","apiResponse","json","match","resourceName","toLowerCase","endsWith","slice","resourceKey","undefined","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","type","eventFetch","action","trigger","acknowledge","change"],"sourceRoot":""} \ No newline at end of file +{"version":3,"file":"pdjs.js","mappings":"iCACA,IAAIA,EAAsB,CCA1BA,EAAwB,CAACC,EAASC,KACjC,IAAI,IAAIC,KAAOD,EACXF,EAAoBI,EAAEF,EAAYC,KAASH,EAAoBI,EAAEH,EAASE,IAC5EE,OAAOC,eAAeL,EAASE,EAAK,CAAEI,YAAY,EAAMC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Ac6D,EAAd,uBA8BP,SAAoB7D,EAAaC,GAC/B,OAAOF,EAAQC,EAAKC,GAASe,MAC3B,SAACC,GACC,IAAM4D,EAAc5D,EACpB,OAAOA,EAAS6D,OAAO9D,MACrB,SAACyC,GAGC,OAFAoB,EAAYpB,KAAOA,EACnBoB,EAAY5D,SAAWA,EAChB4D,QAnCRmB,CAAWhG,EAAD,GACf4C,OAAQ,OACR4B,KAAMC,KAAKC,UAAUjB,IAClBS,IAIP,IAAMvB,EAAY,SAACsD,GAAD,OAAoB,SACpCH,GAIA,OAAOD,EAAM,OACRC,GADO,IAEVrC,KAAM,OACDqC,EAAgBrC,MADjB,QAJY,eAMDwC,SAKNC,EAAUvD,EAAU,WACpBwD,EAAcxD,EAAU,eACxB9B,EAAU8B,EAAU,WACpByD,EAAS,SAACN,GAAD,OACpBD,EAAM,OAAIC,GAAL,IAAsBC,KAAM,a","sources":["webpack://PagerDuty/webpack/bootstrap","webpack://PagerDuty/webpack/runtime/define property getters","webpack://PagerDuty/webpack/runtime/hasOwnProperty shorthand","webpack://PagerDuty/webpack/runtime/make namespace object","webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts"],"sourcesContent":["// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","/* webpack-strip-block:removed */\n\nconst VERSION = '2.0.0';\n\ntype QueryParameter = Record>;\n\nexport interface RequestOptions extends RequestInit {\n queryParameters?: QueryParameter;\n retryCount?: number;\n requestTimeout?: number;\n requestTimer?: any;\n retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000} = options;\n\n url = new URL(url.toString());\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...options,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* webpack-strip-block:removed */\n ...options.headers,\n }),\n });\n}\n\nfunction fetch_retry(\n url: string,\n retries: number,\n options: RequestOptions\n): Promise {\n return new Promise((resolve, reject) => {\n fetch(url, options)\n .then(response => {\n // We don't want to `reject` when retries have finished\n // Instead simply stop trying and return.\n if (retries === 0) return resolve(response);\n if (response.status === 429) {\n const {retryTimeout = 20000} = options;\n retryTimeoutPromise(retryTimeout).then(() => {\n fetch_retry(url, retries - 1, options)\n .then(resolve)\n .catch(reject);\n });\n } else {\n clearTimeout(options.requestTimer);\n resolve(response);\n }\n })\n .catch(reject);\n });\n}\n\nconst retryTimeoutPromise = (milliseconds: number) => {\n return new Promise(resolve => setTimeout(resolve, milliseconds));\n};\n\nfunction userAgentHeader(): object {\n if (isNode) {\n return {\n 'User-Agent': `pdjs/${VERSION} (${process.version}/${process.platform})`,\n };\n } else if (isWebWorker) {\n return {\n 'User-Agent': `pdjs/${VERSION} (WebWorker)`,\n };\n } else if (isJsDom) {\n return {\n 'User-Agent': `pdjs/${VERSION} (JsDom)`,\n };\n } else if (isDeno) {\n return {\n 'User-Agent': `pdjs/${VERSION} (Deno)`,\n };\n } else if (isBrowser) {\n return {\n // Note: This will not work consistently for all browsers as some silently drop the userAgent Header.\n 'User-Agent': `pdjs/${VERSION} (${window.navigator.userAgent})`,\n };\n } else {\n return {};\n }\n}\n\nfunction applyParameters(url: URL, queryParameters?: QueryParameter): URL {\n if (!queryParameters) return url;\n\n const combinedParameters = url.searchParams;\n\n for (const key of Object.keys(queryParameters)) {\n const parameter = queryParameters[key];\n if (Array.isArray(parameter)) {\n // Support for array based keys like `additional_fields[]`\n parameter.forEach(item => {\n combinedParameters.append(key, item);\n });\n } else {\n combinedParameters.append(key, parameter);\n }\n }\n\n url.search = combinedParameters.toString();\n return url;\n}\n\nfunction applyTimeout(init: RequestOptions, timeout?: number): RequestOptions {\n if (!timeout) return init;\n const timer = setTimeout(() => {}, timeout);\n return {\n ...init,\n requestTimer: timer,\n };\n}\n","import {request, RequestOptions} from './common';\n\nexport interface ShorthandCall {\n (res: string, apiParameters?: Partial): APIPromise;\n}\n\nexport interface PartialCall {\n (apiParameters: APIParameters): APIPromise;\n (apiParameters: Partial): PartialCall;\n get: ShorthandCall;\n post: ShorthandCall;\n put: ShorthandCall;\n patch: ShorthandCall;\n delete: ShorthandCall;\n all: ShorthandCall;\n}\n\nexport type APIParameters = RequestOptions & {\n endpoint?: string;\n url?: string;\n data?: object;\n token?: string;\n tokenType?: string;\n server?: string;\n version?: number;\n} & ({endpoint: string} | {url: string});\n\nexport type APIPromise = Promise;\n\nexport interface APIResponse extends Response {\n data: any;\n resource: any;\n response: Response;\n next?: () => APIPromise;\n}\n\nexport function api(apiParameters: APIParameters): APIPromise;\nexport function api(apiParameters: Partial): PartialCall;\nexport function api(\n apiParameters: Partial\n): APIPromise | PartialCall {\n // If the apiParameters don't include `endpoint` treat it as a partial\n // application.\n if (!apiParameters.endpoint && !apiParameters.url) {\n return partialCall(apiParameters);\n }\n\n // allows for Token and Bearer token types to be used in Authorization\n type typeMap = {\n [key: string]: string;\n };\n\n const types: typeMap = {\n bearer: 'Bearer ',\n token: 'Token token=',\n };\n\n const {\n endpoint,\n server = 'api.pagerduty.com',\n token,\n tokenType = apiParameters.tokenType || 'token',\n url,\n version = 2,\n data,\n ...rest\n } = apiParameters;\n\n const config: RequestOptions = {\n method: 'GET',\n ...rest,\n headers: {\n Accept: `application/vnd.pagerduty+json;version=${version}`,\n Authorization: `${types[tokenType]}${token!}`,\n ...rest.headers,\n },\n };\n\n // Allow `data` for `queryParameters` for requests without bodies.\n if (isReadonlyRequest(config.method!) && data) {\n config.queryParameters =\n config.queryParameters ?? (data as Record);\n } else {\n config.body = JSON.stringify(data);\n }\n\n return apiRequest(\n url ?? `https://${server}/${endpoint!.replace(/^\\/+/, '')}`,\n config\n );\n}\n\nfunction apiRequest(url: string, options: RequestOptions): APIPromise {\n return request(url, options).then(\n (response: Response): APIPromise => {\n const apiResponse = response as APIResponse;\n apiResponse.response = response;\n\n if (response.status === 204) {\n return Promise.resolve(apiResponse);\n }\n\n return response\n .json()\n .then(\n (data): APIResponse => {\n const resource = resourceKey(url, options.method);\n apiResponse.next = nextFunc(url, options, data);\n apiResponse.data = data;\n apiResponse.resource = resource ? data[resource] : null;\n return apiResponse;\n }\n )\n .catch(() => Promise.reject(apiResponse));\n }\n );\n}\n\nfunction resourceKey(url: string, method?: string) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n const resourceName = resource[1];\n if (method && method.toLowerCase() === 'get') {\n return resourceName;\n }\n if (resourceName.endsWith('ies')) {\n return resourceName.slice(0, -3) + 'y';\n } else if (resourceName.endsWith('s')) {\n return resourceName.slice(0, -1);\n }\n return resourceName;\n }\n return null;\n}\n\nfunction isReadonlyRequest(method: string) {\n return !['PUT', 'POST', 'DELETE', 'PATCH'].includes(\n method.toUpperCase() ?? 'GET'\n );\n}\n\ninterface OffsetPagination {\n type: 'offset';\n more?: boolean;\n offset?: number;\n limit?: number;\n}\n\ninterface CursorPagination {\n type: 'cursor';\n cursor?: string;\n limit?: number;\n}\n\nfunction isOffsetPagination(\n data: OffsetPagination | CursorPagination\n): data is OffsetPagination {\n if ((data as OffsetPagination).offset !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction isCursorPagination(\n data: OffsetPagination | CursorPagination\n): data is CursorPagination {\n if ((data as CursorPagination).cursor !== undefined) {\n return true;\n }\n return false;\n}\n\nfunction nextFunc(\n url: string,\n options: RequestOptions,\n data: OffsetPagination | CursorPagination\n) {\n if (isOffsetPagination(data)) {\n if (data?.more && typeof data.offset !== undefined && data.limit) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n limit: data.limit!.toString(),\n offset: (data.limit! + data.offset!).toString(),\n },\n });\n }\n } else if (isCursorPagination(data)) {\n if (data?.cursor) {\n return () =>\n apiRequest(url, {\n ...options,\n queryParameters: {\n ...options.queryParameters,\n cursor: data.cursor!,\n limit: data.limit!.toString(),\n },\n });\n }\n }\n\n return undefined;\n}\n\nfunction partialCall(apiParameters: Partial) {\n const partialParameters = apiParameters;\n const partial = ((apiParameters: Partial) =>\n api({...partialParameters, ...apiParameters})) as PartialCall;\n\n const shorthand = (method: string) => (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise =>\n api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise;\n\n partial.get = shorthand('get');\n partial.post = shorthand('post');\n partial.put = shorthand('put');\n partial.patch = shorthand('patch');\n partial.delete = shorthand('delete');\n\n partial.all = (\n endpoint: string,\n shorthandParameters?: Partial\n ): APIPromise => {\n function allInner(responses: APIResponse[]): Promise {\n const response = responses[responses.length - 1];\n if (!response.next) {\n // Base case, resolve and return all responses.\n return Promise.resolve(responses);\n }\n // If there are still more resources to get then concat and repeat.\n return response\n .next()\n .then(response => allInner(responses.concat([response])));\n }\n\n function repackResponses(responses: APIResponse[]): APIPromise {\n // Repack the responses object to make it more user friendly.\n const repackedResponse = responses.shift() as APIResponse; // Use the first response to build the standard response object\n repackedResponse.data = [repackedResponse.data];\n responses.forEach(response => {\n repackedResponse.data = repackedResponse.data.concat(response.data);\n repackedResponse.resource = repackedResponse.resource.concat(\n response.resource\n );\n });\n return Promise.resolve(repackedResponse);\n }\n\n const method = 'get';\n return (api({\n endpoint,\n method,\n ...partialParameters,\n ...shorthandParameters,\n }) as APIPromise)\n .then(response => allInner([response]))\n .then(responses => repackResponses(responses));\n };\n\n return partial;\n}\n","import {request, RequestOptions} from './common';\n\nexport type Action = 'trigger' | 'acknowledge' | 'resolve';\n\nexport type EventPromise = Promise;\n\nexport interface EventResponse extends Response {\n data: any;\n response: Response;\n}\n\nexport type Severity = 'critical' | 'error' | 'warning' | 'info';\n\nexport interface Image {\n src: string;\n href?: string;\n alt?: string;\n}\n\nexport interface Link {\n href: string;\n text?: string;\n}\n\nexport interface EventPayloadV2 {\n routing_key: string;\n event_action: Action;\n dedup_key?: string;\n payload: {\n summary: string;\n source: string;\n severity: Severity;\n timestamp?: string;\n component?: string;\n group?: string;\n class?: string;\n custom_details?: object;\n };\n images?: Array;\n links?: Array;\n}\n\nexport interface EventParameters extends RequestOptions {\n data: EventPayloadV2;\n type?: string;\n server?: string;\n}\n\nexport interface ChangePayload {\n routing_key: string;\n payload: {\n summary: string;\n source?: string;\n timestamp: string;\n custom_details: object;\n };\n links: Array;\n}\nexport interface ChangeParameters extends RequestOptions {\n data: ChangePayload;\n server?: string;\n}\n\nexport function event(eventParameters: EventParameters): EventPromise {\n const {\n server = 'events.pagerduty.com',\n type = 'event',\n data,\n ...config\n } = eventParameters;\n\n let url = `https://${server}/v2/enqueue`;\n if (type === 'change') {\n url = `https://${server}/v2/change/enqueue`;\n }\n\n return eventFetch(url, {\n method: 'POST',\n body: JSON.stringify(data),\n ...config,\n });\n}\n\nconst shorthand = (action: Action) => (\n eventParameters: EventParameters\n): EventPromise => {\n const typeField = 'event_action';\n\n return event({\n ...eventParameters,\n data: {\n ...eventParameters.data,\n [typeField]: action,\n },\n });\n};\n\nexport const trigger = shorthand('trigger');\nexport const acknowledge = shorthand('acknowledge');\nexport const resolve = shorthand('resolve');\nexport const change = (eventParameters: EventParameters) =>\n event({...eventParameters, type: 'change'});\n\nfunction eventFetch(url: string, options: RequestOptions): EventPromise {\n return request(url, options).then(\n (response: Response): EventPromise => {\n const apiResponse = response as EventResponse;\n return response.json().then(\n (data): EventResponse => {\n apiResponse.data = data;\n apiResponse.response = response;\n return apiResponse;\n }\n );\n }\n );\n}\n"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","request","url","options","queryParameters","requestTimeout","applyParameters","URL","toString","applyTimeout","fetch_retry","headers","Headers","retries","Promise","resolve","reject","fetch","then","response","status","retryTimeout","retryTimeoutPromise","clearTimeout","requestTimer","milliseconds","setTimeout","combinedParameters","searchParams","parameter","Array","isArray","forEach","item","append","keys","search","init","timeout","timer","api","apiParameters","endpoint","partialParameters","partial","shorthand","method","shorthandParameters","post","put","patch","all","allInner","responses","length","next","concat","repackedResponse","shift","data","resource","repackResponses","partialCall","server","token","tokenType","version","rest","config","Accept","Authorization","bearer","includes","toUpperCase","body","JSON","stringify","apiRequest","replace","apiResponse","json","match","resourceName","toLowerCase","endsWith","slice","resourceKey","undefined","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","type","eventFetch","action","trigger","acknowledge","change"],"sourceRoot":""} \ No newline at end of file