Socket
Socket
Sign inDemoInstall

@pnp/config-store

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/config-store - npm Package Compare versions

Comparing version 1.0.0-beta.11 to 1.0.0-rc.0

2

dist/config-store.es5.js
/**
@license
* @pnp/config-store v1.0.0-beta.11 - pnp - provides a way to manage configuration within your application
* @pnp/config-store v1.0.0-rc.0 - pnp - provides a way to manage configuration within your application
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

/**
@license
* @pnp/config-store v1.0.0-beta.11 - pnp - provides a way to manage configuration within your application
* @pnp/config-store v1.0.0-rc.0 - pnp - provides a way to manage configuration within your application
* MIT (https://github.com/pnp/pnp/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=5)}([function(e,t,n){"use strict";(function(e){function r(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}n.d(t,"a",function(){return a}),n.d(t,"b",function(){return d});var i=n(1),o=n(2),a=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}(),u=(function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",i.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}Object(o.a)(t,e)}(Error),function(){function e(){this._v=new a,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}()),s=new u,c=s,l=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.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.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.isFunc=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.extend=function(t,n,r){if(void 0===r&&(r=!1),!e.objectDefinedNotNull(n))return t;var i=r?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(n).filter(function(e){return i(t,e)}).reduce(function(e,t){return e[t]=n[t],e},t)},e.isUrlAbsolute=function(e){return/^https?:\/\/|^\/\//i.test(e)},e.stringIsNullOrEmpty=function(e){return void 0===e||null===e||e.length<1},e}(),f=function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}(),p=(function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}Object(o.a)(t,e),t.prototype.fetch=function(t,n){void 0===n&&(n={});var i=new Headers;return r(i,n.headers),i.set("Authorization","Bearer "+this._token),n.headers=i,e.prototype.fetch.call(this,t,n)}}(f),function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),c.enableCacheExpiration&&(i.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?(i.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=c.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=l.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;i.a.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(l.getCtxCallback(e,e.cacheExpirationHandler),c.cacheExpirationIntervalMilliseconds)}).catch(function(e){i.a.log({data:e,level:3,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}()),h=function(){function e(e){void 0===e&&(e=new a),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}(),d=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 h)),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 h)),this._session},enumerable:!0,configurable:!0}),e}()}).call(t,n(8))},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=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=5)}([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!w.stringIsNullOrEmpty(e)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")}function u(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 s(e){return"function"==typeof e}function c(e){return void 0!==e&&null!==e}function l(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array}function f(e,t,n){if(void 0===n&&(n=!1),!w.objectDefinedNotNull(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)}function p(e){return/^https?:\/\/|^\/\//i.test(e)}function h(e){return void 0===e||null===e||e.length<1}function d(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}n.d(t,"a",function(){return b}),n.d(t,"b",function(){return C});var g=n(1),v=n(2),b=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}(),y=(function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",g.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}Object(v.a)(t,e)}(Error),function(){function e(){this._v=new b,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}()),m=new y,x=m,w=function(){function e(){}return e.getCtxCallback=r,e.dateAdd=i,e.combinePaths=o,e.getRandomString=u,e.getGUID=a,e.isFunc=s,e.objectDefinedNotNull=c,e.isArray=l,e.extend=f,e.isUrlAbsolute=p,e.stringIsNullOrEmpty=h,e}(),_=function(){function t(){}return t.prototype.fetch=function(t,n){return e.fetch(t,n)},t}(),O=(function(e){function t(t){var n=e.call(this)||this;return n._token=t,n}Object(v.a)(t,e),t.prototype.fetch=function(t,n){void 0===n&&(n={});var r=new Headers;return d(r,n.headers),r.set("Authorization","Bearer "+this._token),n.headers=r,e.prototype.fetch.call(this,t,n)}}(_),function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),x.enableCacheExpiration&&(g.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?(g.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=x.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=w.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;g.a.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(w.getCtxCallback(e,e.cacheExpirationHandler),x.cacheExpirationIntervalMilliseconds)}).catch(function(e){g.a.log({data:e,level:3,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}()),P=function(){function e(e){void 0===e&&(e=new b),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 O("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 O("undefined"!=typeof sessionStorage?sessionStorage:new P)),this._session},enumerable:!0,configurable:!0}),e}()}).call(t,n(8))},function(e,t,n){"use strict";n.d(t,"a",function(){return r});/**
@license
* @pnp/logging v1.0.0-beta.11 - pnp - light-weight, subscribable logging framework
* @pnp/logging v1.0.0-rc.0 - pnp - light-weight, subscribable logging framework
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE)

@@ -20,3 +20,3 @@ * Copyright (c) 2018 Microsoft

*/
var r=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 i),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=0),e.instance.log({level:n,message:t})},e.writeJSON=function(t,n){void 0===n&&(n=0),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.name+"]::"+t.message})},e}(),i=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=0),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(){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}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}t.a=r;/*! *****************************************************************************
var r=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 i),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=0),e.instance.log({level:n,message:t})},e.writeJSON=function(t,n){void 0===n&&(n=0),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}(),i=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=0),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(){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}i(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}t.a=r;/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.

@@ -23,0 +23,0 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use

/**
@license
* @pnp/config-store v1.0.0-beta.11 - pnp - provides a way to manage configuration within your application
* @pnp/config-store v1.0.0-rc.0 - pnp - provides a way to manage configuration within your application
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE)

@@ -13,3 +13,3 @@ * Copyright (c) 2018 Microsoft

typeof define === 'function' && define.amd ? define(['exports', '@pnp/common', 'tslib', '@pnp/logging'], factory) :
(factory((global.pnp = global.pnp || {}, global.pnp['config-store'] = {}),global.common,global.tslib_1,global.logging));
(factory((global.pnp = global.pnp || {}, global.pnp['config-store'] = {}),global.pnp.common,global.tslib_1,global.pnp.logging));
}(this, (function (exports,common,tslib_1,logging) { 'use strict';

@@ -16,0 +16,0 @@

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

!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["config-store"]={}),e.common,e.tslib_1,e.logging)}(this,function(e,t,i,n){"use strict";var o=function(){function e(){this._settings=new t.Dictionary}return e.prototype.add=function(e,t){this._settings.add(e,t)},e.prototype.addJSON=function(e,t){this._settings.add(e,JSON.stringify(t))},e.prototype.apply=function(e){var t=this;return new Promise(function(i,n){try{t._settings.merge(e),i()}catch(e){n(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(i,n){e.getConfiguration().then(function(e){t._settings.merge(e),i()}).catch(function(e){n(e)})})},e.prototype.get=function(e){return this._settings.get(e)},e.prototype.getJSON=function(e){var t=this.get(e);return void 0===t||null===t?t:JSON.parse(t)},e}(),r=function(e){i.__extends(t,e);function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var i=e.call(this,t)||this;return i.name="NoCacheAvailableException",n.Logger.log({data:{},level:3,message:"["+i.name+"]::"+i.message}),i}return t}(Error),s=function(){function e(e,t,i){this.wrappedProvider=e,this.store=i||this.selectPnPCache(),this.cacheKey="_configcache_"+t}return e.prototype.getWrappedProvider=function(){return this.wrappedProvider},e.prototype.getConfiguration=function(){var e=this;if(!this.store||!this.store.enabled)return this.wrappedProvider.getConfiguration();var t=this.store.get(this.cacheKey);if(t)return new Promise(function(e){e(t)});var i=this.wrappedProvider.getConfiguration();return i.then(function(t){e.store.put(e.cacheKey,t)}),i},e.prototype.selectPnPCache=function(){var e=new t.PnPClientStorage;if(e.local&&e.local.enabled)return e.local;if(e.session&&e.session.enabled)return e.session;throw new r},e}(),a=function(){function e(e,t,i,n){void 0===t&&(t="config"),void 0===i&&(i="Title"),void 0===n&&(n="Value"),this.sourceWeb=e,this.sourceListTitle=t,this.keyFieldName=i,this.valueFieldName=n}return Object.defineProperty(e.prototype,"web",{get:function(){return this.sourceWeb},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listTitle",{get:function(){return this.sourceListTitle},enumerable:!0,configurable:!0}),e.prototype.getConfiguration=function(){var e=this;return this.web.lists.getByTitle(this.listTitle).items.select(this.keyFieldName,this.valueFieldName).get().then(function(t){return t.reduce(function(t,i){return Object.defineProperty(t,i[e.keyFieldName],{configurable:!1,enumerable:!1,value:i[e.valueFieldName],writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new s(this,e)},e}();e.Settings=o,e.CachingConfigurationProvider=s,e.SPListConfigurationProvider=a,e.NoCacheAvailableException=r,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["config-store"]={}),e.pnp.common,e.tslib_1,e.pnp.logging)}(this,function(e,t,i,n){"use strict";var o=function(){function e(){this._settings=new t.Dictionary}return e.prototype.add=function(e,t){this._settings.add(e,t)},e.prototype.addJSON=function(e,t){this._settings.add(e,JSON.stringify(t))},e.prototype.apply=function(e){var t=this;return new Promise(function(i,n){try{t._settings.merge(e),i()}catch(e){n(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(i,n){e.getConfiguration().then(function(e){t._settings.merge(e),i()}).catch(function(e){n(e)})})},e.prototype.get=function(e){return this._settings.get(e)},e.prototype.getJSON=function(e){var t=this.get(e);return void 0===t||null===t?t:JSON.parse(t)},e}(),r=function(e){function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var i=e.call(this,t)||this;return i.name="NoCacheAvailableException",n.Logger.log({data:{},level:3,message:"["+i.name+"]::"+i.message}),i}return i.__extends(t,e),t}(Error),s=function(){function e(e,t,i){this.wrappedProvider=e,this.store=i||this.selectPnPCache(),this.cacheKey="_configcache_"+t}return e.prototype.getWrappedProvider=function(){return this.wrappedProvider},e.prototype.getConfiguration=function(){var e=this;if(!this.store||!this.store.enabled)return this.wrappedProvider.getConfiguration();var t=this.store.get(this.cacheKey);if(t)return new Promise(function(e){e(t)});var i=this.wrappedProvider.getConfiguration();return i.then(function(t){e.store.put(e.cacheKey,t)}),i},e.prototype.selectPnPCache=function(){var e=new t.PnPClientStorage;if(e.local&&e.local.enabled)return e.local;if(e.session&&e.session.enabled)return e.session;throw new r},e}(),a=function(){function e(e,t,i,n){void 0===t&&(t="config"),void 0===i&&(i="Title"),void 0===n&&(n="Value"),this.sourceWeb=e,this.sourceListTitle=t,this.keyFieldName=i,this.valueFieldName=n}return Object.defineProperty(e.prototype,"web",{get:function(){return this.sourceWeb},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"listTitle",{get:function(){return this.sourceListTitle},enumerable:!0,configurable:!0}),e.prototype.getConfiguration=function(){var e=this;return this.web.lists.getByTitle(this.listTitle).items.select(this.keyFieldName,this.valueFieldName).get().then(function(t){return t.reduce(function(t,i){return Object.defineProperty(t,i[e.keyFieldName],{configurable:!1,enumerable:!1,value:i[e.valueFieldName],writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new s(this,e)},e}();e.Settings=o,e.CachingConfigurationProvider=s,e.SPListConfigurationProvider=a,e.NoCacheAvailableException=r,Object.defineProperty(e,"__esModule",{value:!0})});
/**
@license
* @pnp/config-store v1.0.0-beta.11 - pnp - provides a way to manage configuration within your application
* @pnp/config-store v1.0.0-rc.0 - pnp - provides a way to manage configuration within your application
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE)

@@ -5,0 +5,0 @@ * Copyright (c) 2018 Microsoft

@@ -10,3 +10,3 @@ # @pnp/config-store/configuration

// create an instance of the setttings class, could be static and shared across your application
// create an instance of the settings class, could be static and shared across your application
// or built as needed.

@@ -34,2 +34,5 @@ const settings = new Settings();

// and finally you can load values from a configuration provider
import { Web } from "@pnp/sp";
const w = new Web("https://mytenant.sharepoint.com/sites/dev");

@@ -42,3 +45,2 @@ const provider = new SPListConfigurationProvider(w, "myconfiglistname");

// once we have loaded values we can then read them

@@ -45,0 +47,0 @@ const value = settings.get("mykey");

# @pnp/config-store
This module providers a way to load application configuration from one or more providers and share it across the application in a consistent way.
[![npm version](https://badge.fury.io/js/%40pnp%2Fconfig-store.svg)](https://badge.fury.io/js/%40pnp%2Fconfig-store)
This module providers a way to load application configuration from one or more providers and share it across an application in a consistent way.
## Getting Started
Install the library and required dependencies
`npm install @pnp\logging @pnp\common @pnp\odata @pnp\sp @pnp\config-store --save`
See the topics below for usage:
* [configuration](configuration.md)
* [providers](providers.md)
{
"name": "@pnp/config-store",
"version": "1.0.0-beta.11",
"version": "1.0.0-rc.0",
"description": "pnp - provides a way to manage configuration within your application",

@@ -8,8 +8,8 @@ "main": "./dist/config-store.es5.umd.js",

"dependencies": {
"tslib": "1.7.1"
"tslib": "1.8.1"
},
"peerDependencies": {
"@pnp/common": "1.0.0-beta.11",
"@pnp/sp": "1.0.0-beta.11",
"@pnp/logging": "1.0.0-beta.11"
"@pnp/common": "1.0.0-rc.0",
"@pnp/sp": "1.0.0-rc.0",
"@pnp/logging": "1.0.0-rc.0"
},

@@ -16,0 +16,0 @@ "author": {

![SharePoint Patterns and Practices](https://devofficecdn.azureedge.net/media/Default/PnP/sppnp.png)
The SharePoint Patterns and Practices client side libraries were created to help enable developers to do their best work, without worrying about the exact
REST api details. Built with feedback from the community they represent a way to simplify your day-to-day dev cycle while relying on tested and proven
patterns.
Please use [http://aka.ms/sppnp](http://aka.ms/sppnp) for the latest updates around the whole *SharePoint Patterns and Practices (PnP) initiative*.
## Source & Docs
This code is managed within the [main pnp repo](https://github.com/pnp/pnp), please report issues and submit pull requests there.
Please see the public site for [package documentation](https://pnp.github.io/pnp/).
### Code of Conduct
This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/) or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

@@ -7,0 +18,0 @@

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

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