@pnp/config-store
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.5
import { Dictionary, PnPClientStorage } from '@pnp/common'; | ||
import { __extends } from 'tslib'; | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
import { Logger } from '@pnp/logging'; | ||
@@ -100,3 +100,3 @@ /** | ||
_this.name = "NoCacheAvailableException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: "[" + _this.name + "]::" + _this.message }); | ||
Logger.log({ data: {}, level: 3 /* Error */, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
@@ -103,0 +103,0 @@ } |
@@ -89,3 +89,2 @@ // TODO:: banner | ||
/* unused harmony export beta */ | ||
/* unused harmony export FunctionExpectedException */ | ||
/* unused harmony export UrlException */ | ||
@@ -511,3 +510,3 @@ /* unused harmony export CommonRuntimeConfigKeys */ | ||
} | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ | ||
data: { | ||
@@ -518,3 +517,3 @@ descriptor: descriptor, | ||
}, | ||
level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Warning, | ||
level: 2 /* Warning */, | ||
message: "(" + deprecationVersion + ") " + message, | ||
@@ -535,3 +534,3 @@ }); | ||
} | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ | ||
data: { | ||
@@ -542,3 +541,3 @@ descriptor: descriptor, | ||
}, | ||
level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Warning, | ||
level: 2 /* Warning */, | ||
message: message, | ||
@@ -551,13 +550,2 @@ }); | ||
var FunctionExpectedException = /** @class */ (function (_super) { | ||
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __extends */])(FunctionExpectedException, _super); | ||
function FunctionExpectedException(msg) { | ||
if (msg === void 0) { msg = "Expected a function."; } | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = "FunctionExpectedException"; | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ data: {}, level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Error, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
} | ||
return FunctionExpectedException; | ||
}(Error)); | ||
var UrlException = /** @class */ (function (_super) { | ||
@@ -568,3 +556,3 @@ Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __extends */])(UrlException, _super); | ||
_this.name = "UrlException"; | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ data: {}, level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Error, message: "[" + _this.name + "]::" + _this.message }); | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ data: {}, level: 3 /* Error */, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
@@ -684,3 +672,3 @@ } | ||
if (RuntimeConfig.enableCacheExpiration) { | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].write("Enabling cache expiration.", __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Info); | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].write("Enabling cache expiration.", 1 /* Info */); | ||
this.cacheExpirationHandler(); | ||
@@ -704,3 +692,3 @@ } | ||
if (new Date(persistable.expiration) <= new Date()) { | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].write("Removing item with key '" + key + "' from cache due to expiration.", __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Info); | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].write("Removing item with key '" + key + "' from cache due to expiration.", 1 /* Info */); | ||
this.delete(key); | ||
@@ -820,3 +808,3 @@ return null; | ||
var _this = this; | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].write("Called cache expiration handler.", __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Verbose); | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].write("Called cache expiration handler.", 0 /* Verbose */); | ||
this.deleteExpired().then(function (_) { | ||
@@ -827,5 +815,5 @@ // call ourself in the future | ||
// we've got some error - so just stop the loop and report the error | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ | ||
data: e, | ||
level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Error, | ||
level: 3 /* Error */, | ||
message: "Error deleting expired cache entries, see data for details. Timeout not reset.", | ||
@@ -922,20 +910,6 @@ }); | ||
"use strict"; | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Logger; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return LogLevel; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Logger; }); | ||
/* unused harmony export ConsoleListener */ | ||
/* unused harmony export FunctionListener */ | ||
/** | ||
* A set of logging levels | ||
* | ||
*/ | ||
var LogLevel; | ||
(function (LogLevel) { | ||
LogLevel[LogLevel["Verbose"] = 0] = "Verbose"; | ||
LogLevel[LogLevel["Info"] = 1] = "Info"; | ||
LogLevel[LogLevel["Warning"] = 2] = "Warning"; | ||
LogLevel[LogLevel["Error"] = 3] = "Error"; | ||
LogLevel[LogLevel["Off"] = 99] = "Off"; | ||
})(LogLevel || (LogLevel = {})); | ||
/** | ||
* Class used to subscribe ILogListener and log messages throughout an application | ||
@@ -1005,3 +979,3 @@ * | ||
Logger.write = function (message, level) { | ||
if (level === void 0) { level = LogLevel.Verbose; } | ||
if (level === void 0) { level = 0 /* Verbose */; } | ||
Logger.instance.log({ level: level, message: message }); | ||
@@ -1016,3 +990,3 @@ }; | ||
Logger.writeJSON = function (json, level) { | ||
if (level === void 0) { level = LogLevel.Verbose; } | ||
if (level === void 0) { level = 0 /* Verbose */; } | ||
Logger.instance.log({ level: level, message: JSON.stringify(json) }); | ||
@@ -1028,11 +1002,2 @@ }; | ||
}; | ||
/** | ||
* Logs performance tracking data for the the execution duration of the supplied function using console.profile | ||
* | ||
* @param name The name of this profile boundary | ||
* @param f The function to execute and track within this performance boundary | ||
*/ | ||
Logger.measure = function (name, f) { | ||
return Logger.instance.measure(name, f); | ||
}; | ||
return Logger; | ||
@@ -1042,3 +1007,3 @@ }()); | ||
function LoggerImpl(activeLogLevel, subscribers) { | ||
if (activeLogLevel === void 0) { activeLogLevel = LogLevel.Warning; } | ||
if (activeLogLevel === void 0) { activeLogLevel = 2 /* Warning */; } | ||
if (subscribers === void 0) { subscribers = []; } | ||
@@ -1064,20 +1029,10 @@ this.activeLogLevel = activeLogLevel; | ||
LoggerImpl.prototype.write = function (message, level) { | ||
if (level === void 0) { level = LogLevel.Verbose; } | ||
if (level === void 0) { level = 0 /* Verbose */; } | ||
this.log({ level: level, message: message }); | ||
}; | ||
LoggerImpl.prototype.log = function (entry) { | ||
if (typeof entry === "undefined" || entry.level < this.activeLogLevel) { | ||
return; | ||
if (typeof entry !== "undefined" && this.activeLogLevel <= entry.level) { | ||
this.subscribers.map(function (subscriber) { return subscriber.log(entry); }); | ||
} | ||
this.subscribers.map(function (subscriber) { return subscriber.log(entry); }); | ||
}; | ||
LoggerImpl.prototype.measure = function (name, f) { | ||
console.profile(name); | ||
try { | ||
return f(); | ||
} | ||
finally { | ||
console.profileEnd(); | ||
} | ||
}; | ||
return LoggerImpl; | ||
@@ -1087,3 +1042,3 @@ }()); | ||
/** | ||
* Implementation of ILogListener which logs to the browser console | ||
* Implementation of LogListener which logs to the console | ||
* | ||
@@ -1102,10 +1057,10 @@ */ | ||
switch (entry.level) { | ||
case LogLevel.Verbose: | ||
case LogLevel.Info: | ||
case 0 /* Verbose */: | ||
case 1 /* Info */: | ||
console.log(msg); | ||
break; | ||
case LogLevel.Warning: | ||
case 2 /* Warning */: | ||
console.warn(msg); | ||
break; | ||
case LogLevel.Error: | ||
case 3 /* Error */: | ||
console.error(msg); | ||
@@ -1131,3 +1086,3 @@ break; | ||
/** | ||
* Implementation of ILogListener which logs to the supplied function | ||
* Implementation of LogListener which logs to the supplied function | ||
* | ||
@@ -1433,3 +1388,3 @@ */ | ||
_this.name = "NoCacheAvailableException"; | ||
__WEBPACK_IMPORTED_MODULE_1__pnp_logging__["b" /* Logger */].log({ data: {}, level: __WEBPACK_IMPORTED_MODULE_1__pnp_logging__["a" /* LogLevel */].Error, message: "[" + _this.name + "]::" + _this.message }); | ||
__WEBPACK_IMPORTED_MODULE_1__pnp_logging__["a" /* Logger */].log({ data: {}, level: 3 /* Error */, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
@@ -1436,0 +1391,0 @@ } |
@@ -1,2 +0,2 @@ | ||
!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 o=n[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,t),o.l=!0,o.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";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return h});var r=n(1),o=n(2),i=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}(),a=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+"=([^&#]*)"),n=t.exec(location.search);return null==n?"":decodeURIComponent(n[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}(),s=(function(e){function t(t){void 0===t&&(t="Expected a function.");var n=e.call(this,t)||this;return n.name="FunctionExpectedException",r.b.log({data:{},level:r.a.Error,message:"["+n.name+"]::"+n.message}),n}Object(o.a)(t,e)}(Error),function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",r.b.log({data:{},level:r.a.Error,message:"["+n.name+"]::"+n.message}),n}Object(o.a)(t,e)}(Error),function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}()),u=function(){function e(){this._v=new i,this._v.add(s.defaultCachingStore,"session"),this._v.add(s.defaultCachingTimeoutSeconds,60),this._v.add(s.globalCacheDisable,!1),this._v.add(s.enableCacheExpiration,!1),this._v.add(s.cacheExpirationIntervalMilliseconds,750),this._v.add(s.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(s.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(s.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(s.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(s.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(s.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(s.spfxContext)},enumerable:!0,configurable:!0}),e}(),c=new u,l=c,f=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),l.enableCacheExpiration&&(r.b.write("Enabling cache expiration.",r.a.Info),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?(r.b.write("Removing item with key '"+e+"' from cache due to expiration.",r.a.Info),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(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=l.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=a.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;r.b.write("Called cache expiration handler.",r.a.Verbose),this.deleteExpired().then(function(t){setTimeout(a.getCtxCallback(e,e.cacheExpirationHandler),l.cacheExpirationIntervalMilliseconds)}).catch(function(e){r.b.log({data:e,level:r.a.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 i),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 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}()},function(e,t,n){"use strict";n.d(t,"b",function(){return o}),n.d(t,"a",function(){return r});var r;!function(e){e[e.Verbose=0]="Verbose",e[e.Info=1]="Info",e[e.Warning=2]="Warning",e[e.Error=3]="Error",e[e.Off=99]="Off"}(r||(r={}));var o=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=r.Verbose),e.instance.log({level:n,message:t})},e.writeJSON=function(t,n){void 0===n&&(n=r.Verbose),e.instance.log({level:n,message:JSON.stringify(t)})},e.log=function(t){e.instance.log(t)},e.measure=function(t,n){return e.instance.measure(t,n)},e}(),i=function(){function e(e,t){void 0===e&&(e=r.Warning),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=r.Verbose),this.log({level:t,message:e})},e.prototype.log=function(e){void 0===e||e.level<this.activeLogLevel||this.subscribers.map(function(t){return t.log(e)})},e.prototype.measure=function(e,t){console.profile(e);try{return t()}finally{console.profileEnd()}},e}();(function(){function e(){}e.prototype.log=function(e){var t=this.format(e);switch(e.level){case r.Verbose:case r.Info:console.log(t);break;case r.Warning:console.warn(t);break;case r.Error: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}o(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}t.a=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()}(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";n.d(t,"a",function(){return o}),n.d(t,"b",function(){return h});var r=n(1),i=n(2),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 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=[]},e.prototype.count=function(){return this.keys.length},e}(),a=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+"=([^&#]*)"),n=t.exec(location.search);return null==n?"":decodeURIComponent(n[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 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}(),s=(function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",r.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}Object(i.a)(t,e)}(Error),function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}()),u=function(){function e(){this._v=new o,this._v.add(s.defaultCachingStore,"session"),this._v.add(s.defaultCachingTimeoutSeconds,60),this._v.add(s.globalCacheDisable,!1),this._v.add(s.enableCacheExpiration,!1),this._v.add(s.cacheExpirationIntervalMilliseconds,750),this._v.add(s.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(s.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(s.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(s.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(s.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(s.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(s.spfxContext)},enumerable:!0,configurable:!0}),e}(),c=new u,l=c,f=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),l.enableCacheExpiration&&(r.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?(r.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=l.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=a.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;r.a.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(a.getCtxCallback(e,e.cacheExpirationHandler),l.cacheExpirationIntervalMilliseconds)}).catch(function(e){r.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 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}(),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 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}()},function(e,t,n){"use strict";n.d(t,"a",function(){return 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}(),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. | ||
@@ -15,3 +15,3 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use | ||
***************************************************************************** */ | ||
var o=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])};Object.assign},function(e,t,n){"use strict";var r=n(0),o=n(4),i=function(){function e(e,t,n){this.wrappedProvider=e,this.store=n||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 n=this.wrappedProvider.getConfiguration();return n.then(function(t){e.store.put(e.cacheKey,t)}),n},e.prototype.selectPnPCache=function(){var e=new r.b;if(e.local&&e.local.enabled)return e.local;if(e.session&&e.session.enabled)return e.session;throw new o.a},e}();t.a=i},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(2),o=n(1),i=function(e){function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var n=e.call(this,t)||this;return n.name="NoCacheAvailableException",o.b.log({data:{},level:o.a.Error,message:"["+n.name+"]::"+n.message}),n}return r.a(t,e),t}(Error)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);n.d(t,"Settings",function(){return r.d}),n.d(t,"CachingConfigurationProvider",function(){return r.a}),n.d(t,"SPListConfigurationProvider",function(){return r.c}),n.d(t,"NoCacheAvailableException",function(){return r.b})},function(e,t,n){"use strict";var r=n(7);n.d(t,"d",function(){return r.a});var o=n(8);n.d(t,"a",function(){return o.a}),n.d(t,"c",function(){return o.b});var i=n(4);n.d(t,"b",function(){return i.a})},function(e,t,n){"use strict";n.d(t,"a",function(){return o});var r=n(0),o=function(){function e(){this._settings=new r.a}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(n,r){try{t._settings.merge(e),n()}catch(e){r(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(n,r){e.getConfiguration().then(function(e){t._settings.merge(e),n()}).catch(function(e){r(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}()},function(e,t,n){"use strict";var r=n(3);n.d(t,"a",function(){return r.a});var o=n(9);n.d(t,"b",function(){return o.a})},function(e,t,n){"use strict";var r=n(3),o=function(){function e(e,t){void 0===t&&(t="config"),this.sourceWeb=e,this.sourceListTitle=t}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(){return this.web.lists.getByTitle(this.listTitle).items.select("Title","Value").getAs().then(function(e){return e.reduce(function(e,t){return Object.defineProperty(e,t.Title,{configurable:!1,enumerable:!1,value:t.Value,writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new r.a(this,e)},e}();t.a=o}])}); | ||
var i=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])};Object.assign},function(e,t,n){"use strict";var r=n(0),i=n(4),o=function(){function e(e,t,n){this.wrappedProvider=e,this.store=n||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 n=this.wrappedProvider.getConfiguration();return n.then(function(t){e.store.put(e.cacheKey,t)}),n},e.prototype.selectPnPCache=function(){var e=new r.b;if(e.local&&e.local.enabled)return e.local;if(e.session&&e.session.enabled)return e.session;throw new i.a},e}();t.a=o},function(e,t,n){"use strict";n.d(t,"a",function(){return o});var r=n(2),i=n(1),o=function(e){function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var n=e.call(this,t)||this;return n.name="NoCacheAvailableException",i.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}return r.a(t,e),t}(Error)},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(6);n.d(t,"Settings",function(){return r.d}),n.d(t,"CachingConfigurationProvider",function(){return r.a}),n.d(t,"SPListConfigurationProvider",function(){return r.c}),n.d(t,"NoCacheAvailableException",function(){return r.b})},function(e,t,n){"use strict";var r=n(7);n.d(t,"d",function(){return r.a});var i=n(8);n.d(t,"a",function(){return i.a}),n.d(t,"c",function(){return i.b});var o=n(4);n.d(t,"b",function(){return o.a})},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(0),i=function(){function e(){this._settings=new r.a}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(n,r){try{t._settings.merge(e),n()}catch(e){r(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(n,r){e.getConfiguration().then(function(e){t._settings.merge(e),n()}).catch(function(e){r(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}()},function(e,t,n){"use strict";var r=n(3);n.d(t,"a",function(){return r.a});var i=n(9);n.d(t,"b",function(){return i.a})},function(e,t,n){"use strict";var r=n(3),i=function(){function e(e,t){void 0===t&&(t="config"),this.sourceWeb=e,this.sourceListTitle=t}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(){return this.web.lists.getByTitle(this.listTitle).items.select("Title","Value").getAs().then(function(e){return e.reduce(function(e,t){return Object.defineProperty(e,t.Title,{configurable:!1,enumerable:!1,value:t.Value,writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new r.a(this,e)},e}();t.a=i}])}); | ||
//# sourceMappingURL=config-store.es5.umd.bundle.min.js.map |
@@ -102,3 +102,3 @@ (function (global, factory) { | ||
_this.name = "NoCacheAvailableException"; | ||
logging.Logger.log({ data: {}, level: logging.LogLevel.Error, message: "[" + _this.name + "]::" + _this.message }); | ||
logging.Logger.log({ data: {}, level: 3 /* Error */, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
@@ -105,0 +105,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,n,i){"use strict";var r=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(n,i){try{t._settings.merge(e),n()}catch(e){i(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(n,i){e.getConfiguration().then(function(e){t._settings.merge(e),n()}).catch(function(e){i(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}(),o=function(e){function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var n=e.call(this,t)||this;return n.name="NoCacheAvailableException",i.Logger.log({data:{},level:i.LogLevel.Error,message:"["+n.name+"]::"+n.message}),n}return n.__extends(t,e),t}(Error),s=function(){function e(e,t,n){this.wrappedProvider=e,this.store=n||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 n=this.wrappedProvider.getConfiguration();return n.then(function(t){e.store.put(e.cacheKey,t)}),n},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 o},e}(),c=function(){function e(e,t){void 0===t&&(t="config"),this.sourceWeb=e,this.sourceListTitle=t}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(){return this.web.lists.getByTitle(this.listTitle).items.select("Title","Value").getAs().then(function(e){return e.reduce(function(e,t){return Object.defineProperty(e,t.Title,{configurable:!1,enumerable:!1,value:t.Value,writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new s(this,e)},e}();e.Settings=r,e.CachingConfigurationProvider=s,e.SPListConfigurationProvider=c,e.NoCacheAvailableException=o,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,n,i){"use strict";var r=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(n,i){try{t._settings.merge(e),n()}catch(e){i(e)}})},e.prototype.load=function(e){var t=this;return new Promise(function(n,i){e.getConfiguration().then(function(e){t._settings.merge(e),n()}).catch(function(e){i(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}(),o=function(e){function t(t){void 0===t&&(t="Cannot create a caching configuration provider since cache is not available.");var n=e.call(this,t)||this;return n.name="NoCacheAvailableException",i.Logger.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}return n.__extends(t,e),t}(Error),s=function(){function e(e,t,n){this.wrappedProvider=e,this.store=n||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 n=this.wrappedProvider.getConfiguration();return n.then(function(t){e.store.put(e.cacheKey,t)}),n},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 o},e}(),c=function(){function e(e,t){void 0===t&&(t="config"),this.sourceWeb=e,this.sourceListTitle=t}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(){return this.web.lists.getByTitle(this.listTitle).items.select("Title","Value").getAs().then(function(e){return e.reduce(function(e,t){return Object.defineProperty(e,t.Title,{configurable:!1,enumerable:!1,value:t.Value,writable:!1})},{})})},e.prototype.asCaching=function(){var e="splist_"+this.web.toUrl()+"+"+this.listTitle;return new s(this,e)},e}();e.Settings=r,e.CachingConfigurationProvider=s,e.SPListConfigurationProvider=c,e.NoCacheAvailableException=o,Object.defineProperty(e,"__esModule",{value:!0})}); |
import { Dictionary, PnPClientStorage } from '@pnp/common'; | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
import { Logger } from '@pnp/logging'; | ||
@@ -94,3 +94,3 @@ /** | ||
this.name = "NoCacheAvailableException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: `[${this.name}]::${this.message}` }); | ||
Logger.log({ data: {}, level: 3 /* Error */, message: `[${this.name}]::${this.message}` }); | ||
} | ||
@@ -97,0 +97,0 @@ } |
{ | ||
"name": "@pnp/config-store", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.5", | ||
"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.3", | ||
"@pnp/sp": "1.0.0-beta.3", | ||
"@pnp/logging": "1.0.0-beta.3" | ||
"@pnp/common": "1.0.0-beta.5", | ||
"@pnp/sp": "1.0.0-beta.5", | ||
"@pnp/logging": "1.0.0-beta.5" | ||
}, | ||
@@ -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
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
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
379974
2440