Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnp/common

Package Overview
Dependencies
Maintainers
6
Versions
155
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/common - npm Package Compare versions

Comparing version 1.0.0-beta.2 to 1.0.0-beta.3

dist/common.es5.umd.bundle.js

24

dist/common.es5.js
import { LogLevel, Logger } from '@pnp/logging';
import { __extends } from 'tslib';

@@ -447,23 +448,2 @@ /**

var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var NodeFetchClientUnsupportedException = /** @class */ (function (_super) {
__extends(NodeFetchClientUnsupportedException, _super);
function NodeFetchClientUnsupportedException(msg) {
if (msg === void 0) { msg = "Using NodeFetchClient in the browser is not supported."; }
var _this = _super.call(this, msg) || this;
_this.name = "NodeFetchClientUnsupportedException";
Logger.log({ data: {}, level: LogLevel.Error, message: "[" + _this.name + "]::" + _this.message });
return _this;
}
return NodeFetchClientUnsupportedException;
}(Error));
var FunctionExpectedException = /** @class */ (function (_super) {

@@ -825,3 +805,3 @@ __extends(FunctionExpectedException, _super);

export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, NodeFetchClientUnsupportedException, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage };
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage };
//# sourceMappingURL=common.es5.js.map
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pnp/logging')) :
typeof define === 'function' && define.amd ? define(['exports', '@pnp/logging'], factory) :
(factory((global.pnp = {}),global.logging));
}(this, (function (exports,logging) { 'use strict';
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@pnp/logging'), require('tslib')) :
typeof define === 'function' && define.amd ? define(['exports', '@pnp/logging', 'tslib'], factory) :
(factory((global.pnp = global.pnp || {}, global.pnp.common = {}),global.logging,global.tslib_1));
}(this, (function (exports,logging,tslib_1) { 'use strict';

@@ -451,25 +451,4 @@ /**

var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var NodeFetchClientUnsupportedException = /** @class */ (function (_super) {
__extends(NodeFetchClientUnsupportedException, _super);
function NodeFetchClientUnsupportedException(msg) {
if (msg === void 0) { msg = "Using NodeFetchClient in the browser is not supported."; }
var _this = _super.call(this, msg) || this;
_this.name = "NodeFetchClientUnsupportedException";
logging.Logger.log({ data: {}, level: logging.LogLevel.Error, message: "[" + _this.name + "]::" + _this.message });
return _this;
}
return NodeFetchClientUnsupportedException;
}(Error));
var FunctionExpectedException = /** @class */ (function (_super) {
__extends(FunctionExpectedException, _super);
tslib_1.__extends(FunctionExpectedException, _super);
function FunctionExpectedException(msg) {

@@ -485,3 +464,3 @@ if (msg === void 0) { msg = "Expected a function."; }

var UrlException = /** @class */ (function (_super) {
__extends(UrlException, _super);
tslib_1.__extends(UrlException, _super);
function UrlException(msg) {

@@ -837,3 +816,2 @@ var _this = _super.call(this, msg) || this;

exports.beta = beta;
exports.NodeFetchClientUnsupportedException = NodeFetchClientUnsupportedException;
exports.FunctionExpectedException = FunctionExpectedException;

@@ -840,0 +818,0 @@ exports.UrlException = UrlException;

@@ -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(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})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/logging"),require("tslib")):"function"==typeof define&&define.amd?define(["exports","@pnp/logging","tslib"],t):t((e.pnp=e.pnp||{},e.pnp.common={}),e.logging,e.tslib_1)}(this,function(e,t,n){"use strict";function r(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 o=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}(),i=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}(),a=function(e){function r(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 n.__extends(r,e),r}(Error),s=function(e){function r(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 n.__extends(r,e),r}(Error),u=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 o,this._v.add(u.defaultCachingStore,"session"),this._v.add(u.defaultCachingTimeoutSeconds,60),this._v.add(u.globalCacheDisable,!1),this._v.add(u.enableCacheExpiration,!1),this._v.add(u.cacheExpirationIntervalMilliseconds,750),this._v.add(u.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(u.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(u.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(u.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(u.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(u.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(u.spfxContext)},enumerable:!0,configurable:!0}),e}(),c=new l,f=function(){function e(e,n){void 0===n&&(n=-1),this.store=e,this.defaultTimeoutMinutes=n,this.enabled=this.test(),c.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=c.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=i.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(i.getCtxCallback(e,e.cacheExpirationHandler),c.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}(),p=function(){function e(e){void 0===e&&(e=new o),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}(),g=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 f("undefined"!=typeof localStorage?localStorage:new p)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new f("undefined"!=typeof sessionStorage?sessionStorage:new p)),this._session},enumerable:!0,configurable:!0}),e}();e.Util=i,e.readBlobAsText=function(e){return r(e,"string")},e.readBlobAsArrayBuffer=function(e){return r(e,"buffer")},e.Dictionary=o,e.mergeOptions=function(e,t){if(i.objectDefinedNotNull(t)){var n=i.extend(e.headers||{},t.headers);(e=i.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.FunctionExpectedException=a,e.UrlException=s,e.CommonRuntimeConfigKeys=u,e.RuntimeConfigImpl=l,e.RuntimeConfig=c,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=f,e.PnPClientStorage=g,Object.defineProperty(e,"__esModule",{value:!0})});

@@ -422,9 +422,2 @@ import { LogLevel, Logger } from '@pnp/logging';

class NodeFetchClientUnsupportedException extends Error {
constructor(msg = "Using NodeFetchClient in the browser is not supported.") {
super(msg);
this.name = "NodeFetchClientUnsupportedException";
Logger.log({ data: {}, level: LogLevel.Error, message: `[${this.name}]::${this.message}` });
}
}
class FunctionExpectedException extends Error {

@@ -728,3 +721,3 @@ constructor(msg = "Expected a function.") {

export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, NodeFetchClientUnsupportedException, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage };
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage };
//# sourceMappingURL=common.js.map
{
"name": "@pnp/common",
"version": "1.0.0-beta.2",
"version": "1.0.0-beta.3",
"description": "pnp - provides shared functionality across all pnp libraries",
"main": "./dist/common.es5.umd.js",
"typings": "./index",
"dependencies": {},
"dependencies": {
"tslib": "1.7.1"
},
"peerDependencies": {
"@pnp/logging": "1.0.0-beta.2"
"@pnp/logging": "1.0.0-beta.3"
},

@@ -11,0 +13,0 @@ "author": {

@@ -1,4 +0,1 @@

export declare class NodeFetchClientUnsupportedException extends Error {
constructor(msg?: string);
}
export declare class FunctionExpectedException extends Error {

@@ -5,0 +2,0 @@ constructor(msg?: string);

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc