@pnp/common
Advanced tools
Comparing version 1.2.6 to 1.2.7
/** | ||
* @license | ||
* v1.2.6 | ||
* v1.2.7 | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -139,6 +139,10 @@ * Copyright (c) 2018 Microsoft | ||
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
* https://stackoverflow.com/a/8809472 updated to prevent collisions. | ||
*/ | ||
/* tslint:disable no-bitwise */ | ||
function getGUID() { | ||
var d = new Date().getTime(); | ||
var d = Date.now(); | ||
if (typeof performance !== "undefined" && typeof performance.now === "function") { | ||
d += performance.now(); // use high-precision timer if available | ||
} | ||
var guid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { | ||
@@ -145,0 +149,0 @@ var r = (d + Math.random() * 16) % 16 | 0; |
/** | ||
* @license | ||
* v1.2.6 | ||
* v1.2.7 | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,3 +10,3 @@ * 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.common"]=t():e["pnp.common"]=t()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";function i(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return function(){t.apply(e,n)}}function r(e,t,n){var i=new Date(e);switch(t.toLowerCase()){case"year":i.setFullYear(i.getFullYear()+n);break;case"quarter":i.setMonth(i.getMonth()+3*n);break;case"month":i.setMonth(i.getMonth()+n);break;case"week":i.setDate(i.getDate()+7*n);break;case"day":i.setDate(i.getDate()+n);break;case"hour":i.setTime(i.getTime()+36e5*n);break;case"minute":i.setTime(i.getTime()+6e4*n);break;case"second":i.setTime(i.getTime()+1e3*n);break;default:i=void 0}return i}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!p(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")}function s(e){for(var t=new Array(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t[i]=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 c(e){return"function"==typeof e}function u(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,i){if(void 0===n&&(n=!1),void 0===i&&(i=function(){return!0}),!u(t))return e;var r=n?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(t).filter(function(t){return r(e,t)&&i(t)}).reduce(function(e,n){return e[n]=t[n],e},e)}function d(e){return/^https?:\/\/|^\/\//i.test(e)}function p(e){return void 0===e||null===e||e.length<1}function T(e,t){e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var n=new RegExp(t+"\\s*?=\\s*?(\"|')([^\\1]*?)\\1","i").exec(e);return null!==n&&n.length>0?n[2]:null}function f(e){if(p(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 _(e){return JSON.stringify(e)}function S(e,t){return Object.hasOwnProperty.call(e,t)}function E(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}n.d(t,"e",function(){return i}),n.d(t,"b",function(){return r}),n.d(t,"a",function(){return o}),n.d(t,"h",function(){return s}),n.d(t,"f",function(){return a}),n.d(t,"k",function(){return c}),n.d(t,"n",function(){return u}),n.d(t,"j",function(){return h}),n.d(t,"c",function(){return l}),n.d(t,"l",function(){return d}),n.d(t,"p",function(){return p}),n.d(t,"d",function(){return T}),n.d(t,"o",function(){return f}),n.d(t,"m",function(){return _}),n.d(t,"i",function(){return S}),n.d(t,"g",function(){return E})},function(e,t,n){"use strict";(function(e){n.d(t,"c",function(){return o}),n.d(t,"d",function(){return s}),n.d(t,"b",function(){return a}),n.d(t,"a",function(){return c});var i=n(2),r=n(0);function o(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}function s(e,t){if(Object(r.n)(t)){var n=Object(r.c)(e.headers||{},t.headers);(e=Object(r.c)(e,t)).headers=n}}var a=function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}(),c=function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}return i.a(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 i=new Headers;return o(i,n.headers),i.set("Authorization","Bearer "+this._token),n.headers=i,e.prototype.fetch.call(this,t,n)},t}(a)}).call(this,n(4))},function(e,t,n){"use strict";n.d(t,"a",function(){return r}); | ||
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports["pnp.common"]=t():e["pnp.common"]=t()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=5)}([function(e,t,n){"use strict";function i(e,t){for(var n=[],i=2;i<arguments.length;i++)n[i-2]=arguments[i];return function(){t.apply(e,n)}}function r(e,t,n){var i=new Date(e);switch(t.toLowerCase()){case"year":i.setFullYear(i.getFullYear()+n);break;case"quarter":i.setMonth(i.getMonth()+3*n);break;case"month":i.setMonth(i.getMonth()+n);break;case"week":i.setDate(i.getDate()+7*n);break;case"day":i.setDate(i.getDate()+n);break;case"hour":i.setTime(i.getTime()+36e5*n);break;case"minute":i.setTime(i.getTime()+6e4*n);break;case"second":i.setTime(i.getTime()+1e3*n);break;default:i=void 0}return i}function o(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!p(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")}function s(e){for(var t=new Array(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=0;i<e;i++)t[i]=n.charAt(Math.floor(Math.random()*n.length));return t.join("")}function a(){var e=Date.now();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(e+=performance.now()),"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 c(e){return"function"==typeof e}function u(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,i){if(void 0===n&&(n=!1),void 0===i&&(i=function(){return!0}),!u(t))return e;var r=n?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(t).filter(function(t){return r(e,t)&&i(t)}).reduce(function(e,n){return e[n]=t[n],e},e)}function d(e){return/^https?:\/\/|^\/\//i.test(e)}function p(e){return void 0===e||null===e||e.length<1}function T(e,t){e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var n=new RegExp(t+"\\s*?=\\s*?(\"|')([^\\1]*?)\\1","i").exec(e);return null!==n&&n.length>0?n[2]:null}function f(e){if(p(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 _(e){return JSON.stringify(e)}function S(e,t){return Object.hasOwnProperty.call(e,t)}function E(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++){t=(t<<5)-t+e.charCodeAt(n),t|=0}return t}n.d(t,"e",function(){return i}),n.d(t,"b",function(){return r}),n.d(t,"a",function(){return o}),n.d(t,"h",function(){return s}),n.d(t,"f",function(){return a}),n.d(t,"k",function(){return c}),n.d(t,"n",function(){return u}),n.d(t,"j",function(){return h}),n.d(t,"c",function(){return l}),n.d(t,"l",function(){return d}),n.d(t,"p",function(){return p}),n.d(t,"d",function(){return T}),n.d(t,"o",function(){return f}),n.d(t,"m",function(){return _}),n.d(t,"i",function(){return S}),n.d(t,"g",function(){return E})},function(e,t,n){"use strict";(function(e){n.d(t,"c",function(){return o}),n.d(t,"d",function(){return s}),n.d(t,"b",function(){return a}),n.d(t,"a",function(){return c});var i=n(2),r=n(0);function o(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}function s(e,t){if(Object(r.n)(t)){var n=Object(r.c)(e.headers||{},t.headers);(e=Object(r.c)(e,t)).headers=n}}var a=function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}(),c=function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}return i.a(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 i=new Headers;return o(i,n.headers),i.set("Authorization","Bearer "+this._token),n.headers=i,e.prototype.fetch.call(this,t,n)},t}(a)}).call(this,n(4))},function(e,t,n){"use strict";n.d(t,"a",function(){return r}); | ||
/*! ***************************************************************************** | ||
@@ -13,0 +13,0 @@ Copyright (c) Microsoft Corporation. All rights reserved. |
/** | ||
* @license | ||
* v1.2.6 | ||
* v1.2.7 | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -143,6 +143,10 @@ * Copyright (c) 2018 Microsoft | ||
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
* https://stackoverflow.com/a/8809472 updated to prevent collisions. | ||
*/ | ||
/* tslint:disable no-bitwise */ | ||
function getGUID() { | ||
var d = new Date().getTime(); | ||
var d = Date.now(); | ||
if (typeof performance !== "undefined" && typeof performance.now === "function") { | ||
d += performance.now(); // use high-precision timer if available | ||
} | ||
var guid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { | ||
@@ -149,0 +153,0 @@ var r = (d + Math.random() * 16) % 16 | 0; |
/** | ||
* @license | ||
* v1.2.6 | ||
* v1.2.7 | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -10,3 +10,3 @@ * Copyright (c) 2018 Microsoft | ||
*/ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("adal-angular/dist/adal.min.js")):"function"==typeof define&&define.amd?define(["exports","adal-angular/dist/adal.min.js"],t):t((e.pnp=e.pnp||{},e.pnp.common={}),e.adal)}(this,function(e,n){"use strict";var r=function(e,t){return(r=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 t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function i(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}}function u(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 a(e){return"function"==typeof e}function c(e){return null!=e}function s(t,n,e,r){if(void 0===e&&(e=!1),void 0===r&&(r=function(){return!0}),!c(n))return t;var o=e?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(n).filter(function(e){return o(t,e)&&r(e)}).reduce(function(e,t){return e[t]=n[t],e},t)}function l(e){return/^https?:\/\/|^\/\//i.test(e)}function f(e){return null==e||e.length<1}function h(e){return JSON.stringify(e)}function p(n,e){null!=e&&new Request("",{headers:e}).headers.forEach(function(e,t){n.append(t,e)})}var d=function(){function e(){}return e.prototype.fetch=function(e,t){return o.fetch(e,t)},e}(),g=function(r){function e(e){var t=r.call(this)||this;return t._token=e,t}return t(e,r),Object.defineProperty(e.prototype,"token",{get:function(){return this._token||""},set:function(e){this._token=e},enumerable:!0,configurable:!0}),e.prototype.fetch=function(e,t){void 0===t&&(t={});var n=new Headers;return p(n,t.headers),n.set("Authorization","Bearer "+this._token),t.headers=n,r.prototype.fetch.call(this,e,t)},e}(d);function y(e){var t=document.createElement("a");return t.href=e,t.protocol+"//"+t.hostname}var b=function(o){function u(e,t,n){var r=o.call(this,null)||this;return r.clientId=e,r.tenant=t,r.redirectUri=n,r._displayCallback=null,r._loginPromise=null,r}return t(u,o),u.fromSPFxContext=function(e){return new v(e)},u.prototype.fetch=function(t,n){var r=this;if(!l(t))throw Error("You must supply absolute urls to AdalClient.fetch.");return this.getToken(y(t)).then(function(e){return r.token=e,o.prototype.fetch.call(r,t,n)})},u.prototype.getToken=function(t){var o=this;return new Promise(function(n,r){o.ensureAuthContext().then(function(e){return o.login()}).then(function(e){u._authContext.acquireToken(t,function(e,t){if(e)return r(Error(e));n(t)})}).catch(r)})},u.prototype.ensureAuthContext=function(){var t=this;return new Promise(function(e){null===u._authContext&&(u._authContext=n.inject({clientId:t.clientId,displayCall:function(e){t._displayCallback&&t._displayCallback(e)},navigateToLoginRequestUrl:!1,redirectUri:t.redirectUri,tenant:t.tenant})),e()})},u.prototype.login=function(){var i=this;return this._loginPromise||(this._loginPromise=new Promise(function(r,o){if(u._authContext.getCachedUser())return r();i._displayCallback=function(e){var t=window.open(e,"login","width=483, height=600");if(!t)return o(Error("Could not open pop-up window for auth. Likely pop-ups are blocked by the browser."));t&&t.focus&&t.focus();var n=window.setInterval(function(){t&&!t.closed&&void 0!==t.closed||window.clearInterval(n);try{-1!==t.document.URL.indexOf(i.redirectUri)&&(window.clearInterval(n),u._authContext.handleWindowCallback(t.location.hash),t.close(),r())}catch(e){o(e)}},30)},i.ensureAuthContext().then(function(e){u._authContext._loginInProgress=!1,u._authContext.login(),i._displayCallback=null})})),this._loginPromise},u._authContext=null,u}(g),v=function(o){function e(e){var t=o.call(this,null)||this;return t.context=e,t}return t(e,o),e.prototype.fetch=function(t,n){var r=this;return this.getToken(y(t)).then(function(e){return r.token=e,o.prototype.fetch.call(r,t,n)})},e.prototype.getToken=function(t){return this.context.aadTokenProviderFactory.getTokenProvider().then(function(e){return e.getToken(t)})},e}(g),m=a(Object.entries)?Object.entries:function(t){return Object.keys(t).map(function(e){return[e,t[e]]})};function x(e){return null!=e?new Map(m(e)):new Map}function _(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var r=0;r<e.length;r++)e[r].forEach(function(e,t){n.set(t,e)});return n}var w=["defaultCachingStore","defaultCachingTimeoutSeconds","globalCacheDisable","enableCacheExpiration","cacheExpirationIntervalMilliseconds","spfxContext"],C=function(){function e(e){void 0===e&&(e=new Map),this._v=e,this._v.set(w[0],"session"),this._v.set(w[1],60),this._v.set(w[2],!1),this._v.set(w[3],!1),this._v.set(w[4],750),this._v.set(w[5],null)}return e.prototype.extend=function(e){this._v=_(this._v,x(e))},e.prototype.get=function(e){return this._v.get(e)},Object.defineProperty(e.prototype,"defaultCachingStore",{get:function(){return this.get(w[0])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(w[1])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(w[2])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(w[3])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(w[4])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(w[5])},enumerable:!0,configurable:!0}),e}(),k=new C,P=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),k.enableCacheExpiration&&this.cacheExpirationHandler()}return e.prototype.get=function(e){if(!this.enabled)return null;var t=this.store.getItem(e);if(!c(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(n,r,o){var i=this;return this.enabled?new Promise(function(t){var e=i.get(n);null==e?r().then(function(e){i.put(n,e,o),t(e)}):t(e)}):r()},e.prototype.deleteExpired=function(){var o=this;return new Promise(function(e,t){o.enabled||e();try{for(var n=0;n<o.store.length;n++){var r=o.store.key(n);null!==r&&/["|']?pnp["|']? ?: ?1/i.test(o.store.getItem(r))&&o.get(r)}e()}catch(e){t(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=k.defaultCachingTimeoutSeconds;0<this.defaultTimeoutMinutes&&(n=60*this.defaultTimeoutMinutes),t=u(new Date,"second",n)}return h({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var t=this;this.deleteExpired().then(function(e){setTimeout(i(t,t.cacheExpirationHandler),k.cacheExpirationIntervalMilliseconds)}).catch(function(e){console.error(e)})},e}(),O=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}(),j=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("local")),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=this.getStore("session")),this._session},enumerable:!0,configurable:!0}),e.prototype.getStore=function(e){return new P("local"===e?"undefined"==typeof localStorage?new O:localStorage:"undefined"==typeof sessionStorage?new O:sessionStorage)},e}();e.AdalClient=b,e.SPFxAdalClient=v,e.objectToMap=x,e.mergeMaps=_,e.setup=function(e){k.extend(e)},e.RuntimeConfigImpl=C,e.RuntimeConfig=k,e.mergeHeaders=p,e.mergeOptions=function(e,t){if(c(t)){var n=s(e.headers||{},t.headers);(e=s(e,t)).headers=n}},e.FetchClient=d,e.BearerTokenFetchClient=g,e.PnPClientStorageWrapper=P,e.PnPClientStorage=j,e.getCtxCallback=i,e.dateAdd=u,e.combine=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!f(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")},e.getRandomString=function(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("")},e.getGUID=function(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},e.isFunc=a,e.objectDefinedNotNull=c,e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.extend=s,e.isUrlAbsolute=l,e.stringIsNullOrEmpty=f,e.getAttrValueFromString=function(e,t){e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var n=new RegExp(t+"\\s*?=\\s*?(\"|')([^\\1]*?)\\1","i").exec(e);return null!==n&&0<n.length?n[2]:null},e.sanitizeGuid=function(e){if(f(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]},e.jsS=h,e.hOP=function(e,t){return Object.hasOwnProperty.call(e,t)},e.getHashCode=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("adal-angular/dist/adal.min.js")):"function"==typeof define&&define.amd?define(["exports","adal-angular/dist/adal.min.js"],t):t((e.pnp=e.pnp||{},e.pnp.common={}),e.adal)}(this,function(e,n){"use strict";var r=function(e,t){return(r=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 t(e,t){function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var o="undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{};function i(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}}function u(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 a(e){return"function"==typeof e}function c(e){return null!=e}function s(t,n,e,r){if(void 0===e&&(e=!1),void 0===r&&(r=function(){return!0}),!c(n))return t;var o=e?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(n).filter(function(e){return o(t,e)&&r(e)}).reduce(function(e,t){return e[t]=n[t],e},t)}function l(e){return/^https?:\/\/|^\/\//i.test(e)}function f(e){return null==e||e.length<1}function p(e){return JSON.stringify(e)}function h(n,e){null!=e&&new Request("",{headers:e}).headers.forEach(function(e,t){n.append(t,e)})}var d=function(){function e(){}return e.prototype.fetch=function(e,t){return o.fetch(e,t)},e}(),g=function(r){function e(e){var t=r.call(this)||this;return t._token=e,t}return t(e,r),Object.defineProperty(e.prototype,"token",{get:function(){return this._token||""},set:function(e){this._token=e},enumerable:!0,configurable:!0}),e.prototype.fetch=function(e,t){void 0===t&&(t={});var n=new Headers;return h(n,t.headers),n.set("Authorization","Bearer "+this._token),t.headers=n,r.prototype.fetch.call(this,e,t)},e}(d);function y(e){var t=document.createElement("a");return t.href=e,t.protocol+"//"+t.hostname}var b=function(o){function u(e,t,n){var r=o.call(this,null)||this;return r.clientId=e,r.tenant=t,r.redirectUri=n,r._displayCallback=null,r._loginPromise=null,r}return t(u,o),u.fromSPFxContext=function(e){return new m(e)},u.prototype.fetch=function(t,n){var r=this;if(!l(t))throw Error("You must supply absolute urls to AdalClient.fetch.");return this.getToken(y(t)).then(function(e){return r.token=e,o.prototype.fetch.call(r,t,n)})},u.prototype.getToken=function(t){var o=this;return new Promise(function(n,r){o.ensureAuthContext().then(function(e){return o.login()}).then(function(e){u._authContext.acquireToken(t,function(e,t){if(e)return r(Error(e));n(t)})}).catch(r)})},u.prototype.ensureAuthContext=function(){var t=this;return new Promise(function(e){null===u._authContext&&(u._authContext=n.inject({clientId:t.clientId,displayCall:function(e){t._displayCallback&&t._displayCallback(e)},navigateToLoginRequestUrl:!1,redirectUri:t.redirectUri,tenant:t.tenant})),e()})},u.prototype.login=function(){var i=this;return this._loginPromise||(this._loginPromise=new Promise(function(r,o){if(u._authContext.getCachedUser())return r();i._displayCallback=function(e){var t=window.open(e,"login","width=483, height=600");if(!t)return o(Error("Could not open pop-up window for auth. Likely pop-ups are blocked by the browser."));t&&t.focus&&t.focus();var n=window.setInterval(function(){t&&!t.closed&&void 0!==t.closed||window.clearInterval(n);try{-1!==t.document.URL.indexOf(i.redirectUri)&&(window.clearInterval(n),u._authContext.handleWindowCallback(t.location.hash),t.close(),r())}catch(e){o(e)}},30)},i.ensureAuthContext().then(function(e){u._authContext._loginInProgress=!1,u._authContext.login(),i._displayCallback=null})})),this._loginPromise},u._authContext=null,u}(g),m=function(o){function e(e){var t=o.call(this,null)||this;return t.context=e,t}return t(e,o),e.prototype.fetch=function(t,n){var r=this;return this.getToken(y(t)).then(function(e){return r.token=e,o.prototype.fetch.call(r,t,n)})},e.prototype.getToken=function(t){return this.context.aadTokenProviderFactory.getTokenProvider().then(function(e){return e.getToken(t)})},e}(g),v=a(Object.entries)?Object.entries:function(t){return Object.keys(t).map(function(e){return[e,t[e]]})};function x(e){return null!=e?new Map(v(e)):new Map}function _(n){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];for(var r=0;r<e.length;r++)e[r].forEach(function(e,t){n.set(t,e)});return n}var w=["defaultCachingStore","defaultCachingTimeoutSeconds","globalCacheDisable","enableCacheExpiration","cacheExpirationIntervalMilliseconds","spfxContext"],C=function(){function e(e){void 0===e&&(e=new Map),this._v=e,this._v.set(w[0],"session"),this._v.set(w[1],60),this._v.set(w[2],!1),this._v.set(w[3],!1),this._v.set(w[4],750),this._v.set(w[5],null)}return e.prototype.extend=function(e){this._v=_(this._v,x(e))},e.prototype.get=function(e){return this._v.get(e)},Object.defineProperty(e.prototype,"defaultCachingStore",{get:function(){return this.get(w[0])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(w[1])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(w[2])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(w[3])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(w[4])},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(w[5])},enumerable:!0,configurable:!0}),e}(),k=new C,P=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),k.enableCacheExpiration&&this.cacheExpirationHandler()}return e.prototype.get=function(e){if(!this.enabled)return null;var t=this.store.getItem(e);if(!c(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(n,r,o){var i=this;return this.enabled?new Promise(function(t){var e=i.get(n);null==e?r().then(function(e){i.put(n,e,o),t(e)}):t(e)}):r()},e.prototype.deleteExpired=function(){var o=this;return new Promise(function(e,t){o.enabled||e();try{for(var n=0;n<o.store.length;n++){var r=o.store.key(n);null!==r&&/["|']?pnp["|']? ?: ?1/i.test(o.store.getItem(r))&&o.get(r)}e()}catch(e){t(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=k.defaultCachingTimeoutSeconds;0<this.defaultTimeoutMinutes&&(n=60*this.defaultTimeoutMinutes),t=u(new Date,"second",n)}return p({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var t=this;this.deleteExpired().then(function(e){setTimeout(i(t,t.cacheExpirationHandler),k.cacheExpirationIntervalMilliseconds)}).catch(function(e){console.error(e)})},e}(),O=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}(),j=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("local")),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=this.getStore("session")),this._session},enumerable:!0,configurable:!0}),e.prototype.getStore=function(e){return new P("local"===e?"undefined"==typeof localStorage?new O:localStorage:"undefined"==typeof sessionStorage?new O:sessionStorage)},e}();e.AdalClient=b,e.SPFxAdalClient=m,e.objectToMap=x,e.mergeMaps=_,e.setup=function(e){k.extend(e)},e.RuntimeConfigImpl=C,e.RuntimeConfig=k,e.mergeHeaders=h,e.mergeOptions=function(e,t){if(c(t)){var n=s(e.headers||{},t.headers);(e=s(e,t)).headers=n}},e.FetchClient=d,e.BearerTokenFetchClient=g,e.PnPClientStorageWrapper=P,e.PnPClientStorage=j,e.getCtxCallback=i,e.dateAdd=u,e.combine=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return e.filter(function(e){return!f(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")},e.getRandomString=function(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("")},e.getGUID=function(){var n=Date.now();return"undefined"!=typeof performance&&"function"==typeof performance.now&&(n+=performance.now()),"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=(n+16*Math.random())%16|0;return n=Math.floor(n/16),("x"===e?t:3&t|8).toString(16)})},e.isFunc=a,e.objectDefinedNotNull=c,e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.extend=s,e.isUrlAbsolute=l,e.stringIsNullOrEmpty=f,e.getAttrValueFromString=function(e,t){e=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var n=new RegExp(t+"\\s*?=\\s*?(\"|')([^\\1]*?)\\1","i").exec(e);return null!==n&&0<n.length?n[2]:null},e.sanitizeGuid=function(e){if(f(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]},e.jsS=p,e.hOP=function(e,t){return Object.hasOwnProperty.call(e,t)},e.getHashCode=function(e){var t=0;if(0===e.length)return t;for(var n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return t},Object.defineProperty(e,"__esModule",{value:!0})}); | ||
//# sourceMappingURL=common.es5.umd.min.js.map |
/** | ||
* @license | ||
* v1.2.6 | ||
* v1.2.7 | ||
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE) | ||
@@ -102,6 +102,10 @@ * Copyright (c) 2018 Microsoft | ||
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
* https://stackoverflow.com/a/8809472 updated to prevent collisions. | ||
*/ | ||
/* tslint:disable no-bitwise */ | ||
function getGUID() { | ||
let d = new Date().getTime(); | ||
let d = Date.now(); | ||
if (typeof performance !== "undefined" && typeof performance.now === "function") { | ||
d += performance.now(); // use high-precision timer if available | ||
} | ||
const guid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) { | ||
@@ -108,0 +112,0 @@ const r = (d + Math.random() * 16) % 16 | 0; |
@@ -24,3 +24,2 @@ # @pnp/common | ||
* [adalclient](adalclient.md) | ||
* [blobutil](blobutil.md) | ||
* [collections](collections.md) | ||
@@ -31,2 +30,3 @@ * [libconfig](libconfig.md) | ||
* [util](util.md) | ||
* [Custom HttpClient](custom-httpclientimpl.md) | ||
@@ -33,0 +33,0 @@ ## UML |
{ | ||
"name": "@pnp/common", | ||
"version": "1.2.6", | ||
"version": "1.2.7", | ||
"description": "pnp - provides shared functionality across all pnp libraries", | ||
@@ -22,3 +22,3 @@ "main": "./dist/common.es5.umd.js", | ||
}, | ||
"homepage": "https:github.com/pnp/pnpjs", | ||
"homepage": "https://github.com/pnp/pnpjs", | ||
"repository": { | ||
@@ -25,0 +25,0 @@ "type": "git", |
@@ -40,2 +40,3 @@ import { TypedHash } from "./collections"; | ||
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript | ||
* https://stackoverflow.com/a/8809472 updated to prevent collisions. | ||
*/ | ||
@@ -42,0 +43,0 @@ export declare function getGUID(): string; |
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
733147
4739