/**
 * Minified by jsDelivr using Terser v5.39.0.
 * Original file: /npm/@itentialopensource/adapter-service_desk_plus@1.0.0/adapter.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
/* @copyright Itential, LLC 2019 (pre-modifications) */
const path=require("path"),AdapterBaseCl=require(path.join(__dirname,"adapterBase.js"));class ServiceDeskPlus extends AdapterBaseCl{healthCheck(r,t){let e=null;r&&(e=Object.assign(...r)),super.healthCheck(e,t)}iapGetAdapterWorkflowFunctions(r){let t=["healthCheck","iapGetAdapterWorkflowFunctions","hasEntities","getAuthorization"];return!r&&Array.isArray(r)?t=r:r||"string"!=typeof r||(t=[r]),super.iapGetAdapterWorkflowFunctions(t)}iapUpdateAdapterConfiguration(r,t,e,n,l,s,u){const i=`${this.id}-adapter-iapUpdateAdapterConfiguration`;log.trace(i),super.iapUpdateAdapterConfiguration(r,t,e,n,l,s,u)}iapSuspendAdapter(r,t){const e=`${this.id}-adapter-iapSuspendAdapter`;log.trace(e);try{return super.iapSuspendAdapter(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapUnsuspendAdapter(r){const t=`${this.id}-adapter-iapUnsuspendAdapter`;log.trace(t);try{return super.iapUnsuspendAdapter(r)}catch(e){return log.error(`${t}: ${e}`),r(null,e)}}iapGetAdapterQueue(r){const t=`${this.id}-adapter-iapGetAdapterQueue`;return log.trace(t),super.iapGetAdapterQueue(r)}iapFindAdapterPath(r,t){const e=`${this.id}-adapter-iapFindAdapterPath`;log.trace(e),super.iapFindAdapterPath(r,t)}iapTroubleshootAdapter(r,t){const e=`${this.id}-adapter-iapTroubleshootAdapter`;log.trace(e);try{return super.iapTroubleshootAdapter(r,this,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapRunAdapterHealthcheck(r){const t=`${this.id}-adapter-iapRunAdapterHealthcheck`;log.trace(t);try{return super.iapRunAdapterHealthcheck(this,r)}catch(e){return log.error(`${t}: ${e}`),r(null,e)}}iapRunAdapterConnectivity(r){const t=`${this.id}-adapter-iapRunAdapterConnectivity`;log.trace(t);try{return super.iapRunAdapterConnectivity(r)}catch(e){return log.error(`${t}: ${e}`),r(null,e)}}iapRunAdapterBasicGet(r,t){const e=`${this.id}-adapter-iapRunAdapterBasicGet`;log.trace(e);try{return super.iapRunAdapterBasicGet(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapMoveAdapterEntitiesToDB(r){const t=`${this.id}-adapter-iapMoveAdapterEntitiesToDB`;log.trace(t);try{return super.iapMoveAdapterEntitiesToDB(r)}catch(e){return log.error(`${t}: ${e}`),r(null,e)}}iapDeactivateTasks(r,t){const e=`${this.id}-adapter-iapDeactivateTasks`;log.trace(e);try{return super.iapDeactivateTasks(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapActivateTasks(r,t){const e=`${this.id}-adapter-iapActivateTasks`;log.trace(e);try{return super.iapActivateTasks(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapPopulateEntityCache(r,t){const e=`${this.id}-adapter-iapPopulateEntityCache`;log.trace(e);try{return super.iapPopulateEntityCache(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}iapRetrieveEntitiesCache(r,t,e){const n=`${this.id}-adapter-iapCheckEiapRetrieveEntitiesCachentityCached`;log.trace(n);try{return super.iapRetrieveEntitiesCache(r,t,e)}catch(r){return log.error(`${n}: ${r}`),e(null,r)}}hasEntities(r,t,e){const n=`${this.id}-adapter-hasEntities`;log.trace(n);try{return super.hasEntities(r,t,e)}catch(r){return log.error(`${n}: ${r}`),e(null,r)}}getDevice(r,t){const e=`${this.id}-adapter-getDevice`;log.trace(e);try{return super.getDevice(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}getDevicesFiltered(r,t){const e=`${this.id}-adapter-getDevicesFiltered`;log.trace(e);try{return super.getDevicesFiltered(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}isAlive(r,t){const e=`${this.id}-adapter-isAlive`;log.trace(e);try{return super.isAlive(r,t)}catch(r){return log.error(`${e}: ${r}`),t(null,r)}}getConfig(r,t,e){const n=`${this.id}-adapter-getConfig`;log.trace(n);try{return super.getConfig(r,t,e)}catch(r){return log.error(`${n}: ${r}`),e(null,r)}}iapGetDeviceCount(r){const t=`${this.id}-adapter-iapGetDeviceCount`;log.trace(t);try{return super.iapGetDeviceCount(r)}catch(e){return log.error(`${t}: ${e}`),r(null,e)}}iapExpandedGenericAdapterRequest(r,t,e,n,l,s,u,i){const o=`${this.id}-adapter-iapExpandedGenericAdapterRequest`;log.trace(o);try{return super.iapExpandedGenericAdapterRequest(r,t,e,n,l,s,u,i)}catch(r){return log.error(`${o}: ${r}`),i(null,r)}}genericAdapterRequest(r,t,e,n,l,s){const u=`${this.id}-adapter-genericAdapterRequest`;log.trace(u);try{return super.genericAdapterRequest(r,t,e,n,l,s)}catch(r){return log.error(`${u}: ${r}`),s(null,r)}}genericAdapterRequestNoBasePath(r,t,e,n,l,s){const u=`${this.id}-adapter-genericAdapterRequestNoBasePath`;log.trace(u);try{return super.genericAdapterRequestNoBasePath(r,t,e,n,l,s)}catch(r){return log.error(`${u}: ${r}`),s(null,r)}}iapRunAdapterLint(r){const t=`${this.id}-adapter-iapRunAdapterLint`;return log.trace(t),super.iapRunAdapterLint(r)}iapRunAdapterTests(r){const t=`${this.id}-adapter-iapRunAdapterTests`;return log.trace(t),super.iapRunAdapterTests(r)}iapGetAdapterInventory(r){const t=`${this.id}-adapter-iapGetAdapterInventory`;return log.trace(t),super.iapGetAdapterInventory(r)}postAddRequest(r,t){const e="adapter-postAddRequest",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["body"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={},s={},u=r;Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:u,uriPathVars:[],uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Request","postAddRequest",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["postAddRequest"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}postAssociateProjectToRequest(r,t,e){const n="adapter-postAssociateProjectToRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Request","postAssociateProjectToRequest",a,!0,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["postAssociateProjectToRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}putUpdateRequest(r,t,e){const n="adapter-putUpdateRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Request","putUpdateRequest",a,!1,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["putUpdateRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}postAddResolution(r,t,e){const n="adapter-postAddResolution",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Request","postAddResolution",a,!0,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["postAddResolution"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}getRequests(r){const t="adapter-getRequests",e=`${this.id}-${t}`;if(log.trace(e),this.suspended&&"error"===this.suspendMode){const n=this.requestHandlerInst.formatErrorObject(this.id,t,"AD.600",[],null,null,null);return log.error(`${e}: ${n.IAPerror.displayString}`),r(null,n)}const n={},l={};Object.keys(n).forEach((r=>{null!=n[r]&&""!==n[r]&&(l[r]=n[r])}));const s={payload:{},uriPathVars:[],uriQuery:l};try{return this.requestHandlerInst.identifyRequest("Request","getRequests",s,!0,((n,l)=>{if(l)return r(null,l);if(!Object.hasOwnProperty.call(n,"response")){const n=this.requestHandlerInst.formatErrorObject(this.id,t,"Invalid Response",["getRequests"],null,null,null);return log.error(`${e}: ${n.IAPerror.displayString}`),r(null,n)}return r(n,null)}))}catch(n){const l=this.requestHandlerInst.formatErrorObject(this.id,t,"Caught Exception",null,null,null,n);return log.error(`${e}: ${l.IAPerror.displayString}`),r(null,l)}}getRequestById(r,t){const e="adapter-getRequestById",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["requestId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Request","getRequestById",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["getRequestById"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}getRequestSummary(r,t){const e="adapter-getRequestSummary",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["requestId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Request","getRequestSummary",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["getRequestSummary"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}getResolutionsFromRequest(r,t){const e="adapter-getResolutionsFromRequest",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["requestId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Request","getResolutionsFromRequest",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["getResolutionsFromRequest"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}assignRequest(r,t,e){const n="adapter-assignRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Request","assignRequest",a,!1,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["assignRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}closeRequest(r,t,e){const n="adapter-closeRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Request","closeRequest",a,!1,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["closeRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}getProblemsFromRequest(r,t){const e="adapter-getProblemsFromRequest",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["requestId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Problem","getProblemsFromRequest",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["getProblemsFromRequest"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}associateProblemWithRequest(r,t,e){const n="adapter-associateProblemWithRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Problem","associateProblemWithRequest",a,!0,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["associateProblemWithRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}dissociateProblemWithRequest(r,t,e){const n="adapter-dissociateProblemWithRequest",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["requestId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Problem","dissociateProblemWithRequest",a,!1,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["dissociateProblemWithRequest"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}getChanges(r){const t="adapter-getChanges",e=`${this.id}-${t}`;if(log.trace(e),this.suspended&&"error"===this.suspendMode){const n=this.requestHandlerInst.formatErrorObject(this.id,t,"AD.600",[],null,null,null);return log.error(`${e}: ${n.IAPerror.displayString}`),r(null,n)}const n={OPERATION_NAME:"GET_ALL"},l={};Object.keys(n).forEach((r=>{null!=n[r]&&""!==n[r]&&(l[r]=n[r])}));const s={payload:{},uriPathVars:[],uriQuery:l};try{return this.requestHandlerInst.identifyRequest("Change","getChanges",s,!0,((n,l)=>{if(l)return r(null,l);if(!Object.hasOwnProperty.call(n,"response")){const n=this.requestHandlerInst.formatErrorObject(this.id,t,"Invalid Response",["getChanges"],null,null,null);return log.error(`${e}: ${n.IAPerror.displayString}`),r(null,n)}return r(n,null)}))}catch(n){const l=this.requestHandlerInst.formatErrorObject(this.id,t,"Caught Exception",null,null,null,n);return log.error(`${e}: ${l.IAPerror.displayString}`),r(null,l)}}createChange(r,t){const e="adapter-createChange",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["body"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={OPERATION_NAME:"ADD"},s={},u=r;Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:u,uriPathVars:[],uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Change","createChange",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["createChange"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}getChangeById(r,t){const e="adapter-getChangeById",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["changeId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={OPERATION_NAME:"GET"},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Change","getChangeById",i,!0,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["getChangeById"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}updateChange(r,t,e){const n="adapter-updateChange",l=`${this.id}-${n}`;if(log.trace(l),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"AD.600",[],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["changeId"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}if(null==t||""===t){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Missing Data",["body"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}const s={OPERATION_NAME:"UPDATE"},u={},i=[r],o=t;Object.keys(s).forEach((r=>{null!=s[r]&&""!==s[r]&&(u[r]=s[r])}));const a={payload:o,uriPathVars:i,uriQuery:u};try{return this.requestHandlerInst.identifyRequest("Change","updateChange",a,!1,((r,t)=>{if(t)return e(null,t);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,n,"Invalid Response",["updateChange"],null,null,null);return log.error(`${l}: ${r.IAPerror.displayString}`),e(null,r)}return e(r,null)}))}catch(r){const t=this.requestHandlerInst.formatErrorObject(this.id,n,"Caught Exception",null,null,null,r);return log.error(`${l}: ${t.IAPerror.displayString}`),e(null,t)}}deleteChange(r,t){const e="adapter-deleteChange",n=`${this.id}-${e}`;if(log.trace(n),this.suspended&&"error"===this.suspendMode){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"AD.600",[],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}if(null==r||""===r){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Missing Data",["changeId"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}const l={OPERATION_NAME:"DELETE"},s={},u=[r];Object.keys(l).forEach((r=>{null!=l[r]&&""!==l[r]&&(s[r]=l[r])}));const i={payload:{},uriPathVars:u,uriQuery:s};try{return this.requestHandlerInst.identifyRequest("Change","updateChange",i,!1,((r,l)=>{if(l)return t(null,l);if(!Object.hasOwnProperty.call(r,"response")){const r=this.requestHandlerInst.formatErrorObject(this.id,e,"Invalid Response",["updateChange"],null,null,null);return log.error(`${n}: ${r.IAPerror.displayString}`),t(null,r)}return t(r,null)}))}catch(r){const l=this.requestHandlerInst.formatErrorObject(this.id,e,"Caught Exception",null,null,null,r);return log.error(`${n}: ${l.IAPerror.displayString}`),t(null,l)}}}module.exports=ServiceDeskPlus;
//# sourceMappingURL=/sm/41076e00c252bec06f762533e7d71e03101aea8f51fc82b8227a9cef1800a657.map