diff --git a/build/src/api.js b/build/src/api.js index 34fc641..2e6b5bc 100644 --- a/build/src/api.js +++ b/build/src/api.js @@ -25,7 +25,8 @@ function api(apiParameters) { }; // Allow `data` for `queryParameters` for requests without bodies. if (isReadonlyRequest(config.method) && data) { - config.queryParameters = (_a = config.queryParameters) !== null && _a !== void 0 ? _a : data; + config.queryParameters = + (_a = config.queryParameters) !== null && _a !== void 0 ? _a : data; } else { config.body = JSON.stringify(data); @@ -37,10 +38,13 @@ function apiRequest(url, options) { return common_1.request(url, options).then((response) => { const apiResponse = response; apiResponse.response = response; - const resource = resourceKey(url); + if (response.status === 204) { + return Promise.resolve(apiResponse); + } return response .json() .then((data) => { + const resource = resourceKey(url); apiResponse.next = nextFunc(url, options, data); apiResponse.data = data; apiResponse.resource = resource ? data[resource] : null; diff --git a/build/src/api.js.map b/build/src/api.js.map index 6fad531..6197c9d 100644 --- a/build/src/api.js.map +++ b/build/src/api.js.map @@ -1 +1 @@ -{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/api.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAsCjD,SAAgB,GAAG,CACjB,aAAqC;;IAErC,sEAAsE;IACtE,eAAe;IACf,IAAI,CAAC,aAAa,CAAC,QAAQ,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE;QACjD,OAAO,WAAW,CAAC,aAAa,CAAC,CAAC;KACnC;IAOD,MAAM,KAAK,GAAY;QACrB,MAAM,EAAE,SAAS;QACjB,KAAK,EAAE,cAAc;KACtB,CAAC;IAEF,MAAM,EACJ,QAAQ,EACR,MAAM,GAAG,mBAAmB,EAC5B,KAAK,EACL,SAAS,GAAG,aAAa,CAAC,SAAS,IAAI,OAAO,EAC9C,GAAG,EACH,OAAO,GAAG,CAAC,EACX,IAAI,EACJ,GAAG,IAAI,EACR,GAAG,aAAa,CAAC;IAElB,MAAM,MAAM,GAAmB;QAC7B,MAAM,EAAE,KAAK;QACb,GAAG,IAAI;QACP,OAAO,EAAE;YACP,MAAM,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,SAAS,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;QAC9D,CAAC;QAED,SAAS,eAAe,CAAC,SAAwB;YAC/C,6DAA6D;YAC7D,MAAM,gBAAgB,GAAG,SAAS,CAAC,KAAK,EAAiB,CAAC,CAAC,+DAA+D;YAC1H,gBAAgB,CAAC,IAAI,GAAG,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;YAChD,SAAS,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE;gBAC3B,gBAAgB,CAAC,IAAI,GAAG,gBAAgB,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;gBACpE,gBAAgB,CAAC,QAAQ,GAAG,gBAAgB,CAAC,QAAQ,CAAC,MAAM,CAC1D,QAAQ,CAAC,QAAQ,CAClB,CAAC;YACJ,CAAC,CAAC,CAAC;YACH,OAAO,OAAO,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;QAC3C,CAAC;QAED,MAAM,MAAM,GAAG,KAAK,CAAC;QACrB,OAAQ,GAAG,CAAC;YACV,QAAQ;YACR,MAAM;YACN,GAAG,iBAAiB;YACpB,GAAG,mBAAmB;SACvB,CAAgB;aACd,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC;aACtC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC;IACnD,CAAC,CAAC;IAEF,OAAO,OAAO,CAAC;AACjB,CAAC"} \ No newline at end of file diff --git a/build/src/api.test.js b/build/src/api.test.js index cefd6f2..523e056 100644 --- a/build/src/api.test.js +++ b/build/src/api.test.js @@ -61,6 +61,21 @@ test('API calls return JSON for basic API calls with endpoint', async (done) => expect(resp.data).toEqual(EMPTY_BODY); done(); }); +test('API calls return successfully on DELETE endpoints', async (done) => { + nock('https://api.pagerduty.com', { + reqheaders: { + Authorization: 'Token token=someToken1234567890', + 'User-Agent': header => header.startsWith('pdjs'), + }, + }) + .delete('/incidents/delete') + .reply(204); + const pd = index_1.api({ token: 'someToken1234567890' }); + const response = await pd.delete('/incidents/delete'); + expect(response.url).toEqual('https://api.pagerduty.com/incidents/delete'); + expect(response.data).toEqual(undefined); + done(); +}); test('API calls support partial application with url', async (done) => { nock('https://api.pagerduty.com', { reqheaders: { diff --git a/build/src/api.test.js.map b/build/src/api.test.js.map index d657dd3..7a5d9d6 100644 --- a/build/src/api.test.js.map +++ b/build/src/api.test.js.map @@ -1 +1 @@ -{"version":3,"file":"api.test.js","sourceRoot":"","sources":["../../src/api.test.ts"],"names":[],"mappings":";;AAAA,6BAA8B;AAC9B,mCAA4B;AAE5B,MAAM,UAAU,GAAG;IACjB,SAAS,EAAE,EAAE;IACb,KAAK,EAAE,EAAE;IACT,MAAM,EAAE,CAAC;IACT,KAAK,EAAE,IAAI;IACX,IAAI,EAAE,KAAK;CACZ,CAAC;AAEF,IAAI,CAAC,uDAAuD,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;IACzE,IAAI,CAAC,2BAA2B,EAAE;QAChC,UAAU,EAAE;YACV,aAAa,EAAE,iCAAiC;YAChD,YAAY,EAAE,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,UAAU,CAAC,MAAM,CAAC;SAClD;KACF,CAAC;SACC,GAAG,CAAC,YAAY,CAAC;SACjB,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,CAAC;IAE1B,MAAM,IAAI,GAAG,MAAM,WAAG,CAAC;QACrB,KAAK,EAAE,qBAAqB;QAC5B,MAAM,EAAE,mBAAmB;QAC3B,QAAQ,EAAE,WAAW;KACtB,CAAC,CAAC;IAEH,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;IAChE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACtC,IAAI,EAA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,EAAC,CAAC,CAAC;IAE/C,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;IAE/C,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,qCAAqC,CAAC,CAAC;IACpE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC;AAEH,IAAI,CAAC,6BAA6B,EAAE,KAAK,EAAC,IAAI,EAAC,EAAE;IAC/C,IAAI,CAAC,2BAA2B,CAAC;SAC9B,GAAG,CAAC,YAAY,CAAC;SACjB,cAAc,CAAC,EAAC,IAAI,EAAE,WAAW,EAAC,CAAC,CAAC;IAEvC,MAAM,EAAE,GAAG,WAAG,CAAC,EAAC,KAAK,EAAE,qBAAqB,EAAC,CAAC,CAAC;IAE/C,MAAM,MAAM,CAAC,EAAE,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,CAAC,OAAO,CAAC,OAAO,CAChD,0EAA0E,CAC3E,CAAC;IACF,IAAI,EAAE,CAAC;AACT,CAAC,CAAC,CAAC"} \ No newline at end of file diff --git a/build/src/events.test.js b/build/src/events.test.js index 54bcc83..b4f2231 100644 --- a/build/src/events.test.js +++ b/build/src/events.test.js @@ -28,7 +28,7 @@ test('Events API properly passes Events V2 requests', async (done) => { }, }) .post('/v2/enqueue') - .reply(200, body); + .reply(202, body); const response = await index_1.event(eventPayloadV2); expect(response.url).toEqual('https://events.pagerduty.com/v2/enqueue'); expect(response.data).toEqual(body); @@ -48,7 +48,7 @@ test('Events API properly passes Change Events requests', async (done) => { }, }) .post('/v2/change/enqueue') - .reply(200, body); + .reply(202, body); const response = await index_1.change(eventPayloadV2); expect(response.url).toEqual('https://events.pagerduty.com/v2/change/enqueue'); expect(response.data).toEqual(body); @@ -68,7 +68,7 @@ test('Events API properly passes Events V2 requests with images/links/details', }, }) .post('/v2/enqueue') - .reply(200, body); + .reply(202, body); const response = await index_1.event({ data: { routing_key: 'someRoutingKeybfa2a710673888f520', @@ -112,11 +112,11 @@ test('Events API shorthands should send corresponding events', async (done) => { }, }) .post('/v2/enqueue') - .reply(200, body) + .reply(202, body) .post('/v2/enqueue') - .reply(200, body) + .reply(202, body) .post('/v2/enqueue') - .reply(200, body); + .reply(202, body); let response = await index_1.acknowledge(eventPayloadV2); expect(response.url).toEqual('https://events.pagerduty.com/v2/enqueue'); expect(response.data).toEqual(body); diff --git a/dist/pdjs-legacy.js b/dist/pdjs-legacy.js index 5711116..c3364d7 100644 --- a/dist/pdjs-legacy.js +++ b/dist/pdjs-legacy.js @@ -1,2 +1,2 @@ -var PagerDuty;PagerDuty=(()=>{var t={988:(t,e)=>{"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var r=0;r{"use strict";r.r(e),r.d(e,{acknowledge:()=>I,api:()=>_,change:()=>F,event:()=>B,resolve:()=>M,trigger:()=>q});var n=r(98),o=r.n(n),i=r(988),u=r(818);function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function s(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function l(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e,o=r.queryParameters,i=r.requestTimeout,u=void 0===i?3e4:i,a=f(r,["queryParameters","requestTimeout"]);return t=d(t=new URL(t.toString()),o),e=b(e,u),p(t.toString(),3,s(s({},a),{},{headers:new n.Headers(s(s({"Content-Type":"application/json; charset=utf-8"},h()),a.headers))}))}function p(t,e,r){return new Promise((function(n,i){o()(t,r).then((function(o){if(0===e)return n(o);if(429===o.status){var u=r.retryTimeout;y(void 0===u?2e4:u).then((function(){p(t,e-1,r).then(n).catch(i)}))}else n(o)})).catch(i)}))}var y=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function h(){return u.jU?{}:{"User-Agent":"pdjs/".concat("2.0.0"," (").concat(process.version,"/").concat(process.platform,")")}}function d(t,e){if(!e)return t;for(var r=t.searchParams,n=function(){var t=i[o],n=e[t];Array.isArray(n)?n.forEach((function(e){r.append(t,e)})):r.append(t,n)},o=0,i=Object.keys(e);o]+)>/g,(function(t,e){return"$"+r[e]})))}if("function"==typeof e){var i=this;return n[Symbol.replace].call(this,t,(function(){var t=[];return t.push.apply(t,arguments),"object"!==v(t[t.length-1])&&t.push(u(t,i)),e.apply(this,t)}))}return n[Symbol.replace].call(this,t,e)},m.apply(this,arguments)}function g(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&P(t,e)}function O(t){var e="function"==typeof Map?new Map:void 0;return(O=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return w(t,arguments,E(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),P(n,t)})(t)}function w(t,e,r){return(w=j()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&P(o,r.prototype),o}).apply(null,arguments)}function j(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(t){return!1}}function P(t,e){return(P=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function E(t){return(E=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function S(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function x(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,["endpoint","server","token","tokenType","url","version","data"]),d=x(x({method:"GET"},h),{},{headers:x({Accept:"application/vnd.pagerduty+json;version=".concat(p),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[c]).concat(a)},h.headers)});return r=d.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?d.queryParameters=null!==(e=d.queryParameters)&&void 0!==e?e:y:d.body=JSON.stringify(y),A(null!=f?f:"https://".concat(u,"/").concat(o.replace(/^\/+/,"")),d)}function A(t,e){return l(t,e).then((function(r){var n=r;n.response=r;var o=function(t){var e=t.match(m(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));return e?e[1]:null}(t);return r.json().then((function(r){return n.next=function(t,e,r){if(function(t){return void 0!==t.offset}(r)){if(null!=r&&r.more&&void 0!==v(r.offset)&&r.limit)return function(){return A(t,x(x({},e),{},{queryParameters:x(x({},e.queryParameters),{},{limit:r.limit.toString(),offset:(r.limit+r.offset).toString()})}))}}else if(function(t){return void 0!==t.cursor}(r)&&null!=r&&r.cursor)return function(){return A(t,x(x({},e),{},{queryParameters:x(x({},e.queryParameters),{},{cursor:r.cursor,limit:r.limit.toString()})}))}}(t,e,r),n.data=r,n.resource=o?r[o]:null,n})).catch((function(){return Promise.reject(n)}))}))}function D(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function R(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,["server","type","data"]),a="https://".concat(r,"/v2/enqueue");return"change"===o&&(a="https://".concat(r,"/v2/change/enqueue")),function(t,e){return l(t,e).then((function(t){var e=t;return t.json().then((function(r){return e.data=r,e.response=t,e}))}))}(a,R({method:"POST",body:JSON.stringify(i)},u))}var U=function(t){return function(e){return B(R(R({},e),{},{data:R(R({},e.data),{},k({},"event_action",t))}))}},q=U("trigger"),I=U("acknowledge"),M=U("resolve"),F=function(t){return B(R(R({},t),{},{type:"change"}))}},818:(t,e)=>{"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},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;e.jU=n},98:function(t,e){var r=function(t){function e(){this.fetch=!1,this.DOMException=t.DOMException}return e.prototype=t,new e}("undefined"!=typeof self?self:this);!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,u="ArrayBuffer"in t;if(u)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function y(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?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(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=y(this);if(t)return t;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 t,e,r,n=y(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=h(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.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(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}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 p(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var j=[301,302,303,307,308];w.redirect=function(t,e){if(-1===j.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function P(t,r){return new Promise((function(n,i){var u=new g(t,r);if(u.signal&&u.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function s(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};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 e.DOMException("Aborted","AbortError"))},a.open(u.method,u.url,!0),"include"===u.credentials?a.withCredentials=!0:"omit"===u.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),u.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),u.signal&&(u.signal.addEventListener("abort",s),a.onreadystatechange=function(){4===a.readyState&&u.signal.removeEventListener("abort",s)}),a.send(void 0===u._bodyInit?null:u._bodyInit)}))}P.polyfill=!0,t.fetch||(t.fetch=P,t.Headers=p,t.Request=g,t.Response=w),e.Headers=p,e.Request=g,e.Response=w,e.fetch=P}({})}(r),delete r.fetch.polyfill,(e=r.fetch).default=r.fetch,e.fetch=r.fetch,e.Headers=r.Headers,e.Request=r.Request,e.Response=r.Response,t.exports=e}},e={};function r(n){if(e[n])return e[n].exports;var o=e[n]={exports:{}};return t[n].call(o.exports,o,o.exports,r),o.exports}return r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r(47)})(); +var PagerDuty;(()=>{var t={988:(t,e)=>{"use strict";function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function n(t,e){for(var r=0;r{"use strict";var r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},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;e.jU=n},98:function(t,e){var r="undefined"!=typeof self?self:this,n=function(){function t(){this.fetch=!1,this.DOMException=r.DOMException}return t.prototype=r,new t}();!function(t){!function(e){var r="URLSearchParams"in t,n="Symbol"in t&&"iterator"in Symbol,o="FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),i="FormData"in t,u="ArrayBuffer"in t;if(u)var a=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],s=ArrayBuffer.isView||function(t){return t&&a.indexOf(Object.prototype.toString.call(t))>-1};function c(t){if("string"!=typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function f(t){return"string"!=typeof t&&(t=String(t)),t}function l(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return n&&(e[Symbol.iterator]=function(){return e}),e}function p(t){this.map={},t instanceof p?t.forEach((function(t,e){this.append(e,t)}),this):Array.isArray(t)?t.forEach((function(t){this.append(t[0],t[1])}),this):t&&Object.getOwnPropertyNames(t).forEach((function(e){this.append(e,t[e])}),this)}function y(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function h(t){return new Promise((function(e,r){t.onload=function(){e(t.result)},t.onerror=function(){r(t.error)}}))}function d(t){var e=new FileReader,r=h(e);return e.readAsArrayBuffer(t),r}function b(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function v(){return this.bodyUsed=!1,this._initBody=function(t){var e;this._bodyInit=t,t?"string"==typeof t?this._bodyText=t:o&&Blob.prototype.isPrototypeOf(t)?this._bodyBlob=t:i&&FormData.prototype.isPrototypeOf(t)?this._bodyFormData=t:r&&URLSearchParams.prototype.isPrototypeOf(t)?this._bodyText=t.toString():u&&o&&(e=t)&&DataView.prototype.isPrototypeOf(e)?(this._bodyArrayBuffer=b(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):u&&(ArrayBuffer.prototype.isPrototypeOf(t)||s(t))?this._bodyArrayBuffer=b(t):this._bodyText=t=Object.prototype.toString.call(t):this._bodyText="",this.headers.get("content-type")||("string"==typeof t?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(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},o&&(this.blob=function(){var t=y(this);if(t)return t;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 t,e,r,n=y(this);if(n)return n;if(this._bodyBlob)return t=this._bodyBlob,r=h(e=new FileReader),e.readAsText(t),r;if(this._bodyArrayBuffer)return Promise.resolve(function(t){for(var e=new Uint8Array(t),r=new Array(e.length),n=0;n-1?n:r),this.mode=e.mode||this.mode||null,this.signal=e.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(t){var e=new FormData;return t.trim().split("&").forEach((function(t){if(t){var r=t.split("="),n=r.shift().replace(/\+/g," "),o=r.join("=").replace(/\+/g," ");e.append(decodeURIComponent(n),decodeURIComponent(o))}})),e}function w(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new p(e.headers),this.url=e.url||"",this._initBody(t)}O.prototype.clone=function(){return new O(this,{body:this._bodyInit})},v.call(O.prototype),v.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},w.error=function(){var t=new w(null,{status:0,statusText:""});return t.type="error",t};var j=[301,302,303,307,308];w.redirect=function(t,e){if(-1===j.indexOf(e))throw new RangeError("Invalid status code");return new w(null,{status:e,headers:{location:t}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(t,e){this.message=t,this.name=e;var r=Error(t);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function P(t,r){return new Promise((function(n,i){var u=new O(t,r);if(u.signal&&u.signal.aborted)return i(new e.DOMException("Aborted","AbortError"));var a=new XMLHttpRequest;function s(){a.abort()}a.onload=function(){var t,e,r={status:a.status,statusText:a.statusText,headers:(t=a.getAllResponseHeaders()||"",e=new p,t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach((function(t){var r=t.split(":"),n=r.shift().trim();if(n){var o=r.join(":").trim();e.append(n,o)}})),e)};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 e.DOMException("Aborted","AbortError"))},a.open(u.method,u.url,!0),"include"===u.credentials?a.withCredentials=!0:"omit"===u.credentials&&(a.withCredentials=!1),"responseType"in a&&o&&(a.responseType="blob"),u.headers.forEach((function(t,e){a.setRequestHeader(e,t)})),u.signal&&(u.signal.addEventListener("abort",s),a.onreadystatechange=function(){4===a.readyState&&u.signal.removeEventListener("abort",s)}),a.send(void 0===u._bodyInit?null:u._bodyInit)}))}P.polyfill=!0,t.fetch||(t.fetch=P,t.Headers=p,t.Request=O,t.Response=w),e.Headers=p,e.Request=O,e.Response=w,e.fetch=P,Object.defineProperty(e,"__esModule",{value:!0})}({})}(n),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var o=n;(e=o.fetch).default=o.fetch,e.fetch=o.fetch,e.Headers=o.Headers,e.Request=o.Request,e.Response=o.Response,t.exports=e}},e={};function r(n){var o=e[n];if(void 0!==o)return o.exports;var i=e[n]={exports:{}};return t[n].call(i.exports,i,i.exports,r),i.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var n={};(()=>{"use strict";r.r(n),r.d(n,{acknowledge:()=>q,api:()=>_,change:()=>M,event:()=>k,resolve:()=>I,trigger:()=>U});var t=r(98),e=r.n(t),o=r(988),i=r(818);function u(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function a(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}function f(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r,o=n.queryParameters,i=n.requestTimeout,u=void 0===i?3e4:i,s=c(n,["queryParameters","requestTimeout"]);return e=h(e=new URL(e.toString()),o),r=d(r,u),l(e.toString(),3,a(a({},s),{},{headers:new t.Headers(a(a({"Content-Type":"application/json; charset=utf-8"},y()),s.headers))}))}function l(t,r,n){return new Promise((function(o,i){e()(t,n).then((function(e){if(0===r)return o(e);if(429===e.status){var u=n.retryTimeout;p(void 0===u?2e4:u).then((function(){l(t,r-1,n).then(o).catch(i)}))}else o(e)})).catch(i)}))}var p=function(t){return new Promise((function(e){return setTimeout(e,t)}))};function y(){return i.jU?{}:{"User-Agent":"pdjs/".concat("2.0.0"," (").concat(process.version,"/").concat(process.platform,")")}}function h(t,e){if(!e)return t;for(var r=t.searchParams,n=function(){var t=i[o],n=e[t];Array.isArray(n)?n.forEach((function(e){r.append(t,e)})):r.append(t,n)},o=0,i=Object.keys(e);o]+)>/g,(function(t,e){return"$"+r[e]})))}if("function"==typeof e){var i=this;return n[Symbol.replace].call(this,t,(function(){var t=[];return t.push.apply(t,arguments),"object"!==b(t[t.length-1])&&t.push(u(t,i)),e.apply(this,t)}))}return n[Symbol.replace].call(this,t,e)},v.apply(this,arguments)}function m(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&j(t,e)}function O(t){var e="function"==typeof Map?new Map:void 0;return(O=function(t){if(null===t||(r=t,-1===Function.toString.call(r).indexOf("[native code]")))return t;var r;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,n)}function n(){return g(t,arguments,P(this).constructor)}return n.prototype=Object.create(t.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),j(n,t)})(t)}function g(t,e,r){return(g=w()?Reflect.construct:function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&j(o,r.prototype),o}).apply(null,arguments)}function w(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function j(t,e){return(j=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function P(t){return(P=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function E(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function S(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,["endpoint","server","token","tokenType","url","version","data"]),d=S(S({method:"GET"},h),{},{headers:S({Accept:"application/vnd.pagerduty+json;version=".concat(p),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[c]).concat(a)},h.headers)});return r=d.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?d.queryParameters=null!==(e=d.queryParameters)&&void 0!==e?e:y:d.body=JSON.stringify(y),T(null!=f?f:"https://".concat(u,"/").concat(o.replace(/^\/+/,"")),d)}function T(t,e){return f(t,e).then((function(r){var n=r;return n.response=r,204===r.status?Promise.resolve(n):r.json().then((function(r){var o=function(t){var e=t.match(v(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));return e?e[1]:null}(t);return n.next=function(t,e,r){if(function(t){return void 0!==t.offset}(r)){if(null!=r&&r.more&&void 0!==b(r.offset)&&r.limit)return function(){return T(t,S(S({},e),{},{queryParameters:S(S({},e.queryParameters),{},{limit:r.limit.toString(),offset:(r.limit+r.offset).toString()})}))}}else if(function(t){return void 0!==t.cursor}(r)&&null!=r&&r.cursor)return function(){return T(t,S(S({},e),{},{queryParameters:S(S({},e.queryParameters),{},{cursor:r.cursor,limit:r.limit.toString()})}))}}(t,e,r),n.data=r,n.resource=o?r[o]:null,n})).catch((function(){return Promise.reject(n)}))}))}function A(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function D(t){for(var e=1;e=0||(o[r]=t[r]);return o}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(t,["server","type","data"]),a="https://".concat(r,"/v2/enqueue");return"change"===o&&(a="https://".concat(r,"/v2/change/enqueue")),function(t,e){return f(t,e).then((function(t){var e=t;return t.json().then((function(r){return e.data=r,e.response=t,e}))}))}(a,D({method:"POST",body:JSON.stringify(i)},u))}var B=function(t){return function(e){return k(D(D({},e),{},{data:D(D({},e.data),{},R({},"event_action",t))}))}},U=B("trigger"),q=B("acknowledge"),I=B("resolve"),M=function(t){return k(D(D({},t),{},{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 17e283a..83281f7 100644 --- a/dist/pdjs-legacy.js.map +++ b/dist/pdjs-legacy.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://PagerDuty/./node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts","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/startup","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"],"names":["_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","prototype","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_setPrototypeOf","p","_assertThisInitialized","self","ReferenceError","_possibleConstructorReturn","call","_get","property","receiver","Reflect","get","base","object","hasOwnProperty","_superPropBase","desc","getOwnPropertyDescriptor","value","Emitter","this","type","callback","options","listeners","push","stack","l","splice","event","stackToCall","slice","listener","e","Promise","resolve","then","once","removeEventListener","defaultPrevented","AbortSignal","_Emitter","subClass","superClass","create","constructor","_inherits","Derived","hasNativeReflectConstruct","_super","construct","sham","Proxy","Date","toString","_isNativeReflectConstruct","result","Super","NewTarget","arguments","apply","_this","aborted","onabort","AbortController","Event","document","createEvent","initEvent","createEventObject","bubbles","cancelable","signal","dispatchEvent","Symbol","toStringTag","exports","request","url","queryParameters","requestTimeout","rest","applyParameters","URL","applyTimeout","fetch_retry","headers","Headers","userAgentHeader","retries","reject","fetch","response","status","retryTimeout","retryTimeoutPromise","milliseconds","setTimeout","isBrowser","process","version","platform","combinedParameters","searchParams","parameter","Array","isArray","forEach","item","append","keys","search","init","timeout","controller","abort","api","apiParameters","endpoint","partialParameters","partial","shorthand","method","shorthandParameters","post","put","patch","all","allInner","responses","next","concat","repackedResponse","shift","data","resource","repackResponses","partialCall","server","token","tokenType","config","Accept","Authorization","bearer","includes","toUpperCase","body","JSON","stringify","apiRequest","replace","apiResponse","match","resourceKey","json","undefined","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","eventParameters","eventFetch","action","trigger","acknowledge","change","_typeof","iterator","obj","window","name","versions","node","__self__","root","F","DOMException","support","Blob","viewClasses","isArrayBufferView","ArrayBuffer","isView","indexOf","normalizeName","String","test","toLowerCase","normalizeValue","iteratorFor","items","done","map","header","getOwnPropertyNames","consumed","bodyUsed","fileReaderReady","reader","onload","onerror","error","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","view","Uint8Array","byteLength","set","buffer","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","rejected","Error","arrayBuffer","text","readAsText","chars","fromCharCode","join","readArrayBufferAsText","formData","decode","parse","oldValue","has","thisArg","values","entries","methods","Request","input","upcased","credentials","mode","referrer","form","trim","split","bytes","decodeURIComponent","Response","bodyInit","ok","statusText","clone","redirectStatuses","redirect","RangeError","location","err","message","xhr","XMLHttpRequest","abortXhr","rawHeaders","getAllResponseHeaders","line","parts","responseURL","responseText","ontimeout","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","send","polyfill","default","module","__webpack_module_cache__","__webpack_require__","moduleId","__webpack_modules__","n","getter","__esModule","d","a","definition","prop","r"],"mappings":"8DAIA,SAASA,EAAgBC,EAAUC,GACjC,KAAMD,aAAoBC,GACxB,MAAM,IAAIC,UAAU,qCAIxB,SAASC,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAIlD,SAASO,EAAad,EAAae,EAAYC,GAG7C,OAFID,GAAYb,EAAkBF,EAAYiB,UAAWF,GACrDC,GAAad,EAAkBF,EAAagB,GACzChB,EAkBT,SAASkB,EAAgBC,GAIvB,OAHAD,EAAkBP,OAAOS,eAAiBT,OAAOU,eAAiB,SAAyBF,GACzF,OAAOA,EAAEG,WAAaX,OAAOU,eAAeF,KAEvBA,GAGzB,SAASI,EAAgBJ,EAAGK,GAM1B,OALAD,EAAkBZ,OAAOS,gBAAkB,SAAyBD,EAAGK,GAErE,OADAL,EAAEG,UAAYE,EACPL,IAGcA,E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AC5B+B,EAAOrN,QAAUA,IChiBbsN,EAA2B,GAG/B,SAASC,EAAoBC,GAE5B,GAAGF,EAAyBE,GAC3B,OAAOF,EAAyBE,GAAUxN,QAG3C,IAAIqN,EAASC,EAAyBE,GAAY,CAGjDxN,QAAS,IAOV,OAHAyN,EAAoBD,GAAU9R,KAAK2R,EAAOrN,QAASqN,EAAQA,EAAOrN,QAASuN,GAGpEF,EAAOrN,QCjBf,OCFAuN,EAAoBG,EAAKL,IACxB,IAAIM,EAASN,GAAUA,EAAOO,WAC7B,IAAMP,EAAgB,QACtB,IAAMA,EAEP,OADAE,EAAoBM,EAAEF,EAAQ,CAAEG,EAAGH,IAC5BA,GCLRJ,EAAoBM,EAAI,CAAC7N,EAAS+N,KACjC,IAAI,IAAIrT,KAAOqT,EACXR,EAAoBvS,EAAE+S,EAAYrT,KAAS6S,EAAoBvS,EAAEgF,EAAStF,IAC5EF,OAAOC,eAAeuF,EAAStF,EAAK,CAAEL,YAAY,EAAM0B,IAAKgS,EAAWrT,MCJ3E6S,EAAoBvS,EAAI,CAACgL,EAAKgI,IAASxT,OAAOM,UAAUoB,eAAeR,KAAKsK,EAAKgI,GCCjFT,EAAoBU,EAAKjO,IACH,oBAAXF,QAA0BA,OAAOC,aAC1CvF,OAAOC,eAAeuF,EAASF,OAAOC,YAAa,CAAEzD,MAAO,WAE7D9B,OAAOC,eAAeuF,EAAS,aAAc,CAAE1D,OAAO,KJFhDiR,EAAoB,K","file":"pdjs-legacy.js","sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort() {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","/* LEGACY-BROWSER-SUPPORT-START */\nimport fetch, {Headers} from 'cross-fetch';\nimport {AbortController} from 'abortcontroller-polyfill/dist/cjs-ponyfill';\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 retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000, ...rest} = options;\n\n url = new URL(url.toString());\n\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...rest,\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 ...rest.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 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\n const controller = new AbortController();\n setTimeout(() => controller.abort(), timeout);\n\n return {\n ...init,\n signal: controller.signal,\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 const resource = resourceKey(url);\n return response\n .json()\n .then(\n (data): APIResponse => {\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) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n return resource[1];\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","'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 __self__ = (function (root) {\nfunction F() {\nthis.fetch = false;\nthis.DOMException = root.DOMException\n}\nF.prototype = root;\nreturn new F();\n})(typeof self !== 'undefined' ? self : this);\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 return exports;\n\n}({}));\n})(__self__);\ndelete __self__.fetch.polyfill\nexports = __self__.fetch // To enable: import fetch from 'cross-fetch'\nexports.default = __self__.fetch // For TypeScript consumers without esModuleInterop.\nexports.fetch = __self__.fetch // To enable: import {fetch} from 'cross-fetch'\nexports.Headers = __self__.Headers\nexports.Request = __self__.Request\nexports.Response = __self__.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\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].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","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(47);\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};"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["webpack://PagerDuty/./node_modules/abortcontroller-polyfill/dist/cjs-ponyfill.js","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"],"names":["_classCallCheck","instance","Constructor","TypeError","_defineProperties","target","props","i","length","descriptor","enumerable","configurable","writable","Object","defineProperty","key","_createClass","protoProps","staticProps","prototype","_getPrototypeOf","o","setPrototypeOf","getPrototypeOf","__proto__","_setPrototypeOf","p","_assertThisInitialized","self","ReferenceError","_possibleConstructorReturn","call","_get","property","receiver","Reflect","get","base","object","hasOwnProperty","_superPropBase","desc","getOwnPropertyDescriptor","value","Emitter","this","type","callback","options","listeners","push","stack","l","splice","event","stackToCall","slice","listener","e","Promise","resolve","then","once","removeEventListener","defaultPrevented","AbortSignal","_Emitter","subClass","superClass","create","constructor","_inherits","Derived","hasNativeReflectConstruct","_super","construct","sham","Proxy","Date","toString","_isNativeReflectConstruct","result","Super","NewTarget","arguments","apply","_this","aborted","onabort","AbortController","Event","document","createEvent","initEvent","createEventObject","bubbles","cancelable","signal","dispatchEvent","Symbol","toStringTag","exports","_typeof","iterator","obj","isBrowser","window","name","process","versions","node","global","__self__","F","fetch","DOMException","support","Blob","viewClasses","isArrayBufferView","ArrayBuffer","isView","indexOf","normalizeName","String","test","toLowerCase","normalizeValue","iteratorFor","items","next","shift","done","undefined","Headers","headers","map","forEach","append","Array","isArray","header","getOwnPropertyNames","consumed","body","bodyUsed","reject","fileReaderReady","reader","onload","onerror","error","readBlobAsArrayBuffer","blob","FileReader","promise","readAsArrayBuffer","bufferClone","buf","view","Uint8Array","byteLength","set","buffer","Body","_initBody","_bodyInit","_bodyText","isPrototypeOf","_bodyBlob","FormData","_bodyFormData","URLSearchParams","DataView","_bodyArrayBuffer","rejected","Error","arrayBuffer","text","readAsText","chars","fromCharCode","join","readArrayBufferAsText","formData","decode","json","JSON","parse","oldValue","has","thisArg","keys","values","entries","methods","Request","input","method","upcased","url","credentials","mode","toUpperCase","referrer","form","trim","split","bytes","replace","decodeURIComponent","Response","bodyInit","status","ok","statusText","clone","response","redirectStatuses","redirect","RangeError","location","err","message","init","request","xhr","XMLHttpRequest","abortXhr","abort","rawHeaders","getAllResponseHeaders","line","parts","responseURL","responseText","ontimeout","open","withCredentials","responseType","setRequestHeader","addEventListener","onreadystatechange","readyState","send","polyfill","ponyfill","ctx","default","module","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","__webpack_modules__","n","getter","__esModule","d","a","definition","prop","r","queryParameters","requestTimeout","rest","applyParameters","URL","applyTimeout","fetch_retry","userAgentHeader","retries","retryTimeout","retryTimeoutPromise","milliseconds","setTimeout","version","platform","combinedParameters","searchParams","parameter","item","search","timeout","controller","api","apiParameters","endpoint","partialParameters","partial","shorthand","shorthandParameters","post","put","patch","all","allInner","responses","concat","repackedResponse","data","resource","repackResponses","partialCall","server","token","tokenType","config","Accept","Authorization","bearer","includes","stringify","apiRequest","apiResponse","match","resourceKey","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","eventParameters","eventFetch","action","trigger","acknowledge","change"],"mappings":"oDAIA,SAASA,EAAgBC,EAAUC,GACjC,KAAMD,aAAoBC,GACxB,MAAM,IAAIC,UAAU,qCAIxB,SAASC,EAAkBC,EAAQC,GACjC,IAAK,IAAIC,EAAI,EAAGA,EAAID,EAAME,OAAQD,IAAK,CACrC,IAAIE,EAAaH,EAAMC,GACvBE,EAAWC,WAAaD,EAAWC,aAAc,EACjDD,EAAWE,cAAe,EACtB,UAAWF,IAAYA,EAAWG,UAAW,GACjDC,OAAOC,eAAeT,EAAQI,EAAWM,IAAKN,IAIlD,SAASO,EAAad,EAAae,EAAYC,GAG7C,OAFID,GAAYb,EAAkBF,EAAYiB,UAAWF,GACrDC,GAAad,EAAkBF,EAAagB,GACzChB,EAkBT,SAASkB,EAAgBC,GAIvB,OAHAD,EAAkBP,OAAOS,eAAiBT,OAAOU,eAAiB,SAAyBF,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,OAAI8Q,GAAL,IAAsBtR,KAAM,c","file":"pdjs-legacy.js","sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\n\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, descriptor.key, descriptor);\n }\n}\n\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n return Constructor;\n}\n\nfunction _inherits(subClass, superClass) {\n if (typeof superClass !== \"function\" && superClass !== null) {\n throw new TypeError(\"Super expression must either be null or a function\");\n }\n\n subClass.prototype = Object.create(superClass && superClass.prototype, {\n constructor: {\n value: subClass,\n writable: true,\n configurable: true\n }\n });\n if (superClass) _setPrototypeOf(subClass, superClass);\n}\n\nfunction _getPrototypeOf(o) {\n _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) {\n return o.__proto__ || Object.getPrototypeOf(o);\n };\n return _getPrototypeOf(o);\n}\n\nfunction _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}\n\nfunction _isNativeReflectConstruct() {\n if (typeof Reflect === \"undefined\" || !Reflect.construct) return false;\n if (Reflect.construct.sham) return false;\n if (typeof Proxy === \"function\") return true;\n\n try {\n Date.prototype.toString.call(Reflect.construct(Date, [], function () {}));\n return true;\n } catch (e) {\n return false;\n }\n}\n\nfunction _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}\n\nfunction _possibleConstructorReturn(self, call) {\n if (call && (typeof call === \"object\" || typeof call === \"function\")) {\n return call;\n }\n\n return _assertThisInitialized(self);\n}\n\nfunction _createSuper(Derived) {\n var hasNativeReflectConstruct = _isNativeReflectConstruct();\n\n return function _createSuperInternal() {\n var Super = _getPrototypeOf(Derived),\n result;\n\n if (hasNativeReflectConstruct) {\n var NewTarget = _getPrototypeOf(this).constructor;\n\n result = Reflect.construct(Super, arguments, NewTarget);\n } else {\n result = Super.apply(this, arguments);\n }\n\n return _possibleConstructorReturn(this, result);\n };\n}\n\nfunction _superPropBase(object, property) {\n while (!Object.prototype.hasOwnProperty.call(object, property)) {\n object = _getPrototypeOf(object);\n if (object === null) break;\n }\n\n return object;\n}\n\nfunction _get(target, property, receiver) {\n if (typeof Reflect !== \"undefined\" && Reflect.get) {\n _get = Reflect.get;\n } else {\n _get = function _get(target, property, receiver) {\n var base = _superPropBase(target, property);\n\n if (!base) return;\n var desc = Object.getOwnPropertyDescriptor(base, property);\n\n if (desc.get) {\n return desc.get.call(receiver);\n }\n\n return desc.value;\n };\n }\n\n return _get(target, property, receiver || target);\n}\n\nvar Emitter = /*#__PURE__*/function () {\n function Emitter() {\n _classCallCheck(this, Emitter);\n\n Object.defineProperty(this, 'listeners', {\n value: {},\n writable: true,\n configurable: true\n });\n }\n\n _createClass(Emitter, [{\n key: \"addEventListener\",\n value: function addEventListener(type, callback, options) {\n if (!(type in this.listeners)) {\n this.listeners[type] = [];\n }\n\n this.listeners[type].push({\n callback: callback,\n options: options\n });\n }\n }, {\n key: \"removeEventListener\",\n value: function removeEventListener(type, callback) {\n if (!(type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[type];\n\n for (var i = 0, l = stack.length; i < l; i++) {\n if (stack[i].callback === callback) {\n stack.splice(i, 1);\n return;\n }\n }\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (!(event.type in this.listeners)) {\n return;\n }\n\n var stack = this.listeners[event.type];\n var stackToCall = stack.slice();\n\n for (var i = 0, l = stackToCall.length; i < l; i++) {\n var listener = stackToCall[i];\n\n try {\n listener.callback.call(this, event);\n } catch (e) {\n Promise.resolve().then(function () {\n throw e;\n });\n }\n\n if (listener.options && listener.options.once) {\n this.removeEventListener(event.type, listener.callback);\n }\n }\n\n return !event.defaultPrevented;\n }\n }]);\n\n return Emitter;\n}();\n\nvar AbortSignal = /*#__PURE__*/function (_Emitter) {\n _inherits(AbortSignal, _Emitter);\n\n var _super = _createSuper(AbortSignal);\n\n function AbortSignal() {\n var _this;\n\n _classCallCheck(this, AbortSignal);\n\n _this = _super.call(this); // Some versions of babel does not transpile super() correctly for IE <= 10, if the parent\n // constructor has failed to run, then \"this.listeners\" will still be undefined and then we call\n // the parent constructor directly instead as a workaround. For general details, see babel bug:\n // https://github.com/babel/babel/issues/3041\n // This hack was added as a fix for the issue described here:\n // https://github.com/Financial-Times/polyfill-library/pull/59#issuecomment-477558042\n\n if (!_this.listeners) {\n Emitter.call(_assertThisInitialized(_this));\n } // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController().signal) to be [] for compat with the native impl\n\n\n Object.defineProperty(_assertThisInitialized(_this), 'aborted', {\n value: false,\n writable: true,\n configurable: true\n });\n Object.defineProperty(_assertThisInitialized(_this), 'onabort', {\n value: null,\n writable: true,\n configurable: true\n });\n return _this;\n }\n\n _createClass(AbortSignal, [{\n key: \"toString\",\n value: function toString() {\n return '[object AbortSignal]';\n }\n }, {\n key: \"dispatchEvent\",\n value: function dispatchEvent(event) {\n if (event.type === 'abort') {\n this.aborted = true;\n\n if (typeof this.onabort === 'function') {\n this.onabort.call(this, event);\n }\n }\n\n _get(_getPrototypeOf(AbortSignal.prototype), \"dispatchEvent\", this).call(this, event);\n }\n }]);\n\n return AbortSignal;\n}(Emitter);\nvar AbortController = /*#__PURE__*/function () {\n function AbortController() {\n _classCallCheck(this, AbortController);\n\n // Compared to assignment, Object.defineProperty makes properties non-enumerable by default and\n // we want Object.keys(new AbortController()) to be [] for compat with the native impl\n Object.defineProperty(this, 'signal', {\n value: new AbortSignal(),\n writable: true,\n configurable: true\n });\n }\n\n _createClass(AbortController, [{\n key: \"abort\",\n value: function abort() {\n var event;\n\n try {\n event = new Event('abort');\n } catch (e) {\n if (typeof document !== 'undefined') {\n if (!document.createEvent) {\n // For Internet Explorer 8:\n event = document.createEventObject();\n event.type = 'abort';\n } else {\n // For Internet Explorer 11:\n event = document.createEvent('Event');\n event.initEvent('abort', false, false);\n }\n } else {\n // Fallback where document isn't available:\n event = {\n type: 'abort',\n bubbles: false,\n cancelable: false\n };\n }\n }\n\n this.signal.dispatchEvent(event);\n }\n }, {\n key: \"toString\",\n value: function toString() {\n return '[object AbortController]';\n }\n }]);\n\n return AbortController;\n}();\n\nif (typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n // These are necessary to make sure that we get correct output for:\n // Object.prototype.toString.call(new AbortController())\n AbortController.prototype[Symbol.toStringTag] = 'AbortController';\n AbortSignal.prototype[Symbol.toStringTag] = 'AbortSignal';\n}\n\nfunction polyfillNeeded(self) {\n if (self.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n console.log('__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL=true is set, will force install polyfill');\n return true;\n } // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // so the below feature detection needs the !self.AbortController part.\n // The Request.prototype check is also needed because Safari versions 11.1.2\n // up to and including 12.1.x has a window.AbortController present but still\n // does NOT correctly implement abortable fetch:\n // https://bugs.webkit.org/show_bug.cgi?id=174980#c2\n\n\n return typeof self.Request === 'function' && !self.Request.prototype.hasOwnProperty('signal') || !self.AbortController;\n}\n\n/**\n * Note: the \"fetch.Request\" default value is available for fetch imported from\n * the \"node-fetch\" package and not in browsers. This is OK since browsers\n * will be importing umd-polyfill.js from that path \"self\" is passed the\n * decorator so the default value will not be used (because browsers that define\n * fetch also has Request). One quirky setup where self.fetch exists but\n * self.Request does not is when the \"unfetch\" minimal fetch polyfill is used\n * on top of IE11; for this case the browser will try to use the fetch.Request\n * default value which in turn will be undefined but then then \"if (Request)\"\n * will ensure that you get a patched fetch but still no Request (as expected).\n * @param {fetch, Request = fetch.Request}\n * @returns {fetch: abortableFetch, Request: AbortableRequest}\n */\n\nfunction abortableFetchDecorator(patchTargets) {\n if ('function' === typeof patchTargets) {\n patchTargets = {\n fetch: patchTargets\n };\n }\n\n var _patchTargets = patchTargets,\n fetch = _patchTargets.fetch,\n _patchTargets$Request = _patchTargets.Request,\n NativeRequest = _patchTargets$Request === void 0 ? fetch.Request : _patchTargets$Request,\n NativeAbortController = _patchTargets.AbortController,\n _patchTargets$__FORCE = _patchTargets.__FORCE_INSTALL_ABORTCONTROLLER_POLYFILL,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL = _patchTargets$__FORCE === void 0 ? false : _patchTargets$__FORCE;\n\n if (!polyfillNeeded({\n fetch: fetch,\n Request: NativeRequest,\n AbortController: NativeAbortController,\n __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL: __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL\n })) {\n return {\n fetch: fetch,\n Request: Request\n };\n }\n\n var Request = NativeRequest; // Note that the \"unfetch\" minimal fetch polyfill defines fetch() without\n // defining window.Request, and this polyfill need to work on top of unfetch\n // hence we only patch it if it's available. Also we don't patch it if signal\n // is already available on the Request prototype because in this case support\n // is present and the patching below can cause a crash since it assigns to\n // request.signal which is technically a read-only property. This latter error\n // happens when you run the main5.js node-fetch example in the repo\n // \"abortcontroller-polyfill-examples\". The exact error is:\n // request.signal = init.signal;\n // ^\n // TypeError: Cannot set property signal of # which has only a getter\n\n if (Request && !Request.prototype.hasOwnProperty('signal') || __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL) {\n Request = function Request(input, init) {\n var signal;\n\n if (init && init.signal) {\n signal = init.signal; // Never pass init.signal to the native Request implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to construct 'Request': member signal is not of type AbortSignal.\n\n delete init.signal;\n }\n\n var request = new NativeRequest(input, init);\n\n if (signal) {\n Object.defineProperty(request, 'signal', {\n writable: false,\n enumerable: false,\n configurable: true,\n value: signal\n });\n }\n\n return request;\n };\n\n Request.prototype = NativeRequest.prototype;\n }\n\n var realFetch = fetch;\n\n var abortableFetch = function abortableFetch(input, init) {\n var signal = Request && Request.prototype.isPrototypeOf(input) ? input.signal : init ? init.signal : undefined;\n\n if (signal) {\n var abortError;\n\n try {\n abortError = new DOMException('Aborted', 'AbortError');\n } catch (err) {\n // IE 11 does not support calling the DOMException constructor, use a\n // regular error object on it instead.\n abortError = new Error('Aborted');\n abortError.name = 'AbortError';\n } // Return early if already aborted, thus avoiding making an HTTP request\n\n\n if (signal.aborted) {\n return Promise.reject(abortError);\n } // Turn an event into a promise, reject it once `abort` is dispatched\n\n\n var cancellation = new Promise(function (_, reject) {\n signal.addEventListener('abort', function () {\n return reject(abortError);\n }, {\n once: true\n });\n });\n\n if (init && init.signal) {\n // Never pass .signal to the native implementation when the polyfill has\n // been installed because if we're running on top of a browser with a\n // working native AbortController (i.e. the polyfill was installed due to\n // __FORCE_INSTALL_ABORTCONTROLLER_POLYFILL being set), then passing our\n // fake AbortSignal to the native fetch will trigger:\n // TypeError: Failed to execute 'fetch' on 'Window': member signal is not of type AbortSignal.\n delete init.signal;\n } // Return the fastest promise (don't need to wait for request to finish)\n\n\n return Promise.race([cancellation, realFetch(input, init)]);\n }\n\n return realFetch(input, init);\n };\n\n return {\n fetch: abortableFetch,\n Request: Request\n };\n}\n\nexports.AbortController = AbortController;\nexports.AbortSignal = AbortSignal;\nexports.abortableFetch = abortableFetchDecorator;\n","'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 {AbortController} from 'abortcontroller-polyfill/dist/cjs-ponyfill';\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 retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000, ...rest} = options;\n\n url = new URL(url.toString());\n\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...rest,\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 ...rest.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 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\n const controller = new AbortController();\n setTimeout(() => controller.abort(), timeout);\n\n return {\n ...init,\n signal: controller.signal,\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);\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) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n return resource[1];\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"],"sourceRoot":""} \ No newline at end of file diff --git a/dist/pdjs.js b/dist/pdjs.js index e901559..0e375e1 100644 --- a/dist/pdjs.js +++ b/dist/pdjs.js @@ -1,2 +1,2 @@ -var PagerDuty;PagerDuty=(()=>{"use strict";var e={337:(e,t,r)=>{function n(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 o(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function i(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t,n=r.queryParameters,u=r.requestTimeout,i=void 0===u?3e4:u,f=c(r,["queryParameters","requestTimeout"]);return e=l(e=new URL(e.toString()),n),t=p(t,i),a(e.toString(),3,o(o({},f),{},{headers:new Headers(o({"Content-Type":"application/json; charset=utf-8"},f.headers))}))}function a(e,t,r){return new Promise((function(n,o){fetch(e,r).then((function(u){if(0===t)return n(u);if(429===u.status){var c=r.retryTimeout;f(void 0===c?2e4:c).then((function(){a(e,t-1,r).then(n).catch(o)}))}else n(u)})).catch(o)}))}r.r(t),r.d(t,{acknowledge:()=>_,api:()=>w,change:()=>A,event:()=>E,resolve:()=>R,trigger:()=>q});var f=function(e){return new Promise((function(t){return setTimeout(t,e)}))};function l(e,t){if(!t)return e;for(var r=e.searchParams,n=function(){var e=u[o],n=t[e];Array.isArray(n)?n.forEach((function(t){r.append(e,t)})):r.append(e,n)},o=0,u=Object.keys(t);o]+)>/g,(function(e,t){return"$"+r[t]})))}if("function"==typeof t){var u=this;return n[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!==s(e[e.length-1])&&e.push(c(e,u)),t.apply(this,e)}))}return n[Symbol.replace].call(this,e,t)},y.apply(this,arguments)}function b(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&&d(e,t)}function O(e){var t="function"==typeof Map?new Map:void 0;return(O=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return v(e,arguments,h(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)})(e)}function v(e,t,r){return(v=g()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&d(o,r.prototype),o}).apply(null,arguments)}function g(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return!1}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function h(e){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function m(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 j(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["endpoint","server","token","tokenType","url","version","data"]),O=j(j({method:"GET"},b),{},{headers:j({Accept:"application/vnd.pagerduty+json;version=".concat(s),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[f]).concat(i)},b.headers)});return r=O.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?O.queryParameters=null!==(t=O.queryParameters)&&void 0!==t?t:y:O.body=JSON.stringify(y),S(null!=l?l:"https://".concat(c,"/").concat(o.replace(/^\/+/,"")),O)}function S(e,t){return i(e,t).then((function(r){var n=r;n.response=r;var o=function(e){var t=e.match(y(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));return t?t[1]:null}(e);return r.json().then((function(r){return n.next=function(e,t,r){if(function(e){return void 0!==e.offset}(r)){if(null!=r&&r.more&&void 0!==s(r.offset)&&r.limit)return function(){return S(e,j(j({},t),{},{queryParameters:j(j({},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 S(e,j(j({},t),{},{queryParameters:j(j({},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)}))}))}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 u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["server","type","data"]),a="https://".concat(r,"/v2/enqueue");return"change"===o&&(a="https://".concat(r,"/v2/change/enqueue")),function(e,t){return i(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(u)},c))}var D=function(e){return function(t){return E(T(T({},t),{},{data:T(T({},t.data),{},k({},"event_action",e))}))}},q=D("trigger"),_=D("acknowledge"),R=D("resolve"),A=function(e){return E(T(T({},e),{},{type:"change"}))}}},t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={exports:{}};return e[n](o,o.exports,r),o.exports}return 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})},r(337)})(); +var PagerDuty;(()=>{"use strict";var e={d:(t,r)=>{for(var n in r)e.o(r,n)&&!e.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:r[n]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(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 n(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}function c(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=t,o=r.queryParameters,c=r.requestTimeout,a=void 0===c?3e4:c,p=u(r,["queryParameters","requestTimeout"]);return e=f(e=new URL(e.toString()),o),t=l(t,a),i(e.toString(),3,n(n({},p),{},{headers:new Headers(n({"Content-Type":"application/json; charset=utf-8"},p.headers))}))}function i(e,t,r){return new Promise((function(n,o){fetch(e,r).then((function(u){if(0===t)return n(u);if(429===u.status){var c=r.retryTimeout;a(void 0===c?2e4:c).then((function(){i(e,t-1,r).then(n).catch(o)}))}else n(u)})).catch(o)}))}e.r(t),e.d(t,{acknowledge:()=>q,api:()=>P,change:()=>R,event:()=>E,resolve:()=>_,trigger:()=>D});var a=function(e){return new Promise((function(t){return setTimeout(t,e)}))};function f(e,t){if(!t)return e;for(var r=e.searchParams,n=function(){var e=u[o],n=t[e];Array.isArray(n)?n.forEach((function(t){r.append(e,t)})):r.append(e,n)},o=0,u=Object.keys(t);o]+)>/g,(function(e,t){return"$"+r[t]})))}if("function"==typeof t){var u=this;return n[Symbol.replace].call(this,e,(function(){var e=[];return e.push.apply(e,arguments),"object"!==p(e[e.length-1])&&e.push(c(e,u)),t.apply(this,e)}))}return n[Symbol.replace].call(this,e,t)},s.apply(this,arguments)}function y(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&&d(e,t)}function b(e){var t="function"==typeof Map?new Map:void 0;return(b=function(e){if(null===e||(r=e,-1===Function.toString.call(r).indexOf("[native code]")))return e;var r;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return O(e,arguments,g(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)})(e)}function O(e,t,r){return(O=v()?Reflect.construct:function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&d(o,r.prototype),o}).apply(null,arguments)}function v(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}function d(e,t){return(d=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}function g(e){return(g=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function h(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 m(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["endpoint","server","token","tokenType","url","version","data"]),O=m(m({method:"GET"},b),{},{headers:m({Accept:"application/vnd.pagerduty+json;version=".concat(s),Authorization:"".concat({bearer:"Bearer ",token:"Token token="}[f]).concat(i)},b.headers)});return r=O.method,!["PUT","POST","DELETE","PATCH"].includes(null!==(n=r.toUpperCase())&&void 0!==n?n:"GET")&&y?O.queryParameters=null!==(t=O.queryParameters)&&void 0!==t?t:y:O.body=JSON.stringify(y),w(null!=l?l:"https://".concat(c,"/").concat(o.replace(/^\/+/,"")),O)}function w(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){var t=e.match(s(/.+.com\/([0-9A-Z_a-z]+)/,{resource:1}));return t?t[1]:null}(e);return n.next=function(e,t,r){if(function(e){return void 0!==e.offset}(r)){if(null!=r&&r.more&&void 0!==p(r.offset)&&r.limit)return function(){return w(e,m(m({},t),{},{queryParameters:m(m({},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 w(e,m(m({},t),{},{queryParameters:m(m({},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)}))}))}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 T(e){for(var t=1;t=0||(o[r]=e[r]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,r)&&(o[r]=e[r])}return o}(e,["server","type","data"]),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(u)},i))}var x=function(e){return function(t){return E(T(T({},t),{},{data:T(T({},t.data),{},k({},"event_action",e))}))}},D=x("trigger"),q=x("acknowledge"),_=x("resolve"),R=function(e){return E(T(T({},e),{},{type:"change"}))};PagerDuty=t})(); //# sourceMappingURL=pdjs.js.map \ No newline at end of file diff --git a/dist/pdjs.js.map b/dist/pdjs.js.map index bdb97dc..c4e91da 100644 --- a/dist/pdjs.js.map +++ b/dist/pdjs.js.map @@ -1 +1 @@ -{"version":3,"sources":["webpack://PagerDuty/./src/common.ts","webpack://PagerDuty/./src/api.ts","webpack://PagerDuty/./src/events.ts","webpack://PagerDuty/webpack/bootstrap","webpack://PagerDuty/webpack/startup","webpack://PagerDuty/webpack/runtime/define property getters","webpack://PagerDuty/webpack/runtime/hasOwnProperty shorthand","webpack://PagerDuty/webpack/runtime/make namespace object"],"names":["request","url","options","queryParameters","requestTimeout","rest","applyParameters","URL","toString","applyTimeout","fetch_retry","headers","Headers","retries","Promise","resolve","reject","fetch","then","response","status","retryTimeout","retryTimeoutPromise","milliseconds","setTimeout","combinedParameters","searchParams","key","parameter","Array","isArray","forEach","item","append","Object","keys","search","init","timeout","controller","AbortController","abort","signal","api","apiParameters","endpoint","partialParameters","partial","shorthand","method","shorthandParameters","get","post","put","patch","all","allInner","responses","length","next","concat","repackedResponse","shift","data","resource","repackResponses","partialCall","server","token","tokenType","version","config","Accept","Authorization","bearer","includes","toUpperCase","body","JSON","stringify","apiRequest","replace","apiResponse","match","resourceKey","json","undefined","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","type","eventFetch","action","trigger","acknowledge","change","__webpack_module_cache__","__webpack_require__","moduleId","exports","module","__webpack_modules__","d","definition","o","defineProperty","enumerable","obj","prop","prototype","hasOwnProperty","call","r","Symbol","toStringTag","value"],"mappings":"2mCAcO,SAASA,EACdC,GAEmB,IADnBC,EACmB,uDADO,GACP,EACwCA,EAApDC,EADY,EACZA,gBADY,IACKC,sBADL,MACsB,IADtB,EACgCC,EADhC,0CAQnB,OAHAJ,EAAMK,EAFNL,EAAM,IAAIM,IAAIN,EAAIO,YAESL,GAC3BD,EAAUO,EAAaP,EAASE,GAEzBM,EAAYT,EAAIO,WAAY,EAAjB,OACbH,GADa,IAEhBM,QAAS,IAAIC,QAAJ,GACP,eAAgB,mCAEbP,EAAKM,aAKd,SAASD,EACPT,EACAY,EACAX,GAEA,OAAO,IAAIY,SAAQ,SAACC,EAASC,GAC3BC,MAAMhB,EAAKC,GACRgB,MAAK,SAAAC,GAGJ,GAAgB,IAAZN,EAAe,OAAOE,EAAQI,GAClC,GAAwB,MAApBA,EAASC,OAAgB,OACIlB,EAAxBmB,aACPC,OAF2B,MACL,IADK,GAEOJ,MAAK,WACrCR,EAAYT,EAAKY,EAAU,EAAGX,GAC3BgB,KAAKH,GADR,MAESC,WAGXD,EAAQI,MAbd,MAgBSH,M,iGAIb,IAAMM,EAAsB,SAACC,GAC3B,OAAO,IAAIT,SAAQ,SAAAC,GAAO,OAAIS,WAAWT,EAASQ,OAWpD,SAASjB,E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ack-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 retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000, ...rest} = options;\n\n url = new URL(url.toString());\n\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...rest,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* webpack-strip-block:removed */\n ...rest.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 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\n const controller = new AbortController();\n setTimeout(() => controller.abort(), timeout);\n\n return {\n ...init,\n signal: controller.signal,\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 const resource = resourceKey(url);\n return response\n .json()\n .then(\n (data): APIResponse => {\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) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n return resource[1];\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","// 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\tif(__webpack_module_cache__[moduleId]) {\n\t\treturn __webpack_module_cache__[moduleId].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](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","// module exports must be returned from runtime so entry inlining is disabled\n// startup\n// Load entry module and return exports\nreturn __webpack_require__(337);\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};"],"sourceRoot":""} \ No newline at end of file +{"version":3,"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"],"names":["__webpack_require__","exports","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","request","url","options","queryParameters","requestTimeout","rest","applyParameters","URL","toString","applyTimeout","fetch_retry","headers","Headers","retries","Promise","resolve","reject","fetch","then","response","status","retryTimeout","retryTimeoutPromise","milliseconds","setTimeout","combinedParameters","searchParams","parameter","Array","isArray","forEach","item","append","keys","search","init","timeout","controller","AbortController","abort","signal","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","config","Accept","Authorization","bearer","includes","toUpperCase","body","JSON","stringify","apiRequest","replace","apiResponse","json","match","resourceKey","undefined","offset","isOffsetPagination","more","limit","cursor","isCursorPagination","nextFunc","event","eventParameters","type","eventFetch","action","trigger","acknowledge","change"],"mappings":"iCACA,IAAIA,EAAsB,CCA1B,EAAwB,CA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MAC3B,SAACC,GACC,IAAM4D,EAAc5D,EACpB,OAAOA,EAAS6D,OAAO9D,MACrB,SAAC0C,GAGC,OAFAmB,EAAYnB,KAAOA,EACnBmB,EAAY5D,SAAWA,EAChB4D,QAnCRe,CAAW7F,EAAD,GACf8C,OAAQ,OACR2B,KAAMC,KAAKC,UAAUhB,IAClBQ,IAIP,IAAMtB,EAAY,SAACiD,GAAD,OAAoB,SACpCH,GAIA,OAAOD,EAAM,OACRC,GADO,IAEVhC,KAAM,OACDgC,EAAgBhC,MADjB,QAJY,eAMDmC,SAKNC,EAAUlD,EAAU,WACpBmD,EAAcnD,EAAU,eACxB/B,EAAU+B,EAAU,WACpBoD,EAAS,SAACN,GAAD,OACpBD,EAAM,OAAIC,GAAL,IAAsBC,KAAM,a","file":"pdjs.js","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 retryTimeout?: number;\n timeout?: number;\n}\n\nexport function request(\n url: string | URL,\n options: RequestOptions = {}\n): Promise {\n const {queryParameters, requestTimeout = 30000, ...rest} = options;\n\n url = new URL(url.toString());\n\n url = applyParameters(url, queryParameters);\n options = applyTimeout(options, requestTimeout);\n\n return fetch_retry(url.toString(), 3, {\n ...rest,\n headers: new Headers({\n 'Content-Type': 'application/json; charset=utf-8',\n /* webpack-strip-block:removed */\n ...rest.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 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\n const controller = new AbortController();\n setTimeout(() => controller.abort(), timeout);\n\n return {\n ...init,\n signal: controller.signal,\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);\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) {\n const resource = url.match(/.+.com\\/(?[\\w]+)/);\n if (resource) {\n return resource[1];\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"],"sourceRoot":""} \ No newline at end of file diff --git a/examples/browser.html b/examples/browser.html index 9c445e0..b448134 100644 --- a/examples/browser.html +++ b/examples/browser.html @@ -7,8 +7,8 @@ - - + +