@pnp/config-store
Advanced tools
Comparing version 1.0.0-beta.10 to 1.0.0-beta.11
/** | ||
@license | ||
* @pnp/config-store v1.0.0-beta.10 - pnp - provides a way to manage configuration within your application | ||
* @pnp/config-store v1.0.0-beta.11 - 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.10 - pnp - provides a way to manage configuration within your application | ||
* @pnp/config-store v1.0.0-beta.11 - pnp - provides a way to manage configuration within your application | ||
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE) | ||
@@ -19,3 +19,3 @@ * Copyright (c) 2018 Microsoft | ||
root["pnp"] = factory(); | ||
})(this, function() { | ||
})(typeof self !== 'undefined' ? self : this, function() { | ||
return /******/ (function(modules) { // webpackBootstrap | ||
@@ -98,2 +98,3 @@ /******/ // The module cache | ||
/* unused harmony export UrlException */ | ||
/* unused harmony export setup */ | ||
/* unused harmony export RuntimeConfigImpl */ | ||
@@ -111,3 +112,3 @@ /* unused harmony export RuntimeConfig */ | ||
@license | ||
* @pnp/common v1.0.0-beta.10 - pnp - provides shared functionality across all pnp libraries | ||
* @pnp/common v1.0.0-beta.11 - pnp - provides shared functionality across all pnp libraries | ||
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE) | ||
@@ -338,2 +339,5 @@ * Copyright (c) 2018 Microsoft | ||
function setup(config) { | ||
RuntimeConfig.extend(config); | ||
} | ||
var RuntimeConfigImpl = /** @class */ (function () { | ||
@@ -887,3 +891,3 @@ function RuntimeConfigImpl() { | ||
@license | ||
* @pnp/logging v1.0.0-beta.10 - pnp - light-weight, subscribable logging framework | ||
* @pnp/logging v1.0.0-beta.11 - pnp - light-weight, subscribable logging framework | ||
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE) | ||
@@ -890,0 +894,0 @@ * Copyright (c) 2018 Microsoft |
/** | ||
@license | ||
* @pnp/config-store v1.0.0-beta.10 - pnp - provides a way to manage configuration within your application | ||
* @pnp/config-store v1.0.0-beta.11 - 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()}(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){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});/** | ||
@license | ||
* @pnp/logging v1.0.0-beta.10 - pnp - light-weight, subscribable logging framework | ||
* @pnp/logging v1.0.0-beta.11 - pnp - light-weight, subscribable logging framework | ||
* MIT (https://github.com/pnp/pnp/blob/master/LICENSE) | ||
@@ -15,0 +15,0 @@ * Copyright (c) 2018 Microsoft |
/** | ||
@license | ||
* @pnp/config-store v1.0.0-beta.10 - pnp - provides a way to manage configuration within your application | ||
* @pnp/config-store v1.0.0-beta.11 - 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 |
@@ -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){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})}); | ||
!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})}); |
/** | ||
@license | ||
* @pnp/config-store v1.0.0-beta.10 - pnp - provides a way to manage configuration within your application | ||
* @pnp/config-store v1.0.0-beta.11 - 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 |
{ | ||
"name": "@pnp/config-store", | ||
"version": "1.0.0-beta.10", | ||
"version": "1.0.0-beta.11", | ||
"description": "pnp - provides a way to manage configuration within your application", | ||
@@ -11,5 +11,5 @@ "main": "./dist/config-store.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/common": "1.0.0-beta.10", | ||
"@pnp/sp": "1.0.0-beta.10", | ||
"@pnp/logging": "1.0.0-beta.10" | ||
"@pnp/common": "1.0.0-beta.11", | ||
"@pnp/sp": "1.0.0-beta.11", | ||
"@pnp/logging": "1.0.0-beta.11" | ||
}, | ||
@@ -16,0 +16,0 @@ "author": { |
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
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
387798
2532