@ace-de/eua-silver-dat-client
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -1,2 +0,2 @@ | ||
function e(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(){t=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:j(e,r,c)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var h="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function T(){}function b(){}var w={};l(w,c,(function(){return this}));var x=Object.getPrototypeOf,A=x&&x(x(D([])));A&&A!==n&&o.call(A,c)&&(w=A);var E=b.prototype=g.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(n,i,a,c){var u=p(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,n){r(e,o,t,n)}))}return n=n?n.then(i,i):i()}})}function j(t,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=p(t,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return T.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:T,configurable:!0}),T.displayName=l(b,s,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===T||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},r.awrap=function(e){return{__await:e}},O(k.prototype),l(k.prototype,u,(function(){return this})),r.AsyncIterator=k,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var a=new k(f(e,t,n,o),i);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),l(E,s,"Generator"),l(E,c,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=D,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void r(s)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}function c(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function f(){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 p(e,t,r){return p=f()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&l(o,r.prototype),o},p.apply(null,arguments)}function h(e){var t="function"===typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},h(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){var t=f();return function(){var r,n=s(e);if(t){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===typeof t||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}var d=0;function m(e){return"__private_"+d+++"_"+e}function g(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var T={},b=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,w=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,x=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,A=/\\([\u000b\u0020-\u00ff])/g,E=/([\\"])/g,O=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function k(e){var t=String(e);if(x.test(t))return t;if(t.length>0&&!w.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(E,"\\$1")+'"'}function j(e){this.parameters=Object.create(null),this.type=e}T.format=function(e){if(!e||"object"!==typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!O.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"===typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!x.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+k(t[o])}return n},T.parse=function(e){if(!e)throw new TypeError("argument string is required");var t="object"===typeof e?function(e){var t;"function"===typeof e.getHeader?t=e.getHeader("content-type"):"object"===typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!==typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!==typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.slice(0,r).trim():t.trim();if(!O.test(n))throw new TypeError("invalid media type");var o=new j(n.toLowerCase());if(-1!==r){var i,a,c;for(b.lastIndex=r;a=b.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),34===(c=a[2]).charCodeAt(0)&&-1!==(c=c.slice(1,-1)).indexOf("\\")&&(c=c.replace(A,"$1")),o.parameters[i]=c}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};var S=function(e){!function(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(r,h(Error));var t=y(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return i(this,r),e=t.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(v(e),r),e.response=o,e}return c(r)}(),P=function(e){var t=function(e){var t=T.parse(e.headers.get("content-type")).type;return["application/json"].indexOf(t)>-1?e.json():["text/html","application/xml","text/xml"].indexOf(t)>-1?e.text():["application/octet-stream"].indexOf(t)>-1?Promise.resolve(""):["application/pdf"].indexOf(t)>-1?e.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(t,"'.")))}(e);return e.ok?t:t.then((function(t){throw new S(t,e)}))},L="APPRAISAL",_=m("silverDATAuthToken"),D=m("silverDATAuthTokenRefreshTimeout"),V=c((function r(){var n=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),this.accessToken=null,this.setAccessToken=function(e){n.accessToken=e},Object.defineProperty(this,_,{writable:!0,value:null}),Object.defineProperty(this,D,{writable:!0,value:null}),this.acquireSilverDATAuthToken=o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(n.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(n.accessToken)}}).then(P).then((function(e){return e.token}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.startSilverDATTokenRefreshTimeout=function(){clearTimeout(g(n,D)[D]);g(n,D)[D]=setTimeout(o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.acquireSilverDATAuthToken();case 2:g(n,_)[_]=e.sent,g(n,_)[_]&&n.startSilverDATTokenRefreshTimeout();case 4:case"end":return e.stop()}}),e)}))),15e5)},this.getSilverDATAuthToken=o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!g(n,_)[_]){e.next=2;break}return e.abrupt("return",g(n,_)[_]);case 2:return e.next=4,n.acquireSilverDATAuthToken();case 4:return g(n,_)[_]=e.sent,g(n,_)[_]&&n.startSilverDATTokenRefreshTimeout(),e.abrupt("return",g(n,_)[_]);case 7:case"end":return e.stop()}}),e)}))),this.getVehicleTypes=o(t().mark((function e(){var r,o,i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSilverDATAuthToken();case 2:return r=e.sent,o=n.serviceParameters.SERVICE_URL,i='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(r,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getVehicleTypes>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n <restriction>ALL</restriction>\n </request>\n </veh:getVehicleTypes>\n </soapenv:Body>\n </soapenv:Envelope>\n '),e.abrupt("return",fetch(o,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":r},body:i}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("vehicleType"),r={};return t.forEach((function(e){r[e.getAttribute("key")]=e.getAttribute("value")})),{vehicleTypes:r}})));case 6:case"end":return e.stop()}}),e)}))),this.getVehicleManufacturers=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>0&&void 0!==p[0]?p[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=n.serviceParameters.SERVICE_URL,f='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getManufacturers>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n </request>\n </veh:getManufacturers>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(l,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:f}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("manufacturer"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleManufacturers:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleModels=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h.length>0&&void 0!==h[0]?h[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=n.serviceParameters.SERVICE_URL,p='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getBaseModelsN>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n </request>\n </veh:getBaseModelsN>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(f,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:p}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("baseModelN"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleModels:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleVariants=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h,v=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.length>0&&void 0!==v[0]?v[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=r.baseModel,p=n.serviceParameters.SERVICE_URL,h='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getSubModels>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n ").concat(f?"<baseModel>".concat(f,"</baseModel>"):"","\n </request>\n </veh:getSubModels>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(p,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:h}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("subModel"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleVariants:r}})));case 8:case"end":return e.stop()}}),e)}))),this.serviceParameters=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},a),{setAccessToken:this.setAccessToken,getVehicleTypes:this.getVehicleTypes,getVehicleManufacturers:this.getVehicleManufacturers,getVehicleModels:this.getVehicleModels,getVehicleVariants:this.getVehicleVariants}}));export{V as SilverDATClient}; | ||
function e(e,r,n){return r=f(r),function(e,t){if(t&&("object"===typeof t||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,t()?Reflect.construct(r,n||[],f(e).constructor):r.apply(e,n))}function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}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(){n=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:j(e,r,c)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var h="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function T(){}function b(){}var w={};l(w,c,(function(){return this}));var x=Object.getPrototypeOf,A=x&&x(x(D([])));A&&A!==r&&o.call(A,c)&&(w=A);var E=b.prototype=g.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(n,i,a,c){var u=p(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,n){r(e,o,t,n)}))}return n=n?n.then(i,i):i()}})}function j(t,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=p(t,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return T.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:T,configurable:!0}),T.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===T||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},O(k.prototype),l(k.prototype,u,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new k(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),l(E,s,"Generator"),l(E,c,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=D,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void r(s)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function h(e){var r="function"===typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return function(e,r,n){if(t())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,r);var i=new(e.bind.apply(e,o));return n&&p(i,n.prototype),i}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}var v=0;function y(e){return"__private_"+v+++"_"+e}function d(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var m={},g=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,T=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,b=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,w=/\\([\u000b\u0020-\u00ff])/g,x=/([\\"])/g,A=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function E(e){var t=String(e);if(b.test(t))return t;if(t.length>0&&!T.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(x,"\\$1")+'"'}function O(e){this.parameters=Object.create(null),this.type=e}m.format=function(e){if(!e||"object"!==typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!A.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"===typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!b.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+E(t[o])}return n},m.parse=function(e){if(!e)throw new TypeError("argument string is required");var t="object"===typeof e?function(e){var t;"function"===typeof e.getHeader?t=e.getHeader("content-type"):"object"===typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!==typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!==typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.slice(0,r).trim():t.trim();if(!A.test(n))throw new TypeError("invalid media type");var o=new O(n.toLowerCase());if(-1!==r){var i,a,c;for(g.lastIndex=r;a=g.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),34===(c=a[2]).charCodeAt(0)&&-1!==(c=c.slice(1,-1)).indexOf("\\")&&(c=c.replace(w,"$1")),o.parameters[i]=c}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};var k=function(t){function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return c(this,r),t=e(this,r,[n]),Error.captureStackTrace&&Error.captureStackTrace(t,r),t.response=o,t}return function(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(r,h(Error)),s(r)}(),j=function(e){var t=function(e){var t=m.parse(e.headers.get("content-type")).type;return["application/json"].indexOf(t)>-1?e.json():["text/html","application/xml","text/xml"].indexOf(t)>-1?e.text():["application/octet-stream"].indexOf(t)>-1?Promise.resolve(""):["application/pdf"].indexOf(t)>-1?e.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(t,"'.")))}(e);return e.ok?t:t.then((function(t){throw new k(t,e)}))},S="APPRAISAL",P=y("silverDATAuthToken"),L=y("silverDATAuthTokenRefreshTimeout"),_=s((function e(){var t=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c(this,e),this.accessToken=null,this.setAccessToken=function(e){t.accessToken=e},Object.defineProperty(this,P,{writable:!0,value:null}),Object.defineProperty(this,L,{writable:!0,value:null}),this.acquireSilverDATAuthToken=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(t.accessToken)}}).then(j).then((function(e){return e.token}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.startSilverDATTokenRefreshTimeout=function(){clearTimeout(d(t,L)[L]);d(t,L)[L]=setTimeout(a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.acquireSilverDATAuthToken();case 2:d(t,P)[P]=e.sent,d(t,P)[P]&&t.startSilverDATTokenRefreshTimeout();case 4:case"end":return e.stop()}}),e)}))),15e5)},this.getSilverDATAuthToken=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!d(t,P)[P]){e.next=2;break}return e.abrupt("return",d(t,P)[P]);case 2:return e.next=4,t.acquireSilverDATAuthToken();case 4:return d(t,P)[P]=e.sent,d(t,P)[P]&&t.startSilverDATTokenRefreshTimeout(),e.abrupt("return",d(t,P)[P]);case 7:case"end":return e.stop()}}),e)}))),this.getVehicleTypes=a(n().mark((function e(){var r,o,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getSilverDATAuthToken();case 2:return r=e.sent,o=t.serviceParameters.SERVICE_URL,i='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(r,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getVehicleTypes>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n <restriction>ALL</restriction>\n </request>\n </veh:getVehicleTypes>\n </soapenv:Body>\n </soapenv:Envelope>\n '),e.abrupt("return",fetch(o,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":r},body:i}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("vehicleType"),r={};return t.forEach((function(e){r[e.getAttribute("key")]=e.getAttribute("value")})),{vehicleTypes:r}})));case 6:case"end":return e.stop()}}),e)}))),this.getVehicleManufacturers=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>0&&void 0!==p[0]?p[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=t.serviceParameters.SERVICE_URL,f='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getManufacturers>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n </request>\n </veh:getManufacturers>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(l,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:f}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("manufacturer"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleManufacturers:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleModels=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h.length>0&&void 0!==h[0]?h[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=t.serviceParameters.SERVICE_URL,p='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getBaseModelsN>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n </request>\n </veh:getBaseModelsN>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(f,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:p}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("baseModelN"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleModels:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleVariants=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h,v=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.length>0&&void 0!==v[0]?v[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=r.baseModel,p=t.serviceParameters.SERVICE_URL,h='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getSubModels>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n ").concat(f?"<baseModel>".concat(f,"</baseModel>"):"","\n </request>\n </veh:getSubModels>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(p,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:h}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("subModel"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleVariants:r}})));case 8:case"end":return e.stop()}}),e)}))),this.serviceParameters=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o),{setAccessToken:this.setAccessToken,getVehicleTypes:this.getVehicleTypes,getVehicleManufacturers:this.getVehicleManufacturers,getVehicleModels:this.getVehicleModels,getVehicleVariants:this.getVehicleVariants}}));export{_ as SilverDATClient}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function e(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(){t=function(){return r};var e,r={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:j(e,r,c)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}r.wrap=f;var h="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function T(){}function b(){}var w={};l(w,c,(function(){return this}));var x=Object.getPrototypeOf,A=x&&x(x(D([])));A&&A!==n&&o.call(A,c)&&(w=A);var E=b.prototype=g.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(n,i,a,c){var u=p(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,n){r(e,o,t,n)}))}return n=n?n.then(i,i):i()}})}function j(t,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=p(t,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return T.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:T,configurable:!0}),T.displayName=l(b,s,"GeneratorFunction"),r.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===T||"GeneratorFunction"===(t.displayName||t.name))},r.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},r.awrap=function(e){return{__await:e}},O(k.prototype),l(k.prototype,u,(function(){return this})),r.AsyncIterator=k,r.async=function(e,t,n,o,i){void 0===i&&(i=Promise);var a=new k(f(e,t,n,o),i);return r.isGeneratorFunction(t)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),l(E,s,"Generator"),l(E,c,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),r.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},r.values=D,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},r}function r(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:String(t)}function n(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void r(s)}c.done?t(u):Promise.resolve(u).then(n,o)}function o(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var a=e.apply(t,r);function c(e){n(a,o,i,c,u,"next",e)}function u(e){n(a,o,i,c,u,"throw",e)}c(void 0)}))}}function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var n=0;n<t.length;n++){var o=t[n];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(e,r(o.key),o)}}function c(e,t,r){return t&&a(e.prototype,t),r&&a(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function u(e,t,n){return(t=r(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function s(e){return s=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},s(e)}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}function f(){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 p(e,t,r){return p=f()?Reflect.construct.bind():function(e,t,r){var n=[null];n.push.apply(n,t);var o=new(Function.bind.apply(e,n));return r&&l(o,r.prototype),o},p.apply(null,arguments)}function h(e){var t="function"===typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return p(e,arguments,s(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,e)},h(e)}function v(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function y(e){var t=f();return function(){var r,n=s(e);if(t){var o=s(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(e,t){if(t&&("object"===typeof t||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return v(e)}(this,r)}}var d=0;function m(e){return"__private_"+d+++"_"+e}function g(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var T={},b=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,w=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,x=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,A=/\\([\u000b\u0020-\u00ff])/g,E=/([\\"])/g,O=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function k(e){var t=String(e);if(x.test(t))return t;if(t.length>0&&!w.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(E,"\\$1")+'"'}function j(e){this.parameters=Object.create(null),this.type=e}T.format=function(e){if(!e||"object"!==typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!O.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"===typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!x.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+k(t[o])}return n},T.parse=function(e){if(!e)throw new TypeError("argument string is required");var t="object"===typeof e?function(e){var t;"function"===typeof e.getHeader?t=e.getHeader("content-type"):"object"===typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!==typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!==typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.slice(0,r).trim():t.trim();if(!O.test(n))throw new TypeError("invalid media type");var o=new j(n.toLowerCase());if(-1!==r){var i,a,c;for(b.lastIndex=r;a=b.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),34===(c=a[2]).charCodeAt(0)&&-1!==(c=c.slice(1,-1)).indexOf("\\")&&(c=c.replace(A,"$1")),o.parameters[i]=c}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};var S=function(e){!function(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&l(e,t)}(r,h(Error));var t=y(r);function r(){var e,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return i(this,r),e=t.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(v(e),r),e.response=o,e}return c(r)}(),P=function(e){var t=function(e){var t=T.parse(e.headers.get("content-type")).type;return["application/json"].indexOf(t)>-1?e.json():["text/html","application/xml","text/xml"].indexOf(t)>-1?e.text():["application/octet-stream"].indexOf(t)>-1?Promise.resolve(""):["application/pdf"].indexOf(t)>-1?e.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(t,"'.")))}(e);return e.ok?t:t.then((function(t){throw new S(t,e)}))},L="APPRAISAL",_=m("silverDATAuthToken"),D=m("silverDATAuthTokenRefreshTimeout"),V=c((function r(){var n=this,a=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return i(this,r),this.accessToken=null,this.setAccessToken=function(e){n.accessToken=e},Object.defineProperty(this,_,{writable:!0,value:null}),Object.defineProperty(this,D,{writable:!0,value:null}),this.acquireSilverDATAuthToken=o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(n.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(n.accessToken)}}).then(P).then((function(e){return e.token}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.startSilverDATTokenRefreshTimeout=function(){clearTimeout(g(n,D)[D]);g(n,D)[D]=setTimeout(o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.acquireSilverDATAuthToken();case 2:g(n,_)[_]=e.sent,g(n,_)[_]&&n.startSilverDATTokenRefreshTimeout();case 4:case"end":return e.stop()}}),e)}))),15e5)},this.getSilverDATAuthToken=o(t().mark((function e(){return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!g(n,_)[_]){e.next=2;break}return e.abrupt("return",g(n,_)[_]);case 2:return e.next=4,n.acquireSilverDATAuthToken();case 4:return g(n,_)[_]=e.sent,g(n,_)[_]&&n.startSilverDATTokenRefreshTimeout(),e.abrupt("return",g(n,_)[_]);case 7:case"end":return e.stop()}}),e)}))),this.getVehicleTypes=o(t().mark((function e(){var r,o,i;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.getSilverDATAuthToken();case 2:return r=e.sent,o=n.serviceParameters.SERVICE_URL,i='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(r,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getVehicleTypes>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n <restriction>ALL</restriction>\n </request>\n </veh:getVehicleTypes>\n </soapenv:Body>\n </soapenv:Envelope>\n '),e.abrupt("return",fetch(o,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":r},body:i}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("vehicleType"),r={};return t.forEach((function(e){r[e.getAttribute("key")]=e.getAttribute("value")})),{vehicleTypes:r}})));case 6:case"end":return e.stop()}}),e)}))),this.getVehicleManufacturers=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>0&&void 0!==p[0]?p[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=n.serviceParameters.SERVICE_URL,f='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getManufacturers>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n </request>\n </veh:getManufacturers>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(l,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:f}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("manufacturer"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleManufacturers:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleModels=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h.length>0&&void 0!==h[0]?h[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=n.serviceParameters.SERVICE_URL,p='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getBaseModelsN>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n </request>\n </veh:getBaseModelsN>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(f,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:p}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("baseModelN"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleModels:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleVariants=o(t().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h,v=arguments;return t().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.length>0&&void 0!==v[0]?v[0]:{},e.next=3,n.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?L:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=r.baseModel,p=n.serviceParameters.SERVICE_URL,h='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getSubModels>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n ").concat(f?"<baseModel>".concat(f,"</baseModel>"):"","\n </request>\n </veh:getSubModels>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(p,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:h}).then(P).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("subModel"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleVariants:r}})));case 8:case"end":return e.stop()}}),e)}))),this.serviceParameters=function(t){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?e(Object(n),!0).forEach((function(e){u(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):e(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},a),{setAccessToken:this.setAccessToken,getVehicleTypes:this.getVehicleTypes,getVehicleManufacturers:this.getVehicleManufacturers,getVehicleModels:this.getVehicleModels,getVehicleVariants:this.getVehicleVariants}}));exports.SilverDATClient=V; | ||
"use strict";function e(e,r,n){return r=f(r),function(e,t){if(t&&("object"===typeof t||"function"===typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,t()?Reflect.construct(r,n||[],f(e).constructor):r.apply(e,n))}function t(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(t=function(){return!!e})()}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(){n=function(){return t};var e,t={},r=Object.prototype,o=r.hasOwnProperty,i=Object.defineProperty||function(e,t,r){e[t]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function l(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{l({},"")}catch(e){l=function(e,t,r){return e[t]=r}}function f(e,t,r,n){var o=t&&t.prototype instanceof g?t:g,a=Object.create(o.prototype),c=new _(n||[]);return i(a,"_invoke",{value:j(e,r,c)}),a}function p(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}t.wrap=f;var h="suspendedStart",v="suspendedYield",y="executing",d="completed",m={};function g(){}function T(){}function b(){}var w={};l(w,c,(function(){return this}));var x=Object.getPrototypeOf,A=x&&x(x(D([])));A&&A!==r&&o.call(A,c)&&(w=A);var E=b.prototype=g.prototype=Object.create(w);function O(e){["next","throw","return"].forEach((function(t){l(e,t,(function(e){return this._invoke(t,e)}))}))}function k(e,t){function r(n,i,a,c){var u=p(e[n],e,i);if("throw"!==u.type){var s=u.arg,l=s.value;return l&&"object"==typeof l&&o.call(l,"__await")?t.resolve(l.__await).then((function(e){r("next",e,a,c)}),(function(e){r("throw",e,a,c)})):t.resolve(l).then((function(e){s.value=e,a(s)}),(function(e){return r("throw",e,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(e,o){function i(){return new t((function(t,n){r(e,o,t,n)}))}return n=n?n.then(i,i):i()}})}function j(t,r,n){var o=h;return function(i,a){if(o===y)throw Error("Generator is already running");if(o===d){if("throw"===i)throw a;return{value:e,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=S(c,n);if(u){if(u===m)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=d,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=p(t,r,n);if("normal"===s.type){if(o=n.done?d:v,s.arg===m)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=d,n.method="throw",n.arg=s.arg)}}}function S(t,r){var n=r.method,o=t.iterator[n];if(o===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,S(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),m;var i=p(o,t.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,m;var a=i.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,m):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,m)}function P(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function _(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(P,this),this.reset(!0)}function D(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var n=-1,i=function r(){for(;++n<t.length;)if(o.call(t,n))return r.value=t[n],r.done=!1,r;return r.value=e,r.done=!0,r};return i.next=i}}throw new TypeError(typeof t+" is not iterable")}return T.prototype=b,i(E,"constructor",{value:b,configurable:!0}),i(b,"constructor",{value:T,configurable:!0}),T.displayName=l(b,s,"GeneratorFunction"),t.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===T||"GeneratorFunction"===(t.displayName||t.name))},t.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,b):(e.__proto__=b,l(e,s,"GeneratorFunction")),e.prototype=Object.create(E),e},t.awrap=function(e){return{__await:e}},O(k.prototype),l(k.prototype,u,(function(){return this})),t.AsyncIterator=k,t.async=function(e,r,n,o,i){void 0===i&&(i=Promise);var a=new k(f(e,r,n,o),i);return t.isGeneratorFunction(r)?a:a.next().then((function(e){return e.done?e.value:a.next()}))},O(E),l(E,s,"Generator"),l(E,c,(function(){return this})),l(E,"toString",(function(){return"[object Generator]"})),t.keys=function(e){var t=Object(e),r=[];for(var n in t)r.push(n);return r.reverse(),function e(){for(;r.length;){var n=r.pop();if(n in t)return e.value=n,e.done=!1,e}return e.done=!0,e}},t.values=D,_.prototype={constructor:_,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(L),!t)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,o){return c.type="throw",c.arg=t,r.next=n,o&&(r.method="next",r.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=o.call(a,"catchLoc"),s=o.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&o.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===e||"continue"===e)&&i.tryLoc<=t&&t<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=e,a.arg=t,i?(this.method="next",this.next=i.finallyLoc,m):this.complete(a)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:D(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),m}},t}function o(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function i(e,t,r,n,o,i,a){try{var c=e[i](a),u=c.value}catch(s){return void r(s)}c.done?t(u):Promise.resolve(u).then(n,o)}function a(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var a=e.apply(t,r);function c(e){i(a,n,o,c,u,"next",e)}function u(e){i(a,n,o,c,u,"throw",e)}c(void 0)}))}}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function u(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,o(n.key),n)}}function s(e,t,r){return t&&u(e.prototype,t),r&&u(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function l(e,t,r){return(t=o(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function f(e){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},f(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function h(e){var r="function"===typeof Map?new Map:void 0;return h=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"===typeof e}}(e))return e;if("function"!==typeof e)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof r){if(r.has(e))return r.get(e);r.set(e,n)}function n(){return function(e,r,n){if(t())return Reflect.construct.apply(null,arguments);var o=[null];o.push.apply(o,r);var i=new(e.bind.apply(e,o));return n&&p(i,n.prototype),i}(e,arguments,f(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),p(n,e)},h(e)}var v=0;function y(e){return"__private_"+v+++"_"+e}function d(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw new TypeError("attempted to use private field on non-instance");return e}var m={},g=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,T=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,b=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,w=/\\([\u000b\u0020-\u00ff])/g,x=/([\\"])/g,A=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function E(e){var t=String(e);if(b.test(t))return t;if(t.length>0&&!T.test(t))throw new TypeError("invalid parameter value");return'"'+t.replace(x,"\\$1")+'"'}function O(e){this.parameters=Object.create(null),this.type=e}m.format=function(e){if(!e||"object"!==typeof e)throw new TypeError("argument obj is required");var t=e.parameters,r=e.type;if(!r||!A.test(r))throw new TypeError("invalid type");var n=r;if(t&&"object"===typeof t)for(var o,i=Object.keys(t).sort(),a=0;a<i.length;a++){if(o=i[a],!b.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+E(t[o])}return n},m.parse=function(e){if(!e)throw new TypeError("argument string is required");var t="object"===typeof e?function(e){var t;"function"===typeof e.getHeader?t=e.getHeader("content-type"):"object"===typeof e.headers&&(t=e.headers&&e.headers["content-type"]);if("string"!==typeof t)throw new TypeError("content-type header is missing from object");return t}(e):e;if("string"!==typeof t)throw new TypeError("argument string is required to be a string");var r=t.indexOf(";"),n=-1!==r?t.slice(0,r).trim():t.trim();if(!A.test(n))throw new TypeError("invalid media type");var o=new O(n.toLowerCase());if(-1!==r){var i,a,c;for(g.lastIndex=r;a=g.exec(t);){if(a.index!==r)throw new TypeError("invalid parameter format");r+=a[0].length,i=a[1].toLowerCase(),34===(c=a[2]).charCodeAt(0)&&-1!==(c=c.slice(1,-1)).indexOf("\\")&&(c=c.replace(w,"$1")),o.parameters[i]=c}if(r!==t.length)throw new TypeError("invalid parameter format")}return o};var k=function(t){function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return c(this,r),t=e(this,r,[n]),Error.captureStackTrace&&Error.captureStackTrace(t,r),t.response=o,t}return function(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}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(r,h(Error)),s(r)}(),j=function(e){var t=function(e){var t=m.parse(e.headers.get("content-type")).type;return["application/json"].indexOf(t)>-1?e.json():["text/html","application/xml","text/xml"].indexOf(t)>-1?e.text():["application/octet-stream"].indexOf(t)>-1?Promise.resolve(""):["application/pdf"].indexOf(t)>-1?e.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(t,"'.")))}(e);return e.ok?t:t.then((function(t){throw new k(t,e)}))},S="APPRAISAL",P=y("silverDATAuthToken"),L=y("silverDATAuthTokenRefreshTimeout"),_=s((function e(){var t=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return c(this,e),this.accessToken=null,this.setAccessToken=function(e){t.accessToken=e},Object.defineProperty(this,P,{writable:!0,value:null}),Object.defineProperty(this,L,{writable:!0,value:null}),this.acquireSilverDATAuthToken=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,fetch(t.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(t.accessToken)}}).then(j).then((function(e){return e.token}));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}}),e)}))),this.startSilverDATTokenRefreshTimeout=function(){clearTimeout(d(t,L)[L]);d(t,L)[L]=setTimeout(a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.acquireSilverDATAuthToken();case 2:d(t,P)[P]=e.sent,d(t,P)[P]&&t.startSilverDATTokenRefreshTimeout();case 4:case"end":return e.stop()}}),e)}))),15e5)},this.getSilverDATAuthToken=a(n().mark((function e(){return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!d(t,P)[P]){e.next=2;break}return e.abrupt("return",d(t,P)[P]);case 2:return e.next=4,t.acquireSilverDATAuthToken();case 4:return d(t,P)[P]=e.sent,d(t,P)[P]&&t.startSilverDATTokenRefreshTimeout(),e.abrupt("return",d(t,P)[P]);case 7:case"end":return e.stop()}}),e)}))),this.getVehicleTypes=a(n().mark((function e(){var r,o,i;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getSilverDATAuthToken();case 2:return r=e.sent,o=t.serviceParameters.SERVICE_URL,i='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(r,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getVehicleTypes>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n <restriction>ALL</restriction>\n </request>\n </veh:getVehicleTypes>\n </soapenv:Body>\n </soapenv:Envelope>\n '),e.abrupt("return",fetch(o,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":r},body:i}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("vehicleType"),r={};return t.forEach((function(e){r[e.getAttribute("key")]=e.getAttribute("value")})),{vehicleTypes:r}})));case 6:case"end":return e.stop()}}),e)}))),this.getVehicleManufacturers=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=p.length>0&&void 0!==p[0]?p[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=t.serviceParameters.SERVICE_URL,f='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getManufacturers>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n </request>\n </veh:getManufacturers>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(l,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:f}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("manufacturer"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleManufacturers:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleModels=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=h.length>0&&void 0!==h[0]?h[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=t.serviceParameters.SERVICE_URL,p='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getBaseModelsN>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n </request>\n </veh:getBaseModelsN>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(f,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:p}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("baseModelN"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleModels:r}})));case 8:case"end":return e.stop()}}),e)}))),this.getVehicleVariants=a(n().mark((function e(){var r,o,i,a,c,u,s,l,f,p,h,v=arguments;return n().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.length>0&&void 0!==v[0]?v[0]:{},e.next=3,t.getSilverDATAuthToken();case 3:return o=e.sent,i=r.releaseRestriction,a=void 0===i?S:i,c=r.constructionTimeFrom,u=r.constructionTimeTo,s=r.vehicleType,l=r.manufacturer,f=r.baseModel,p=t.serviceParameters.SERVICE_URL,h='\n <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\n xmlns:veh="http://sphinx.dat.de/services/VehicleSelectionService">\n <soapenv:Header>\n <DAT-AuthorizationToken>'.concat(o,'</DAT-AuthorizationToken>\n </soapenv:Header>\n <soapenv:Body>\n <veh:getSubModels>\n <request>\n <locale country="de" datCountryIndicator="de" language="de"/>\n ').concat(c?"<constructionTimeFrom>".concat(c,"</constructionTimeFrom>"):"","\n ").concat(u?"<constructionTimeTo>".concat(u,"</constructionTimeTo>"):"","\n ").concat(a?"<restriction>".concat(a,"</restriction>"):"","\n ").concat(s?"<vehicleType>".concat(s,"</vehicleType>"):"","\n ").concat(l?"<manufacturer>".concat(l,"</manufacturer>"):"","\n ").concat(f?"<baseModel>".concat(f,"</baseModel>"):"","\n </request>\n </veh:getSubModels>\n </soapenv:Body>\n </soapenv:Envelope>\n "),e.abrupt("return",fetch(p,{method:"POST",headers:{"Content-Type":"text/xml",Accept:"*/*","DAT-AuthorizationToken":o},body:h}).then(j).then((function(e){var t=(new DOMParser).parseFromString(e,"text/xml").getElementsByTagName("subModel"),r={};return Array.from(t).forEach((function(e){var t=e.getAttribute("key"),n=e.getAttribute("value");r[t]={name:n}})),{vehicleVariants:r}})));case 8:case"end":return e.stop()}}),e)}))),this.serviceParameters=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?r(Object(n),!0).forEach((function(t){l(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):r(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({},o),{setAccessToken:this.setAccessToken,getVehicleTypes:this.getVehicleTypes,getVehicleManufacturers:this.getVehicleManufacturers,getVehicleModels:this.getVehicleModels,getVehicleVariants:this.getVehicleVariants}}));exports.SilverDATClient=_; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ace-de/eua-silver-dat-client", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "EUA Silver DAT Client", | ||
@@ -30,3 +30,3 @@ "author": "Computer Rock", | ||
}, | ||
"gitHead": "b4cee33119aff2e8f9fb87975749a1d9d7efba9f" | ||
"gitHead": "78ac00a1ac41aace4f5dc45b96b0fe6a0d11db28" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
105851
158
11