@pnp/common
Advanced tools
Comparing version 1.0.0-beta.0 to 1.0.0-beta.1
@@ -372,3 +372,3 @@ import { LogLevel, Logger } from '@pnp/logging'; | ||
if (noOverwrite === void 0) { noOverwrite = false; } | ||
if (source === null || typeof source === "undefined") { | ||
if (!Util.objectDefinedNotNull(source)) { | ||
return target; | ||
@@ -397,4 +397,4 @@ } | ||
function mergeOptions(target, source) { | ||
if (typeof source !== "undefined" && typeof source.headers !== "undefined") { | ||
var headers = Util.extend(target.headers, source.headers); | ||
if (Util.objectDefinedNotNull(source)) { | ||
var headers = Util.extend(target.headers || {}, source.headers); | ||
target = Util.extend(target, source); | ||
@@ -401,0 +401,0 @@ target.headers = headers; |
@@ -376,3 +376,3 @@ (function (global, factory) { | ||
if (noOverwrite === void 0) { noOverwrite = false; } | ||
if (source === null || typeof source === "undefined") { | ||
if (!Util.objectDefinedNotNull(source)) { | ||
return target; | ||
@@ -401,4 +401,4 @@ } | ||
function mergeOptions(target, source) { | ||
if (typeof source !== "undefined" && typeof source.headers !== "undefined") { | ||
var headers = Util.extend(target.headers, source.headers); | ||
if (Util.objectDefinedNotNull(source)) { | ||
var headers = Util.extend(target.headers || {}, source.headers); | ||
target = Util.extend(target, source); | ||
@@ -405,0 +405,0 @@ target.headers = headers; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/logging"],t):t(e.pnp={},e.logging)}(this,function(e,t){"use strict";function n(e,t){return new Promise(function(n,r){try{var o=new FileReader;switch(o.onload=function(e){n(e.target.result)},t){case"string":o.readAsText(e);break;case"buffer":o.readAsArrayBuffer(e)}}catch(e){r(e)}})}var r=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 o in r)r.hasOwnProperty(o)&&this.add(o,r[o])}},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=[]},e.prototype.count=function(){return this.keys.length},e}(),o=function(){function e(){}return e.getCtxCallback=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}},e.urlParamExists=function(e){return e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),new RegExp("[\\?&]"+e+"=([^&#]*)").test(location.search)},e.getUrlParamByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.getUrlParamBoolByName=function(e){var t=this.getUrlParamByName(e);return!(""===t||/false|0/i.test(t))},e.stringInsert=function(e,t,n){return t>0?e.substring(0,t)+n+e.substring(t,e.length):n+e},e.dateAdd=function(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},e.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var r=document.createElement("link");n[0].appendChild(r),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",e)}},e.combinePaths=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!e.stringIsNullOrEmpty(t)}).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 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)})},e.isFunction=function(e){return"function"==typeof e},e.objectDefinedNotNull=function(e){return void 0!==e&&null!==e},e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.stringIsNullOrEmpty=function(e){return void 0===e||null===e||e.length<1},e.extend=function(e,t,n){if(void 0===n&&(n=!1),null===t||void 0===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)}).reduce(function(e,n){return e[n]=t[n],e},e)},e.isUrlAbsolute=function(e){return/^https?:\/\/|^\/\//i.test(e)},e}(),i=function(){var e=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])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),a=function(e){function n(n){void 0===n&&(n="Using NodeFetchClient in the browser is not supported.");var r=e.call(this,n)||this;return r.name="NodeFetchClientUnsupportedException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),s=function(e){function n(n){void 0===n&&(n="Expected a function.");var r=e.call(this,n)||this;return r.name="FunctionExpectedException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),u=function(e){function n(n){var r=e.call(this,n)||this;return r.name="UrlException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),c=function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}(),l=function(){function e(){this._v=new r,this._v.add(c.defaultCachingStore,"session"),this._v.add(c.defaultCachingTimeoutSeconds,60),this._v.add(c.globalCacheDisable,!1),this._v.add(c.enableCacheExpiration,!1),this._v.add(c.cacheExpirationIntervalMilliseconds,750),this._v.add(c.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(c.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(c.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(c.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(c.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(c.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(c.spfxContext)},enumerable:!0,configurable:!0}),e}(),f=new l,p=function(){function e(e,n){void 0===n&&(n=-1),this.store=e,this.defaultTimeoutMinutes=n,this.enabled=this.test(),f.enableCacheExpiration&&(t.Logger.write("Enabling cache expiration.",t.LogLevel.Info),this.cacheExpirationHandler())}return e.prototype.get=function(e){if(!this.enabled)return null;var n=this.store.getItem(e);if(null==n)return null;var r=JSON.parse(n);return new Date(r.expiration)<=new Date?(t.Logger.write("Removing item with key '"+e+"' from cache due to expiration.",t.LogLevel.Info),this.delete(e),null):r.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(o){var i=r.get(e);null==i?t().then(function(t){r.put(e,t,n),o(t)}):o(i)}):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 o=e.store.key(r);null!==o&&/["|']?pnp["|']? ?: ?1/i.test(e.store.getItem(o))&&e.get(o)}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=f.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=o.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;t.Logger.write("Called cache expiration handler.",t.LogLevel.Verbose),this.deleteExpired().then(function(t){setTimeout(o.getCtxCallback(e,e.cacheExpirationHandler),f.cacheExpirationIntervalMilliseconds)}).catch(function(e){t.Logger.log({data:e,level:t.LogLevel.Error,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),g=function(){function e(e){void 0===e&&(e=new r),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}(),h=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 p("undefined"!=typeof localStorage?localStorage:new g)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new p("undefined"!=typeof sessionStorage?sessionStorage:new g)),this._session},enumerable:!0,configurable:!0}),e}();e.Util=o,e.readBlobAsText=function(e){return n(e,"string")},e.readBlobAsArrayBuffer=function(e){return n(e,"buffer")},e.Dictionary=r,e.mergeOptions=function(e,t){if(void 0!==t&&void 0!==t.headers){var n=o.extend(e.headers,t.headers);(e=o.extend(e,t)).headers=n}},e.deprecated=function(e,n){return function(r,o,i){var a=i.value;i.value=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return t.Logger.log({data:{descriptor:i,propertyKey:o,target:r},level:t.LogLevel.Warning,message:"("+e+") "+n}),a.apply(this,s)}}},e.beta=function(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(n,r,o){var i=o.value;o.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return t.Logger.log({data:{descriptor:o,propertyKey:r,target:n},level:t.LogLevel.Warning,message:e}),i.apply(this,a)}}},e.NodeFetchClientUnsupportedException=a,e.FunctionExpectedException=s,e.UrlException=u,e.CommonRuntimeConfigKeys=c,e.RuntimeConfigImpl=l,e.RuntimeConfig=f,e.mergeHeaders=function(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})},e.PnPClientStorageWrapper=p,e.PnPClientStorage=h,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/logging")):"function"==typeof define&&define.amd?define(["exports","@pnp/logging"],t):t(e.pnp={},e.logging)}(this,function(e,t){"use strict";function n(e,t){return new Promise(function(n,r){try{var o=new FileReader;switch(o.onload=function(e){n(e.target.result)},t){case"string":o.readAsText(e);break;case"buffer":o.readAsArrayBuffer(e)}}catch(e){r(e)}})}var r=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 o in r)r.hasOwnProperty(o)&&this.add(o,r[o])}},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=[]},e.prototype.count=function(){return this.keys.length},e}(),o=function(){function e(){}return e.getCtxCallback=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}},e.urlParamExists=function(e){return e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),new RegExp("[\\?&]"+e+"=([^&#]*)").test(location.search)},e.getUrlParamByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.getUrlParamBoolByName=function(e){var t=this.getUrlParamByName(e);return!(""===t||/false|0/i.test(t))},e.stringInsert=function(e,t,n){return t>0?e.substring(0,t)+n+e.substring(t,e.length):n+e},e.dateAdd=function(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},e.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var r=document.createElement("link");n[0].appendChild(r),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",e)}},e.combinePaths=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!e.stringIsNullOrEmpty(t)}).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 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)})},e.isFunction=function(e){return"function"==typeof e},e.objectDefinedNotNull=function(e){return void 0!==e&&null!==e},e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.stringIsNullOrEmpty=function(e){return void 0===e||null===e||e.length<1},e.extend=function(t,n,r){if(void 0===r&&(r=!1),!e.objectDefinedNotNull(n))return t;var o=r?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(n).filter(function(e){return o(t,e)}).reduce(function(e,t){return e[t]=n[t],e},t)},e.isUrlAbsolute=function(e){return/^https?:\/\/|^\/\//i.test(e)},e}(),i=function(){var e=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])};return function(t,n){function r(){this.constructor=t}e(t,n),t.prototype=null===n?Object.create(n):(r.prototype=n.prototype,new r)}}(),a=function(e){function n(n){void 0===n&&(n="Using NodeFetchClient in the browser is not supported.");var r=e.call(this,n)||this;return r.name="NodeFetchClientUnsupportedException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),s=function(e){function n(n){void 0===n&&(n="Expected a function.");var r=e.call(this,n)||this;return r.name="FunctionExpectedException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),u=function(e){function n(n){var r=e.call(this,n)||this;return r.name="UrlException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return i(n,e),n}(Error),c=function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}(),l=function(){function e(){this._v=new r,this._v.add(c.defaultCachingStore,"session"),this._v.add(c.defaultCachingTimeoutSeconds,60),this._v.add(c.globalCacheDisable,!1),this._v.add(c.enableCacheExpiration,!1),this._v.add(c.cacheExpirationIntervalMilliseconds,750),this._v.add(c.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(c.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(c.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(c.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(c.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(c.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(c.spfxContext)},enumerable:!0,configurable:!0}),e}(),f=new l,p=function(){function e(e,n){void 0===n&&(n=-1),this.store=e,this.defaultTimeoutMinutes=n,this.enabled=this.test(),f.enableCacheExpiration&&(t.Logger.write("Enabling cache expiration.",t.LogLevel.Info),this.cacheExpirationHandler())}return e.prototype.get=function(e){if(!this.enabled)return null;var n=this.store.getItem(e);if(null==n)return null;var r=JSON.parse(n);return new Date(r.expiration)<=new Date?(t.Logger.write("Removing item with key '"+e+"' from cache due to expiration.",t.LogLevel.Info),this.delete(e),null):r.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(o){var i=r.get(e);null==i?t().then(function(t){r.put(e,t,n),o(t)}):o(i)}):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 o=e.store.key(r);null!==o&&/["|']?pnp["|']? ?: ?1/i.test(e.store.getItem(o))&&e.get(o)}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=f.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=o.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;t.Logger.write("Called cache expiration handler.",t.LogLevel.Verbose),this.deleteExpired().then(function(t){setTimeout(o.getCtxCallback(e,e.cacheExpirationHandler),f.cacheExpirationIntervalMilliseconds)}).catch(function(e){t.Logger.log({data:e,level:t.LogLevel.Error,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),g=function(){function e(e){void 0===e&&(e=new r),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}(),h=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 p("undefined"!=typeof localStorage?localStorage:new g)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new p("undefined"!=typeof sessionStorage?sessionStorage:new g)),this._session},enumerable:!0,configurable:!0}),e}();e.Util=o,e.readBlobAsText=function(e){return n(e,"string")},e.readBlobAsArrayBuffer=function(e){return n(e,"buffer")},e.Dictionary=r,e.mergeOptions=function(e,t){if(o.objectDefinedNotNull(t)){var n=o.extend(e.headers||{},t.headers);(e=o.extend(e,t)).headers=n}},e.deprecated=function(e,n){return function(r,o,i){var a=i.value;i.value=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return t.Logger.log({data:{descriptor:i,propertyKey:o,target:r},level:t.LogLevel.Warning,message:"("+e+") "+n}),a.apply(this,s)}}},e.beta=function(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(n,r,o){var i=o.value;o.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return t.Logger.log({data:{descriptor:o,propertyKey:r,target:n},level:t.LogLevel.Warning,message:e}),i.apply(this,a)}}},e.NodeFetchClientUnsupportedException=a,e.FunctionExpectedException=s,e.UrlException=u,e.CommonRuntimeConfigKeys=c,e.RuntimeConfigImpl=l,e.RuntimeConfig=f,e.mergeHeaders=function(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})},e.PnPClientStorageWrapper=p,e.PnPClientStorage=h,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -357,3 +357,3 @@ import { LogLevel, Logger } from '@pnp/logging'; | ||
static extend(target, source, noOverwrite = false) { | ||
if (source === null || typeof source === "undefined") { | ||
if (!Util.objectDefinedNotNull(source)) { | ||
return target; | ||
@@ -381,4 +381,4 @@ } | ||
function mergeOptions(target, source) { | ||
if (typeof source !== "undefined" && typeof source.headers !== "undefined") { | ||
const headers = Util.extend(target.headers, source.headers); | ||
if (Util.objectDefinedNotNull(source)) { | ||
const headers = Util.extend(target.headers || {}, source.headers); | ||
target = Util.extend(target, source); | ||
@@ -385,0 +385,0 @@ target.headers = headers; |
{ | ||
"name": "@pnp/common", | ||
"version": "1.0.0-beta.0", | ||
"version": "1.0.0-beta.1", | ||
"description": "pnp - provides shared functionality across all pnp libraries", | ||
@@ -9,3 +9,3 @@ "main": "./dist/common.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/logging": "1.0.0-beta.0" | ||
"@pnp/logging": "1.0.0-beta.1" | ||
}, | ||
@@ -12,0 +12,0 @@ "author": { |
@@ -1,2 +0,1 @@ | ||
import { TypedHash } from "./collections"; | ||
export declare class Util { | ||
@@ -102,3 +101,3 @@ /** | ||
*/ | ||
static extend(target: any, source: TypedHash<any>, noOverwrite?: boolean): any; | ||
static extend(target: any, source: any, noOverwrite?: boolean): any; | ||
/** | ||
@@ -105,0 +104,0 @@ * Determines if a given url is absolute |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
300185
2781
1