@ace-de/eua-datafactory-client
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -1,2 +0,2 @@ | ||
function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),c=new L(n||[]);return i(a,"_invoke",{value:_(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function m(){}function w(){}function E(){}var b={};f(b,c,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(R([])));x&&x!==n&&o.call(x,c)&&(b=x);var S=E.prototype=m.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function _(e,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=j(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?v:d,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function j(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,j(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function C(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(C,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=E,i(S,"constructor",{value:E,configurable:!0}),i(E,"constructor",{value:w,configurable:!0}),w.displayName=f(E,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,f(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(A.prototype),f(A.prototype,u,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),f(S,s,"Generator"),f(S,c,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function n(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(s){return void r(s)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function u(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function l(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t,e,r){return h=l()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&p(o,r.prototype),o},h.apply(null,arguments)}function d(t){var e="function"===typeof Map?new Map:void 0;return d=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"===typeof t}}(t))return t;if("function"!==typeof t)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return h(t,arguments,f(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,t)},d(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t){var e=l();return function(){var r,n=f(t);if(e){var o=f(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===typeof e||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}(this,r)}}var g=0;function m(t){return"__private_"+g+++"_"+t}function w(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var E={},b=/; *([!#$%&'*+.^_`|~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]+$/,x=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,S=/\\([\u000b\u0020-\u00ff])/g,O=/([\\"])/g,A=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function _(t){var e=String(t);if(x.test(e))return e;if(e.length>0&&!T.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(O,"\\$1")+'"'}function j(t){this.parameters=Object.create(null),this.type=t}E.format=function(t){if(!t||"object"!==typeof t)throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!A.test(r))throw new TypeError("invalid type");var n=r;if(e&&"object"===typeof e)for(var o,i=Object.keys(e).sort(),a=0;a<i.length;a++){if(o=i[a],!x.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+_(e[o])}return n},E.parse=function(t){if(!t)throw new TypeError("argument string is required");var e="object"===typeof t?function(t){var e;"function"===typeof t.getHeader?e=t.getHeader("content-type"):"object"===typeof t.headers&&(e=t.headers&&t.headers["content-type"]);if("string"!==typeof e)throw new TypeError("content-type header is missing from object");return e}(t):t;if("string"!==typeof e)throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=-1!==r?e.slice(0,r).trim():e.trim();if(!A.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(e);){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(S,"$1")),o.parameters[i]=c}if(r!==e.length)throw new TypeError("invalid parameter format")}return o};var C=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(r,d(Error));var e=v(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return a(this,r),t=e.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(y(t),r),t.response=o,t}return u(r)}(),P=function(t){var e=function(t){var e=E.parse(t.headers.get("content-type")).type;return["application/json"].indexOf(e)>-1?t.json():["text/html","application/xml","text/xml"].indexOf(e)>-1?t.text():["application/octet-stream"].indexOf(e)>-1?Promise.resolve(""):["application/pdf"].indexOf(e)>-1?t.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(e,"'.")))}(t);return t.ok?e:e.then((function(e){throw new C("string"===typeof e?e:JSON.stringify(e),t)}))},L={SEARCH_BUILDINGS:"search/:country/buildings",SELECT_BUILDINGS:"select/:country/buildings",SEARCH_ADDRESSES:"search/:country/postalcodes_cities_streets",SELECT_ADDRESSES:"select/:country/postalcodes_cities_streets",SEARCH_POST_CODES_CITIES:"search/:country/postalcodes_cities",SELECT_POST_CODES_CITIES:"select/:country/postalcodes_cities",SEARCH_POST_CODES:"search/:country/postalcodes",SELECT_POST_CODES:"select/:country/postalcodes",SEARCH_CITIES:"search/:country/cities",SELECT_CITIES:"select/:country/cities"};function R(t,e){void 0===e&&(e={});for(var r=function(t){for(var e=[],r=0;r<t.length;){var n=t[r];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)e.push({type:"CHAR",index:r,value:t[r++]});else{var o=1,i="";if("?"===t[c=r+1])throw new TypeError('Pattern cannot start with "?" at '.concat(c));for(;c<t.length;)if("\\"!==t[c]){if(")"===t[c]){if(0===--o){c++;break}}else if("("===t[c]&&(o++,"?"!==t[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));i+=t[c++]}else i+=t[c++]+t[c++];if(o)throw new TypeError("Unbalanced pattern at ".concat(r));if(!i)throw new TypeError("Missing pattern at ".concat(r));e.push({type:"PATTERN",index:r,value:i}),r=c}else{for(var a="",c=r+1;c<t.length;){var u=t.charCodeAt(c);if(!(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||95===u))break;a+=t[c++]}if(!a)throw new TypeError("Missing parameter name at ".concat(r));e.push({type:"NAME",index:r,value:a}),r=c}else e.push({type:"CLOSE",index:r,value:t[r++]});else e.push({type:"OPEN",index:r,value:t[r++]});else e.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});else e.push({type:"MODIFIER",index:r,value:t[r++]})}return e.push({type:"END",index:r,value:""}),e}(t),n=e.prefixes,o=void 0===n?"./":n,i="[^".concat(function(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}(e.delimiter||"/#?"),"]+?"),a=[],c=0,u=0,s="",f=function(t){if(u<r.length&&r[u].type===t)return r[u++].value},p=function(t){var e=f(t);if(void 0!==e)return e;var n=r[u],o=n.type,i=n.index;throw new TypeError("Unexpected ".concat(o," at ").concat(i,", expected ").concat(t))},l=function(){for(var t,e="";t=f("CHAR")||f("ESCAPED_CHAR");)e+=t;return e};u<r.length;){var h=f("CHAR"),d=f("NAME"),y=f("PATTERN");if(d||y){var v=h||"";-1===o.indexOf(v)&&(s+=v,v=""),s&&(a.push(s),s=""),a.push({name:d||c++,prefix:v,suffix:"",pattern:y||i,modifier:f("MODIFIER")||""})}else{var g=h||f("ESCAPED_CHAR");if(g)s+=g;else if(s&&(a.push(s),s=""),f("OPEN")){v=l();var m=f("NAME")||"",w=f("PATTERN")||"",E=l();p("CLOSE"),a.push({name:m||(w?c++:""),pattern:m&&!w?i:w,prefix:v,suffix:E,modifier:f("MODIFIER")||""})}else p("END")}}return a}function k(t,e){return function(t,e){void 0===e&&(e={});var r=function(t){return t&&t.sensitive?"":"i"}(e),n=e.encode,o=void 0===n?function(t){return t}:n,i=e.validate,a=void 0===i||i,c=t.map((function(t){if("object"===typeof t)return new RegExp("^(?:".concat(t.pattern,")$"),r)}));return function(e){for(var r="",n=0;n<t.length;n++){var i=t[n];if("string"!==typeof i){var u=e?e[i.name]:void 0,s="?"===i.modifier||"*"===i.modifier,f="*"===i.modifier||"+"===i.modifier;if(Array.isArray(u)){if(!f)throw new TypeError('Expected "'.concat(i.name,'" to not repeat, but got an array'));if(0===u.length){if(s)continue;throw new TypeError('Expected "'.concat(i.name,'" to not be empty'))}for(var p=0;p<u.length;p++){var l=o(u[p],i);if(a&&!c[n].test(l))throw new TypeError('Expected all "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else if("string"!==typeof u&&"number"!==typeof u){if(!s){var h=f?"an array":"a string";throw new TypeError('Expected "'.concat(i.name,'" to be ').concat(h))}}else{l=o(String(u),i);if(a&&!c[n].test(l))throw new TypeError('Expected "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else r+=i}return r}}(R(t,e),e)}var D=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",{encode:encodeURI})(t)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",district:t.district||"",street:"".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),distributionCode:t.distributionCode||"",country:e||"",countryCode:e?e.toUpperCase():"",formattedAddress:["".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),"".concat(t.postalCode).concat(t.district?" "+t.district:""),t.city].filter((function(t){return!!t})).join(", ")||""}},N=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",addressType:t.addressType||"",street:t.street||"",country:e||"",countryCode:e?e.toUpperCase():""}},U=m("datafactoryAuthToken"),B=m("datafactoryAuthTokenRefreshTimeout"),G=u((function t(){var n=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a(this,t),this.accessToken=null,this.setAccessToken=function(t){n.accessToken=t,n.getDatafactoryAuthToken()},Object.defineProperty(this,U,{writable:!0,value:null}),Object.defineProperty(this,B,{writable:!0,value:null}),this.acquireDatafactoryAuthToken=i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(n.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(n.accessToken)}}).then(P).then((function(t){return t.token}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),this.startDatafactoryTokenRefreshTimeout=function(){clearTimeout(w(n,B)[B]);w(n,B)[B]=setTimeout(i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.acquireDatafactoryAuthToken();case 2:w(n,U)[U]=t.sent,w(n,U)[U]&&n.startDatafactoryTokenRefreshTimeout();case 4:case"end":return t.stop()}}),t)}))),84e4)},this.getDatafactoryAuthToken=i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!w(n,U)[U]){t.next=2;break}return t.abrupt("return",w(n,U)[U]);case 2:return t.next=4,n.acquireDatafactoryAuthToken();case 4:return w(n,U)[U]=t.sent,w(n,U)[U]&&n.startDatafactoryTokenRefreshTimeout(),t.abrupt("return",w(n,U)[U]);case 7:case"end":return t.stop()}}),t)}))),this.searchAddressSuggestions=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.combined,(s=void 0===u?"":u)&&i.append("combined",s),f=i.toString(),p=n.serviceParameters.SERVICE_URL+D(L.SEARCH_BUILDINGS,{country:c})+"?".concat(f),t.abrupt("return",fetch(p,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}).then(P).then((function(t){return{addressCandidateDTOs:t.buildings.map((function(t){return I(t,c)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.searchAddressSuggestionsByField=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p,l,h;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.searchQueryParams,s=void 0===u?[]:u,f=e.resourcePathKey,p=void 0===f?"":f,s.forEach((function(t,e){return i.append("".concat(e),t)})),l=i.toString(),h=n.serviceParameters.SERVICE_URL+D(L[p],{country:c})+"?".concat(l),t.abrupt("return",fetch(h,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}).then(P).then((function(t){return{addressCandidateDTOs:t.addresses.map((function(t){return N(t,c)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestion=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.uuid,(s=void 0===u?"":u)&&i.append("uuid",s),f=i.toString(),p=n.serviceParameters.SERVICE_URL+D(L.SELECT_BUILDINGS,{country:c})+"?".concat(f),t.abrupt("return",fetch(p,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestionByField=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p,l,h;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.uuid,s=void 0===u?"":u,f=e.resourcePathKey,p=void 0===f?"":f,s&&i.append("uuid",s),l=i.toString(),h=n.serviceParameters.SERVICE_URL+D(L[p],{country:c})+"?".concat(l),t.abrupt("return",fetch(h,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.serviceParameters=e(e({},o),{},{SERVICE_URL:"string"===typeof o.SERVICE_URL?o.SERVICE_URL.replace(/\/?$/,"/"):""}),{setAccessToken:this.setAccessToken,searchAddressSuggestions:this.searchAddressSuggestions,selectAddressSuggestion:this.selectAddressSuggestion,searchAddressSuggestionsByField:this.searchAddressSuggestionsByField,selectAddressSuggestionByField:this.selectAddressSuggestionByField}}));export{G as DatafactoryClient}; | ||
function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var i=0;function a(t){return"__private_"+i+++"_"+t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g(n.key),n)}}function u(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(e){var r=l();return function(){var n,o=p(e);if(r){var i=p(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return t(e)}(this,n)}}function f(t,e,r){return(e=g(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function y(){y=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new L(n||[]);return o(a,"_invoke",{value:_(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var l="suspendedStart",h="suspendedYield",d="executing",v="completed",g={};function m(){}function w(){}function E(){}var b={};s(b,a,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(R([])));x&&x!==r&&n.call(x,a)&&(b=x);var S=E.prototype=m.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function _(e,r,n){var o=l;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=C(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=p(e,r,n);if("normal"===s.type){if(o=n.done?v:h,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=E,o(S,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:w,configurable:!0}),w.displayName=s(E,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,s(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(A.prototype),s(A.prototype,c,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),s(S,u,"Generator"),s(S,a,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function g(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(l())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&v(o,r.prototype),o}(t,arguments,p(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,t)},m(t)}var w={},E=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,b=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,T=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,x=/\\([\u000b\u0020-\u00ff])/g,S=/([\\"])/g,O=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function A(t){var e=String(t);if(T.test(e))return e;if(e.length>0&&!b.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(S,"\\$1")+'"'}function _(t){this.parameters=Object.create(null),this.type=t}w.format=function(t){if(!t||"object"!==typeof t)throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!O.test(r))throw new TypeError("invalid type");var n=r;if(e&&"object"===typeof e)for(var o,i=Object.keys(e).sort(),a=0;a<i.length;a++){if(o=i[a],!T.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+A(e[o])}return n},w.parse=function(t){if(!t)throw new TypeError("argument string is required");var e="object"===typeof t?function(t){var e;"function"===typeof t.getHeader?e=t.getHeader("content-type"):"object"===typeof t.headers&&(e=t.headers&&t.headers["content-type"]);if("string"!==typeof e)throw new TypeError("content-type header is missing from object");return e}(t):t;if("string"!==typeof e)throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=-1!==r?e.slice(0,r).trim():e.trim();if(!O.test(n))throw new TypeError("invalid media type");var o=new _(n.toLowerCase());if(-1!==r){var i,a,c;for(E.lastIndex=r;a=E.exec(e);){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(x,"$1")),o.parameters[i]=c}if(r!==e.length)throw new TypeError("invalid parameter format")}return o};var C=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(o,m(Error));var r=s(o);function o(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;return n(this,o),e=r.call(this,i),Error.captureStackTrace&&Error.captureStackTrace(t(e),o),e.response=a,e}return u(o)}(),j=function(t){var e=function(t){var e=w.parse(t.headers.get("content-type")).type;return["application/json"].indexOf(e)>-1?t.json():["text/html","application/xml","text/xml"].indexOf(e)>-1?t.text():["application/octet-stream"].indexOf(e)>-1?Promise.resolve(""):["application/pdf"].indexOf(e)>-1?t.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(e,"'.")))}(t);return t.ok?e:e.then((function(e){throw new C("string"===typeof e?e:JSON.stringify(e),t)}))},P={SEARCH_BUILDINGS:"search/:country/buildings",SELECT_BUILDINGS:"select/:country/buildings",SEARCH_ADDRESSES:"search/:country/postalcodes_cities_streets",SELECT_ADDRESSES:"select/:country/postalcodes_cities_streets",SEARCH_POST_CODES_CITIES:"search/:country/postalcodes_cities",SELECT_POST_CODES_CITIES:"select/:country/postalcodes_cities",SEARCH_POST_CODES:"search/:country/postalcodes",SELECT_POST_CODES:"select/:country/postalcodes",SEARCH_CITIES:"search/:country/cities",SELECT_CITIES:"select/:country/cities"};function L(t,e){void 0===e&&(e={});for(var r=function(t){for(var e=[],r=0;r<t.length;){var n=t[r];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)e.push({type:"CHAR",index:r,value:t[r++]});else{var o=1,i="";if("?"===t[c=r+1])throw new TypeError('Pattern cannot start with "?" at '.concat(c));for(;c<t.length;)if("\\"!==t[c]){if(")"===t[c]){if(0===--o){c++;break}}else if("("===t[c]&&(o++,"?"!==t[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));i+=t[c++]}else i+=t[c++]+t[c++];if(o)throw new TypeError("Unbalanced pattern at ".concat(r));if(!i)throw new TypeError("Missing pattern at ".concat(r));e.push({type:"PATTERN",index:r,value:i}),r=c}else{for(var a="",c=r+1;c<t.length;){var u=t.charCodeAt(c);if(!(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||95===u))break;a+=t[c++]}if(!a)throw new TypeError("Missing parameter name at ".concat(r));e.push({type:"NAME",index:r,value:a}),r=c}else e.push({type:"CLOSE",index:r,value:t[r++]});else e.push({type:"OPEN",index:r,value:t[r++]});else e.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});else e.push({type:"MODIFIER",index:r,value:t[r++]})}return e.push({type:"END",index:r,value:""}),e}(t),n=e.prefixes,o=void 0===n?"./":n,i="[^".concat(function(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}(e.delimiter||"/#?"),"]+?"),a=[],c=0,u=0,s="",f=function(t){if(u<r.length&&r[u].type===t)return r[u++].value},p=function(t){var e=f(t);if(void 0!==e)return e;var n=r[u],o=n.type,i=n.index;throw new TypeError("Unexpected ".concat(o," at ").concat(i,", expected ").concat(t))},l=function(){for(var t,e="";t=f("CHAR")||f("ESCAPED_CHAR");)e+=t;return e};u<r.length;){var h=f("CHAR"),d=f("NAME"),y=f("PATTERN");if(d||y){var v=h||"";-1===o.indexOf(v)&&(s+=v,v=""),s&&(a.push(s),s=""),a.push({name:d||c++,prefix:v,suffix:"",pattern:y||i,modifier:f("MODIFIER")||""})}else{var g=h||f("ESCAPED_CHAR");if(g)s+=g;else if(s&&(a.push(s),s=""),f("OPEN")){v=l();var m=f("NAME")||"",w=f("PATTERN")||"",E=l();p("CLOSE"),a.push({name:m||(w?c++:""),pattern:m&&!w?i:w,prefix:v,suffix:E,modifier:f("MODIFIER")||""})}else p("END")}}return a}function R(t,e){return function(t,e){void 0===e&&(e={});var r=function(t){return t&&t.sensitive?"":"i"}(e),n=e.encode,o=void 0===n?function(t){return t}:n,i=e.validate,a=void 0===i||i,c=t.map((function(t){if("object"===typeof t)return new RegExp("^(?:".concat(t.pattern,")$"),r)}));return function(e){for(var r="",n=0;n<t.length;n++){var i=t[n];if("string"!==typeof i){var u=e?e[i.name]:void 0,s="?"===i.modifier||"*"===i.modifier,f="*"===i.modifier||"+"===i.modifier;if(Array.isArray(u)){if(!f)throw new TypeError('Expected "'.concat(i.name,'" to not repeat, but got an array'));if(0===u.length){if(s)continue;throw new TypeError('Expected "'.concat(i.name,'" to not be empty'))}for(var p=0;p<u.length;p++){var l=o(u[p],i);if(a&&!c[n].test(l))throw new TypeError('Expected all "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else if("string"!==typeof u&&"number"!==typeof u){if(!s){var h=f?"an array":"a string";throw new TypeError('Expected "'.concat(i.name,'" to be ').concat(h))}}else{l=o(String(u),i);if(a&&!c[n].test(l))throw new TypeError('Expected "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else r+=i}return r}}(L(t,e),e)}var k=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return R(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",{encode:encodeURI})(t)},D=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",district:t.district||"",street:"".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),distributionCode:t.distributionCode||"",country:e||"",countryCode:e?e.toUpperCase():"",formattedAddress:["".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),"".concat(t.postalCode).concat(t.district?" "+t.district:""),t.city].filter((function(t){return!!t})).join(", ")||""}},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",addressType:t.addressType||"",street:t.street||"",country:e||"",countryCode:e?e.toUpperCase():""}},N=a("datafactoryAuthToken"),U=a("datafactoryAuthTokenRefreshTimeout"),B=u((function t(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,t),this.accessToken=null,this.setAccessToken=function(t){e.accessToken=t,e.getDatafactoryAuthToken()},Object.defineProperty(this,N,{writable:!0,value:null}),Object.defineProperty(this,U,{writable:!0,value:null}),this.acquireDatafactoryAuthToken=r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(e.accessToken)}}).then(j).then((function(t){return t.token}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),this.startDatafactoryTokenRefreshTimeout=function(){clearTimeout(o(e,U)[U]);o(e,U)[U]=setTimeout(r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.acquireDatafactoryAuthToken();case 2:o(e,N)[N]=t.sent,o(e,N)[N]&&e.startDatafactoryTokenRefreshTimeout();case 4:case"end":return t.stop()}}),t)}))),84e4)},this.getDatafactoryAuthToken=r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!o(e,N)[N]){t.next=2;break}return t.abrupt("return",o(e,N)[N]);case 2:return t.next=4,e.acquireDatafactoryAuthToken();case 4:return o(e,N)[N]=t.sent,o(e,N)[N]&&e.startDatafactoryTokenRefreshTimeout(),t.abrupt("return",o(e,N)[N]);case 7:case"end":return t.stop()}}),t)}))),this.searchAddressSuggestions=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.combined,(u=void 0===c?"":c)&&o.append("combined",u),s=o.toString(),f=e.serviceParameters.SERVICE_URL+k(P.SEARCH_BUILDINGS,{country:a})+"?".concat(s),t.abrupt("return",fetch(f,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}).then(j).then((function(t){return{addressCandidateDTOs:t.buildings.map((function(t){return D(t,a)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.searchAddressSuggestionsByField=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f,p,l;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.searchQueryParams,u=void 0===c?[]:c,s=r.resourcePathKey,f=void 0===s?"":s,u.forEach((function(t,e){return o.append("".concat(e),t)})),p=o.toString(),l=e.serviceParameters.SERVICE_URL+k(P[f],{country:a})+"?".concat(p),t.abrupt("return",fetch(l,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}).then(j).then((function(t){return{addressCandidateDTOs:t.addresses.map((function(t){return I(t,a)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestion=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.uuid,(u=void 0===c?"":c)&&o.append("uuid",u),s=o.toString(),f=e.serviceParameters.SERVICE_URL+k(P.SELECT_BUILDINGS,{country:a})+"?".concat(s),t.abrupt("return",fetch(f,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestionByField=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f,p,l;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.uuid,u=void 0===c?"":c,s=r.resourcePathKey,f=void 0===s?"":s,u&&o.append("uuid",u),p=o.toString(),l=e.serviceParameters.SERVICE_URL+k(P[f],{country:a})+"?".concat(p),t.abrupt("return",fetch(l,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.serviceParameters=d(d({},i),{},{SERVICE_URL:"string"===typeof i.SERVICE_URL?i.SERVICE_URL.replace(/\/?$/,"/"):""}),{setAccessToken:this.setAccessToken,searchAddressSuggestions:this.searchAddressSuggestions,selectAddressSuggestion:this.selectAddressSuggestion,searchAddressSuggestionsByField:this.searchAddressSuggestionsByField,selectAddressSuggestionByField:this.selectAddressSuggestionByField}}));export{B as DatafactoryClient}; | ||
//# sourceMappingURL=index.esm.js.map |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function e(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?t(Object(n),!0).forEach((function(t){s(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):t(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function r(){r=function(){return e};var t,e={},n=Object.prototype,o=n.hasOwnProperty,i=Object.defineProperty||function(t,e,r){t[e]=r.value},a="function"==typeof Symbol?Symbol:{},c=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",s=a.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(t){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var o=e&&e.prototype instanceof m?e:m,a=Object.create(o.prototype),c=new L(n||[]);return i(a,"_invoke",{value:_(t,r,c)}),a}function l(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=p;var h="suspendedStart",d="suspendedYield",y="executing",v="completed",g={};function m(){}function w(){}function E(){}var b={};f(b,c,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(R([])));x&&x!==n&&o.call(x,c)&&(b=x);var S=E.prototype=m.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(n,i,a,c){var u=l(t[n],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&o.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var n;i(this,"_invoke",{value:function(t,o){function i(){return new e((function(e,n){r(t,o,e,n)}))}return n=n?n.then(i,i):i()}})}function _(e,r,n){var o=h;return function(i,a){if(o===y)throw new Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=C(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===h)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=y;var s=l(e,r,n);if("normal"===s.type){if(o=n.done?v:d,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=l(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[c];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,i=function r(){for(;++n<e.length;)if(o.call(e,n))return r.value=e[n],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=E,i(S,"constructor",{value:E,configurable:!0}),i(E,"constructor",{value:w,configurable:!0}),w.displayName=f(E,s,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,f(t,s,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(A.prototype),f(A.prototype,u,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(p(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),f(S,s,"Generator"),f(S,c,(function(){return this})),f(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&o.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function n(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!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(t,e){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"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function n(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:String(e)}function o(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(s){return void r(s)}c.done?e(u):Promise.resolve(u).then(n,o)}function i(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var a=t.apply(e,r);function c(t){o(a,n,i,c,u,"next",t)}function u(t){o(a,n,i,c,u,"throw",t)}c(void 0)}))}}function a(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function c(t,e){for(var r=0;r<e.length;r++){var o=e[r];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,n(o.key),o)}}function u(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(t,e,r){return(e=n(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function f(t){return f=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},f(t)}function p(t,e){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},p(t,e)}function l(){if("undefined"===typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"===typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}function h(t,e,r){return h=l()?Reflect.construct.bind():function(t,e,r){var n=[null];n.push.apply(n,e);var o=new(Function.bind.apply(t,n));return r&&p(o,r.prototype),o},h.apply(null,arguments)}function d(t){var e="function"===typeof Map?new Map:void 0;return d=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"===typeof t}}(t))return t;if("function"!==typeof t)throw new TypeError("Super expression must either be null or a function");if("undefined"!==typeof e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return h(t,arguments,f(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,t)},d(t)}function y(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function v(t){var e=l();return function(){var r,n=f(t);if(e){var o=f(this).constructor;r=Reflect.construct(n,arguments,o)}else r=n.apply(this,arguments);return function(t,e){if(e&&("object"===typeof e||"function"===typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return y(t)}(this,r)}}var g=0;function m(t){return"__private_"+g+++"_"+t}function w(t,e){if(!Object.prototype.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var E={},b=/; *([!#$%&'*+.^_`|~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]+$/,x=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,S=/\\([\u000b\u0020-\u00ff])/g,O=/([\\"])/g,A=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function _(t){var e=String(t);if(x.test(e))return e;if(e.length>0&&!T.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(O,"\\$1")+'"'}function C(t){this.parameters=Object.create(null),this.type=t}E.format=function(t){if(!t||"object"!==typeof t)throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!A.test(r))throw new TypeError("invalid type");var n=r;if(e&&"object"===typeof e)for(var o,i=Object.keys(e).sort(),a=0;a<i.length;a++){if(o=i[a],!x.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+_(e[o])}return n},E.parse=function(t){if(!t)throw new TypeError("argument string is required");var e="object"===typeof t?function(t){var e;"function"===typeof t.getHeader?e=t.getHeader("content-type"):"object"===typeof t.headers&&(e=t.headers&&t.headers["content-type"]);if("string"!==typeof e)throw new TypeError("content-type header is missing from object");return e}(t):t;if("string"!==typeof e)throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=-1!==r?e.slice(0,r).trim():e.trim();if(!A.test(n))throw new TypeError("invalid media type");var o=new C(n.toLowerCase());if(-1!==r){var i,a,c;for(b.lastIndex=r;a=b.exec(e);){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(S,"$1")),o.parameters[i]=c}if(r!==e.length)throw new TypeError("invalid parameter format")}return o};var j=function(t){!function(t,e){if("function"!==typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&p(t,e)}(r,d(Error));var e=v(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",o=arguments.length>1?arguments[1]:void 0;return a(this,r),t=e.call(this,n),Error.captureStackTrace&&Error.captureStackTrace(y(t),r),t.response=o,t}return u(r)}(),P=function(t){var e=function(t){var e=E.parse(t.headers.get("content-type")).type;return["application/json"].indexOf(e)>-1?t.json():["text/html","application/xml","text/xml"].indexOf(e)>-1?t.text():["application/octet-stream"].indexOf(e)>-1?Promise.resolve(""):["application/pdf"].indexOf(e)>-1?t.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(e,"'.")))}(t);return t.ok?e:e.then((function(e){throw new j("string"===typeof e?e:JSON.stringify(e),t)}))},L={SEARCH_BUILDINGS:"search/:country/buildings",SELECT_BUILDINGS:"select/:country/buildings",SEARCH_ADDRESSES:"search/:country/postalcodes_cities_streets",SELECT_ADDRESSES:"select/:country/postalcodes_cities_streets",SEARCH_POST_CODES_CITIES:"search/:country/postalcodes_cities",SELECT_POST_CODES_CITIES:"select/:country/postalcodes_cities",SEARCH_POST_CODES:"search/:country/postalcodes",SELECT_POST_CODES:"select/:country/postalcodes",SEARCH_CITIES:"search/:country/cities",SELECT_CITIES:"select/:country/cities"};function R(t,e){void 0===e&&(e={});for(var r=function(t){for(var e=[],r=0;r<t.length;){var n=t[r];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)e.push({type:"CHAR",index:r,value:t[r++]});else{var o=1,i="";if("?"===t[c=r+1])throw new TypeError('Pattern cannot start with "?" at '.concat(c));for(;c<t.length;)if("\\"!==t[c]){if(")"===t[c]){if(0===--o){c++;break}}else if("("===t[c]&&(o++,"?"!==t[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));i+=t[c++]}else i+=t[c++]+t[c++];if(o)throw new TypeError("Unbalanced pattern at ".concat(r));if(!i)throw new TypeError("Missing pattern at ".concat(r));e.push({type:"PATTERN",index:r,value:i}),r=c}else{for(var a="",c=r+1;c<t.length;){var u=t.charCodeAt(c);if(!(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||95===u))break;a+=t[c++]}if(!a)throw new TypeError("Missing parameter name at ".concat(r));e.push({type:"NAME",index:r,value:a}),r=c}else e.push({type:"CLOSE",index:r,value:t[r++]});else e.push({type:"OPEN",index:r,value:t[r++]});else e.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});else e.push({type:"MODIFIER",index:r,value:t[r++]})}return e.push({type:"END",index:r,value:""}),e}(t),n=e.prefixes,o=void 0===n?"./":n,i="[^".concat(function(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}(e.delimiter||"/#?"),"]+?"),a=[],c=0,u=0,s="",f=function(t){if(u<r.length&&r[u].type===t)return r[u++].value},p=function(t){var e=f(t);if(void 0!==e)return e;var n=r[u],o=n.type,i=n.index;throw new TypeError("Unexpected ".concat(o," at ").concat(i,", expected ").concat(t))},l=function(){for(var t,e="";t=f("CHAR")||f("ESCAPED_CHAR");)e+=t;return e};u<r.length;){var h=f("CHAR"),d=f("NAME"),y=f("PATTERN");if(d||y){var v=h||"";-1===o.indexOf(v)&&(s+=v,v=""),s&&(a.push(s),s=""),a.push({name:d||c++,prefix:v,suffix:"",pattern:y||i,modifier:f("MODIFIER")||""})}else{var g=h||f("ESCAPED_CHAR");if(g)s+=g;else if(s&&(a.push(s),s=""),f("OPEN")){v=l();var m=f("NAME")||"",w=f("PATTERN")||"",E=l();p("CLOSE"),a.push({name:m||(w?c++:""),pattern:m&&!w?i:w,prefix:v,suffix:E,modifier:f("MODIFIER")||""})}else p("END")}}return a}function k(t,e){return function(t,e){void 0===e&&(e={});var r=function(t){return t&&t.sensitive?"":"i"}(e),n=e.encode,o=void 0===n?function(t){return t}:n,i=e.validate,a=void 0===i||i,c=t.map((function(t){if("object"===typeof t)return new RegExp("^(?:".concat(t.pattern,")$"),r)}));return function(e){for(var r="",n=0;n<t.length;n++){var i=t[n];if("string"!==typeof i){var u=e?e[i.name]:void 0,s="?"===i.modifier||"*"===i.modifier,f="*"===i.modifier||"+"===i.modifier;if(Array.isArray(u)){if(!f)throw new TypeError('Expected "'.concat(i.name,'" to not repeat, but got an array'));if(0===u.length){if(s)continue;throw new TypeError('Expected "'.concat(i.name,'" to not be empty'))}for(var p=0;p<u.length;p++){var l=o(u[p],i);if(a&&!c[n].test(l))throw new TypeError('Expected all "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else if("string"!==typeof u&&"number"!==typeof u){if(!s){var h=f?"an array":"a string";throw new TypeError('Expected "'.concat(i.name,'" to be ').concat(h))}}else{l=o(String(u),i);if(a&&!c[n].test(l))throw new TypeError('Expected "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else r+=i}return r}}(R(t,e),e)}var D=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return k(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",{encode:encodeURI})(t)},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",district:t.district||"",street:"".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),distributionCode:t.distributionCode||"",country:e||"",countryCode:e?e.toUpperCase():"",formattedAddress:["".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),"".concat(t.postalCode).concat(t.district?" "+t.district:""),t.city].filter((function(t){return!!t})).join(", ")||""}},N=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",addressType:t.addressType||"",street:t.street||"",country:e||"",countryCode:e?e.toUpperCase():""}},U=m("datafactoryAuthToken"),B=m("datafactoryAuthTokenRefreshTimeout"),G=u((function t(){var n=this,o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return a(this,t),this.accessToken=null,this.setAccessToken=function(t){n.accessToken=t,n.getDatafactoryAuthToken()},Object.defineProperty(this,U,{writable:!0,value:null}),Object.defineProperty(this,B,{writable:!0,value:null}),this.acquireDatafactoryAuthToken=i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(n.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(n.accessToken)}}).then(P).then((function(t){return t.token}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),this.startDatafactoryTokenRefreshTimeout=function(){clearTimeout(w(n,B)[B]);w(n,B)[B]=setTimeout(i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.acquireDatafactoryAuthToken();case 2:w(n,U)[U]=t.sent,w(n,U)[U]&&n.startDatafactoryTokenRefreshTimeout();case 4:case"end":return t.stop()}}),t)}))),84e4)},this.getDatafactoryAuthToken=i(r().mark((function t(){return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!w(n,U)[U]){t.next=2;break}return t.abrupt("return",w(n,U)[U]);case 2:return t.next=4,n.acquireDatafactoryAuthToken();case 4:return w(n,U)[U]=t.sent,w(n,U)[U]&&n.startDatafactoryTokenRefreshTimeout(),t.abrupt("return",w(n,U)[U]);case 7:case"end":return t.stop()}}),t)}))),this.searchAddressSuggestions=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.combined,(s=void 0===u?"":u)&&i.append("combined",s),f=i.toString(),p=n.serviceParameters.SERVICE_URL+D(L.SEARCH_BUILDINGS,{country:c})+"?".concat(f),t.abrupt("return",fetch(p,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}).then(P).then((function(t){return{addressCandidateDTOs:t.buildings.map((function(t){return I(t,c)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.searchAddressSuggestionsByField=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p,l,h;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.searchQueryParams,s=void 0===u?[]:u,f=e.resourcePathKey,p=void 0===f?"":f,s.forEach((function(t,e){return i.append("".concat(e),t)})),l=i.toString(),h=n.serviceParameters.SERVICE_URL+D(L[p],{country:c})+"?".concat(l),t.abrupt("return",fetch(h,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}).then(P).then((function(t){return{addressCandidateDTOs:t.addresses.map((function(t){return N(t,c)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestion=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.uuid,(s=void 0===u?"":u)&&i.append("uuid",s),f=i.toString(),p=n.serviceParameters.SERVICE_URL+D(L.SELECT_BUILDINGS,{country:c})+"?".concat(f),t.abrupt("return",fetch(p,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestionByField=function(){var t=i(r().mark((function t(e){var o,i,a,c,u,s,f,p,l,h;return r().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,n.getDatafactoryAuthToken();case 2:return o=t.sent,i=new URLSearchParams,a=e.country,c=void 0===a?"de":a,u=e.uuid,s=void 0===u?"":u,f=e.resourcePathKey,p=void 0===f?"":f,s&&i.append("uuid",s),l=i.toString(),h=n.serviceParameters.SERVICE_URL+D(L[p],{country:c})+"?".concat(l),t.abrupt("return",fetch(h,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(o)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.serviceParameters=e(e({},o),{},{SERVICE_URL:"string"===typeof o.SERVICE_URL?o.SERVICE_URL.replace(/\/?$/,"/"):""}),{setAccessToken:this.setAccessToken,searchAddressSuggestions:this.searchAddressSuggestions,selectAddressSuggestion:this.selectAddressSuggestion,searchAddressSuggestionsByField:this.searchAddressSuggestionsByField,selectAddressSuggestionByField:this.selectAddressSuggestionByField}}));exports.DatafactoryClient=G; | ||
"use strict";function t(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function e(t,e,r,n,o,i,a){try{var c=t[i](a),u=c.value}catch(t){return void r(t)}c.done?e(u):Promise.resolve(u).then(n,o)}function r(t){return function(){var r=this,n=arguments;return new Promise((function(o,i){var a=t.apply(r,n);function c(t){e(a,o,i,c,u,"next",t)}function u(t){e(a,o,i,c,u,"throw",t)}c(void 0)}))}}function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function o(t,e){if(!{}.hasOwnProperty.call(t,e))throw new TypeError("attempted to use private field on non-instance");return t}var i=0;function a(t){return"__private_"+i+++"_"+t}function c(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,g(n.key),n)}}function u(t,e,r){return e&&c(t.prototype,e),r&&c(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function s(e){var r=l();return function(){var n,o=p(e);if(r){var i=p(this).constructor;n=Reflect.construct(o,arguments,i)}else n=o.apply(this,arguments);return function(e,r){if(r&&("object"==typeof r||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return t(e)}(this,n)}}function f(t,e,r){return(e=g(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function p(t){return p=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},p(t)}function l(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(l=function(){return!!t})()}function h(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function d(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?h(Object(r),!0).forEach((function(e){f(t,e,r[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))}))}return t}function y(){y=function(){return e};var t,e={},r=Object.prototype,n=r.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},i="function"==typeof Symbol?Symbol:{},a=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",u=i.toStringTag||"@@toStringTag";function s(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{s({},"")}catch(t){s=function(t,e,r){return t[e]=r}}function f(t,e,r,n){var i=e&&e.prototype instanceof m?e:m,a=Object.create(i.prototype),c=new L(n||[]);return o(a,"_invoke",{value:_(t,r,c)}),a}function p(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=f;var l="suspendedStart",h="suspendedYield",d="executing",v="completed",g={};function m(){}function w(){}function E(){}var b={};s(b,a,(function(){return this}));var T=Object.getPrototypeOf,x=T&&T(T(R([])));x&&x!==r&&n.call(x,a)&&(b=x);var S=E.prototype=m.prototype=Object.create(b);function O(t){["next","throw","return"].forEach((function(e){s(t,e,(function(t){return this._invoke(e,t)}))}))}function A(t,e){function r(o,i,a,c){var u=p(t[o],t,i);if("throw"!==u.type){var s=u.arg,f=s.value;return f&&"object"==typeof f&&n.call(f,"__await")?e.resolve(f.__await).then((function(t){r("next",t,a,c)}),(function(t){r("throw",t,a,c)})):e.resolve(f).then((function(t){s.value=t,a(s)}),(function(t){return r("throw",t,a,c)}))}c(u.arg)}var i;o(this,"_invoke",{value:function(t,n){function o(){return new e((function(e,o){r(t,n,e,o)}))}return i=i?i.then(o,o):o()}})}function _(e,r,n){var o=l;return function(i,a){if(o===d)throw Error("Generator is already running");if(o===v){if("throw"===i)throw a;return{value:t,done:!0}}for(n.method=i,n.arg=a;;){var c=n.delegate;if(c){var u=C(c,n);if(u){if(u===g)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(o===l)throw o=v,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);o=d;var s=p(e,r,n);if("normal"===s.type){if(o=n.done?v:h,s.arg===g)continue;return{value:s.arg,done:n.done}}"throw"===s.type&&(o=v,n.method="throw",n.arg=s.arg)}}}function C(e,r){var n=r.method,o=e.iterator[n];if(o===t)return r.delegate=null,"throw"===n&&e.iterator.return&&(r.method="return",r.arg=t,C(e,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),g;var i=p(o,e.iterator,r.arg);if("throw"===i.type)return r.method="throw",r.arg=i.arg,r.delegate=null,g;var a=i.arg;return a?a.done?(r[e.resultName]=a.value,r.next=e.nextLoc,"return"!==r.method&&(r.method="next",r.arg=t),r.delegate=null,g):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,g)}function j(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function P(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function L(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(j,this),this.reset(!0)}function R(e){if(e||""===e){var r=e[a];if(r)return r.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var o=-1,i=function r(){for(;++o<e.length;)if(n.call(e,o))return r.value=e[o],r.done=!1,r;return r.value=t,r.done=!0,r};return i.next=i}}throw new TypeError(typeof e+" is not iterable")}return w.prototype=E,o(S,"constructor",{value:E,configurable:!0}),o(E,"constructor",{value:w,configurable:!0}),w.displayName=s(E,u,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===w||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,E):(t.__proto__=E,s(t,u,"GeneratorFunction")),t.prototype=Object.create(S),t},e.awrap=function(t){return{__await:t}},O(A.prototype),s(A.prototype,c,(function(){return this})),e.AsyncIterator=A,e.async=function(t,r,n,o,i){void 0===i&&(i=Promise);var a=new A(f(t,r,n,o),i);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},O(S),s(S,u,"Generator"),s(S,a,(function(){return this})),s(S,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},e.values=R,L.prototype={constructor:L,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=t,this.done=!1,this.delegate=null,this.method="next",this.arg=t,this.tryEntries.forEach(P),!e)for(var r in this)"t"===r.charAt(0)&&n.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=t)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var r=this;function o(n,o){return c.type="throw",c.arg=e,r.next=n,o&&(r.method="next",r.arg=t),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var a=this.tryEntries[i],c=a.completion;if("root"===a.tryLoc)return o("end");if(a.tryLoc<=this.prev){var u=n.call(a,"catchLoc"),s=n.call(a,"finallyLoc");if(u&&s){if(this.prev<a.catchLoc)return o(a.catchLoc,!0);if(this.prev<a.finallyLoc)return o(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return o(a.catchLoc,!0)}else{if(!s)throw Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return o(a.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var o=this.tryEntries[r];if(o.tryLoc<=this.prev&&n.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,g):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),g},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),g}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var o=n.arg;P(r)}return o}}throw Error("illegal catch attempt")},delegateYield:function(e,r,n){return this.delegate={iterator:R(e),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=t),g}},e}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}function g(t){var e=function(t,e){if("object"!=typeof t||!t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var n=r.call(t,e||"default");if("object"!=typeof n)return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==typeof e?e:e+""}function m(t){var e="function"==typeof Map?new Map:void 0;return m=function(t){if(null===t||!function(t){try{return-1!==Function.toString.call(t).indexOf("[native code]")}catch(e){return"function"==typeof t}}(t))return t;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return function(t,e,r){if(l())return Reflect.construct.apply(null,arguments);var n=[null];n.push.apply(n,e);var o=new(t.bind.apply(t,n));return r&&v(o,r.prototype),o}(t,arguments,p(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),v(r,t)},m(t)}var w={},E=/; *([!#$%&'*+.^_`|~0-9A-Za-z-]+) *= *("(?:[\u000b\u0020\u0021\u0023-\u005b\u005d-\u007e\u0080-\u00ff]|\\[\u000b\u0020-\u00ff])*"|[!#$%&'*+.^_`|~0-9A-Za-z-]+) */g,b=/^[\u000b\u0020-\u007e\u0080-\u00ff]+$/,T=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/,x=/\\([\u000b\u0020-\u00ff])/g,S=/([\\"])/g,O=/^[!#$%&'*+.^_`|~0-9A-Za-z-]+\/[!#$%&'*+.^_`|~0-9A-Za-z-]+$/;function A(t){var e=String(t);if(T.test(e))return e;if(e.length>0&&!b.test(e))throw new TypeError("invalid parameter value");return'"'+e.replace(S,"\\$1")+'"'}function _(t){this.parameters=Object.create(null),this.type=t}w.format=function(t){if(!t||"object"!==typeof t)throw new TypeError("argument obj is required");var e=t.parameters,r=t.type;if(!r||!O.test(r))throw new TypeError("invalid type");var n=r;if(e&&"object"===typeof e)for(var o,i=Object.keys(e).sort(),a=0;a<i.length;a++){if(o=i[a],!T.test(o))throw new TypeError("invalid parameter name");n+="; "+o+"="+A(e[o])}return n},w.parse=function(t){if(!t)throw new TypeError("argument string is required");var e="object"===typeof t?function(t){var e;"function"===typeof t.getHeader?e=t.getHeader("content-type"):"object"===typeof t.headers&&(e=t.headers&&t.headers["content-type"]);if("string"!==typeof e)throw new TypeError("content-type header is missing from object");return e}(t):t;if("string"!==typeof e)throw new TypeError("argument string is required to be a string");var r=e.indexOf(";"),n=-1!==r?e.slice(0,r).trim():e.trim();if(!O.test(n))throw new TypeError("invalid media type");var o=new _(n.toLowerCase());if(-1!==r){var i,a,c;for(E.lastIndex=r;a=E.exec(e);){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(x,"$1")),o.parameters[i]=c}if(r!==e.length)throw new TypeError("invalid parameter format")}return o};var C=function(e){!function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(o,m(Error));var r=s(o);function o(){var e,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0;return n(this,o),e=r.call(this,i),Error.captureStackTrace&&Error.captureStackTrace(t(e),o),e.response=a,e}return u(o)}(),j=function(t){var e=function(t){var e=w.parse(t.headers.get("content-type")).type;return["application/json"].indexOf(e)>-1?t.json():["text/html","application/xml","text/xml"].indexOf(e)>-1?t.text():["application/octet-stream"].indexOf(e)>-1?Promise.resolve(""):["application/pdf"].indexOf(e)>-1?t.blob():Promise.reject(new Error("[service] Content-type not parsed: '".concat(e,"'.")))}(t);return t.ok?e:e.then((function(e){throw new C("string"===typeof e?e:JSON.stringify(e),t)}))},P={SEARCH_BUILDINGS:"search/:country/buildings",SELECT_BUILDINGS:"select/:country/buildings",SEARCH_ADDRESSES:"search/:country/postalcodes_cities_streets",SELECT_ADDRESSES:"select/:country/postalcodes_cities_streets",SEARCH_POST_CODES_CITIES:"search/:country/postalcodes_cities",SELECT_POST_CODES_CITIES:"select/:country/postalcodes_cities",SEARCH_POST_CODES:"search/:country/postalcodes",SELECT_POST_CODES:"select/:country/postalcodes",SEARCH_CITIES:"search/:country/cities",SELECT_CITIES:"select/:country/cities"};function L(t,e){void 0===e&&(e={});for(var r=function(t){for(var e=[],r=0;r<t.length;){var n=t[r];if("*"!==n&&"+"!==n&&"?"!==n)if("\\"!==n)if("{"!==n)if("}"!==n)if(":"!==n)if("("!==n)e.push({type:"CHAR",index:r,value:t[r++]});else{var o=1,i="";if("?"===t[c=r+1])throw new TypeError('Pattern cannot start with "?" at '.concat(c));for(;c<t.length;)if("\\"!==t[c]){if(")"===t[c]){if(0===--o){c++;break}}else if("("===t[c]&&(o++,"?"!==t[c+1]))throw new TypeError("Capturing groups are not allowed at ".concat(c));i+=t[c++]}else i+=t[c++]+t[c++];if(o)throw new TypeError("Unbalanced pattern at ".concat(r));if(!i)throw new TypeError("Missing pattern at ".concat(r));e.push({type:"PATTERN",index:r,value:i}),r=c}else{for(var a="",c=r+1;c<t.length;){var u=t.charCodeAt(c);if(!(u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122||95===u))break;a+=t[c++]}if(!a)throw new TypeError("Missing parameter name at ".concat(r));e.push({type:"NAME",index:r,value:a}),r=c}else e.push({type:"CLOSE",index:r,value:t[r++]});else e.push({type:"OPEN",index:r,value:t[r++]});else e.push({type:"ESCAPED_CHAR",index:r++,value:t[r++]});else e.push({type:"MODIFIER",index:r,value:t[r++]})}return e.push({type:"END",index:r,value:""}),e}(t),n=e.prefixes,o=void 0===n?"./":n,i="[^".concat(function(t){return t.replace(/([.+*?=^!:${}()[\]|/\\])/g,"\\$1")}(e.delimiter||"/#?"),"]+?"),a=[],c=0,u=0,s="",f=function(t){if(u<r.length&&r[u].type===t)return r[u++].value},p=function(t){var e=f(t);if(void 0!==e)return e;var n=r[u],o=n.type,i=n.index;throw new TypeError("Unexpected ".concat(o," at ").concat(i,", expected ").concat(t))},l=function(){for(var t,e="";t=f("CHAR")||f("ESCAPED_CHAR");)e+=t;return e};u<r.length;){var h=f("CHAR"),d=f("NAME"),y=f("PATTERN");if(d||y){var v=h||"";-1===o.indexOf(v)&&(s+=v,v=""),s&&(a.push(s),s=""),a.push({name:d||c++,prefix:v,suffix:"",pattern:y||i,modifier:f("MODIFIER")||""})}else{var g=h||f("ESCAPED_CHAR");if(g)s+=g;else if(s&&(a.push(s),s=""),f("OPEN")){v=l();var m=f("NAME")||"",w=f("PATTERN")||"",E=l();p("CLOSE"),a.push({name:m||(w?c++:""),pattern:m&&!w?i:w,prefix:v,suffix:E,modifier:f("MODIFIER")||""})}else p("END")}}return a}function R(t,e){return function(t,e){void 0===e&&(e={});var r=function(t){return t&&t.sensitive?"":"i"}(e),n=e.encode,o=void 0===n?function(t){return t}:n,i=e.validate,a=void 0===i||i,c=t.map((function(t){if("object"===typeof t)return new RegExp("^(?:".concat(t.pattern,")$"),r)}));return function(e){for(var r="",n=0;n<t.length;n++){var i=t[n];if("string"!==typeof i){var u=e?e[i.name]:void 0,s="?"===i.modifier||"*"===i.modifier,f="*"===i.modifier||"+"===i.modifier;if(Array.isArray(u)){if(!f)throw new TypeError('Expected "'.concat(i.name,'" to not repeat, but got an array'));if(0===u.length){if(s)continue;throw new TypeError('Expected "'.concat(i.name,'" to not be empty'))}for(var p=0;p<u.length;p++){var l=o(u[p],i);if(a&&!c[n].test(l))throw new TypeError('Expected all "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else if("string"!==typeof u&&"number"!==typeof u){if(!s){var h=f?"an array":"a string";throw new TypeError('Expected "'.concat(i.name,'" to be ').concat(h))}}else{l=o(String(u),i);if(a&&!c[n].test(l))throw new TypeError('Expected "'.concat(i.name,'" to match "').concat(i.pattern,'", but got "').concat(l,'"'));r+=i.prefix+l+i.suffix}}else r+=i}return r}}(L(t,e),e)}var k=function(){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return R(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"/",{encode:encodeURI})(t)},D=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",district:t.district||"",street:"".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),distributionCode:t.distributionCode||"",country:e||"",countryCode:e?e.toUpperCase():"",formattedAddress:["".concat(t.street||"").concat(t.street&&t.houseNumber?" "+t.houseNumber:""),"".concat(t.postalCode).concat(t.district?" "+t.district:""),t.city].filter((function(t){return!!t})).join(", ")||""}},I=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";return{uuid:t.uuid||"",postCode:t.postalCode||"",city:t.city||"",addressType:t.addressType||"",street:t.street||"",country:e||"",countryCode:e?e.toUpperCase():""}},N=a("datafactoryAuthToken"),U=a("datafactoryAuthTokenRefreshTimeout"),B=u((function t(){var e=this,i=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return n(this,t),this.accessToken=null,this.setAccessToken=function(t){e.accessToken=t,e.getDatafactoryAuthToken()},Object.defineProperty(this,N,{writable:!0,value:null}),Object.defineProperty(this,U,{writable:!0,value:null}),this.acquireDatafactoryAuthToken=r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,fetch(e.serviceParameters.AUTH_SERVICE_URL,{method:"GET",headers:{Authorization:"Bearer ".concat(e.accessToken)}}).then(j).then((function(t){return t.token}));case 2:return t.abrupt("return",t.sent);case 3:case"end":return t.stop()}}),t)}))),this.startDatafactoryTokenRefreshTimeout=function(){clearTimeout(o(e,U)[U]);o(e,U)[U]=setTimeout(r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.acquireDatafactoryAuthToken();case 2:o(e,N)[N]=t.sent,o(e,N)[N]&&e.startDatafactoryTokenRefreshTimeout();case 4:case"end":return t.stop()}}),t)}))),84e4)},this.getDatafactoryAuthToken=r(y().mark((function t(){return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!o(e,N)[N]){t.next=2;break}return t.abrupt("return",o(e,N)[N]);case 2:return t.next=4,e.acquireDatafactoryAuthToken();case 4:return o(e,N)[N]=t.sent,o(e,N)[N]&&e.startDatafactoryTokenRefreshTimeout(),t.abrupt("return",o(e,N)[N]);case 7:case"end":return t.stop()}}),t)}))),this.searchAddressSuggestions=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.combined,(u=void 0===c?"":c)&&o.append("combined",u),s=o.toString(),f=e.serviceParameters.SERVICE_URL+k(P.SEARCH_BUILDINGS,{country:a})+"?".concat(s),t.abrupt("return",fetch(f,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}).then(j).then((function(t){return{addressCandidateDTOs:t.buildings.map((function(t){return D(t,a)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.searchAddressSuggestionsByField=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f,p,l;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.searchQueryParams,u=void 0===c?[]:c,s=r.resourcePathKey,f=void 0===s?"":s,u.forEach((function(t,e){return o.append("".concat(e),t)})),p=o.toString(),l=e.serviceParameters.SERVICE_URL+k(P[f],{country:a})+"?".concat(p),t.abrupt("return",fetch(l,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}).then(j).then((function(t){return{addressCandidateDTOs:t.addresses.map((function(t){return I(t,a)}))}})));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestion=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.uuid,(u=void 0===c?"":c)&&o.append("uuid",u),s=o.toString(),f=e.serviceParameters.SERVICE_URL+k(P.SELECT_BUILDINGS,{country:a})+"?".concat(s),t.abrupt("return",fetch(f,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.selectAddressSuggestionByField=function(){var t=r(y().mark((function t(r){var n,o,i,a,c,u,s,f,p,l;return y().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.getDatafactoryAuthToken();case 2:return n=t.sent,o=new URLSearchParams,i=r.country,a=void 0===i?"de":i,c=r.uuid,u=void 0===c?"":c,s=r.resourcePathKey,f=void 0===s?"":s,u&&o.append("uuid",u),p=o.toString(),l=e.serviceParameters.SERVICE_URL+k(P[f],{country:a})+"?".concat(p),t.abrupt("return",fetch(l,{method:"GET",headers:{"Content-Type":"application/json",Accept:"application/json",Authorization:"Bearer ".concat(n)}}));case 9:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),this.serviceParameters=d(d({},i),{},{SERVICE_URL:"string"===typeof i.SERVICE_URL?i.SERVICE_URL.replace(/\/?$/,"/"):""}),{setAccessToken:this.setAccessToken,searchAddressSuggestions:this.searchAddressSuggestions,selectAddressSuggestion:this.selectAddressSuggestion,searchAddressSuggestionsByField:this.searchAddressSuggestionsByField,selectAddressSuggestionByField:this.selectAddressSuggestionByField}}));exports.DatafactoryClient=B; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "@ace-de/eua-datafactory-client", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "EUA Deutsche Post Datafactory Client", | ||
@@ -31,3 +31,3 @@ "author": "Computer Rock", | ||
}, | ||
"gitHead": "78ac00a1ac41aace4f5dc45b96b0fe6a0d11db28" | ||
"gitHead": "a9f78f4e0ea8e88d822dfe4b81ecb0827a451a80" | ||
} |
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
145635
176
11