@pnp/odata
Advanced tools
Comparing version 1.1.4 to 1.1.5-0
/** | ||
@license | ||
* @pnp/odata v1.1.4 - pnp - provides shared odata functionality and base classes | ||
* @pnp/odata v1.1.5-0 - pnp - provides shared odata functionality and base classes | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,3 +10,3 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
import { RuntimeConfig, dateAdd, PnPClientStorage, isFunc, extend, combinePaths, Dictionary, mergeOptions, objectDefinedNotNull, getGUID } from '@pnp/common'; | ||
import { RuntimeConfig, dateAdd, PnPClientStorage, isFunc, hOP, extend, combine, mergeOptions, objectDefinedNotNull, getGUID } from '@pnp/common'; | ||
import { __extends, __decorate } from 'tslib'; | ||
@@ -113,15 +113,3 @@ import { Logger } from '@pnp/logging'; | ||
}).catch(function (e) { | ||
// we failed to read the body - possibly it is empty. Let's report the original status that caused | ||
// the request to fail and log the error without parsing the body if anyone needs it for debugging | ||
Logger.log({ | ||
data: e, | ||
level: 2 /* Warning */, | ||
message: "There was an error parsing the error response body. See data for details.", | ||
}); | ||
// include the headers as they contain diagnostic information | ||
var data = { | ||
responseBody: "[[body not available]]", | ||
responseHeaders: r.headers, | ||
}; | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, data)); | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, e)); | ||
}); | ||
@@ -138,4 +126,4 @@ } | ||
var result = json; | ||
if (json.hasOwnProperty("d")) { | ||
if (json.d.hasOwnProperty("results")) { | ||
if (hOP(json, "d")) { | ||
if (hOP(json.d, "results")) { | ||
result = json.d.results; | ||
@@ -147,3 +135,3 @@ } | ||
} | ||
else if (json.hasOwnProperty("value")) { | ||
else if (hOP(json, "value")) { | ||
result = json.value; | ||
@@ -285,3 +273,3 @@ } | ||
// if we have a result already in the pipeline, pass it along and don't call the tagged method | ||
if (!alwaysRun && args.length > 0 && args[0].hasOwnProperty("hasResult") && args[0].hasResult) { | ||
if (!alwaysRun && args.length > 0 && hOP(args[0], "hasResult") && args[0].hasResult) { | ||
Logger.write("[" + args[0].requestId + "] (" + (new Date()).getTime() + ") Skipping request pipeline method " + propertyKey + ", existing result in pipeline.", 0 /* Verbose */); | ||
@@ -325,3 +313,3 @@ return Promise.resolve(args[0]); | ||
var cacheOptions = new CachingOptions(context.requestAbsoluteUrl.toLowerCase()); | ||
if (typeof context.cachingOptions !== "undefined") { | ||
if (context.cachingOptions !== undefined) { | ||
cacheOptions = extend(cacheOptions, context.cachingOptions); | ||
@@ -344,3 +332,3 @@ } | ||
// handle the case where a parser needs to take special actions with a cached result | ||
if (context.parser.hasOwnProperty("hydrate")) { | ||
if (hOP(context.parser, "hydrate")) { | ||
data = context.parser.hydrate(data); | ||
@@ -447,3 +435,3 @@ } | ||
function Queryable() { | ||
this._query = new Dictionary(); | ||
this._query = new Map(); | ||
this._options = {}; | ||
@@ -508,3 +496,3 @@ this._url = ""; | ||
this._useCaching = true; | ||
if (typeof options !== "undefined") { | ||
if (options !== undefined) { | ||
this._cachingOptions = options; | ||
@@ -546,3 +534,3 @@ } | ||
Queryable.prototype.append = function (pathPart) { | ||
this._url = combinePaths(this._url, pathPart); | ||
this._url = combine(this._url, pathPart); | ||
}; | ||
@@ -568,3 +556,3 @@ Object.defineProperty(Queryable.prototype, "parentUrl", { | ||
this._parentUrl = parent._url; | ||
this._url = combinePaths(this._parentUrl, path); | ||
this._url = combine(this._parentUrl, path); | ||
this.configureFrom(parent); | ||
@@ -680,5 +668,5 @@ }; | ||
this._batchId = _batchId; | ||
this._requests = []; | ||
this._dependencies = []; | ||
this._resolveBatchDependencies = []; | ||
this._reqs = []; | ||
this._deps = []; | ||
this._rDeps = []; | ||
} | ||
@@ -697,3 +685,3 @@ Object.defineProperty(ODataBatch.prototype, "batchId", { | ||
get: function () { | ||
return this._requests; | ||
return this._reqs; | ||
}, | ||
@@ -709,6 +697,7 @@ enumerable: true, | ||
* @param parser The parser used to handle the eventual return from the query | ||
* @param id An identifier used to track a request within a batch | ||
*/ | ||
ODataBatch.prototype.add = function (url, method, options, parser, requestId) { | ||
ODataBatch.prototype.add = function (url, method, options, parser, id) { | ||
var info = { | ||
id: requestId, | ||
id: id, | ||
method: method.toUpperCase(), | ||
@@ -725,3 +714,3 @@ options: options, | ||
}); | ||
this._requests.push(info); | ||
this._reqs.push(info); | ||
return p; | ||
@@ -735,6 +724,5 @@ }; | ||
var resolver = function () { return void (0); }; | ||
var promise = new Promise(function (resolve) { | ||
this._deps.push(new Promise(function (resolve) { | ||
resolver = resolve; | ||
}); | ||
this._dependencies.push(promise); | ||
})); | ||
return resolver; | ||
@@ -748,3 +736,3 @@ }; | ||
ODataBatch.prototype.addResolveBatchDependency = function (p) { | ||
this._resolveBatchDependencies.push(p); | ||
this._rDeps.push(p); | ||
}; | ||
@@ -760,6 +748,6 @@ /** | ||
// We can get a second set of promises added during the first set resolving | ||
return Promise.all(this._dependencies) | ||
.then(function () { return Promise.all(_this._dependencies); }) | ||
return Promise.all(this._deps) | ||
.then(function () { return Promise.all(_this._deps); }) | ||
.then(function () { return _this.executeImpl(); }) | ||
.then(function () { return Promise.all(_this._resolveBatchDependencies); }) | ||
.then(function () { return Promise.all(_this._rDeps); }) | ||
.then(function () { return void (0); }); | ||
@@ -766,0 +754,0 @@ }; |
/** | ||
@license | ||
* @pnp/odata v1.1.4 - pnp - provides shared odata functionality and base classes | ||
* @pnp/odata v1.1.5-0 - pnp - provides shared odata functionality and base classes | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,5 +10,5 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pnp=t():e.pnp=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";(function(e){function r(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}}function i(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!d(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")}function s(e){for(var t=new Array(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;r<e;r++)t[r]=n.charAt(Math.floor(Math.random()*n.length));return t.join("")}function a(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})}function u(e){return"function"==typeof e}function c(e){return void 0!==e&&null!==e}function h(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array}function l(e,t,n,r){if(void 0===n&&(n=!1),!c(t))return e;var i=n?function(e,t){return!(t in e)}:function(){return!0},o=u(r)?r:function(){return!0},s=function(t){return i(e,t)&&o(t)};return Object.getOwnPropertyNames(t).filter(s).reduce(function(e,n){return e[n]=t[n],e},e)}function p(e){return/^https?:\/\/|^\/\//i.test(e)}function d(e){return void 0===e||null===e||e.length<1}function f(e,t){e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var n=new RegExp(t+"\\s*?=\\s*?(\"|')([^\\1]*?)\\1","i"),r=n.exec(e);return null!==r&&r.length>0?r[2]:null}function T(e){if(d(e))return e;var t=/([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})/i.exec(e);return null===t?e:t[1]}function g(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}function _(e,t){if(c(t)){var n=l(e.headers||{},t.headers);e=l(e,t),e.headers=n}}n.d(t,"a",function(){return v}),n.d(t,"c",function(){return I}),n.d(t,"i",function(){return _}),n.d(t,"b",function(){return C}),n.d(t,"e",function(){return i}),n.d(t,"d",function(){return o}),n.d(t,"g",function(){return a}),n.d(t,"h",function(){return u}),n.d(t,"j",function(){return c}),n.d(t,"f",function(){return l});var S=n(1),E=n(2),O=n(9),N=(n.n(O),function(){function e(){}e.getCtxCallback=r,e.dateAdd=i,e.combinePaths=o,e.getRandomString=s,e.getGUID=a,e.isFunc=u,e.objectDefinedNotNull=c,e.isArray=h,e.extend=l,e.isUrlAbsolute=p,e.stringIsNullOrEmpty=d,e.getAttrValueFromString=f,e.sanitizeGuid=T}(),function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}()),m=function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}return Object(E.b)(t,e),Object.defineProperty(t.prototype,"token",{get:function(){return this._token},set:function(e){this._token=e},enumerable:!0,configurable:!0}),t.prototype.fetch=function(t,n){void 0===n&&(n={});var r=new Headers;return g(r,n.headers),r.set("Authorization","Bearer "+this._token),n.headers=r,e.prototype.fetch.call(this,t,n)},t}(N),v=(function(e){function t(t,n,r){var i=e.call(this,null)||this;return i.clientId=t,i.tenant=n,i.redirectUri=r,i}Object(E.b)(t,e),t.fromSPFxContext=function(e,n){return void 0===n&&(n="c58637bb-e2e1-4312-8a00-04b5ffcd3403"),new t(n,e.pageContext.aadInfo.tenantId.toString(),o(window.location.origin,"/_forms/spfxsinglesignon.aspx"))},t.prototype.fetch=function(t,n){var r=this;if(!p(t))throw new Error("You must supply absolute urls to AdalClient.fetch.");return this.getToken(this.getResource(t)).then(function(i){return r.token=i,e.prototype.fetch.call(r,t,n)})},t.prototype.getToken=function(e){var n=this;return new Promise(function(r,i){n.ensureAuthContext().then(function(e){return n.login()}).then(function(n){t._authContext.acquireToken(e,function(e,t){if(e)return i(new Error(e));r(t)})}).catch(i)})},t.prototype.ensureAuthContext=function(){var e=this;return new Promise(function(n){null===t._authContext&&(t._authContext=Object(O.inject)({clientId:e.clientId,displayCall:function(t){e._displayCallback&&e._displayCallback(t)},navigateToLoginRequestUrl:!1,redirectUri:e.redirectUri,tenant:e.tenant})),n()})},t.prototype.login=function(){var e=this;return this._loginPromise?this._loginPromise:(this._loginPromise=new Promise(function(n,r){if(t._authContext.getCachedUser())return n();e._displayCallback=function(i){var o=window.open(i,"login","width=483, height=600");if(!o)return r(new Error("Could not open pop-up window for auth. Likely pop-ups are blocked by the browser."));o&&o.focus&&o.focus();var s=window.setInterval(function(){o&&!o.closed&&void 0!==o.closed||window.clearInterval(s);try{-1!==o.document.URL.indexOf(e.redirectUri)&&(window.clearInterval(s),t._authContext.handleWindowCallback(o.location.hash),o.close(),n())}catch(e){r(e)}},30)},e.ensureAuthContext().then(function(n){t._authContext._loginInProgress=!1,t._authContext.login(),e._displayCallback=null})}),this._loginPromise)},t.prototype.getResource=function(e){var t=document.createElement("a");return t.href=e,t.protocol+"//"+t.hostname},t._authContext=null}(m),function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=[]),this.keys=e,this.values=t}return e.prototype.get=function(e){var t=this.keys.indexOf(e);return t<0?null:this.values[t]},e.prototype.add=function(e,t){var n=this.keys.indexOf(e);n>-1?null===t?this.remove(e):this.values[n]=t:null!==t&&(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){var t=this;if("getKeys"in e){var n=e;n.getKeys().map(function(e){t.add(e,n.get(e))})}else{var r=e;for(var i in r)r.hasOwnProperty(i)&&this.add(i,r[i])}},e.prototype.remove=function(e){var t=this.keys.indexOf(e);if(t<0)return null;var n=this.values[t];return this.keys.splice(t,1),this.values.splice(t,1),n},e.prototype.getKeys=function(){return this.keys},e.prototype.getValues=function(){return this.values},e.prototype.clear=function(){this.keys=[],this.values=[]},Object.defineProperty(e.prototype,"count",{get:function(){return this.keys.length},enumerable:!0,configurable:!0}),e}()),R=(function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",S.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}Object(E.b)(t,e)}(Error),function(){function e(){this._v=new v,this._v.add("defaultCachingStore","session"),this._v.add("defaultCachingTimeoutSeconds",60),this._v.add("globalCacheDisable",!1),this._v.add("enableCacheExpiration",!1),this._v.add("cacheExpirationIntervalMilliseconds",750),this._v.add("spfxContext",null)}return e.prototype.extend=function(e){var t=this;Object.keys(e).forEach(function(n){t._v.add(n,e[n])})},e.prototype.get=function(e){return this._v.get(e)},Object.defineProperty(e.prototype,"defaultCachingStore",{get:function(){return this.get("defaultCachingStore")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get("defaultCachingTimeoutSeconds")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get("globalCacheDisable")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get("enableCacheExpiration")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get("cacheExpirationIntervalMilliseconds")},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get("spfxContext")},enumerable:!0,configurable:!0}),e}()),y=new R,I=y,b=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),I.enableCacheExpiration&&(S.a.write("Enabling cache expiration.",1),this.cacheExpirationHandler())}return e.prototype.get=function(e){if(!this.enabled)return null;var t=this.store.getItem(e);if(null==t)return null;var n=JSON.parse(t);return new Date(n.expiration)<=new Date?(S.a.write("Removing item with key '"+e+"' from cache due to expiration.",1),this.delete(e),null):n.value},e.prototype.put=function(e,t,n){this.enabled&&this.store.setItem(e,this.createPersistable(t,n))},e.prototype.delete=function(e){this.enabled&&this.store.removeItem(e)},e.prototype.getOrPut=function(e,t,n){var r=this;return this.enabled?new Promise(function(i){var o=r.get(e);null==o?t().then(function(t){r.put(e,t,n),i(t)}):i(o)}):t()},e.prototype.deleteExpired=function(){var e=this;return new Promise(function(t,n){e.enabled||t();try{for(var r=0;r<e.store.length;r++){var i=e.store.key(r);null!==i&&/["|']?pnp["|']? ?: ?1/i.test(e.store.getItem(i))&&e.get(i)}t()}catch(e){n(e)}})},e.prototype.test=function(){try{return this.store.setItem("test","test"),this.store.removeItem("test"),!0}catch(e){return!1}},e.prototype.createPersistable=function(e,t){if(void 0===t){var n=I.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=i(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;S.a.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(r(e,e.cacheExpirationHandler),I.cacheExpirationIntervalMilliseconds)}).catch(function(e){S.a.log({data:e,level:3,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),w=function(){function e(e){void 0===e&&(e=new v),this._store=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this._store.count},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this._store.clear()},e.prototype.getItem=function(e){return this._store.get(e)},e.prototype.key=function(e){return this._store.getKeys()[e]},e.prototype.removeItem=function(e){this._store.remove(e)},e.prototype.setItem=function(e,t){this._store.add(e,t)},e}(),C=function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=null),this._local=e,this._session=t}return Object.defineProperty(e.prototype,"local",{get:function(){return null===this._local&&(this._local=new b("undefined"!=typeof localStorage?localStorage:new w)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new b("undefined"!=typeof sessionStorage?sessionStorage:new w)),this._session},enumerable:!0,configurable:!0}),e}()}).call(t,n(8))},function(e,t,n){"use strict";n.d(t,"a",function(){return i});/** | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.pnp=t():e.pnp=t()}("undefined"!=typeof self?self:this,function(){return function(e){function t(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,t),i.l=!0,i.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,r){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:r})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="",t(t.s=6)}([function(e,t,n){"use strict";(function(e){/** | ||
@license | ||
* @pnp/logging v1.1.4 - pnp - light-weight, subscribable logging framework | ||
* @pnp/common v1.1.5-0 - pnp - provides shared functionality across all pnp libraries | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -20,3 +20,3 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
var r,i=function(){function e(){}return Object.defineProperty(e,"activeLogLevel",{get:function(){return e.instance.activeLogLevel},set:function(t){e.instance.activeLogLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return void 0!==e._instance&&null!==e._instance||(e._instance=new o),e._instance},enumerable:!0,configurable:!0}),e.subscribe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.map(function(t){return e.instance.subscribe(t)})},e.clearSubscribers=function(){return e.instance.clearSubscribers()},Object.defineProperty(e,"count",{get:function(){return e.instance.count},enumerable:!0,configurable:!0}),e.write=function(t,n){void 0===n&&(n=1),e.instance.log({level:n,message:t})},e.writeJSON=function(t,n){void 0===n&&(n=1),e.instance.log({level:n,message:JSON.stringify(t)})},e.log=function(t){e.instance.log(t)},e.error=function(t){e.instance.log({data:t,level:3,message:t.message})},e}(),o=function(){function e(e,t){void 0===e&&(e=2),void 0===t&&(t=[]),this.activeLogLevel=e,this.subscribers=t}return e.prototype.subscribe=function(e){this.subscribers.push(e)},e.prototype.clearSubscribers=function(){var e=this.subscribers.slice(0);return this.subscribers.length=0,e},Object.defineProperty(e.prototype,"count",{get:function(){return this.subscribers.length},enumerable:!0,configurable:!0}),e.prototype.write=function(e,t){void 0===t&&(t=1),this.log({level:t,message:e})},e.prototype.log=function(e){void 0!==e&&this.activeLogLevel<=e.level&&this.subscribers.map(function(t){return t.log(e)})},e}();!function(e){e[e.Verbose=0]="Verbose",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Off=99]="Off"}(r||(r={}));(function(){function e(){}e.prototype.log=function(e){var t=this.format(e);switch(e.level){case 0:case 1:console.log(t);break;case 2:console.warn(t);break;case 3:console.error(t)}},e.prototype.format=function(e){var t=[];return t.push("Message: "+e.message),void 0!==e.data&&t.push(" Data: "+JSON.stringify(e.data)),t.join("")}})(),function(){function e(e){this.method=e}e.prototype.log=function(e){this.method(e)}}()},function(e,t,n){"use strict";function r(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}t.b=r,t.a=i;/*! ***************************************************************************** | ||
function r(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}}function i(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!l(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")}function s(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})}function a(e){return"function"==typeof e}function c(e){return void 0!==e&&null!==e}function u(e,t,n,r){if(void 0===n&&(n=!1),void 0===r&&(r=function(){return!0}),!c(t))return e;var i=n?function(e,t){return!(t in e)}:function(){return!0},o=function(t){return i(e,t)&&r(t)};return Object.getOwnPropertyNames(t).filter(o).reduce(function(e,n){return e[n]=t[n],e},e)}function h(e){return/^https?:\/\/|^\/\//i.test(e)}function l(e){return void 0===e||null===e||e.length<1}function p(e){return JSON.stringify(e)}function d(e,t){return Object.hasOwnProperty.call(e,t)}function f(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}function T(e,t){if(c(t)){var n=u(e.headers||{},t.headers);e=u(e,t),e.headers=n}}function _(e){return void 0!==e&&null!==e?new Map(m(e)):new Map}function g(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r=0;r<t.length;r++)t[r].forEach(function(t,n){e.set(n,t)});return e}n.d(t,"b",function(){return y}),n.d(t,"i",function(){return T}),n.d(t,"a",function(){return C}),n.d(t,"d",function(){return i}),n.d(t,"c",function(){return o}),n.d(t,"f",function(){return s}),n.d(t,"h",function(){return a}),n.d(t,"j",function(){return c}),n.d(t,"e",function(){return u}),n.d(t,"g",function(){return d});var S=n(1),E=n(9),O=(n.n(E),function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}()),N=function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}return Object(S.b)(t,e),Object.defineProperty(t.prototype,"token",{get:function(){return this._token},set:function(e){this._token=e},enumerable:!0,configurable:!0}),t.prototype.fetch=function(t,n){void 0===n&&(n={});var r=new Headers;return f(r,n.headers),r.set("Authorization","Bearer "+this._token),n.headers=r,e.prototype.fetch.call(this,t,n)},t}(O),m=(function(e){function t(t,n,r){var i=e.call(this,null)||this;return i.clientId=t,i.tenant=n,i.redirectUri=r,i}Object(S.b)(t,e),t.fromSPFxContext=function(e,n){return void 0===n&&(n="c58637bb-e2e1-4312-8a00-04b5ffcd3403"),new t(n,e.pageContext.aadInfo.tenantId.toString(),o(window.location.origin,"/_forms/spfxsinglesignon.aspx"))},t.prototype.fetch=function(t,n){var r=this;if(!h(t))throw new Error("You must supply absolute urls to AdalClient.fetch.");return this.getToken(this.getResource(t)).then(function(i){return r.token=i,e.prototype.fetch.call(r,t,n)})},t.prototype.getToken=function(e){var n=this;return new Promise(function(r,i){n.ensureAuthContext().then(function(e){return n.login()}).then(function(n){t._authContext.acquireToken(e,function(e,t){if(e)return i(new Error(e));r(t)})}).catch(i)})},t.prototype.ensureAuthContext=function(){var e=this;return new Promise(function(n){null===t._authContext&&(t._authContext=Object(E.inject)({clientId:e.clientId,displayCall:function(t){e._displayCallback&&e._displayCallback(t)},navigateToLoginRequestUrl:!1,redirectUri:e.redirectUri,tenant:e.tenant})),n()})},t.prototype.login=function(){var e=this;return this._loginPromise?this._loginPromise:(this._loginPromise=new Promise(function(n,r){if(t._authContext.getCachedUser())return n();e._displayCallback=function(i){var o=window.open(i,"login","width=483, height=600");if(!o)return r(new Error("Could not open pop-up window for auth. Likely pop-ups are blocked by the browser."));o&&o.focus&&o.focus();var s=window.setInterval(function(){o&&!o.closed&&void 0!==o.closed||window.clearInterval(s);try{-1!==o.document.URL.indexOf(e.redirectUri)&&(window.clearInterval(s),t._authContext.handleWindowCallback(o.location.hash),o.close(),n())}catch(e){r(e)}},30)},e.ensureAuthContext().then(function(n){t._authContext._loginInProgress=!1,t._authContext.login(),e._displayCallback=null})}),this._loginPromise)},t.prototype.getResource=function(e){var t=document.createElement("a");return t.href=e,t.protocol+"//"+t.hostname},t._authContext=null}(N),a(Object.entries)?Object.entries:function(e){return Object.keys(e).map(function(t){return[t,e[t]]})}),v=["defaultCachingStore","defaultCachingTimeoutSeconds","globalCacheDisable","enableCacheExpiration","cacheExpirationIntervalMilliseconds","spfxContext"],R=function(){function e(e){void 0===e&&(e=new Map),this._v=e,this._v.set(v[0],"session"),this._v.set(v[1],60),this._v.set(v[2],!1),this._v.set(v[3],!1),this._v.set(v[4],750),this._v.set(v[5],null)}return e.prototype.extend=function(e){this._v=g(this._v,_(e))},e.prototype.get=function(e){return this._v.get(e)},Object.defineProperty(e.prototype,"defaultCachingStore",{get:function(){return this.get(v[0])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(v[1])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(v[2])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(v[3])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(v[4])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(v[5])},enumerable:!0,configurable:!0}),e}(),I=new R,y=I,b=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),y.enableCacheExpiration&&this.cacheExpirationHandler()}return e.prototype.get=function(e){if(!this.enabled)return null;var t=this.store.getItem(e);if(void 0===t)return null;var n=JSON.parse(t);return new Date(n.expiration)<=new Date?(this.delete(e),null):n.value},e.prototype.put=function(e,t,n){this.enabled&&this.store.setItem(e,this.createPersistable(t,n))},e.prototype.delete=function(e){this.enabled&&this.store.removeItem(e)},e.prototype.getOrPut=function(e,t,n){var r=this;return this.enabled?new Promise(function(i){var o=r.get(e);null==o?t().then(function(t){r.put(e,t,n),i(t)}):i(o)}):t()},e.prototype.deleteExpired=function(){var e=this;return new Promise(function(t,n){e.enabled||t();try{for(var r=0;r<e.store.length;r++){var i=e.store.key(r);null!==i&&/["|']?pnp["|']? ?: ?1/i.test(e.store.getItem(i))&&e.get(i)}t()}catch(e){n(e)}})},e.prototype.test=function(){try{return this.store.setItem("t","t"),this.store.removeItem("t"),!0}catch(e){return!1}},e.prototype.createPersistable=function(e,t){if(void 0===t){var n=y.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=i(new Date,"second",n)}return p({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;this.deleteExpired().then(function(t){setTimeout(r(e,e.cacheExpirationHandler),y.cacheExpirationIntervalMilliseconds)}).catch(function(e){console.error(e)})},e}(),w=function(){function e(e){void 0===e&&(e=new Map),this._store=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this._store.size},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this._store.clear()},e.prototype.getItem=function(e){return this._store.get(e)},e.prototype.key=function(e){return Array.from(this._store)[e][0]},e.prototype.removeItem=function(e){this._store.delete(e)},e.prototype.setItem=function(e,t){this._store.set(e,t)},e}(),C=function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=null),this._local=e,this._session=t}return Object.defineProperty(e.prototype,"local",{get:function(){return null===this._local&&(this._local=this.getStore(localStorage)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=this.getStore(sessionStorage)),this._session},enumerable:!0,configurable:!0}),e.prototype.getStore=function(e){return new b(void 0!==e?e:new w)},e}()}).call(t,n(8))},function(e,t,n){"use strict";function r(e,t){function n(){this.constructor=e}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function i(e,t,n,r){var i,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,n,r);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(s=(o<3?i(s):o>3?i(t,n,s):i(t,n))||s);return o>3&&s&&Object.defineProperty(t,n,s),s}t.b=r,t.a=i;/*! ***************************************************************************** | ||
Copyright (c) Microsoft Corporation. All rights reserved. | ||
@@ -35,5 +35,13 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
***************************************************************************** */ | ||
var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)}},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return o});var r=n(0),i=function(){function e(e){this.key=e,this.expiration=Object(r.e)(new Date,"second",r.c.defaultCachingTimeoutSeconds),this.storeName=r.c.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new r.b,e}(),o=function(){function e(e,t){this.parser=e,this.cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this.parser.parse(e).then(function(e){return t.cacheData(e)})},e.prototype.cacheData=function(e){return null!==this.cacheOptions.store&&this.cacheOptions.store.put(this.cacheOptions.key,e,this.cacheOptions.expiration),e},e}()},function(e,t,n){"use strict";n.d(t,"g",function(){return s}),n.d(t,"f",function(){return a}),n.d(t,"e",function(){return u}),n.d(t,"h",function(){return c}),n.d(t,"a",function(){return h}),n.d(t,"c",function(){return l}),n.d(t,"b",function(){return p}),n.d(t,"d",function(){return d});var r=n(2),i=n(0),o=n(1),s=function(e){function t(t,n,r){var i=e.call(this,"Error making HttpClient request in queryable: ["+t+"] "+n)||this;return i.status=t,i.statusText=n,i.data=r,i.name="ProcessHttpClientResponseException",o.a.log({data:i.data,level:3,message:i.message}),i}return r.b(t,e),t}(Error),a=function(){function e(){}return e.prototype.parse=function(e){var t=this;return new Promise(function(n,r){t.handleError(e,r)&&t.parseImpl(e,n,r)})},e.prototype.parseImpl=function(e,t,n){var r=this;e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length"))||204===e.status?t({}):e.text().then(function(e){return e.replace(/\s/gi,"").length>0?JSON.parse(e):{}}).then(function(e){return t(r.parseODataJSON(e))}).catch(function(e){return n(e)})},e.prototype.handleError=function(e,t){return e.ok||e.json().then(function(n){var r={responseBody:n,responseHeaders:e.headers};t(new s(e.status,e.statusText,r))}).catch(function(n){o.a.log({data:n,level:2,message:"There was an error parsing the error response body. See data for details."});var r={responseBody:"[[body not available]]",responseHeaders:e.headers};t(new s(e.status,e.statusText,r))}),e.ok},e.prototype.parseODataJSON=function(e){var t=e;return e.hasOwnProperty("d")?t=e.d.hasOwnProperty("results")?e.d.results:e.d:e.hasOwnProperty("value")&&(t=e.value),t},e}(),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t}(a),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.text().then(t)},t}(a),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.blob().then(t)},t}(a),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.json().then(t)},t}(a),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){Object(i.h)(e.arrayBuffer)?e.arrayBuffer().then(t):e.buffer().then(t)},t}(a),d=function(){function e(e){this.parser=e}return e.prototype.parse=function(e){return this.parser(e)},e}()},function(e,t,n){"use strict";function r(e){return l.a.log({data:0===l.a.activeLogLevel?e.result:{},level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Returning result from pipeline. Set logging to verbose to see data."}),Promise.resolve(e.result||null)}function i(e,t){return new Promise(function(n){e.result=t,e.hasResult=!0,n(e)})}function o(e){return e.pipeline.length>0?e.pipeline.shift()(e):Promise.resolve(e)}function s(e){e.pipeline.length<1&&l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Request pipeline contains no methods!",2);var t=o(e).then(function(e){return r(e)}).catch(function(e){throw l.a.error(e),e});return e.isBatched&&e.batch.addResolveBatchDependency(t),t}function a(e){return void 0===e&&(e=!1),function(t,n,r){var i=r.value;r.value=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];return!e&&r.length>0&&r[0].hasOwnProperty("hasResult")&&r[0].hasResult?(l.a.write("["+r[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+n+", existing result in pipeline.",0),Promise.resolve(r[0])):(l.a.write("["+r[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+n+".",0),i.apply(t,r).then(function(e){return o(e)}))}}}function u(){return[d.logStart,d.caching,d.send,d.logEnd].slice(0)}t.e=i,t.c=s,t.d=a,n.d(t,"a",function(){return d}),t.b=u;var c=n(2),h=n(0),l=n(1),p=n(3),d=function(){function e(){}return e.logStart=function(e){return new Promise(function(t){l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Beginning "+e.verb+" request ("+e.requestAbsoluteUrl+")"}),t(e)})},e.caching=function(e){return new Promise(function(t){if(e.isCached){l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",1);var n=new p.a(e.requestAbsoluteUrl.toLowerCase());if(void 0!==e.cachingOptions&&(n=Object(h.f)(n,e.cachingOptions)),null!==n.store){var r=n.store.get(n.key);if(null!==r)return l.a.log({data:1===l.a.activeLogLevel?{}:r,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),Object(h.h)(e.batchDependency)&&e.batchDependency(),e.parser.hasOwnProperty("hydrate")&&(r=e.parser.hydrate(r)),i(e,r).then(function(e){return t(e)})}l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",1),e.parser=new p.b(e.parser,n)}return t(e)})},e.send=function(e){return new Promise(function(t,n){if(e.isBatched){var r=e.batch.add(e.requestAbsoluteUrl,e.verb,e.options,e.parser,e.requestId);Object(h.h)(e.batchDependency)&&e.batchDependency(),l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+e.batch.batchId+".",1),t(i(e,r))}else{l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Sending request.",1);var o=e.clientFactory(),s=Object(h.f)(e.options||{},{method:e.verb});o.fetch(e.requestAbsoluteUrl,s).then(function(t){return e.parser.parse(t)}).then(function(t){return i(e,t)}).then(function(e){return t(e)}).catch(function(e){return n(e)})}})},e.logEnd=function(e){return new Promise(function(t){e.isBatched?l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") "+e.verb+" request will complete in batch "+e.batch.batchId+"."}):l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Completing "+e.verb+" request."}),t(e)})},c.a([a(!0)],e,"logStart",null),c.a([a()],e,"caching",null),c.a([a()],e,"send",null),c.a([a(!0)],e,"logEnd",null),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7);n.d(t,"CachingOptions",function(){return r.d}),n.d(t,"CachingParserWrapper",function(){return r.e}),n.d(t,"ProcessHttpClientResponseException",function(){return r.m}),n.d(t,"ODataParserBase",function(){return r.j}),n.d(t,"ODataDefaultParser",function(){return r.i}),n.d(t,"TextParser",function(){return r.o}),n.d(t,"BlobParser",function(){return r.b}),n.d(t,"JSONParser",function(){return r.f}),n.d(t,"BufferParser",function(){return r.c}),n.d(t,"LambdaParser",function(){return r.g}),n.d(t,"setResult",function(){return r.s}),n.d(t,"pipe",function(){return r.q}),n.d(t,"requestPipelineMethod",function(){return r.r}),n.d(t,"PipelineMethods",function(){return r.l}),n.d(t,"getDefaultPipeline",function(){return r.p}),n.d(t,"AlreadyInBatchException",function(){return r.a}),n.d(t,"Queryable",function(){return r.n}),n.d(t,"ODataQueryable",function(){return r.k}),n.d(t,"ODataBatch",function(){return r.h})},function(e,t,n){"use strict";var r=n(3);n.d(t,"d",function(){return r.a}),n.d(t,"e",function(){return r.b});var i=n(4);n.d(t,"b",function(){return i.a}),n.d(t,"c",function(){return i.b}),n.d(t,"f",function(){return i.c}),n.d(t,"g",function(){return i.d}),n.d(t,"i",function(){return i.e}),n.d(t,"j",function(){return i.f}),n.d(t,"m",function(){return i.g}),n.d(t,"o",function(){return i.h});var o=n(5);n.d(t,"l",function(){return o.a}),n.d(t,"p",function(){return o.b}),n.d(t,"q",function(){return o.c}),n.d(t,"r",function(){return o.d}),n.d(t,"s",function(){return o.e});var s=n(10);n.d(t,"a",function(){return s.a}),n.d(t,"k",function(){return s.b}),n.d(t,"n",function(){return s.c});var a=n(11);n.d(t,"h",function(){return a.a})},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){ | ||
// @preserve Copyright (c) Microsoft Open Technologies, Inc. | ||
var n=function(){"use strict";return n=function(e){if(this.REQUEST_TYPE={LOGIN:"LOGIN",RENEW_TOKEN:"RENEW_TOKEN",UNKNOWN:"UNKNOWN"},this.RESPONSE_TYPE={ID_TOKEN_TOKEN:"id_token token",TOKEN:"token"},this.CONSTANTS={ACCESS_TOKEN:"access_token",EXPIRES_IN:"expires_in",ID_TOKEN:"id_token",ERROR_DESCRIPTION:"error_description",SESSION_STATE:"session_state",ERROR:"error",STORAGE:{TOKEN_KEYS:"adal.token.keys",ACCESS_TOKEN_KEY:"adal.access.token.key",EXPIRATION_KEY:"adal.expiration.key",STATE_LOGIN:"adal.state.login",STATE_RENEW:"adal.state.renew",NONCE_IDTOKEN:"adal.nonce.idtoken",SESSION_STATE:"adal.session.state",USERNAME:"adal.username",IDTOKEN:"adal.idtoken",ERROR:"adal.error",ERROR_DESCRIPTION:"adal.error.description",LOGIN_REQUEST:"adal.login.request",LOGIN_ERROR:"adal.login.error",RENEW_STATUS:"adal.token.renew.status",ANGULAR_LOGIN_REQUEST:"adal.angular.login.request"},RESOURCE_DELIMETER:"|",CACHE_DELIMETER:"||",LOADFRAME_TIMEOUT:6e3,TOKEN_RENEW_STATUS_CANCELED:"Canceled",TOKEN_RENEW_STATUS_COMPLETED:"Completed",TOKEN_RENEW_STATUS_IN_PROGRESS:"In Progress",LOGGING_LEVEL:{ERROR:0,WARN:1,INFO:2,VERBOSE:3},LEVEL_STRING_MAP:{0:"ERROR:",1:"WARNING:",2:"INFO:",3:"VERBOSE:"},POPUP_WIDTH:483,POPUP_HEIGHT:600},n.prototype._singletonInstance)return n.prototype._singletonInstance;if(n.prototype._singletonInstance=this,this.instance="https://login.microsoftonline.com/",this.config={},this.callback=null,this.popUp=!1,this.isAngular=!1,this._user=null,this._activeRenewals={},this._loginInProgress=!1,this._acquireTokenInProgress=!1,this._renewStates=[],this._callBackMappedToRenewStates={},this._callBacksMappedToRenewStates={},this._openedWindows=[],this._requestType=this.REQUEST_TYPE.LOGIN,window._adalInstance=this,e.displayCall&&"function"!=typeof e.displayCall)throw new Error("displayCall is not a function");if(!e.clientId)throw new Error("clientId is required");this.config=this._cloneConfig(e),void 0===this.config.navigateToLoginRequestUrl&&(this.config.navigateToLoginRequestUrl=!0),this.config.popUp&&(this.popUp=!0),this.config.callback&&"function"==typeof this.config.callback&&(this.callback=this.config.callback),this.config.instance&&(this.instance=this.config.instance),this.config.loginResource||(this.config.loginResource=this.config.clientId),this.config.redirectUri||(this.config.redirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.postLogoutRedirectUri||(this.config.postLogoutRedirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.anonymousEndpoints||(this.config.anonymousEndpoints=[]),this.config.isAngular&&(this.isAngular=this.config.isAngular),this.config.loadFrameTimeout&&(this.CONSTANTS.LOADFRAME_TIMEOUT=this.config.loadFrameTimeout)},"undefined"!=typeof window&&(window.Logging={piiLoggingEnabled:!1,level:0,log:function(e){}}),n.prototype.login=function(){if(this._loginInProgress)return void this.info("Login in progress");this._loginInProgress=!0;var e=this._guid();this.config.state=e,this._idTokenNonce=this._guid();var t=this._getItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST);t&&""!==t?this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""):t=window.location.href,this.verbose("Expected state: "+e+" startPage:"+t),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,t),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,e,!0),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var n=this._getNavigateUrl("id_token",null)+"&nonce="+encodeURIComponent(this._idTokenNonce);this.config.displayCall?this.config.displayCall(n):this.popUp?(this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._renewStates.push(e),this.registerCallback(e,this.config.clientId,this.callback),this._loginPopup(n)):this.promptUser(n)},n.prototype._openPopup=function(e,t,n,r){try{var i=window.screenLeft?window.screenLeft:window.screenX,o=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,u=s/2-n/2+i,c=a/2-r/2+o,h=window.open(e,t,"width="+n+", height="+r+", top="+c+", left="+u);return h.focus&&h.focus(),h}catch(e){return this.warn("Error opening popup, "+e.message),this._loginInProgress=!1,this._acquireTokenInProgress=!1,null}},n.prototype._handlePopupError=function(e,t,n,r,i){this.warn(r),this._saveItem(this.CONSTANTS.STORAGE.ERROR,n),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,r),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,i),t&&this._activeRenewals[t]&&(this._activeRenewals[t]=null),this._loginInProgress=!1,this._acquireTokenInProgress=!1,e&&e(r,null,n)},n.prototype._loginPopup=function(e,t,n){var r=this._openPopup(e,"login",this.CONSTANTS.POPUP_WIDTH,this.CONSTANTS.POPUP_HEIGHT),i=n||this.callback;if(null==r){var o="Popup Window is null. This can happen if you are using IE";return void this._handlePopupError(i,t,"Error opening popup",o,o)}if(this._openedWindows.push(r),-1!=this.config.redirectUri.indexOf("#"))var s=this.config.redirectUri.split("#")[0];else var s=this.config.redirectUri;var a=this,u=window.setInterval(function(){if(!r||r.closed||void 0===r.closed){var e="Popup Window closed",n="Popup Window closed by UI action/ Popup Window handle destroyed due to cross zone navigation in IE/Edge";return a.isAngular&&a._broadcast("adal:popUpClosed",n+a.CONSTANTS.RESOURCE_DELIMETER+e),a._handlePopupError(i,t,e,n,n),void window.clearInterval(u)}try{var o=r.location;if(-1!=encodeURI(o.href).indexOf(encodeURI(s)))return a.isAngular?a._broadcast("adal:popUpHashChanged",o.hash):a.handleWindowCallback(o.hash),window.clearInterval(u),a._loginInProgress=!1,a._acquireTokenInProgress=!1,a.info("Closing popup window"),a._openedWindows=[],void r.close()}catch(e){}},1)},n.prototype._broadcast=function(e,t){!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}();var n=new CustomEvent(e,{detail:t});window.dispatchEvent(n)},n.prototype.loginInProgress=function(){return this._loginInProgress},n.prototype._hasResource=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);return t&&!this._isEmpty(t)&&t.indexOf(e+this.CONSTANTS.RESOURCE_DELIMETER)>-1},n.prototype.getCachedToken=function(e){if(!this._hasResource(e))return null;var t=this._getItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e),n=this._getItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e),r=this.config.expireOffsetSeconds||300;return n&&n>this._now()+r?t:(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e,0),null)},n.prototype.getCachedUser=function(){if(this._user)return this._user;var e=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);return this._user=this._createUser(e),this._user},n.prototype.registerCallback=function(e,t,n){this._activeRenewals[t]=e,this._callBacksMappedToRenewStates[e]||(this._callBacksMappedToRenewStates[e]=[]);var r=this;this._callBacksMappedToRenewStates[e].push(n),this._callBackMappedToRenewStates[e]||(this._callBackMappedToRenewStates[e]=function(n,i,o,s){r._activeRenewals[t]=null;for(var a=0;a<r._callBacksMappedToRenewStates[e].length;++a)try{r._callBacksMappedToRenewStates[e][a](n,i,o,s)}catch(o){r.warn(o)}r._callBacksMappedToRenewStates[e]=null,r._callBackMappedToRenewStates[e]=null})},n.prototype._renewToken=function(e,t,n){this.info("renewToken is called for resource:"+e);var r=this._addAdalFrame("adalRenewFrame"+e),i=this._guid()+"|"+e;this.config.state=i,this._renewStates.push(i),this.verbose("Renew token Expected state: "+i),n=n||"token";var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl(n,e),"prompt");n===this.RESPONSE_TYPE.ID_TOKEN_TOKEN&&(this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),o+="&nonce="+encodeURIComponent(this._idTokenNonce)),o+="&prompt=none",o=this._addHintParameters(o),this.registerCallback(i,e,t),this.verbosePii("Navigate to:"+o),r.src="about:blank",this._loadFrameTimeout(o,"adalRenewFrame"+e,e)},n.prototype._renewIdToken=function(e,t){this.info("renewIdToken is called");var n=this._addAdalFrame("adalIdTokenFrame"),r=this._guid()+"|"+this.config.clientId;this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this.config.state=r,this._renewStates.push(r),this.verbose("Renew Idtoken Expected state: "+r);var i=null===t||void 0===t?null:this.config.clientId,t=t||"id_token",o=this._urlRemoveQueryStringParameter(this._getNavigateUrl(t,i),"prompt");o+="&prompt=none",o=this._addHintParameters(o),o+="&nonce="+encodeURIComponent(this._idTokenNonce),this.registerCallback(r,this.config.clientId,e),this.verbosePii("Navigate to:"+o),n.src="about:blank",this._loadFrameTimeout(o,"adalIdTokenFrame",this.config.clientId)},n.prototype._urlContainsQueryStringParameter=function(e,t){return new RegExp("[\\?&]"+e+"=").test(t)},n.prototype._urlRemoveQueryStringParameter=function(e,t){var n=new RegExp("(\\&"+t+"=)[^&]+");return e=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+&"),e=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+"),e=e.replace(n,"")},n.prototype._loadFrameTimeout=function(e,t,n){this.verbose("Set loading state to pending for: "+n),this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+n,this.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS),this._loadFrame(e,t);var r=this;setTimeout(function(){if(r._getItem(r.CONSTANTS.STORAGE.RENEW_STATUS+n)===r.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS){r.verbose("Loading frame has timed out after: "+r.CONSTANTS.LOADFRAME_TIMEOUT/1e3+" seconds for resource "+n);var e=r._activeRenewals[n];e&&r._callBackMappedToRenewStates[e]&&r._callBackMappedToRenewStates[e]("Token renewal operation failed due to timeout",null,"Token Renewal Failed"),r._saveItem(r.CONSTANTS.STORAGE.RENEW_STATUS+n,r.CONSTANTS.TOKEN_RENEW_STATUS_CANCELED)}},r.CONSTANTS.LOADFRAME_TIMEOUT)},n.prototype._loadFrame=function(e,t){var n=this;n.info("LoadFrame: "+t);var r=t;setTimeout(function(){var t=n._addAdalFrame(r);""!==t.src&&"about:blank"!==t.src||(t.src=e,n._loadFrame(e,r))},500)},n.prototype.acquireToken=function(e,t){if(this._isEmpty(e))return this.warn("resource is required"),void t("resource is required",null,"resource is required");var n=this.getCachedToken(e);return n?(this.info("Token is already in cache for resource:"+e),void t(null,n,null)):this._user||this.config.extraQueryParameter&&-1!==this.config.extraQueryParameter.indexOf("login_hint")?void(this._activeRenewals[e]?this.registerCallback(this._activeRenewals[e],e,t):(this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,e===this.config.clientId?this._user?(this.verbose("renewing idtoken"),this._renewIdToken(t)):(this.verbose("renewing idtoken and access_token"),this._renewIdToken(t,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)):this._user?(this.verbose("renewing access_token"),this._renewToken(e,t)):(this.verbose("renewing idtoken and access_token"),this._renewToken(e,t,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)))):(this.warn("User login is required"),void t("User login is required",null,"login required"))},n.prototype.acquireTokenPopup=function(e,t,n,r){if(this._isEmpty(e))return this.warn("resource is required"),void r("resource is required",null,"resource is required");if(!this._user)return this.warn("User login is required"),void r("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void r("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var i=this._guid()+"|"+e;this.config.state=i,this._renewStates.push(i),this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,this.verbose("Renew token Expected state: "+i);var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",e),"prompt");if(o+="&prompt=select_account",t&&(o+=t),n&&-1===o.indexOf("&claims"))o+="&claims="+encodeURIComponent(n);else if(n&&-1!==o.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");o=this._addHintParameters(o),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+e),this.registerCallback(i,e,r),this._loginPopup(o,e,r)},n.prototype.acquireTokenRedirect=function(e,t,n){if(this._isEmpty(e))return this.warn("resource is required"),void r("resource is required",null,"resource is required");var r=this.callback;if(!this._user)return this.warn("User login is required"),void r("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void r("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var i=this._guid()+"|"+e;this.config.state=i,this.verbose("Renew token Expected state: "+i);var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",e),"prompt");if(o+="&prompt=select_account",t&&(o+=t),n&&-1===o.indexOf("&claims"))o+="&claims="+encodeURIComponent(n);else if(n&&-1!==o.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");o=this._addHintParameters(o),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+e),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,window.location.href),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,i,!0),this.promptUser(o)},n.prototype.promptUser=function(e){e?(this.infoPii("Navigate to:"+e),window.location.replace(e)):this.info("Navigate url is empty")},n.prototype.clearCache=function(){this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._renewStates=[],this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"");var e=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);if(!this._isEmpty(e)){e=e.split(this.CONSTANTS.RESOURCE_DELIMETER);for(var t=0;t<e.length&&""!==e[t];t++)this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e[t],""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e[t],0)}this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,"")},n.prototype.clearCacheForResource=function(e){this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._hasResource(e)&&(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e,0))},n.prototype.logOut=function(){this.clearCache(),this._user=null;var e;if(this.config.logOutUri)e=this.config.logOutUri;else{var t="common",n="";this.config.tenant&&(t=this.config.tenant),this.config.postLogoutRedirectUri&&(n="post_logout_redirect_uri="+encodeURIComponent(this.config.postLogoutRedirectUri)),e=this.instance+t+"/oauth2/logout?"+n}this.infoPii("Logout navigate to: "+e),this.promptUser(e)},n.prototype._isEmpty=function(e){return void 0===e||!e||0===e.length},n.prototype.getUser=function(e){if("function"!=typeof e)throw new Error("callback is not a function");if(this._user)return void e(null,this._user);var t=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);this._isEmpty(t)?(this.warn("User information is not available"),e("User information is not available",null)):(this.info("User exists in cache: "),this._user=this._createUser(t),e(null,this._user))},n.prototype._addHintParameters=function(e){if(this._user&&this._user.profile)if(this._user.profile.sid&&-1!==e.indexOf("&prompt=none"))this._urlContainsQueryStringParameter("sid",e)||(e+="&sid="+encodeURIComponent(this._user.profile.sid));else if(this._user.profile.upn&&(this._urlContainsQueryStringParameter("login_hint",e)||(e+="&login_hint="+encodeURIComponent(this._user.profile.upn)),!this._urlContainsQueryStringParameter("domain_hint",e)&&this._user.profile.upn.indexOf("@")>-1)){var t=this._user.profile.upn.split("@");e+="&domain_hint="+encodeURIComponent(t[t.length-1])}return e},n.prototype._createUser=function(e){var t=null,n=this._extractIdToken(e);return n&&n.hasOwnProperty("aud")&&(n.aud.toLowerCase()===this.config.clientId.toLowerCase()?(t={userName:"",profile:n},n.hasOwnProperty("upn")?t.userName=n.upn:n.hasOwnProperty("email")&&(t.userName=n.email)):this.warn("IdToken has invalid aud field")),t},n.prototype._getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},n.prototype.isCallback=function(e){e=this._getHash(e);var t=this._deserialize(e);return t.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||t.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||t.hasOwnProperty(this.CONSTANTS.ID_TOKEN)},n.prototype.getLoginError=function(){return this._getItem(this.CONSTANTS.STORAGE.LOGIN_ERROR)},n.prototype.getRequestInfo=function(e){e=this._getHash(e);var t=this._deserialize(e),n={valid:!1,parameters:{},stateMatch:!1,stateResponse:"",requestType:this.REQUEST_TYPE.UNKNOWN};if(t&&(n.parameters=t,t.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||t.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||t.hasOwnProperty(this.CONSTANTS.ID_TOKEN))){n.valid=!0;var r="";if(!t.hasOwnProperty("state"))return this.warn("No state returned"),n;if(this.verbose("State: "+t.state),r=t.state,n.stateResponse=r,this._matchState(n))return n;if(!n.stateMatch&&window.parent){n.requestType=this._requestType;for(var i=this._renewStates,o=0;o<i.length;o++)if(i[o]===n.stateResponse){n.stateMatch=!0;break}}}return n},n.prototype._matchNonce=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN);if(t){t=t.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<t.length;n++)if(t[n]===e.profile.nonce)return!0}return!1},n.prototype._matchState=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.STATE_LOGIN);if(t){t=t.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<t.length;n++)if(t[n]===e.stateResponse)return e.requestType=this.REQUEST_TYPE.LOGIN,e.stateMatch=!0,!0}var r=this._getItem(this.CONSTANTS.STORAGE.STATE_RENEW);if(r){r=r.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<r.length;n++)if(r[n]===e.stateResponse)return e.requestType=this.REQUEST_TYPE.RENEW_TOKEN,e.stateMatch=!0,!0}return!1},n.prototype._getResourceFromState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},n.prototype.saveTokenFromHash=function(e){this.info("State status:"+e.stateMatch+"; Request type:"+e.requestType),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var t=this._getResourceFromState(e.stateResponse);if(e.parameters.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION))this.infoPii("Error :"+e.parameters.error+"; Error description:"+e.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),this._saveItem(this.CONSTANTS.STORAGE.ERROR,e.parameters.error),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,e.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),e.requestType===this.REQUEST_TYPE.LOGIN&&(this._loginInProgress=!1,this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,e.parameters.error_description));else if(e.stateMatch){this.info("State is right"),e.parameters.hasOwnProperty(this.CONSTANTS.SESSION_STATE)&&this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,e.parameters[this.CONSTANTS.SESSION_STATE]);var n;e.parameters.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)&&(this.info("Fragment has access token"),this._hasResource(t)||(n=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,n+t+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t,e.parameters[this.CONSTANTS.ACCESS_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t,this._expiresIn(e.parameters[this.CONSTANTS.EXPIRES_IN]))),e.parameters.hasOwnProperty(this.CONSTANTS.ID_TOKEN)&&(this.info("Fragment has id token"),this._loginInProgress=!1,this._user=this._createUser(e.parameters[this.CONSTANTS.ID_TOKEN]),this._user&&this._user.profile?this._matchNonce(this._user)?(this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,e.parameters[this.CONSTANTS.ID_TOKEN]),t=this.config.loginResource?this.config.loginResource:this.config.clientId,this._hasResource(t)||(n=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,n+t+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t,e.parameters[this.CONSTANTS.ID_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t,this._user.profile.exp)):(this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"Nonce received: "+this._user.profile.nonce+" is not same as requested: "+this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN)),this._user=null):(e.parameters.error="invalid id_token",e.parameters.error_description="Invalid id_token. id_token: "+e.parameters[this.CONSTANTS.ID_TOKEN],this._saveItem(this.CONSTANTS.STORAGE.ERROR,"invalid id_token"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid id_token. id_token: "+e.parameters[this.CONSTANTS.ID_TOKEN])))}else e.parameters.error="Invalid_state",e.parameters.error_description="Invalid_state. state: "+e.stateResponse,this._saveItem(this.CONSTANTS.STORAGE.ERROR,"Invalid_state"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid_state. state: "+e.stateResponse);this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+t,this.CONSTANTS.TOKEN_RENEW_STATUS_COMPLETED)},n.prototype.getResourceForEndpoint=function(e){if(this.config&&this.config.anonymousEndpoints)for(var t=0;t<this.config.anonymousEndpoints.length;t++)if(e.indexOf(this.config.anonymousEndpoints[t])>-1)return null;if(this.config&&this.config.endpoints)for(var n in this.config.endpoints)if(e.indexOf(n)>-1)return this.config.endpoints[n];return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this._getHostFromUri(e)===this._getHostFromUri(this.config.redirectUri)?this.config.loginResource:null:this.config.loginResource},n.prototype._getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0]},n.prototype.handleWindowCallback=function(e){if(null==e&&(e=window.location.hash),this.isCallback(e)){var t=null,n=!1;this._openedWindows.length>0&&this._openedWindows[this._openedWindows.length-1].opener&&this._openedWindows[this._openedWindows.length-1].opener._adalInstance?(t=this._openedWindows[this._openedWindows.length-1].opener._adalInstance,n=!0):window.parent&&window.parent._adalInstance&&(t=window.parent._adalInstance);var r,i,o=t.getRequestInfo(e),s=null;i=n||window.parent!==window?t._callBackMappedToRenewStates[o.stateResponse]:t.callback,t.info("Returned from redirect url"),t.saveTokenFromHash(o),o.requestType===this.REQUEST_TYPE.RENEW_TOKEN&&window.parent?(window.parent!==window?t.verbose("Window is in iframe, acquiring token silently"):t.verbose("acquiring token interactive in progress"),r=o.parameters[t.CONSTANTS.ACCESS_TOKEN]||o.parameters[t.CONSTANTS.ID_TOKEN],s=t.CONSTANTS.ACCESS_TOKEN):o.requestType===this.REQUEST_TYPE.LOGIN&&(r=o.parameters[t.CONSTANTS.ID_TOKEN],s=t.CONSTANTS.ID_TOKEN);var a=o.parameters[t.CONSTANTS.ERROR_DESCRIPTION],u=o.parameters[t.CONSTANTS.ERROR];try{i&&i(a,r,u,s)}catch(e){t.error("Error occurred in user defined callback function: "+e)}window.parent!==window||n||(t.config.navigateToLoginRequestUrl?window.location.href=t._getItem(t.CONSTANTS.STORAGE.LOGIN_REQUEST):window.location.hash="")}},n.prototype._getNavigateUrl=function(e,t){var n="common";this.config.tenant&&(n=this.config.tenant);var r=this.instance+n+"/oauth2/authorize"+this._serialize(e,this.config,t)+this._addLibMetadata();return this.info("Navigate url:"+r),r},n.prototype._extractIdToken=function(e){var t=this._decodeJwt(e);if(!t)return null;try{var n=t.JWSPayload,r=this._base64DecodeStringUrlSafe(n);return r?JSON.parse(r):(this.info("The returned id_token could not be base64 url safe decoded."),null)}catch(e){this.error("The returned id_token could not be decoded",e)}return null},n.prototype._base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(escape(window.atob(e))):decodeURIComponent(escape(this._decode(e)))},n.prototype._decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=String(e).replace(/=+$/,"");var n=e.length;if(n%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var r,i,o,s,a,u,c,h,l="",p=0;p<n;p+=4){if(r=t.indexOf(e.charAt(p)),i=t.indexOf(e.charAt(p+1)),o=t.indexOf(e.charAt(p+2)),s=t.indexOf(e.charAt(p+3)),p+2===n-1){a=r<<18|i<<12|o<<6,u=a>>16&255,c=a>>8&255,l+=String.fromCharCode(u,c);break}if(p+1===n-1){a=r<<18|i<<12,u=a>>16&255,l+=String.fromCharCode(u);break}a=r<<18|i<<12|o<<6|s,u=a>>16&255,c=a>>8&255,h=255&a,l+=String.fromCharCode(u,c,h)}return l},n.prototype._decodeJwt=function(e){if(this._isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,n=t.exec(e);return!n||n.length<4?(this.warn("The returned id_token is not parseable."),null):{header:n[1],JWSPayload:n[2],JWSSig:n[3]}},n.prototype._convertUrlSafeToRegularBase64EncodedString=function(e){return e.replace("-","+").replace("_","/")},n.prototype._serialize=function(e,t,n){var r=[];if(null!==t){r.push("?response_type="+e),r.push("client_id="+encodeURIComponent(t.clientId)),n&&r.push("resource="+encodeURIComponent(n)),r.push("redirect_uri="+encodeURIComponent(t.redirectUri)),r.push("state="+encodeURIComponent(t.state)),t.hasOwnProperty("slice")&&r.push("slice="+encodeURIComponent(t.slice)),t.hasOwnProperty("extraQueryParameter")&&r.push(t.extraQueryParameter);var i=t.correlationId?t.correlationId:this._guid();r.push("client-request-id="+encodeURIComponent(i))}return r.join("&")},n.prototype._deserialize=function(e){var t,n=/\+/g,r=/([^&=]+)=([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(n," "))},o={};for(t=r.exec(e);t;)o[i(t[1])]=i(t[2]),t=r.exec(e);return o},n.prototype._decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},n.prototype._guid=function(){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,this._decimalToHex(t[0])+this._decimalToHex(t[1])+this._decimalToHex(t[2])+this._decimalToHex(t[3])+"-"+this._decimalToHex(t[4])+this._decimalToHex(t[5])+"-"+this._decimalToHex(t[6])+this._decimalToHex(t[7])+"-"+this._decimalToHex(t[8])+this._decimalToHex(t[9])+"-"+this._decimalToHex(t[10])+this._decimalToHex(t[11])+this._decimalToHex(t[12])+this._decimalToHex(t[13])+this._decimalToHex(t[14])+this._decimalToHex(t[15])}for(var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",r="0123456789abcdef",i=0,o="",s=0;s<36;s++)"-"!==n[s]&&"4"!==n[s]&&(i=16*Math.random()|0),"x"===n[s]?o+=r[i]:"y"===n[s]?(i&=3,i|=8,o+=r[i]):o+=n[s];return o},n.prototype._expiresIn=function(e){return e||(e=3599),this._now()+parseInt(e,10)},n.prototype._now=function(){return Math.round((new Date).getTime()/1e3)},n.prototype._addAdalFrame=function(e){if(void 0!==e){this.info("Add adal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&(window.opera||-1===window.navigator.userAgent.indexOf("MSIE 5.0"))){var n=document.createElement("iframe");n.setAttribute("id",e),n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height=n.borderWidth="0px",t=document.getElementsByTagName("body")[0].appendChild(n)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeEnd",'<iframe name="'+e+'" id="'+e+'" style="display:none"></iframe>');window.frames&&window.frames[e]&&(t=window.frames[e])}return t}},n.prototype._saveItem=function(e,t,n){if(this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation){if(!this._supportsLocalStorage())return this.info("Local storage is not supported"),!1;if(n){var r=this._getItem(e)||"";localStorage.setItem(e,r+t+this.CONSTANTS.CACHE_DELIMETER)}else localStorage.setItem(e,t);return!0}return this._supportsSessionStorage()?(sessionStorage.setItem(e,t),!0):(this.info("Session storage is not supported"),!1)},n.prototype._getItem=function(e){return this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation?this._supportsLocalStorage()?localStorage.getItem(e):(this.info("Local storage is not supported"),null):this._supportsSessionStorage()?sessionStorage.getItem(e):(this.info("Session storage is not supported"),null)},n.prototype._supportsLocalStorage=function(){try{return!!window.localStorage&&(window.localStorage.setItem("storageTest","A"),"A"==window.localStorage.getItem("storageTest")&&(window.localStorage.removeItem("storageTest"),!window.localStorage.getItem("storageTest")))}catch(e){return!1}},n.prototype._supportsSessionStorage=function(){try{return!!window.sessionStorage&&(window.sessionStorage.setItem("storageTest","A"),"A"==window.sessionStorage.getItem("storageTest")&&(window.sessionStorage.removeItem("storageTest"),!window.sessionStorage.getItem("storageTest")))}catch(e){return!1}},n.prototype._cloneConfig=function(e){if(null===e||"object"!=typeof e)return e;var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},n.prototype._addLibMetadata=function(){return"&x-client-SKU=Js&x-client-Ver="+this._libVersion()},n.prototype.log=function(e,t,n,r){if(e<=Logging.level){if(!Logging.piiLoggingEnabled&&r)return;var i=(new Date).toUTCString(),o="";o=this.config.correlationId?i+":"+this.config.correlationId+"-"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[e]+" "+t:i+":"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[e]+" "+t,n&&(o+="\nstack:\n"+n.stack),Logging.log(o)}},n.prototype.error=function(e,t){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,e,t)},n.prototype.warn=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,e,null)},n.prototype.info=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,e,null)},n.prototype.verbose=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,e,null)},n.prototype.errorPii=function(e,t){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,e,t,!0)},n.prototype.warnPii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,e,null,!0)},n.prototype.infoPii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,e,null,!0)},n.prototype.verbosePii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,e,null,!0)},n.prototype._libVersion=function(){return"1.0.17"},void 0!==e&&e.exports&&(e.exports=n,e.exports.inject=function(e){return new n(e)}),n}()},function(e,t,n){"use strict";n.d(t,"a",function(){return u}),n.d(t,"c",function(){return c}),n.d(t,"b",function(){return h});var r=n(2),i=n(0),o=n(1),s=n(4),a=n(5),u=function(e){function t(t){void 0===t&&(t="This query is already part of a batch.");var n=e.call(this,t)||this;return n.name="AlreadyInBatchException",o.a.error(n),n}return r.b(t,e),t}(Error),c=function(){function e(){this._query=new i.a,this._options={},this._url="",this._parentUrl="",this._useCaching=!1,this._cachingOptions=null}return e.prototype.toUrl=function(){return this._url},e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return Object(i.i)(this._options,e),this},e.prototype.configureFrom=function(e){return Object(i.i)(this._options,e._options),this},e.prototype.usingCaching=function(e){return i.c.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.getCore=function(e,t){return void 0===e&&(e=new s.c),void 0===t&&(t={}),this.toRequestContext("GET",t,e,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("POST",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("PATCH",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("DELETE",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("PUT",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.append=function(e){this._url=Object(i.d)(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this._parentUrl=e._url,this._url=Object(i.d)(this._parentUrl,t),this.configureFrom(e)},e}(),h=function(e){function t(){var t=e.call(this)||this;return t._batch=null,t}return r.b(t,e),t.prototype.inBatch=function(e){if(null!==this.batch)throw new u;return this._batch=e,this},t.prototype.toUrl=function(){return this._url},t.prototype.get=function(e,t){return void 0===e&&(e=new s.e),void 0===t&&(t={}),this.getCore(e,t)},t.prototype.getCore=function(e,t){return void 0===e&&(e=new s.e),void 0===t&&(t={}),this.toRequestContext("GET",t,e,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("POST",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("PATCH",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("DELETE",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("PUT",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.addBatchDependency=function(){return null!==this._batch?this._batch.addDependency():function(){return null}},Object.defineProperty(t.prototype,"hasBatch",{get:function(){return Object(i.j)(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),t}(c)},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(0),i=function(){function e(e){void 0===e&&(e=Object(r.g)()),this._batchId=e,this._requests=[],this._dependencies=[],this._resolveBatchDependencies=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._requests},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r,i){var o={id:i,method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},s=new Promise(function(e,t){o.resolve=e,o.reject=t});return this._requests.push(o),s},e.prototype.addDependency=function(){var e=function(){},t=new Promise(function(t){e=t});return this._dependencies.push(t),e},e.prototype.addResolveBatchDependency=function(e){this._resolveBatchDependencies.push(e)},e.prototype.execute=function(){var e=this;return Promise.all(this._dependencies).then(function(){return Promise.all(e._dependencies)}).then(function(){return e.executeImpl()}).then(function(){return Promise.all(e._resolveBatchDependencies)}).then(function(){})},e}()}])}); | ||
var o=function(e,t){return(o=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)}},function(e,t,n){"use strict";n.d(t,"a",function(){return i});/** | ||
@license | ||
* @pnp/logging v1.1.5-0 - pnp - light-weight, subscribable logging framework | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
* Copyright (c) 2018 Microsoft | ||
* docs: https://pnp.github.io/pnpjs/ | ||
* source: https:github.com/pnp/pnpjs | ||
* bugs: https://github.com/pnp/pnpjs/issues | ||
*/ | ||
var r,i=function(){function e(){}return Object.defineProperty(e,"activeLogLevel",{get:function(){return e.instance.activeLogLevel},set:function(t){e.instance.activeLogLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(e,"instance",{get:function(){return void 0!==e._instance&&null!==e._instance||(e._instance=new o),e._instance},enumerable:!0,configurable:!0}),e.subscribe=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];t.map(function(t){return e.instance.subscribe(t)})},e.clearSubscribers=function(){return e.instance.clearSubscribers()},Object.defineProperty(e,"count",{get:function(){return e.instance.count},enumerable:!0,configurable:!0}),e.write=function(t,n){void 0===n&&(n=1),e.instance.log({level:n,message:t})},e.writeJSON=function(e,t){void 0===t&&(t=1),this.write(JSON.stringify(e),t)},e.log=function(t){e.instance.log(t)},e.error=function(t){e.instance.log({data:t,level:3,message:t.message})},e}(),o=function(){function e(e,t){void 0===e&&(e=2),void 0===t&&(t=[]),this.activeLogLevel=e,this.subscribers=t}return e.prototype.subscribe=function(e){this.subscribers.push(e)},e.prototype.clearSubscribers=function(){var e=this.subscribers.slice(0);return this.subscribers.length=0,e},Object.defineProperty(e.prototype,"count",{get:function(){return this.subscribers.length},enumerable:!0,configurable:!0}),e.prototype.write=function(e,t){void 0===t&&(t=1),this.log({level:t,message:e})},e.prototype.log=function(e){void 0!==e&&this.activeLogLevel<=e.level&&this.subscribers.map(function(t){return t.log(e)})},e}();!function(e){e[e.Verbose=0]="Verbose",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Off=99]="Off"}(r||(r={}));(function(){function e(){}e.prototype.log=function(e){var t=this.format(e);switch(e.level){case 0:case 1:console.log(t);break;case 2:console.warn(t);break;case 3:console.error(t)}},e.prototype.format=function(e){var t=[];return t.push("Message: "+e.message),void 0!==e.data&&t.push(" Data: "+JSON.stringify(e.data)),t.join("")}})(),function(){function e(e){this.method=e}e.prototype.log=function(e){this.method(e)}}()},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return o});var r=n(0),i=function(){function e(e){this.key=e,this.expiration=Object(r.d)(new Date,"second",r.b.defaultCachingTimeoutSeconds),this.storeName=r.b.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new r.a,e}(),o=function(){function e(e,t){this.parser=e,this.cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this.parser.parse(e).then(function(e){return t.cacheData(e)})},e.prototype.cacheData=function(e){return null!==this.cacheOptions.store&&this.cacheOptions.store.put(this.cacheOptions.key,e,this.cacheOptions.expiration),e},e}()},function(e,t,n){"use strict";n.d(t,"g",function(){return s}),n.d(t,"f",function(){return a}),n.d(t,"e",function(){return c}),n.d(t,"h",function(){return u}),n.d(t,"a",function(){return h}),n.d(t,"c",function(){return l}),n.d(t,"b",function(){return p}),n.d(t,"d",function(){return d});var r=n(1),i=n(0),o=n(2),s=function(e){function t(t,n,r){var i=e.call(this,"Error making HttpClient request in queryable: ["+t+"] "+n)||this;return i.status=t,i.statusText=n,i.data=r,i.name="ProcessHttpClientResponseException",o.a.log({data:i.data,level:3,message:i.message}),i}return r.b(t,e),t}(Error),a=function(){function e(){}return e.prototype.parse=function(e){var t=this;return new Promise(function(n,r){t.handleError(e,r)&&t.parseImpl(e,n,r)})},e.prototype.parseImpl=function(e,t,n){var r=this;e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length"))||204===e.status?t({}):e.text().then(function(e){return e.replace(/\s/gi,"").length>0?JSON.parse(e):{}}).then(function(e){return t(r.parseODataJSON(e))}).catch(function(e){return n(e)})},e.prototype.handleError=function(e,t){return e.ok||e.json().then(function(n){var r={responseBody:n,responseHeaders:e.headers};t(new s(e.status,e.statusText,r))}).catch(function(n){t(new s(e.status,e.statusText,n))}),e.ok},e.prototype.parseODataJSON=function(e){var t=e;return Object(i.g)(e,"d")?t=Object(i.g)(e.d,"results")?e.d.results:e.d:Object(i.g)(e,"value")&&(t=e.value),t},e}(),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t}(a),u=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.text().then(t)},t}(a),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.blob().then(t)},t}(a),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){e.json().then(t)},t}(a),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.b(t,e),t.prototype.parseImpl=function(e,t){Object(i.h)(e.arrayBuffer)?e.arrayBuffer().then(t):e.buffer().then(t)},t}(a),d=function(){function e(e){this.parser=e}return e.prototype.parse=function(e){return this.parser(e)},e}()},function(e,t,n){"use strict";function r(e){return l.a.log({data:0===l.a.activeLogLevel?e.result:{},level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Returning result from pipeline. Set logging to verbose to see data."}),Promise.resolve(e.result||null)}function i(e,t){return new Promise(function(n){e.result=t,e.hasResult=!0,n(e)})}function o(e){return e.pipeline.length>0?e.pipeline.shift()(e):Promise.resolve(e)}function s(e){e.pipeline.length<1&&l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Request pipeline contains no methods!",2);var t=o(e).then(function(e){return r(e)}).catch(function(e){throw l.a.error(e),e});return e.isBatched&&e.batch.addResolveBatchDependency(t),t}function a(e){return void 0===e&&(e=!1),function(t,n,r){var i=r.value;r.value=function(){for(var r=[],s=0;s<arguments.length;s++)r[s]=arguments[s];return!e&&r.length>0&&Object(h.g)(r[0],"hasResult")&&r[0].hasResult?(l.a.write("["+r[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+n+", existing result in pipeline.",0),Promise.resolve(r[0])):(l.a.write("["+r[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+n+".",0),i.apply(t,r).then(function(e){return o(e)}))}}}function c(){return[d.logStart,d.caching,d.send,d.logEnd].slice(0)}t.e=i,t.c=s,t.d=a,n.d(t,"a",function(){return d}),t.b=c;var u=n(1),h=n(0),l=n(2),p=n(3),d=function(){function e(){}return e.logStart=function(e){return new Promise(function(t){l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Beginning "+e.verb+" request ("+e.requestAbsoluteUrl+")"}),t(e)})},e.caching=function(e){return new Promise(function(t){if(e.isCached){l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",1);var n=new p.a(e.requestAbsoluteUrl.toLowerCase());if(void 0!==e.cachingOptions&&(n=Object(h.e)(n,e.cachingOptions)),null!==n.store){var r=n.store.get(n.key);if(null!==r)return l.a.log({data:1===l.a.activeLogLevel?{}:r,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),Object(h.h)(e.batchDependency)&&e.batchDependency(),Object(h.g)(e.parser,"hydrate")&&(r=e.parser.hydrate(r)),i(e,r).then(function(e){return t(e)})}l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",1),e.parser=new p.b(e.parser,n)}return t(e)})},e.send=function(e){return new Promise(function(t,n){if(e.isBatched){var r=e.batch.add(e.requestAbsoluteUrl,e.verb,e.options,e.parser,e.requestId);Object(h.h)(e.batchDependency)&&e.batchDependency(),l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+e.batch.batchId+".",1),t(i(e,r))}else{l.a.write("["+e.requestId+"] ("+(new Date).getTime()+") Sending request.",1);var o=e.clientFactory(),s=Object(h.e)(e.options||{},{method:e.verb});o.fetch(e.requestAbsoluteUrl,s).then(function(t){return e.parser.parse(t)}).then(function(t){return i(e,t)}).then(function(e){return t(e)}).catch(function(e){return n(e)})}})},e.logEnd=function(e){return new Promise(function(t){e.isBatched?l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") "+e.verb+" request will complete in batch "+e.batch.batchId+"."}):l.a.log({data:1===l.a.activeLogLevel?{}:e,level:1,message:"["+e.requestId+"] ("+(new Date).getTime()+") Completing "+e.verb+" request."}),t(e)})},u.a([a(!0)],e,"logStart",null),u.a([a()],e,"caching",null),u.a([a()],e,"send",null),u.a([a(!0)],e,"logEnd",null),e}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(7);n.d(t,"CachingOptions",function(){return r.d}),n.d(t,"CachingParserWrapper",function(){return r.e}),n.d(t,"ProcessHttpClientResponseException",function(){return r.m}),n.d(t,"ODataParserBase",function(){return r.j}),n.d(t,"ODataDefaultParser",function(){return r.i}),n.d(t,"TextParser",function(){return r.o}),n.d(t,"BlobParser",function(){return r.b}),n.d(t,"JSONParser",function(){return r.f}),n.d(t,"BufferParser",function(){return r.c}),n.d(t,"LambdaParser",function(){return r.g}),n.d(t,"setResult",function(){return r.s}),n.d(t,"pipe",function(){return r.q}),n.d(t,"requestPipelineMethod",function(){return r.r}),n.d(t,"PipelineMethods",function(){return r.l}),n.d(t,"getDefaultPipeline",function(){return r.p}),n.d(t,"AlreadyInBatchException",function(){return r.a}),n.d(t,"Queryable",function(){return r.n}),n.d(t,"ODataQueryable",function(){return r.k}),n.d(t,"ODataBatch",function(){return r.h})},function(e,t,n){"use strict";var r=n(3);n.d(t,"d",function(){return r.a}),n.d(t,"e",function(){return r.b});var i=n(4);n.d(t,"b",function(){return i.a}),n.d(t,"c",function(){return i.b}),n.d(t,"f",function(){return i.c}),n.d(t,"g",function(){return i.d}),n.d(t,"i",function(){return i.e}),n.d(t,"j",function(){return i.f}),n.d(t,"m",function(){return i.g}),n.d(t,"o",function(){return i.h});var o=n(5);n.d(t,"l",function(){return o.a}),n.d(t,"p",function(){return o.b}),n.d(t,"q",function(){return o.c}),n.d(t,"r",function(){return o.d}),n.d(t,"s",function(){return o.e});var s=n(10);n.d(t,"a",function(){return s.a}),n.d(t,"k",function(){return s.b}),n.d(t,"n",function(){return s.c});var a=n(11);n.d(t,"h",function(){return a.a})},function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t){/*! adal-angular v1.0.17 2018-02-27 */ | ||
var n=function(){"use strict";return n=function(e){if(this.REQUEST_TYPE={LOGIN:"LOGIN",RENEW_TOKEN:"RENEW_TOKEN",UNKNOWN:"UNKNOWN"},this.RESPONSE_TYPE={ID_TOKEN_TOKEN:"id_token token",TOKEN:"token"},this.CONSTANTS={ACCESS_TOKEN:"access_token",EXPIRES_IN:"expires_in",ID_TOKEN:"id_token",ERROR_DESCRIPTION:"error_description",SESSION_STATE:"session_state",ERROR:"error",STORAGE:{TOKEN_KEYS:"adal.token.keys",ACCESS_TOKEN_KEY:"adal.access.token.key",EXPIRATION_KEY:"adal.expiration.key",STATE_LOGIN:"adal.state.login",STATE_RENEW:"adal.state.renew",NONCE_IDTOKEN:"adal.nonce.idtoken",SESSION_STATE:"adal.session.state",USERNAME:"adal.username",IDTOKEN:"adal.idtoken",ERROR:"adal.error",ERROR_DESCRIPTION:"adal.error.description",LOGIN_REQUEST:"adal.login.request",LOGIN_ERROR:"adal.login.error",RENEW_STATUS:"adal.token.renew.status",ANGULAR_LOGIN_REQUEST:"adal.angular.login.request"},RESOURCE_DELIMETER:"|",CACHE_DELIMETER:"||",LOADFRAME_TIMEOUT:6e3,TOKEN_RENEW_STATUS_CANCELED:"Canceled",TOKEN_RENEW_STATUS_COMPLETED:"Completed",TOKEN_RENEW_STATUS_IN_PROGRESS:"In Progress",LOGGING_LEVEL:{ERROR:0,WARN:1,INFO:2,VERBOSE:3},LEVEL_STRING_MAP:{0:"ERROR:",1:"WARNING:",2:"INFO:",3:"VERBOSE:"},POPUP_WIDTH:483,POPUP_HEIGHT:600},n.prototype._singletonInstance)return n.prototype._singletonInstance;if(n.prototype._singletonInstance=this,this.instance="https://login.microsoftonline.com/",this.config={},this.callback=null,this.popUp=!1,this.isAngular=!1,this._user=null,this._activeRenewals={},this._loginInProgress=!1,this._acquireTokenInProgress=!1,this._renewStates=[],this._callBackMappedToRenewStates={},this._callBacksMappedToRenewStates={},this._openedWindows=[],this._requestType=this.REQUEST_TYPE.LOGIN,window._adalInstance=this,e.displayCall&&"function"!=typeof e.displayCall)throw new Error("displayCall is not a function");if(!e.clientId)throw new Error("clientId is required");this.config=this._cloneConfig(e),void 0===this.config.navigateToLoginRequestUrl&&(this.config.navigateToLoginRequestUrl=!0),this.config.popUp&&(this.popUp=!0),this.config.callback&&"function"==typeof this.config.callback&&(this.callback=this.config.callback),this.config.instance&&(this.instance=this.config.instance),this.config.loginResource||(this.config.loginResource=this.config.clientId),this.config.redirectUri||(this.config.redirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.postLogoutRedirectUri||(this.config.postLogoutRedirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.anonymousEndpoints||(this.config.anonymousEndpoints=[]),this.config.isAngular&&(this.isAngular=this.config.isAngular),this.config.loadFrameTimeout&&(this.CONSTANTS.LOADFRAME_TIMEOUT=this.config.loadFrameTimeout)},"undefined"!=typeof window&&(window.Logging={piiLoggingEnabled:!1,level:0,log:function(e){}}),n.prototype.login=function(){if(this._loginInProgress)return void this.info("Login in progress");this._loginInProgress=!0;var e=this._guid();this.config.state=e,this._idTokenNonce=this._guid();var t=this._getItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST);t&&""!==t?this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""):t=window.location.href,this.verbose("Expected state: "+e+" startPage:"+t),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,t),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,e,!0),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var n=this._getNavigateUrl("id_token",null)+"&nonce="+encodeURIComponent(this._idTokenNonce);this.config.displayCall?this.config.displayCall(n):this.popUp?(this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._renewStates.push(e),this.registerCallback(e,this.config.clientId,this.callback),this._loginPopup(n)):this.promptUser(n)},n.prototype._openPopup=function(e,t,n,r){try{var i=window.screenLeft?window.screenLeft:window.screenX,o=window.screenTop?window.screenTop:window.screenY,s=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,a=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,c=s/2-n/2+i,u=a/2-r/2+o,h=window.open(e,t,"width="+n+", height="+r+", top="+u+", left="+c);return h.focus&&h.focus(),h}catch(e){return this.warn("Error opening popup, "+e.message),this._loginInProgress=!1,this._acquireTokenInProgress=!1,null}},n.prototype._handlePopupError=function(e,t,n,r,i){this.warn(r),this._saveItem(this.CONSTANTS.STORAGE.ERROR,n),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,r),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,i),t&&this._activeRenewals[t]&&(this._activeRenewals[t]=null),this._loginInProgress=!1,this._acquireTokenInProgress=!1,e&&e(r,null,n)},n.prototype._loginPopup=function(e,t,n){var r=this._openPopup(e,"login",this.CONSTANTS.POPUP_WIDTH,this.CONSTANTS.POPUP_HEIGHT),i=n||this.callback;if(null==r){var o="Popup Window is null. This can happen if you are using IE";return void this._handlePopupError(i,t,"Error opening popup",o,o)}if(this._openedWindows.push(r),-1!=this.config.redirectUri.indexOf("#"))var s=this.config.redirectUri.split("#")[0];else var s=this.config.redirectUri;var a=this,c=window.setInterval(function(){if(!r||r.closed||void 0===r.closed){var e="Popup Window closed",n="Popup Window closed by UI action/ Popup Window handle destroyed due to cross zone navigation in IE/Edge";return a.isAngular&&a._broadcast("adal:popUpClosed",n+a.CONSTANTS.RESOURCE_DELIMETER+e),a._handlePopupError(i,t,e,n,n),void window.clearInterval(c)}try{var o=r.location;if(-1!=encodeURI(o.href).indexOf(encodeURI(s)))return a.isAngular?a._broadcast("adal:popUpHashChanged",o.hash):a.handleWindowCallback(o.hash),window.clearInterval(c),a._loginInProgress=!1,a._acquireTokenInProgress=!1,a.info("Closing popup window"),a._openedWindows=[],void r.close()}catch(e){}},1)},n.prototype._broadcast=function(e,t){!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}if("function"==typeof window.CustomEvent)return!1;e.prototype=window.Event.prototype,window.CustomEvent=e}();var n=new CustomEvent(e,{detail:t});window.dispatchEvent(n)},n.prototype.loginInProgress=function(){return this._loginInProgress},n.prototype._hasResource=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);return t&&!this._isEmpty(t)&&t.indexOf(e+this.CONSTANTS.RESOURCE_DELIMETER)>-1},n.prototype.getCachedToken=function(e){if(!this._hasResource(e))return null;var t=this._getItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e),n=this._getItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e),r=this.config.expireOffsetSeconds||300;return n&&n>this._now()+r?t:(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e,0),null)},n.prototype.getCachedUser=function(){if(this._user)return this._user;var e=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);return this._user=this._createUser(e),this._user},n.prototype.registerCallback=function(e,t,n){this._activeRenewals[t]=e,this._callBacksMappedToRenewStates[e]||(this._callBacksMappedToRenewStates[e]=[]);var r=this;this._callBacksMappedToRenewStates[e].push(n),this._callBackMappedToRenewStates[e]||(this._callBackMappedToRenewStates[e]=function(n,i,o,s){r._activeRenewals[t]=null;for(var a=0;a<r._callBacksMappedToRenewStates[e].length;++a)try{r._callBacksMappedToRenewStates[e][a](n,i,o,s)}catch(o){r.warn(o)}r._callBacksMappedToRenewStates[e]=null,r._callBackMappedToRenewStates[e]=null})},n.prototype._renewToken=function(e,t,n){this.info("renewToken is called for resource:"+e);var r=this._addAdalFrame("adalRenewFrame"+e),i=this._guid()+"|"+e;this.config.state=i,this._renewStates.push(i),this.verbose("Renew token Expected state: "+i),n=n||"token";var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl(n,e),"prompt");n===this.RESPONSE_TYPE.ID_TOKEN_TOKEN&&(this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),o+="&nonce="+encodeURIComponent(this._idTokenNonce)),o+="&prompt=none",o=this._addHintParameters(o),this.registerCallback(i,e,t),this.verbosePii("Navigate to:"+o),r.src="about:blank",this._loadFrameTimeout(o,"adalRenewFrame"+e,e)},n.prototype._renewIdToken=function(e,t){this.info("renewIdToken is called");var n=this._addAdalFrame("adalIdTokenFrame"),r=this._guid()+"|"+this.config.clientId;this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this.config.state=r,this._renewStates.push(r),this.verbose("Renew Idtoken Expected state: "+r);var i=null===t||void 0===t?null:this.config.clientId,t=t||"id_token",o=this._urlRemoveQueryStringParameter(this._getNavigateUrl(t,i),"prompt");o+="&prompt=none",o=this._addHintParameters(o),o+="&nonce="+encodeURIComponent(this._idTokenNonce),this.registerCallback(r,this.config.clientId,e),this.verbosePii("Navigate to:"+o),n.src="about:blank",this._loadFrameTimeout(o,"adalIdTokenFrame",this.config.clientId)},n.prototype._urlContainsQueryStringParameter=function(e,t){return new RegExp("[\\?&]"+e+"=").test(t)},n.prototype._urlRemoveQueryStringParameter=function(e,t){var n=new RegExp("(\\&"+t+"=)[^&]+");return e=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+&"),e=e.replace(n,""),n=new RegExp("("+t+"=)[^&]+"),e=e.replace(n,"")},n.prototype._loadFrameTimeout=function(e,t,n){this.verbose("Set loading state to pending for: "+n),this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+n,this.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS),this._loadFrame(e,t);var r=this;setTimeout(function(){if(r._getItem(r.CONSTANTS.STORAGE.RENEW_STATUS+n)===r.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS){r.verbose("Loading frame has timed out after: "+r.CONSTANTS.LOADFRAME_TIMEOUT/1e3+" seconds for resource "+n);var e=r._activeRenewals[n];e&&r._callBackMappedToRenewStates[e]&&r._callBackMappedToRenewStates[e]("Token renewal operation failed due to timeout",null,"Token Renewal Failed"),r._saveItem(r.CONSTANTS.STORAGE.RENEW_STATUS+n,r.CONSTANTS.TOKEN_RENEW_STATUS_CANCELED)}},r.CONSTANTS.LOADFRAME_TIMEOUT)},n.prototype._loadFrame=function(e,t){var n=this;n.info("LoadFrame: "+t);var r=t;setTimeout(function(){var t=n._addAdalFrame(r);""!==t.src&&"about:blank"!==t.src||(t.src=e,n._loadFrame(e,r))},500)},n.prototype.acquireToken=function(e,t){if(this._isEmpty(e))return this.warn("resource is required"),void t("resource is required",null,"resource is required");var n=this.getCachedToken(e);return n?(this.info("Token is already in cache for resource:"+e),void t(null,n,null)):this._user||this.config.extraQueryParameter&&-1!==this.config.extraQueryParameter.indexOf("login_hint")?void(this._activeRenewals[e]?this.registerCallback(this._activeRenewals[e],e,t):(this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,e===this.config.clientId?this._user?(this.verbose("renewing idtoken"),this._renewIdToken(t)):(this.verbose("renewing idtoken and access_token"),this._renewIdToken(t,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)):this._user?(this.verbose("renewing access_token"),this._renewToken(e,t)):(this.verbose("renewing idtoken and access_token"),this._renewToken(e,t,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)))):(this.warn("User login is required"),void t("User login is required",null,"login required"))},n.prototype.acquireTokenPopup=function(e,t,n,r){if(this._isEmpty(e))return this.warn("resource is required"),void r("resource is required",null,"resource is required");if(!this._user)return this.warn("User login is required"),void r("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void r("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var i=this._guid()+"|"+e;this.config.state=i,this._renewStates.push(i),this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,this.verbose("Renew token Expected state: "+i);var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",e),"prompt");if(o+="&prompt=select_account",t&&(o+=t),n&&-1===o.indexOf("&claims"))o+="&claims="+encodeURIComponent(n);else if(n&&-1!==o.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");o=this._addHintParameters(o),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+e),this.registerCallback(i,e,r),this._loginPopup(o,e,r)},n.prototype.acquireTokenRedirect=function(e,t,n){if(this._isEmpty(e))return this.warn("resource is required"),void r("resource is required",null,"resource is required");var r=this.callback;if(!this._user)return this.warn("User login is required"),void r("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void r("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var i=this._guid()+"|"+e;this.config.state=i,this.verbose("Renew token Expected state: "+i);var o=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",e),"prompt");if(o+="&prompt=select_account",t&&(o+=t),n&&-1===o.indexOf("&claims"))o+="&claims="+encodeURIComponent(n);else if(n&&-1!==o.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");o=this._addHintParameters(o),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+e),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,window.location.href),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,i,!0),this.promptUser(o)},n.prototype.promptUser=function(e){e?(this.infoPii("Navigate to:"+e),window.location.replace(e)):this.info("Navigate url is empty")},n.prototype.clearCache=function(){this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._renewStates=[],this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"");var e=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);if(!this._isEmpty(e)){e=e.split(this.CONSTANTS.RESOURCE_DELIMETER);for(var t=0;t<e.length&&""!==e[t];t++)this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e[t],""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e[t],0)}this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,"")},n.prototype.clearCacheForResource=function(e){this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._hasResource(e)&&(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+e,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+e,0))},n.prototype.logOut=function(){this.clearCache(),this._user=null;var e;if(this.config.logOutUri)e=this.config.logOutUri;else{var t="common",n="";this.config.tenant&&(t=this.config.tenant),this.config.postLogoutRedirectUri&&(n="post_logout_redirect_uri="+encodeURIComponent(this.config.postLogoutRedirectUri)),e=this.instance+t+"/oauth2/logout?"+n}this.infoPii("Logout navigate to: "+e),this.promptUser(e)},n.prototype._isEmpty=function(e){return void 0===e||!e||0===e.length},n.prototype.getUser=function(e){if("function"!=typeof e)throw new Error("callback is not a function");if(this._user)return void e(null,this._user);var t=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);this._isEmpty(t)?(this.warn("User information is not available"),e("User information is not available",null)):(this.info("User exists in cache: "),this._user=this._createUser(t),e(null,this._user))},n.prototype._addHintParameters=function(e){if(this._user&&this._user.profile)if(this._user.profile.sid&&-1!==e.indexOf("&prompt=none"))this._urlContainsQueryStringParameter("sid",e)||(e+="&sid="+encodeURIComponent(this._user.profile.sid));else if(this._user.profile.upn&&(this._urlContainsQueryStringParameter("login_hint",e)||(e+="&login_hint="+encodeURIComponent(this._user.profile.upn)),!this._urlContainsQueryStringParameter("domain_hint",e)&&this._user.profile.upn.indexOf("@")>-1)){var t=this._user.profile.upn.split("@");e+="&domain_hint="+encodeURIComponent(t[t.length-1])}return e},n.prototype._createUser=function(e){var t=null,n=this._extractIdToken(e);return n&&n.hasOwnProperty("aud")&&(n.aud.toLowerCase()===this.config.clientId.toLowerCase()?(t={userName:"",profile:n},n.hasOwnProperty("upn")?t.userName=n.upn:n.hasOwnProperty("email")&&(t.userName=n.email)):this.warn("IdToken has invalid aud field")),t},n.prototype._getHash=function(e){return e.indexOf("#/")>-1?e=e.substring(e.indexOf("#/")+2):e.indexOf("#")>-1&&(e=e.substring(1)),e},n.prototype.isCallback=function(e){e=this._getHash(e);var t=this._deserialize(e);return t.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||t.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||t.hasOwnProperty(this.CONSTANTS.ID_TOKEN)},n.prototype.getLoginError=function(){return this._getItem(this.CONSTANTS.STORAGE.LOGIN_ERROR)},n.prototype.getRequestInfo=function(e){e=this._getHash(e);var t=this._deserialize(e),n={valid:!1,parameters:{},stateMatch:!1,stateResponse:"",requestType:this.REQUEST_TYPE.UNKNOWN};if(t&&(n.parameters=t,t.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||t.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||t.hasOwnProperty(this.CONSTANTS.ID_TOKEN))){n.valid=!0;var r="";if(!t.hasOwnProperty("state"))return this.warn("No state returned"),n;if(this.verbose("State: "+t.state),r=t.state,n.stateResponse=r,this._matchState(n))return n;if(!n.stateMatch&&window.parent){n.requestType=this._requestType;for(var i=this._renewStates,o=0;o<i.length;o++)if(i[o]===n.stateResponse){n.stateMatch=!0;break}}}return n},n.prototype._matchNonce=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN);if(t){t=t.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<t.length;n++)if(t[n]===e.profile.nonce)return!0}return!1},n.prototype._matchState=function(e){var t=this._getItem(this.CONSTANTS.STORAGE.STATE_LOGIN);if(t){t=t.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<t.length;n++)if(t[n]===e.stateResponse)return e.requestType=this.REQUEST_TYPE.LOGIN,e.stateMatch=!0,!0}var r=this._getItem(this.CONSTANTS.STORAGE.STATE_RENEW);if(r){r=r.split(this.CONSTANTS.CACHE_DELIMETER);for(var n=0;n<r.length;n++)if(r[n]===e.stateResponse)return e.requestType=this.REQUEST_TYPE.RENEW_TOKEN,e.stateMatch=!0,!0}return!1},n.prototype._getResourceFromState=function(e){if(e){var t=e.indexOf("|");if(t>-1&&t+1<e.length)return e.substring(t+1)}return""},n.prototype.saveTokenFromHash=function(e){this.info("State status:"+e.stateMatch+"; Request type:"+e.requestType),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var t=this._getResourceFromState(e.stateResponse);if(e.parameters.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION))this.infoPii("Error :"+e.parameters.error+"; Error description:"+e.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),this._saveItem(this.CONSTANTS.STORAGE.ERROR,e.parameters.error),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,e.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),e.requestType===this.REQUEST_TYPE.LOGIN&&(this._loginInProgress=!1,this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,e.parameters.error_description));else if(e.stateMatch){this.info("State is right"),e.parameters.hasOwnProperty(this.CONSTANTS.SESSION_STATE)&&this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,e.parameters[this.CONSTANTS.SESSION_STATE]);var n;e.parameters.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)&&(this.info("Fragment has access token"),this._hasResource(t)||(n=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,n+t+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t,e.parameters[this.CONSTANTS.ACCESS_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t,this._expiresIn(e.parameters[this.CONSTANTS.EXPIRES_IN]))),e.parameters.hasOwnProperty(this.CONSTANTS.ID_TOKEN)&&(this.info("Fragment has id token"),this._loginInProgress=!1,this._user=this._createUser(e.parameters[this.CONSTANTS.ID_TOKEN]),this._user&&this._user.profile?this._matchNonce(this._user)?(this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,e.parameters[this.CONSTANTS.ID_TOKEN]),t=this.config.loginResource?this.config.loginResource:this.config.clientId,this._hasResource(t)||(n=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,n+t+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+t,e.parameters[this.CONSTANTS.ID_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+t,this._user.profile.exp)):(this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"Nonce received: "+this._user.profile.nonce+" is not same as requested: "+this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN)),this._user=null):(e.parameters.error="invalid id_token",e.parameters.error_description="Invalid id_token. id_token: "+e.parameters[this.CONSTANTS.ID_TOKEN],this._saveItem(this.CONSTANTS.STORAGE.ERROR,"invalid id_token"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid id_token. id_token: "+e.parameters[this.CONSTANTS.ID_TOKEN])))}else e.parameters.error="Invalid_state",e.parameters.error_description="Invalid_state. state: "+e.stateResponse,this._saveItem(this.CONSTANTS.STORAGE.ERROR,"Invalid_state"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid_state. state: "+e.stateResponse);this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+t,this.CONSTANTS.TOKEN_RENEW_STATUS_COMPLETED)},n.prototype.getResourceForEndpoint=function(e){if(this.config&&this.config.anonymousEndpoints)for(var t=0;t<this.config.anonymousEndpoints.length;t++)if(e.indexOf(this.config.anonymousEndpoints[t])>-1)return null;if(this.config&&this.config.endpoints)for(var n in this.config.endpoints)if(e.indexOf(n)>-1)return this.config.endpoints[n];return e.indexOf("http://")>-1||e.indexOf("https://")>-1?this._getHostFromUri(e)===this._getHostFromUri(this.config.redirectUri)?this.config.loginResource:null:this.config.loginResource},n.prototype._getHostFromUri=function(e){var t=String(e).replace(/^(https?:)\/\//,"");return t=t.split("/")[0]},n.prototype.handleWindowCallback=function(e){if(null==e&&(e=window.location.hash),this.isCallback(e)){var t=null,n=!1;this._openedWindows.length>0&&this._openedWindows[this._openedWindows.length-1].opener&&this._openedWindows[this._openedWindows.length-1].opener._adalInstance?(t=this._openedWindows[this._openedWindows.length-1].opener._adalInstance,n=!0):window.parent&&window.parent._adalInstance&&(t=window.parent._adalInstance);var r,i,o=t.getRequestInfo(e),s=null;i=n||window.parent!==window?t._callBackMappedToRenewStates[o.stateResponse]:t.callback,t.info("Returned from redirect url"),t.saveTokenFromHash(o),o.requestType===this.REQUEST_TYPE.RENEW_TOKEN&&window.parent?(window.parent!==window?t.verbose("Window is in iframe, acquiring token silently"):t.verbose("acquiring token interactive in progress"),r=o.parameters[t.CONSTANTS.ACCESS_TOKEN]||o.parameters[t.CONSTANTS.ID_TOKEN],s=t.CONSTANTS.ACCESS_TOKEN):o.requestType===this.REQUEST_TYPE.LOGIN&&(r=o.parameters[t.CONSTANTS.ID_TOKEN],s=t.CONSTANTS.ID_TOKEN);var a=o.parameters[t.CONSTANTS.ERROR_DESCRIPTION],c=o.parameters[t.CONSTANTS.ERROR];try{i&&i(a,r,c,s)}catch(e){t.error("Error occurred in user defined callback function: "+e)}window.parent!==window||n||(t.config.navigateToLoginRequestUrl?window.location.href=t._getItem(t.CONSTANTS.STORAGE.LOGIN_REQUEST):window.location.hash="")}},n.prototype._getNavigateUrl=function(e,t){var n="common";this.config.tenant&&(n=this.config.tenant);var r=this.instance+n+"/oauth2/authorize"+this._serialize(e,this.config,t)+this._addLibMetadata();return this.info("Navigate url:"+r),r},n.prototype._extractIdToken=function(e){var t=this._decodeJwt(e);if(!t)return null;try{var n=t.JWSPayload,r=this._base64DecodeStringUrlSafe(n);return r?JSON.parse(r):(this.info("The returned id_token could not be base64 url safe decoded."),null)}catch(e){this.error("The returned id_token could not be decoded",e)}return null},n.prototype._base64DecodeStringUrlSafe=function(e){return e=e.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(escape(window.atob(e))):decodeURIComponent(escape(this._decode(e)))},n.prototype._decode=function(e){var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";e=String(e).replace(/=+$/,"");var n=e.length;if(n%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var r,i,o,s,a,c,u,h,l="",p=0;p<n;p+=4){if(r=t.indexOf(e.charAt(p)),i=t.indexOf(e.charAt(p+1)),o=t.indexOf(e.charAt(p+2)),s=t.indexOf(e.charAt(p+3)),p+2===n-1){a=r<<18|i<<12|o<<6,c=a>>16&255,u=a>>8&255,l+=String.fromCharCode(c,u);break}if(p+1===n-1){a=r<<18|i<<12,c=a>>16&255,l+=String.fromCharCode(c);break}a=r<<18|i<<12|o<<6|s,c=a>>16&255,u=a>>8&255,h=255&a,l+=String.fromCharCode(c,u,h)}return l},n.prototype._decodeJwt=function(e){if(this._isEmpty(e))return null;var t=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,n=t.exec(e);return!n||n.length<4?(this.warn("The returned id_token is not parseable."),null):{header:n[1],JWSPayload:n[2],JWSSig:n[3]}},n.prototype._convertUrlSafeToRegularBase64EncodedString=function(e){return e.replace("-","+").replace("_","/")},n.prototype._serialize=function(e,t,n){var r=[];if(null!==t){r.push("?response_type="+e),r.push("client_id="+encodeURIComponent(t.clientId)),n&&r.push("resource="+encodeURIComponent(n)),r.push("redirect_uri="+encodeURIComponent(t.redirectUri)),r.push("state="+encodeURIComponent(t.state)),t.hasOwnProperty("slice")&&r.push("slice="+encodeURIComponent(t.slice)),t.hasOwnProperty("extraQueryParameter")&&r.push(t.extraQueryParameter);var i=t.correlationId?t.correlationId:this._guid();r.push("client-request-id="+encodeURIComponent(i))}return r.join("&")},n.prototype._deserialize=function(e){var t,n=/\+/g,r=/([^&=]+)=([^&]*)/g,i=function(e){return decodeURIComponent(e.replace(n," "))},o={};for(t=r.exec(e);t;)o[i(t[1])]=i(t[2]),t=r.exec(e);return o},n.prototype._decimalToHex=function(e){for(var t=e.toString(16);t.length<2;)t="0"+t;return t},n.prototype._guid=function(){var e=window.crypto||window.msCrypto;if(e&&e.getRandomValues){var t=new Uint8Array(16);return e.getRandomValues(t),t[6]|=64,t[6]&=79,t[8]|=128,t[8]&=191,this._decimalToHex(t[0])+this._decimalToHex(t[1])+this._decimalToHex(t[2])+this._decimalToHex(t[3])+"-"+this._decimalToHex(t[4])+this._decimalToHex(t[5])+"-"+this._decimalToHex(t[6])+this._decimalToHex(t[7])+"-"+this._decimalToHex(t[8])+this._decimalToHex(t[9])+"-"+this._decimalToHex(t[10])+this._decimalToHex(t[11])+this._decimalToHex(t[12])+this._decimalToHex(t[13])+this._decimalToHex(t[14])+this._decimalToHex(t[15])}for(var n="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",r="0123456789abcdef",i=0,o="",s=0;s<36;s++)"-"!==n[s]&&"4"!==n[s]&&(i=16*Math.random()|0),"x"===n[s]?o+=r[i]:"y"===n[s]?(i&=3,i|=8,o+=r[i]):o+=n[s];return o},n.prototype._expiresIn=function(e){return e||(e=3599),this._now()+parseInt(e,10)},n.prototype._now=function(){return Math.round((new Date).getTime()/1e3)},n.prototype._addAdalFrame=function(e){if(void 0!==e){this.info("Add adal frame to document:"+e);var t=document.getElementById(e);if(!t){if(document.createElement&&document.documentElement&&(window.opera||-1===window.navigator.userAgent.indexOf("MSIE 5.0"))){var n=document.createElement("iframe");n.setAttribute("id",e),n.setAttribute("aria-hidden","true"),n.style.visibility="hidden",n.style.position="absolute",n.style.width=n.style.height=n.borderWidth="0px",t=document.getElementsByTagName("body")[0].appendChild(n)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeEnd",'<iframe name="'+e+'" id="'+e+'" style="display:none"></iframe>');window.frames&&window.frames[e]&&(t=window.frames[e])}return t}},n.prototype._saveItem=function(e,t,n){if(this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation){if(!this._supportsLocalStorage())return this.info("Local storage is not supported"),!1;if(n){var r=this._getItem(e)||"";localStorage.setItem(e,r+t+this.CONSTANTS.CACHE_DELIMETER)}else localStorage.setItem(e,t);return!0}return this._supportsSessionStorage()?(sessionStorage.setItem(e,t),!0):(this.info("Session storage is not supported"),!1)},n.prototype._getItem=function(e){return this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation?this._supportsLocalStorage()?localStorage.getItem(e):(this.info("Local storage is not supported"),null):this._supportsSessionStorage()?sessionStorage.getItem(e):(this.info("Session storage is not supported"),null)},n.prototype._supportsLocalStorage=function(){try{return!!window.localStorage&&(window.localStorage.setItem("storageTest","A"),"A"==window.localStorage.getItem("storageTest")&&(window.localStorage.removeItem("storageTest"),!window.localStorage.getItem("storageTest")))}catch(e){return!1}},n.prototype._supportsSessionStorage=function(){try{return!!window.sessionStorage&&(window.sessionStorage.setItem("storageTest","A"),"A"==window.sessionStorage.getItem("storageTest")&&(window.sessionStorage.removeItem("storageTest"),!window.sessionStorage.getItem("storageTest")))}catch(e){return!1}},n.prototype._cloneConfig=function(e){if(null===e||"object"!=typeof e)return e;var t={};for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n]);return t},n.prototype._addLibMetadata=function(){return"&x-client-SKU=Js&x-client-Ver="+this._libVersion()},n.prototype.log=function(e,t,n,r){if(e<=Logging.level){if(!Logging.piiLoggingEnabled&&r)return;var i=(new Date).toUTCString(),o="";o=this.config.correlationId?i+":"+this.config.correlationId+"-"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[e]+" "+t:i+":"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[e]+" "+t,n&&(o+="\nstack:\n"+n.stack),Logging.log(o)}},n.prototype.error=function(e,t){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,e,t)},n.prototype.warn=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,e,null)},n.prototype.info=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,e,null)},n.prototype.verbose=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,e,null)},n.prototype.errorPii=function(e,t){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,e,t,!0)},n.prototype.warnPii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,e,null,!0)},n.prototype.infoPii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,e,null,!0)},n.prototype.verbosePii=function(e){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,e,null,!0)},n.prototype._libVersion=function(){return"1.0.17"},void 0!==e&&e.exports&&(e.exports=n,e.exports.inject=function(e){return new n(e)}),n}()},function(e,t,n){"use strict";n.d(t,"a",function(){return c}),n.d(t,"c",function(){return u}),n.d(t,"b",function(){return h});var r=n(1),i=n(0),o=n(2),s=n(4),a=n(5),c=function(e){function t(t){void 0===t&&(t="This query is already part of a batch.");var n=e.call(this,t)||this;return n.name="AlreadyInBatchException",o.a.error(n),n}return r.b(t,e),t}(Error),u=function(){function e(){this._query=new Map,this._options={},this._url="",this._parentUrl="",this._useCaching=!1,this._cachingOptions=null}return e.prototype.toUrl=function(){return this._url},e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return Object(i.i)(this._options,e),this},e.prototype.configureFrom=function(e){return Object(i.i)(this._options,e._options),this},e.prototype.usingCaching=function(e){return i.b.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.getCore=function(e,t){return void 0===e&&(e=new s.c),void 0===t&&(t={}),this.toRequestContext("GET",t,e,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("POST",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("PATCH",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("DELETE",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.c),this.toRequestContext("PUT",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},e.prototype.append=function(e){this._url=Object(i.c)(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this._parentUrl=e._url,this._url=Object(i.c)(this._parentUrl,t),this.configureFrom(e)},e}(),h=function(e){function t(){var t=e.call(this)||this;return t._batch=null,t}return r.b(t,e),t.prototype.inBatch=function(e){if(null!==this.batch)throw new c;return this._batch=e,this},t.prototype.toUrl=function(){return this._url},t.prototype.get=function(e,t){return void 0===e&&(e=new s.e),void 0===t&&(t={}),this.getCore(e,t)},t.prototype.getCore=function(e,t){return void 0===e&&(e=new s.e),void 0===t&&(t={}),this.toRequestContext("GET",t,e,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("POST",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("PATCH",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("DELETE",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new s.e),this.toRequestContext("PUT",e,t,Object(a.b)()).then(function(e){return Object(a.c)(e)})},t.prototype.addBatchDependency=function(){return null!==this._batch?this._batch.addDependency():function(){return null}},Object.defineProperty(t.prototype,"hasBatch",{get:function(){return Object(i.j)(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),t}(u)},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(0),i=function(){function e(e){void 0===e&&(e=Object(r.f)()),this._batchId=e,this._reqs=[],this._deps=[],this._rDeps=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._reqs},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r,i){var o={id:i,method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},s=new Promise(function(e,t){o.resolve=e,o.reject=t});return this._reqs.push(o),s},e.prototype.addDependency=function(){var e=function(){};return this._deps.push(new Promise(function(t){e=t})),e},e.prototype.addResolveBatchDependency=function(e){this._rDeps.push(e)},e.prototype.execute=function(){var e=this;return Promise.all(this._deps).then(function(){return Promise.all(e._deps)}).then(function(){return e.executeImpl()}).then(function(){return Promise.all(e._rDeps)}).then(function(){})},e}()}])}); | ||
//# sourceMappingURL=odata.es5.umd.bundle.min.js.map |
/** | ||
@license | ||
* @pnp/odata v1.1.4 - pnp - provides shared odata functionality and base classes | ||
* @pnp/odata v1.1.5-0 - pnp - provides shared odata functionality and base classes | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -114,15 +114,3 @@ * Copyright (c) 2018 Microsoft | ||
}).catch(function (e) { | ||
// we failed to read the body - possibly it is empty. Let's report the original status that caused | ||
// the request to fail and log the error without parsing the body if anyone needs it for debugging | ||
logging.Logger.log({ | ||
data: e, | ||
level: 2 /* Warning */, | ||
message: "There was an error parsing the error response body. See data for details.", | ||
}); | ||
// include the headers as they contain diagnostic information | ||
var data = { | ||
responseBody: "[[body not available]]", | ||
responseHeaders: r.headers, | ||
}; | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, data)); | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, e)); | ||
}); | ||
@@ -139,4 +127,4 @@ } | ||
var result = json; | ||
if (json.hasOwnProperty("d")) { | ||
if (json.d.hasOwnProperty("results")) { | ||
if (common.hOP(json, "d")) { | ||
if (common.hOP(json.d, "results")) { | ||
result = json.d.results; | ||
@@ -148,3 +136,3 @@ } | ||
} | ||
else if (json.hasOwnProperty("value")) { | ||
else if (common.hOP(json, "value")) { | ||
result = json.value; | ||
@@ -286,3 +274,3 @@ } | ||
// if we have a result already in the pipeline, pass it along and don't call the tagged method | ||
if (!alwaysRun && args.length > 0 && args[0].hasOwnProperty("hasResult") && args[0].hasResult) { | ||
if (!alwaysRun && args.length > 0 && common.hOP(args[0], "hasResult") && args[0].hasResult) { | ||
logging.Logger.write("[" + args[0].requestId + "] (" + (new Date()).getTime() + ") Skipping request pipeline method " + propertyKey + ", existing result in pipeline.", 0 /* Verbose */); | ||
@@ -326,3 +314,3 @@ return Promise.resolve(args[0]); | ||
var cacheOptions = new CachingOptions(context.requestAbsoluteUrl.toLowerCase()); | ||
if (typeof context.cachingOptions !== "undefined") { | ||
if (context.cachingOptions !== undefined) { | ||
cacheOptions = common.extend(cacheOptions, context.cachingOptions); | ||
@@ -345,3 +333,3 @@ } | ||
// handle the case where a parser needs to take special actions with a cached result | ||
if (context.parser.hasOwnProperty("hydrate")) { | ||
if (common.hOP(context.parser, "hydrate")) { | ||
data = context.parser.hydrate(data); | ||
@@ -448,3 +436,3 @@ } | ||
function Queryable() { | ||
this._query = new common.Dictionary(); | ||
this._query = new Map(); | ||
this._options = {}; | ||
@@ -509,3 +497,3 @@ this._url = ""; | ||
this._useCaching = true; | ||
if (typeof options !== "undefined") { | ||
if (options !== undefined) { | ||
this._cachingOptions = options; | ||
@@ -547,3 +535,3 @@ } | ||
Queryable.prototype.append = function (pathPart) { | ||
this._url = common.combinePaths(this._url, pathPart); | ||
this._url = common.combine(this._url, pathPart); | ||
}; | ||
@@ -569,3 +557,3 @@ Object.defineProperty(Queryable.prototype, "parentUrl", { | ||
this._parentUrl = parent._url; | ||
this._url = common.combinePaths(this._parentUrl, path); | ||
this._url = common.combine(this._parentUrl, path); | ||
this.configureFrom(parent); | ||
@@ -681,5 +669,5 @@ }; | ||
this._batchId = _batchId; | ||
this._requests = []; | ||
this._dependencies = []; | ||
this._resolveBatchDependencies = []; | ||
this._reqs = []; | ||
this._deps = []; | ||
this._rDeps = []; | ||
} | ||
@@ -698,3 +686,3 @@ Object.defineProperty(ODataBatch.prototype, "batchId", { | ||
get: function () { | ||
return this._requests; | ||
return this._reqs; | ||
}, | ||
@@ -710,6 +698,7 @@ enumerable: true, | ||
* @param parser The parser used to handle the eventual return from the query | ||
* @param id An identifier used to track a request within a batch | ||
*/ | ||
ODataBatch.prototype.add = function (url, method, options, parser, requestId) { | ||
ODataBatch.prototype.add = function (url, method, options, parser, id) { | ||
var info = { | ||
id: requestId, | ||
id: id, | ||
method: method.toUpperCase(), | ||
@@ -726,3 +715,3 @@ options: options, | ||
}); | ||
this._requests.push(info); | ||
this._reqs.push(info); | ||
return p; | ||
@@ -736,6 +725,5 @@ }; | ||
var resolver = function () { return void (0); }; | ||
var promise = new Promise(function (resolve) { | ||
this._deps.push(new Promise(function (resolve) { | ||
resolver = resolve; | ||
}); | ||
this._dependencies.push(promise); | ||
})); | ||
return resolver; | ||
@@ -749,3 +737,3 @@ }; | ||
ODataBatch.prototype.addResolveBatchDependency = function (p) { | ||
this._resolveBatchDependencies.push(p); | ||
this._rDeps.push(p); | ||
}; | ||
@@ -761,6 +749,6 @@ /** | ||
// We can get a second set of promises added during the first set resolving | ||
return Promise.all(this._dependencies) | ||
.then(function () { return Promise.all(_this._dependencies); }) | ||
return Promise.all(this._deps) | ||
.then(function () { return Promise.all(_this._deps); }) | ||
.then(function () { return _this.executeImpl(); }) | ||
.then(function () { return Promise.all(_this._resolveBatchDependencies); }) | ||
.then(function () { return Promise.all(_this._rDeps); }) | ||
.then(function () { return void (0); }); | ||
@@ -767,0 +755,0 @@ }; |
/** | ||
@license | ||
* @pnp/odata v1.1.4 - pnp - provides shared odata functionality and base classes | ||
* @pnp/odata v1.1.5-0 - pnp - provides shared odata functionality and base classes | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,2 +10,2 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/common"),require("tslib"),require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/common","tslib","@pnp/logging"],t):t((e.pnp=e.pnp||{},e.pnp.odata={}),e.pnp.common,e.tslib_1,e.pnp.logging)}(this,function(e,u,r,s){"use strict";var o=function(){function e(e){this.key=e,this.expiration=u.dateAdd(new Date,"second",u.RuntimeConfig.defaultCachingTimeoutSeconds),this.storeName=u.RuntimeConfig.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new u.PnPClientStorage,e}(),i=function(){function e(e,t){this.parser=e,this.cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this.parser.parse(e).then(function(e){return t.cacheData(e)})},e.prototype.cacheData=function(e){return null!==this.cacheOptions.store&&this.cacheOptions.store.put(this.cacheOptions.key,e,this.cacheOptions.expiration),e},e}(),a=function(o){function e(e,t,n){var r=o.call(this,"Error making HttpClient request in queryable: ["+e+"] "+t)||this;return r.status=e,r.statusText=t,r.data=n,r.name="ProcessHttpClientResponseException",s.Logger.log({data:r.data,level:3,message:r.message}),r}return r.__extends(e,o),e}(Error),t=function(){function e(){}return e.prototype.parse=function(n){var r=this;return new Promise(function(e,t){r.handleError(n,t)&&r.parseImpl(n,e,t)})},e.prototype.parseImpl=function(e,t,n){var r=this;e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length"))||204===e.status?t({}):e.text().then(function(e){return 0<e.replace(/\s/gi,"").length?JSON.parse(e):{}}).then(function(e){return t(r.parseODataJSON(e))}).catch(function(e){return n(e)})},e.prototype.handleError=function(n,r){return n.ok||n.json().then(function(e){var t={responseBody:e,responseHeaders:n.headers};r(new a(n.status,n.statusText,t))}).catch(function(e){s.Logger.log({data:e,level:2,message:"There was an error parsing the error response body. See data for details."});var t={responseBody:"[[body not available]]",responseHeaders:n.headers};r(new a(n.status,n.statusText,t))}),n.ok},e.prototype.parseODataJSON=function(e){var t=e;return e.hasOwnProperty("d")?t=e.d.hasOwnProperty("results")?e.d.results:e.d:e.hasOwnProperty("value")&&(t=e.value),t},e}(),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(t),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.text().then(t)},t}(t),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.blob().then(t)},t}(t),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.json().then(t)},t}(t),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){u.isFunc(e.arrayBuffer)?e.arrayBuffer().then(t):e.buffer().then(t)},t}(t),f=function(){function e(e){this.parser=e}return e.prototype.parse=function(e){return this.parser(e)},e}();function d(t,n){return new Promise(function(e){t.result=n,t.hasResult=!0,e(t)})}function g(e){return 0<e.pipeline.length?e.pipeline.shift()(e):Promise.resolve(e)}function y(e){e.pipeline.length<1&&s.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Request pipeline contains no methods!",2);var t=g(e).then(function(e){return t=e,s.Logger.log({data:0===s.Logger.activeLogLevel?t.result:{},level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Returning result from pipeline. Set logging to verbose to see data."}),Promise.resolve(t.result||null);var t}).catch(function(e){throw s.Logger.error(e),e});return e.isBatched&&e.batch.addResolveBatchDependency(t),t}function v(i){return void 0===i&&(i=!1),function(n,r,e){var o=e.value;e.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!i&&0<e.length&&e[0].hasOwnProperty("hasResult")&&e[0].hasResult?(s.Logger.write("["+e[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+r+", existing result in pipeline.",0),Promise.resolve(e[0])):(s.Logger.write("["+e[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+r+".",0),o.apply(n,e).then(function(e){return g(e)}))}}}var m=function(){function e(){}return e.logStart=function(t){return new Promise(function(e){s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Beginning "+t.verb+" request ("+t.requestAbsoluteUrl+")"}),e(t)})},e.caching=function(r){return new Promise(function(t){if(r.isCached){s.Logger.write("["+r.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",1);var e=new o(r.requestAbsoluteUrl.toLowerCase());if(void 0!==r.cachingOptions&&(e=u.extend(e,r.cachingOptions)),null!==e.store){var n=e.store.get(e.key);if(null!==n)return s.Logger.log({data:1===s.Logger.activeLogLevel?{}:n,level:1,message:"["+r.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),u.isFunc(r.batchDependency)&&r.batchDependency(),r.parser.hasOwnProperty("hydrate")&&(n=r.parser.hydrate(n)),d(r,n).then(function(e){return t(e)})}s.Logger.write("["+r.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",1),r.parser=new i(r.parser,e)}return t(r)})},e.send=function(i){return new Promise(function(t,n){if(i.isBatched){var e=i.batch.add(i.requestAbsoluteUrl,i.verb,i.options,i.parser,i.requestId);u.isFunc(i.batchDependency)&&i.batchDependency(),s.Logger.write("["+i.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+i.batch.batchId+".",1),t(d(i,e))}else{s.Logger.write("["+i.requestId+"] ("+(new Date).getTime()+") Sending request.",1);var r=i.clientFactory(),o=u.extend(i.options||{},{method:i.verb});r.fetch(i.requestAbsoluteUrl,o).then(function(e){return i.parser.parse(e)}).then(function(e){return d(i,e)}).then(function(e){return t(e)}).catch(function(e){return n(e)})}})},e.logEnd=function(t){return new Promise(function(e){t.isBatched?s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") "+t.verb+" request will complete in batch "+t.batch.batchId+"."}):s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Completing "+t.verb+" request."}),e(t)})},r.__decorate([v(!0)],e,"logStart",null),r.__decorate([v()],e,"caching",null),r.__decorate([v()],e,"send",null),r.__decorate([v(!0)],e,"logEnd",null),e}();function b(){return[m.logStart,m.caching,m.send,m.logEnd].slice(0)}var _=function(n){function e(e){void 0===e&&(e="This query is already part of a batch.");var t=n.call(this,e)||this;return t.name="AlreadyInBatchException",s.Logger.error(t),t}return r.__extends(e,n),e}(Error),w=function(){function e(){this._query=new u.Dictionary,this._options={},this._url="",this._parentUrl="",this._useCaching=!1,this._cachingOptions=null}return e.prototype.toUrl=function(){return this._url},e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return u.mergeOptions(this._options,e),this},e.prototype.configureFrom=function(e){return u.mergeOptions(this._options,e._options),this},e.prototype.usingCaching=function(e){return u.RuntimeConfig.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.getCore=function(e,t){return void 0===e&&(e=new h),void 0===t&&(t={}),this.toRequestContext("GET",t,e,b()).then(function(e){return y(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("POST",e,t,b()).then(function(e){return y(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("PATCH",e,t,b()).then(function(e){return y(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("DELETE",e,t,b()).then(function(e){return y(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("PUT",e,t,b()).then(function(e){return y(e)})},e.prototype.append=function(e){this._url=u.combinePaths(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this._parentUrl=e._url,this._url=u.combinePaths(this._parentUrl,t),this.configureFrom(e)},e}(),q=function(t){function e(){var e=t.call(this)||this;return e._batch=null,e}return r.__extends(e,t),e.prototype.inBatch=function(e){if(null!==this.batch)throw new _;return this._batch=e,this},e.prototype.toUrl=function(){return this._url},e.prototype.get=function(e,t){return void 0===e&&(e=new n),void 0===t&&(t={}),this.getCore(e,t)},e.prototype.getCore=function(e,t){return void 0===e&&(e=new n),void 0===t&&(t={}),this.toRequestContext("GET",t,e,b()).then(function(e){return y(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("POST",e,t,b()).then(function(e){return y(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("PATCH",e,t,b()).then(function(e){return y(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("DELETE",e,t,b()).then(function(e){return y(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("PUT",e,t,b()).then(function(e){return y(e)})},e.prototype.addBatchDependency=function(){return null!==this._batch?this._batch.addDependency():function(){return null}},Object.defineProperty(e.prototype,"hasBatch",{get:function(){return u.objectDefinedNotNull(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),e}(w),P=function(){function e(e){void 0===e&&(e=u.getGUID()),this._batchId=e,this._requests=[],this._dependencies=[],this._resolveBatchDependencies=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._requests},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r,o){var i={id:o,method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},u=new Promise(function(e,t){i.resolve=e,i.reject=t});return this._requests.push(i),u},e.prototype.addDependency=function(){var t=function(){},e=new Promise(function(e){t=e});return this._dependencies.push(e),t},e.prototype.addResolveBatchDependency=function(e){this._resolveBatchDependencies.push(e)},e.prototype.execute=function(){var e=this;return Promise.all(this._dependencies).then(function(){return Promise.all(e._dependencies)}).then(function(){return e.executeImpl()}).then(function(){return Promise.all(e._resolveBatchDependencies)}).then(function(){})},e}();e.CachingOptions=o,e.CachingParserWrapper=i,e.ProcessHttpClientResponseException=a,e.ODataParserBase=t,e.ODataDefaultParser=n,e.TextParser=c,e.BlobParser=p,e.JSONParser=h,e.BufferParser=l,e.LambdaParser=f,e.setResult=d,e.pipe=y,e.requestPipelineMethod=v,e.PipelineMethods=m,e.getDefaultPipeline=b,e.AlreadyInBatchException=_,e.Queryable=w,e.ODataQueryable=q,e.ODataBatch=P,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/common"),require("tslib"),require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/common","tslib","@pnp/logging"],t):t((e.pnp=e.pnp||{},e.pnp.odata={}),e.pnp.common,e.tslib_1,e.pnp.logging)}(this,function(e,u,r,s){"use strict";var o=function(){function e(e){this.key=e,this.expiration=u.dateAdd(new Date,"second",u.RuntimeConfig.defaultCachingTimeoutSeconds),this.storeName=u.RuntimeConfig.defaultCachingStore}return Object.defineProperty(e.prototype,"store",{get:function(){return"local"===this.storeName?e.storage.local:e.storage.session},enumerable:!0,configurable:!0}),e.storage=new u.PnPClientStorage,e}(),i=function(){function e(e,t){this.parser=e,this.cacheOptions=t}return e.prototype.parse=function(e){var t=this;return this.parser.parse(e).then(function(e){return t.cacheData(e)})},e.prototype.cacheData=function(e){return null!==this.cacheOptions.store&&this.cacheOptions.store.put(this.cacheOptions.key,e,this.cacheOptions.expiration),e},e}(),a=function(o){function e(e,t,n){var r=o.call(this,"Error making HttpClient request in queryable: ["+e+"] "+t)||this;return r.status=e,r.statusText=t,r.data=n,r.name="ProcessHttpClientResponseException",s.Logger.log({data:r.data,level:3,message:r.message}),r}return r.__extends(e,o),e}(Error),t=function(){function e(){}return e.prototype.parse=function(n){var r=this;return new Promise(function(e,t){r.handleError(n,t)&&r.parseImpl(n,e,t)})},e.prototype.parseImpl=function(e,t,n){var r=this;e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length"))||204===e.status?t({}):e.text().then(function(e){return 0<e.replace(/\s/gi,"").length?JSON.parse(e):{}}).then(function(e){return t(r.parseODataJSON(e))}).catch(function(e){return n(e)})},e.prototype.handleError=function(n,r){return n.ok||n.json().then(function(e){var t={responseBody:e,responseHeaders:n.headers};r(new a(n.status,n.statusText,t))}).catch(function(e){r(new a(n.status,n.statusText,e))}),n.ok},e.prototype.parseODataJSON=function(e){var t=e;return u.hOP(e,"d")?t=u.hOP(e.d,"results")?e.d.results:e.d:u.hOP(e,"value")&&(t=e.value),t},e}(),n=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t}(t),c=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.text().then(t)},t}(t),p=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.blob().then(t)},t}(t),h=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){e.json().then(t)},t}(t),l=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return r.__extends(t,e),t.prototype.parseImpl=function(e,t){u.isFunc(e.arrayBuffer)?e.arrayBuffer().then(t):e.buffer().then(t)},t}(t),f=function(){function e(e){this.parser=e}return e.prototype.parse=function(e){return this.parser(e)},e}();function d(t,n){return new Promise(function(e){t.result=n,t.hasResult=!0,e(t)})}function g(e){return 0<e.pipeline.length?e.pipeline.shift()(e):Promise.resolve(e)}function y(e){e.pipeline.length<1&&s.Logger.write("["+e.requestId+"] ("+(new Date).getTime()+") Request pipeline contains no methods!",2);var t=g(e).then(function(e){return t=e,s.Logger.log({data:0===s.Logger.activeLogLevel?t.result:{},level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Returning result from pipeline. Set logging to verbose to see data."}),Promise.resolve(t.result||null);var t}).catch(function(e){throw s.Logger.error(e),e});return e.isBatched&&e.batch.addResolveBatchDependency(t),t}function v(i){return void 0===i&&(i=!1),function(n,r,e){var o=e.value;e.value=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return!i&&0<e.length&&u.hOP(e[0],"hasResult")&&e[0].hasResult?(s.Logger.write("["+e[0].requestId+"] ("+(new Date).getTime()+") Skipping request pipeline method "+r+", existing result in pipeline.",0),Promise.resolve(e[0])):(s.Logger.write("["+e[0].requestId+"] ("+(new Date).getTime()+") Calling request pipeline method "+r+".",0),o.apply(n,e).then(function(e){return g(e)}))}}}var m=function(){function e(){}return e.logStart=function(t){return new Promise(function(e){s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Beginning "+t.verb+" request ("+t.requestAbsoluteUrl+")"}),e(t)})},e.caching=function(r){return new Promise(function(t){if(r.isCached){s.Logger.write("["+r.requestId+"] ("+(new Date).getTime()+") Caching is enabled for request, checking cache...",1);var e=new o(r.requestAbsoluteUrl.toLowerCase());if(void 0!==r.cachingOptions&&(e=u.extend(e,r.cachingOptions)),null!==e.store){var n=e.store.get(e.key);if(null!==n)return s.Logger.log({data:1===s.Logger.activeLogLevel?{}:n,level:1,message:"["+r.requestId+"] ("+(new Date).getTime()+") Value returned from cache."}),u.isFunc(r.batchDependency)&&r.batchDependency(),u.hOP(r.parser,"hydrate")&&(n=r.parser.hydrate(n)),d(r,n).then(function(e){return t(e)})}s.Logger.write("["+r.requestId+"] ("+(new Date).getTime()+") Value not found in cache.",1),r.parser=new i(r.parser,e)}return t(r)})},e.send=function(i){return new Promise(function(t,n){if(i.isBatched){var e=i.batch.add(i.requestAbsoluteUrl,i.verb,i.options,i.parser,i.requestId);u.isFunc(i.batchDependency)&&i.batchDependency(),s.Logger.write("["+i.requestId+"] ("+(new Date).getTime()+") Batching request in batch "+i.batch.batchId+".",1),t(d(i,e))}else{s.Logger.write("["+i.requestId+"] ("+(new Date).getTime()+") Sending request.",1);var r=i.clientFactory(),o=u.extend(i.options||{},{method:i.verb});r.fetch(i.requestAbsoluteUrl,o).then(function(e){return i.parser.parse(e)}).then(function(e){return d(i,e)}).then(function(e){return t(e)}).catch(function(e){return n(e)})}})},e.logEnd=function(t){return new Promise(function(e){t.isBatched?s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") "+t.verb+" request will complete in batch "+t.batch.batchId+"."}):s.Logger.log({data:1===s.Logger.activeLogLevel?{}:t,level:1,message:"["+t.requestId+"] ("+(new Date).getTime()+") Completing "+t.verb+" request."}),e(t)})},r.__decorate([v(!0)],e,"logStart",null),r.__decorate([v()],e,"caching",null),r.__decorate([v()],e,"send",null),r.__decorate([v(!0)],e,"logEnd",null),e}();function b(){return[m.logStart,m.caching,m.send,m.logEnd].slice(0)}var _=function(n){function e(e){void 0===e&&(e="This query is already part of a batch.");var t=n.call(this,e)||this;return t.name="AlreadyInBatchException",s.Logger.error(t),t}return r.__extends(e,n),e}(Error),q=function(){function e(){this._query=new Map,this._options={},this._url="",this._parentUrl="",this._useCaching=!1,this._cachingOptions=null}return e.prototype.toUrl=function(){return this._url},e.prototype.concat=function(e){return this._url+=e,this},Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.configure=function(e){return u.mergeOptions(this._options,e),this},e.prototype.configureFrom=function(e){return u.mergeOptions(this._options,e._options),this},e.prototype.usingCaching=function(e){return u.RuntimeConfig.globalCacheDisable||(this._useCaching=!0,void 0!==e&&(this._cachingOptions=e)),this},e.prototype.getCore=function(e,t){return void 0===e&&(e=new h),void 0===t&&(t={}),this.toRequestContext("GET",t,e,b()).then(function(e){return y(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("POST",e,t,b()).then(function(e){return y(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("PATCH",e,t,b()).then(function(e){return y(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("DELETE",e,t,b()).then(function(e){return y(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new h),this.toRequestContext("PUT",e,t,b()).then(function(e){return y(e)})},e.prototype.append=function(e){this._url=u.combine(this._url,e)},Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),e.prototype.extend=function(e,t){this._parentUrl=e._url,this._url=u.combine(this._parentUrl,t),this.configureFrom(e)},e}(),w=function(t){function e(){var e=t.call(this)||this;return e._batch=null,e}return r.__extends(e,t),e.prototype.inBatch=function(e){if(null!==this.batch)throw new _;return this._batch=e,this},e.prototype.toUrl=function(){return this._url},e.prototype.get=function(e,t){return void 0===e&&(e=new n),void 0===t&&(t={}),this.getCore(e,t)},e.prototype.getCore=function(e,t){return void 0===e&&(e=new n),void 0===t&&(t={}),this.toRequestContext("GET",t,e,b()).then(function(e){return y(e)})},e.prototype.postCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("POST",e,t,b()).then(function(e){return y(e)})},e.prototype.patchCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("PATCH",e,t,b()).then(function(e){return y(e)})},e.prototype.deleteCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("DELETE",e,t,b()).then(function(e){return y(e)})},e.prototype.putCore=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new n),this.toRequestContext("PUT",e,t,b()).then(function(e){return y(e)})},e.prototype.addBatchDependency=function(){return null!==this._batch?this._batch.addDependency():function(){return null}},Object.defineProperty(e.prototype,"hasBatch",{get:function(){return u.objectDefinedNotNull(this._batch)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"batch",{get:function(){return this.hasBatch?this._batch:null},enumerable:!0,configurable:!0}),e}(q),P=function(){function e(e){void 0===e&&(e=u.getGUID()),this._batchId=e,this._reqs=[],this._deps=[],this._rDeps=[]}return Object.defineProperty(e.prototype,"batchId",{get:function(){return this._batchId},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"requests",{get:function(){return this._reqs},enumerable:!0,configurable:!0}),e.prototype.add=function(e,t,n,r,o){var i={id:o,method:t.toUpperCase(),options:n,parser:r,reject:null,resolve:null,url:e},u=new Promise(function(e,t){i.resolve=e,i.reject=t});return this._reqs.push(i),u},e.prototype.addDependency=function(){var t=function(){};return this._deps.push(new Promise(function(e){t=e})),t},e.prototype.addResolveBatchDependency=function(e){this._rDeps.push(e)},e.prototype.execute=function(){var e=this;return Promise.all(this._deps).then(function(){return Promise.all(e._deps)}).then(function(){return e.executeImpl()}).then(function(){return Promise.all(e._rDeps)}).then(function(){})},e}();e.CachingOptions=o,e.CachingParserWrapper=i,e.ProcessHttpClientResponseException=a,e.ODataParserBase=t,e.ODataDefaultParser=n,e.TextParser=c,e.BlobParser=p,e.JSONParser=h,e.BufferParser=l,e.LambdaParser=f,e.setResult=d,e.pipe=y,e.requestPipelineMethod=v,e.PipelineMethods=m,e.getDefaultPipeline=b,e.AlreadyInBatchException=_,e.Queryable=q,e.ODataQueryable=w,e.ODataBatch=P,Object.defineProperty(e,"__esModule",{value:!0})}); |
/** | ||
@license | ||
* @pnp/odata v1.1.4 - pnp - provides shared odata functionality and base classes | ||
* @pnp/odata v1.1.5-0 - pnp - provides shared odata functionality and base classes | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,3 +10,3 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
import { RuntimeConfig, dateAdd, PnPClientStorage, isFunc, extend, combinePaths, Dictionary, mergeOptions, objectDefinedNotNull, getGUID } from '@pnp/common'; | ||
import { RuntimeConfig, dateAdd, PnPClientStorage, isFunc, hOP, extend, combine, mergeOptions, objectDefinedNotNull, getGUID } from '@pnp/common'; | ||
import { Logger } from '@pnp/logging'; | ||
@@ -99,15 +99,3 @@ import { __decorate } from 'tslib'; | ||
}).catch(e => { | ||
// we failed to read the body - possibly it is empty. Let's report the original status that caused | ||
// the request to fail and log the error without parsing the body if anyone needs it for debugging | ||
Logger.log({ | ||
data: e, | ||
level: 2 /* Warning */, | ||
message: "There was an error parsing the error response body. See data for details.", | ||
}); | ||
// include the headers as they contain diagnostic information | ||
const data = { | ||
responseBody: "[[body not available]]", | ||
responseHeaders: r.headers, | ||
}; | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, data)); | ||
reject(new ProcessHttpClientResponseException(r.status, r.statusText, e)); | ||
}); | ||
@@ -124,4 +112,4 @@ } | ||
let result = json; | ||
if (json.hasOwnProperty("d")) { | ||
if (json.d.hasOwnProperty("results")) { | ||
if (hOP(json, "d")) { | ||
if (hOP(json.d, "results")) { | ||
result = json.d.results; | ||
@@ -133,3 +121,3 @@ } | ||
} | ||
else if (json.hasOwnProperty("value")) { | ||
else if (hOP(json, "value")) { | ||
result = json.value; | ||
@@ -239,3 +227,3 @@ } | ||
// if we have a result already in the pipeline, pass it along and don't call the tagged method | ||
if (!alwaysRun && args.length > 0 && args[0].hasOwnProperty("hasResult") && args[0].hasResult) { | ||
if (!alwaysRun && args.length > 0 && hOP(args[0], "hasResult") && args[0].hasResult) { | ||
Logger.write(`[${args[0].requestId}] (${(new Date()).getTime()}) Skipping request pipeline method ${propertyKey}, existing result in pipeline.`, 0 /* Verbose */); | ||
@@ -277,3 +265,3 @@ return Promise.resolve(args[0]); | ||
let cacheOptions = new CachingOptions(context.requestAbsoluteUrl.toLowerCase()); | ||
if (typeof context.cachingOptions !== "undefined") { | ||
if (context.cachingOptions !== undefined) { | ||
cacheOptions = extend(cacheOptions, context.cachingOptions); | ||
@@ -296,3 +284,3 @@ } | ||
// handle the case where a parser needs to take special actions with a cached result | ||
if (context.parser.hasOwnProperty("hydrate")) { | ||
if (hOP(context.parser, "hydrate")) { | ||
data = context.parser.hydrate(data); | ||
@@ -394,3 +382,3 @@ } | ||
constructor() { | ||
this._query = new Dictionary(); | ||
this._query = new Map(); | ||
this._options = {}; | ||
@@ -451,3 +439,3 @@ this._url = ""; | ||
this._useCaching = true; | ||
if (typeof options !== "undefined") { | ||
if (options !== undefined) { | ||
this._cachingOptions = options; | ||
@@ -479,3 +467,3 @@ } | ||
append(pathPart) { | ||
this._url = combinePaths(this._url, pathPart); | ||
this._url = combine(this._url, pathPart); | ||
} | ||
@@ -497,3 +485,3 @@ /** | ||
this._parentUrl = parent._url; | ||
this._url = combinePaths(this._parentUrl, path); | ||
this._url = combine(this._parentUrl, path); | ||
this.configureFrom(parent); | ||
@@ -584,5 +572,5 @@ } | ||
this._batchId = _batchId; | ||
this._requests = []; | ||
this._dependencies = []; | ||
this._resolveBatchDependencies = []; | ||
this._reqs = []; | ||
this._deps = []; | ||
this._rDeps = []; | ||
} | ||
@@ -596,3 +584,3 @@ get batchId() { | ||
get requests() { | ||
return this._requests; | ||
return this._reqs; | ||
} | ||
@@ -605,6 +593,7 @@ /** | ||
* @param parser The parser used to handle the eventual return from the query | ||
* @param id An identifier used to track a request within a batch | ||
*/ | ||
add(url, method, options, parser, requestId) { | ||
add(url, method, options, parser, id) { | ||
const info = { | ||
id: requestId, | ||
id, | ||
method: method.toUpperCase(), | ||
@@ -621,3 +610,3 @@ options, | ||
}); | ||
this._requests.push(info); | ||
this._reqs.push(info); | ||
return p; | ||
@@ -631,6 +620,5 @@ } | ||
let resolver = () => void (0); | ||
const promise = new Promise((resolve) => { | ||
this._deps.push(new Promise((resolve) => { | ||
resolver = resolve; | ||
}); | ||
this._dependencies.push(promise); | ||
})); | ||
return resolver; | ||
@@ -644,3 +632,3 @@ } | ||
addResolveBatchDependency(p) { | ||
this._resolveBatchDependencies.push(p); | ||
this._rDeps.push(p); | ||
} | ||
@@ -655,6 +643,6 @@ /** | ||
// We can get a second set of promises added during the first set resolving | ||
return Promise.all(this._dependencies) | ||
.then(() => Promise.all(this._dependencies)) | ||
return Promise.all(this._deps) | ||
.then(() => Promise.all(this._deps)) | ||
.then(() => this.executeImpl()) | ||
.then(() => Promise.all(this._resolveBatchDependencies)) | ||
.then(() => Promise.all(this._rDeps)) | ||
.then(() => void (0)); | ||
@@ -661,0 +649,0 @@ } |
@@ -66,3 +66,3 @@ # @pnp/odata/caching | ||
## Using [Batching](batching.md) with Caching | ||
## Using [Batching](odata-batch.md) with Caching | ||
@@ -69,0 +69,0 @@ You can use batching and caching together, but remember caching is only applied to get requests. When you use them together the methods can be transposed, the below example is valid. |
@@ -25,4 +25,4 @@ # @pnp/odata | ||
## UML | ||
![Graphical UML diagram](/pnpjs/img/pnpjs-odata-uml.svg =100%x) | ||
![Graphical UML diagram](../../documentation/img/pnpjs-odata-uml.svg) | ||
Graphical UML diagram of @pnp/odata. Right-click the diagram and open in new tab if it is too small. |
# @pnp/odata/parsers | ||
This modules contains a set of generic parsers. These can be used or extended as needed, though it is likely in most cases the | ||
default parser will be all you need. | ||
This modules contains a set of generic parsers. These can be used or extended as needed, though it is likely in most cases the default parser will be all you need. | ||
@@ -12,14 +11,14 @@ ## ODataDefaultParser | ||
Specialized parser used to parse the response usign the .text() method with no other processing. Used primarily for files. | ||
Specialized parser used to parse the response using the .text() method with no other processing. Used primarily for files. | ||
## BlobParser | ||
Specialized parser used to parse the response usign the .blob() method with no other processing. Used primarily for files. | ||
Specialized parser used to parse the response using the .blob() method with no other processing. Used primarily for files. | ||
## JSONParser | ||
Specialized parser used to parse the response usign the .json() method with no other processing. Used primarily for files. | ||
Specialized parser used to parse the response using the .json() method with no other processing. Used primarily for files. | ||
## BufferFileParser | ||
Specialized parser used to parse the response usign the .arrayBuffer() [node] for .buffer() [broswer] method with no other processing. Used primarily for files. | ||
Specialized parser used to parse the response using the .arrayBuffer() [node] for .buffer() [browser] method with no other processing. Used primarily for files. |
@@ -52,7 +52,7 @@ # @pnp/odata/pipeline | ||
1) logs the start of the request | ||
2) checks the cache for a value based on the context's cache settings | ||
3) sends the request if no value from found in the cache | ||
4) logs the end of the request | ||
1. logs the start of the request | ||
2. checks the cache for a value based on the context's cache settings | ||
3. sends the request if no value from found in the cache | ||
4. logs the end of the request | ||
{ | ||
"name": "@pnp/odata", | ||
"version": "1.1.4", | ||
"version": "1.1.5-0", | ||
"description": "pnp - provides shared odata functionality and base classes", | ||
@@ -11,4 +11,4 @@ "main": "./dist/odata.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/logging": "1.1.4", | ||
"@pnp/common": "1.1.4" | ||
"@pnp/logging": "1.1.5-0", | ||
"@pnp/common": "1.1.5-0" | ||
}, | ||
@@ -15,0 +15,0 @@ "author": { |
@@ -14,5 +14,5 @@ import { FetchOptions } from "@pnp/common"; | ||
private _batchId; | ||
protected _dependencies: Promise<void>[]; | ||
protected _requests: ODataBatchRequestInfo[]; | ||
protected _resolveBatchDependencies: Promise<void>[]; | ||
protected _deps: Promise<void>[]; | ||
protected _reqs: ODataBatchRequestInfo[]; | ||
protected _rDeps: Promise<void>[]; | ||
constructor(_batchId?: string); | ||
@@ -30,4 +30,5 @@ readonly batchId: string; | ||
* @param parser The parser used to handle the eventual return from the query | ||
* @param id An identifier used to track a request within a batch | ||
*/ | ||
add<T>(url: string, method: string, options: FetchOptions, parser: ODataParser<T>, requestId: string): Promise<T>; | ||
add<T>(url: string, method: string, options: FetchOptions, parser: ODataParser<T>, id: string): Promise<T>; | ||
/** | ||
@@ -34,0 +35,0 @@ * Adds a dependency insuring that some set of actions will occur before a batch is processed. |
@@ -1,2 +0,2 @@ | ||
import { Dictionary, FetchOptions, ConfigOptions } from "@pnp/common"; | ||
import { FetchOptions, ConfigOptions } from "@pnp/common"; | ||
import { ODataParser } from "./parsers"; | ||
@@ -17,3 +17,3 @@ import { ICachingOptions } from "./caching"; | ||
*/ | ||
protected _query: Dictionary<string>; | ||
protected _query: Map<string, string>; | ||
/** | ||
@@ -56,3 +56,3 @@ * Tracks the url as it is built | ||
*/ | ||
readonly query: Dictionary<string>; | ||
readonly query: Map<string, string>; | ||
/** | ||
@@ -59,0 +59,0 @@ * Sets custom options for current object and all derived objects accessible via chaining |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
909329
5034
2