@pnp/common
Advanced tools
Comparing version 1.0.0-beta.3 to 1.0.0-beta.5
@@ -1,2 +0,2 @@ | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
import { Logger } from '@pnp/logging'; | ||
import { __extends } from 'tslib'; | ||
@@ -418,3 +418,3 @@ | ||
}, | ||
level: LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: "(" + deprecationVersion + ") " + message, | ||
@@ -441,3 +441,3 @@ }); | ||
}, | ||
level: LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: message, | ||
@@ -450,13 +450,2 @@ }); | ||
var FunctionExpectedException = /** @class */ (function (_super) { | ||
__extends(FunctionExpectedException, _super); | ||
function FunctionExpectedException(msg) { | ||
if (msg === void 0) { msg = "Expected a function."; } | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = "FunctionExpectedException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
} | ||
return FunctionExpectedException; | ||
}(Error)); | ||
var UrlException = /** @class */ (function (_super) { | ||
@@ -467,3 +456,3 @@ __extends(UrlException, _super); | ||
_this.name = "UrlException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: "[" + _this.name + "]::" + _this.message }); | ||
Logger.log({ data: {}, level: 3 /* Error */, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
@@ -583,3 +572,3 @@ } | ||
if (RuntimeConfig.enableCacheExpiration) { | ||
Logger.write("Enabling cache expiration.", LogLevel.Info); | ||
Logger.write("Enabling cache expiration.", 1 /* Info */); | ||
this.cacheExpirationHandler(); | ||
@@ -603,3 +592,3 @@ } | ||
if (new Date(persistable.expiration) <= new Date()) { | ||
Logger.write("Removing item with key '" + key + "' from cache due to expiration.", LogLevel.Info); | ||
Logger.write("Removing item with key '" + key + "' from cache due to expiration.", 1 /* Info */); | ||
this.delete(key); | ||
@@ -719,3 +708,3 @@ return null; | ||
var _this = this; | ||
Logger.write("Called cache expiration handler.", LogLevel.Verbose); | ||
Logger.write("Called cache expiration handler.", 0 /* Verbose */); | ||
this.deleteExpired().then(function (_) { | ||
@@ -728,3 +717,3 @@ // call ourself in the future | ||
data: e, | ||
level: LogLevel.Error, | ||
level: 3 /* Error */, | ||
message: "Error deleting expired cache entries, see data for details. Timeout not reset.", | ||
@@ -812,3 +801,3 @@ }); | ||
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage }; | ||
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage }; | ||
//# sourceMappingURL=common.es5.js.map |
@@ -446,20 +446,6 @@ // TODO:: banner | ||
"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 | ||
@@ -529,3 +515,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 }); | ||
@@ -540,3 +526,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) }); | ||
@@ -552,11 +538,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; | ||
@@ -566,3 +543,3 @@ }()); | ||
function LoggerImpl(activeLogLevel, subscribers) { | ||
if (activeLogLevel === void 0) { activeLogLevel = LogLevel.Warning; } | ||
if (activeLogLevel === void 0) { activeLogLevel = 2 /* Warning */; } | ||
if (subscribers === void 0) { subscribers = []; } | ||
@@ -588,20 +565,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; | ||
@@ -611,3 +578,3 @@ }()); | ||
/** | ||
* Implementation of ILogListener which logs to the browser console | ||
* Implementation of LogListener which logs to the console | ||
* | ||
@@ -626,10 +593,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); | ||
@@ -655,3 +622,3 @@ break; | ||
/** | ||
* Implementation of ILogListener which logs to the supplied function | ||
* Implementation of LogListener which logs to the supplied function | ||
* | ||
@@ -786,17 +753,16 @@ */ | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_common__ = __webpack_require__(5); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Util", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["i"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "readBlobAsText", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["o"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "readBlobAsArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["n"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Util", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["h"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "readBlobAsText", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["n"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "readBlobAsArrayBuffer", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["m"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "Dictionary", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["b"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mergeOptions", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["m"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "deprecated", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["k"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "beta", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["j"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "FunctionExpectedException", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["c"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "UrlException", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["h"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mergeOptions", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["l"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "deprecated", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["j"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "beta", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["i"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "UrlException", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["g"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "CommonRuntimeConfigKeys", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["a"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfigImpl", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["g"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfig", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["f"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mergeHeaders", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["l"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorageWrapper", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["e"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorage", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["d"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfigImpl", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["f"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfig", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["e"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "mergeHeaders", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["k"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorageWrapper", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["d"]; }); | ||
/* harmony namespace reexport (by provided) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorage", function() { return __WEBPACK_IMPORTED_MODULE_0__src_common__["c"]; }); | ||
@@ -811,25 +777,24 @@ //# sourceMappingURL=index.js.map | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__blobutil__ = __webpack_require__(6); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __WEBPACK_IMPORTED_MODULE_0__blobutil__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "o", function() { return __WEBPACK_IMPORTED_MODULE_0__blobutil__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_0__blobutil__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "n", function() { return __WEBPACK_IMPORTED_MODULE_0__blobutil__["b"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__collections__ = __webpack_require__(0); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "b", function() { return __WEBPACK_IMPORTED_MODULE_1__collections__["a"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2__configutil__ = __webpack_require__(7); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "m", function() { return __WEBPACK_IMPORTED_MODULE_2__configutil__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_2__configutil__["a"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3__decorators__ = __webpack_require__(8); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_3__decorators__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_3__decorators__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_3__decorators__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "j", function() { return __WEBPACK_IMPORTED_MODULE_3__decorators__["b"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_4__exceptions__ = __webpack_require__(9); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_4__exceptions__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_4__exceptions__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_4__exceptions__["a"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_5__libconfig__ = __webpack_require__(3); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "a", function() { return __WEBPACK_IMPORTED_MODULE_5__libconfig__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_5__libconfig__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "g", function() { return __WEBPACK_IMPORTED_MODULE_5__libconfig__["c"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_5__libconfig__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "f", function() { return __WEBPACK_IMPORTED_MODULE_5__libconfig__["c"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_6__netutil__ = __webpack_require__(11); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "l", function() { return __WEBPACK_IMPORTED_MODULE_6__netutil__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "k", function() { return __WEBPACK_IMPORTED_MODULE_6__netutil__["a"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_7__storage__ = __webpack_require__(12); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_7__storage__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "e", function() { return __WEBPACK_IMPORTED_MODULE_7__storage__["b"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "c", function() { return __WEBPACK_IMPORTED_MODULE_7__storage__["a"]; }); | ||
/* harmony namespace reexport (by used) */ __webpack_require__.d(__webpack_exports__, "d", function() { return __WEBPACK_IMPORTED_MODULE_7__storage__["b"]; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_8__util__ = __webpack_require__(1); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "i", function() { return __WEBPACK_IMPORTED_MODULE_8__util__["a"]; }); | ||
/* harmony reexport (binding) */ __webpack_require__.d(__webpack_exports__, "h", function() { return __WEBPACK_IMPORTED_MODULE_8__util__["a"]; }); | ||
@@ -932,3 +897,3 @@ | ||
} | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ | ||
data: { | ||
@@ -939,3 +904,3 @@ descriptor: descriptor, | ||
}, | ||
level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Warning, | ||
level: 2 /* Warning */, | ||
message: "(" + deprecationVersion + ") " + message, | ||
@@ -956,3 +921,3 @@ }); | ||
} | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* Logger */].log({ | ||
data: { | ||
@@ -963,3 +928,3 @@ descriptor: descriptor, | ||
}, | ||
level: __WEBPACK_IMPORTED_MODULE_0__pnp_logging__["a" /* LogLevel */].Warning, | ||
level: 2 /* Warning */, | ||
message: message, | ||
@@ -978,4 +943,3 @@ }); | ||
"use strict"; | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FunctionExpectedException; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return UrlException; }); | ||
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return UrlException; }); | ||
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_tslib__ = __webpack_require__(10); | ||
@@ -985,14 +949,2 @@ /* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__pnp_logging__ = __webpack_require__(2); | ||
var FunctionExpectedException = /** @class */ (function (_super) { | ||
__WEBPACK_IMPORTED_MODULE_0_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_1__pnp_logging__["b" /* Logger */].log({ data: {}, level: __WEBPACK_IMPORTED_MODULE_1__pnp_logging__["a" /* LogLevel */].Error, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
} | ||
return FunctionExpectedException; | ||
}(Error)); | ||
var UrlException = /** @class */ (function (_super) { | ||
@@ -1003,3 +955,3 @@ __WEBPACK_IMPORTED_MODULE_0_tslib__["a" /* __extends */](UrlException, _super); | ||
_this.name = "UrlException"; | ||
__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; | ||
@@ -1244,3 +1196,3 @@ } | ||
if (__WEBPACK_IMPORTED_MODULE_2__libconfig__["b" /* RuntimeConfig */].enableCacheExpiration) { | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["b" /* Logger */].write("Enabling cache expiration.", __WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* LogLevel */].Info); | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* Logger */].write("Enabling cache expiration.", 1 /* Info */); | ||
this.cacheExpirationHandler(); | ||
@@ -1264,3 +1216,3 @@ } | ||
if (new Date(persistable.expiration) <= new Date()) { | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["b" /* Logger */].write("Removing item with key '" + key + "' from cache due to expiration.", __WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* LogLevel */].Info); | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* Logger */].write("Removing item with key '" + key + "' from cache due to expiration.", 1 /* Info */); | ||
this.delete(key); | ||
@@ -1380,3 +1332,3 @@ return null; | ||
var _this = this; | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["b" /* Logger */].write("Called cache expiration handler.", __WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* LogLevel */].Verbose); | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* Logger */].write("Called cache expiration handler.", 0 /* Verbose */); | ||
this.deleteExpired().then(function (_) { | ||
@@ -1387,5 +1339,5 @@ // call ourself in the future | ||
// we've got some error - so just stop the loop and report the error | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["b" /* Logger */].log({ | ||
__WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* Logger */].log({ | ||
data: e, | ||
level: __WEBPACK_IMPORTED_MODULE_3__pnp_logging__["a" /* LogLevel */].Error, | ||
level: 3 /* Error */, | ||
message: "Error deleting expired cache entries, see data for details. Timeout not reset.", | ||
@@ -1392,0 +1344,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=4)}([function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=[]),this.keys=e,this.values=t}return e.prototype.get=function(e){var t=this.keys.indexOf(e);return t<0?null:this.values[t]},e.prototype.add=function(e,t){var n=this.keys.indexOf(e);n>-1?null===t?this.remove(e):this.values[n]=t:null!==t&&(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){var t=this;if("getKeys"in e){var n=e;n.getKeys().map(function(e){t.add(e,n.get(e))})}else{var r=e;for(var o in r)r.hasOwnProperty(o)&&this.add(o,r[o])}},e.prototype.remove=function(e){var t=this.keys.indexOf(e);if(t<0)return null;var n=this.values[t];return this.keys.splice(t,1),this.values.splice(t,1),n},e.prototype.getKeys=function(){return this.keys},e.prototype.getValues=function(){return this.values},e.prototype.clear=function(){this.keys=[],this.values=[]},e.prototype.count=function(){return this.keys.length},e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=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}()},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";n.d(t,"a",function(){return o}),n.d(t,"c",function(){return i}),n.d(t,"b",function(){return u});var r=n(0),o=function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}(),i=function(){function e(){this._v=new r.a,this._v.add(o.defaultCachingStore,"session"),this._v.add(o.defaultCachingTimeoutSeconds,60),this._v.add(o.globalCacheDisable,!1),this._v.add(o.enableCacheExpiration,!1),this._v.add(o.cacheExpirationIntervalMilliseconds,750),this._v.add(o.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(o.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(o.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(o.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(o.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(o.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(o.spfxContext)},enumerable:!0,configurable:!0}),e}(),a=new i,u=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5);n.d(t,"Util",function(){return r.i}),n.d(t,"readBlobAsText",function(){return r.o}),n.d(t,"readBlobAsArrayBuffer",function(){return r.n}),n.d(t,"Dictionary",function(){return r.b}),n.d(t,"mergeOptions",function(){return r.m}),n.d(t,"deprecated",function(){return r.k}),n.d(t,"beta",function(){return r.j}),n.d(t,"FunctionExpectedException",function(){return r.c}),n.d(t,"UrlException",function(){return r.h}),n.d(t,"CommonRuntimeConfigKeys",function(){return r.a}),n.d(t,"RuntimeConfigImpl",function(){return r.g}),n.d(t,"RuntimeConfig",function(){return r.f}),n.d(t,"mergeHeaders",function(){return r.l}),n.d(t,"PnPClientStorageWrapper",function(){return r.e}),n.d(t,"PnPClientStorage",function(){return r.d})},function(e,t,n){"use strict";var r=n(6);n.d(t,"n",function(){return r.a}),n.d(t,"o",function(){return r.b});var o=n(0);n.d(t,"b",function(){return o.a});var i=n(7);n.d(t,"m",function(){return i.a});var a=n(8);n.d(t,"j",function(){return a.a}),n.d(t,"k",function(){return a.b});var u=n(9);n.d(t,"c",function(){return u.a}),n.d(t,"h",function(){return u.b});var c=n(3);n.d(t,"a",function(){return c.a}),n.d(t,"f",function(){return c.b}),n.d(t,"g",function(){return c.c});var s=n(11);n.d(t,"l",function(){return s.a});var l=n(12);n.d(t,"d",function(){return l.a}),n.d(t,"e",function(){return l.b});var f=n(1);n.d(t,"i",function(){return f.a})},function(e,t,n){"use strict";function r(e){return i(e,"string")}function o(e){return i(e,"buffer")}function i(e,t){return new Promise(function(n,r){try{var o=new FileReader;switch(o.onload=function(e){n(e.target.result)},t){case"string":o.readAsText(e);break;case"buffer":o.readAsArrayBuffer(e)}}catch(e){r(e)}})}t.b=r,t.a=o},function(e,t,n){"use strict";function r(e,t){if(o.a.objectDefinedNotNull(t)){var n=o.a.extend(e.headers||{},t.headers);e=o.a.extend(e,t),e.headers=n}}t.a=r;var o=n(1)},function(e,t,n){"use strict";function r(e,t){return function(n,r,o){var a=o.value;o.value=function(){for(var u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return i.b.log({data:{descriptor:o,propertyKey:r,target:n},level:i.a.Warning,message:"("+e+") "+t}),a.apply(this,u)}}}function o(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(t,n,r){var o=r.value;r.value=function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];return i.b.log({data:{descriptor:r,propertyKey:n,target:t},level:i.a.Warning,message:e}),o.apply(this,a)}}}t.b=r,t.a=o;var i=n(2)},function(e,t,n){"use strict";n.d(t,"a",function(){return i}),n.d(t,"b",function(){return a});var r=n(10),o=n(2),i=function(e){function t(t){void 0===t&&(t="Expected a function.");var n=e.call(this,t)||this;return n.name="FunctionExpectedException",o.b.log({data:{},level:o.a.Error,message:"["+n.name+"]::"+n.message}),n}return r.a(t,e),t}(Error),a=function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",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";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 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=4)}([function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=[]),this.keys=e,this.values=t}return e.prototype.get=function(e){var t=this.keys.indexOf(e);return t<0?null:this.values[t]},e.prototype.add=function(e,t){var n=this.keys.indexOf(e);n>-1?null===t?this.remove(e):this.values[n]=t:null!==t&&(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){var t=this;if("getKeys"in e){var n=e;n.getKeys().map(function(e){t.add(e,n.get(e))})}else{var r=e;for(var o in r)r.hasOwnProperty(o)&&this.add(o,r[o])}},e.prototype.remove=function(e){var t=this.keys.indexOf(e);if(t<0)return null;var n=this.values[t];return this.keys.splice(t,1),this.values.splice(t,1),n},e.prototype.getKeys=function(){return this.keys},e.prototype.getValues=function(){return this.values},e.prototype.clear=function(){this.keys=[],this.values=[]},e.prototype.count=function(){return this.keys.length},e}()},function(e,t,n){"use strict";n.d(t,"a",function(){return r});var r=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}()},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 o),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}(),o=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";n.d(t,"a",function(){return o}),n.d(t,"c",function(){return i}),n.d(t,"b",function(){return u});var r=n(0),o=function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}(),i=function(){function e(){this._v=new r.a,this._v.add(o.defaultCachingStore,"session"),this._v.add(o.defaultCachingTimeoutSeconds,60),this._v.add(o.globalCacheDisable,!1),this._v.add(o.enableCacheExpiration,!1),this._v.add(o.cacheExpirationIntervalMilliseconds,750),this._v.add(o.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(o.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(o.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(o.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(o.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(o.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(o.spfxContext)},enumerable:!0,configurable:!0}),e}(),a=new i,u=a},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r=n(5);n.d(t,"Util",function(){return r.h}),n.d(t,"readBlobAsText",function(){return r.n}),n.d(t,"readBlobAsArrayBuffer",function(){return r.m}),n.d(t,"Dictionary",function(){return r.b}),n.d(t,"mergeOptions",function(){return r.l}),n.d(t,"deprecated",function(){return r.j}),n.d(t,"beta",function(){return r.i}),n.d(t,"UrlException",function(){return r.g}),n.d(t,"CommonRuntimeConfigKeys",function(){return r.a}),n.d(t,"RuntimeConfigImpl",function(){return r.f}),n.d(t,"RuntimeConfig",function(){return r.e}),n.d(t,"mergeHeaders",function(){return r.k}),n.d(t,"PnPClientStorageWrapper",function(){return r.d}),n.d(t,"PnPClientStorage",function(){return r.c})},function(e,t,n){"use strict";var r=n(6);n.d(t,"m",function(){return r.a}),n.d(t,"n",function(){return r.b});var o=n(0);n.d(t,"b",function(){return o.a});var i=n(7);n.d(t,"l",function(){return i.a});var a=n(8);n.d(t,"i",function(){return a.a}),n.d(t,"j",function(){return a.b});var u=n(9);n.d(t,"g",function(){return u.a});var c=n(3);n.d(t,"a",function(){return c.a}),n.d(t,"e",function(){return c.b}),n.d(t,"f",function(){return c.c});var s=n(11);n.d(t,"k",function(){return s.a});var l=n(12);n.d(t,"c",function(){return l.a}),n.d(t,"d",function(){return l.b});var f=n(1);n.d(t,"h",function(){return f.a})},function(e,t,n){"use strict";function r(e){return i(e,"string")}function o(e){return i(e,"buffer")}function i(e,t){return new Promise(function(n,r){try{var o=new FileReader;switch(o.onload=function(e){n(e.target.result)},t){case"string":o.readAsText(e);break;case"buffer":o.readAsArrayBuffer(e)}}catch(e){r(e)}})}t.b=r,t.a=o},function(e,t,n){"use strict";function r(e,t){if(o.a.objectDefinedNotNull(t)){var n=o.a.extend(e.headers||{},t.headers);e=o.a.extend(e,t),e.headers=n}}t.a=r;var o=n(1)},function(e,t,n){"use strict";function r(e,t){return function(n,r,o){var a=o.value;o.value=function(){for(var u=[],c=0;c<arguments.length;c++)u[c]=arguments[c];return i.a.log({data:{descriptor:o,propertyKey:r,target:n},level:2,message:"("+e+") "+t}),a.apply(this,u)}}}function o(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(t,n,r){var o=r.value;r.value=function(){for(var a=[],u=0;u<arguments.length;u++)a[u]=arguments[u];return i.a.log({data:{descriptor:r,propertyKey:n,target:t},level:2,message:e}),o.apply(this,a)}}}t.b=r,t.a=o;var i=n(2)},function(e,t,n){"use strict";n.d(t,"a",function(){return i});var r=n(10),o=n(2),i=function(e){function t(t){var n=e.call(this,t)||this;return n.name="UrlException",o.a.log({data:{},level:3,message:"["+n.name+"]::"+n.message}),n}return r.a(t,e),t}(Error)},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;/*! ***************************************************************************** | ||
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";function r(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}t.a=r},function(e,t,n){"use strict";n.d(t,"b",function(){return u}),n.d(t,"a",function(){return s});var r=n(1),o=n(0),i=n(3),a=n(2),u=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),i.b.enableCacheExpiration&&(a.b.write("Enabling cache expiration.",a.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?(a.b.write("Removing item with key '"+e+"' from cache due to expiration.",a.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=i.b.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=r.a.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;a.b.write("Called cache expiration handler.",a.a.Verbose),this.deleteExpired().then(function(t){setTimeout(r.a.getCtxCallback(e,e.cacheExpirationHandler),i.b.cacheExpirationIntervalMilliseconds)}).catch(function(e){a.b.log({data:e,level:a.a.Error,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),c=function(){function e(e){void 0===e&&(e=new o.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}(),s=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 u("undefined"!=typeof localStorage?localStorage:new c)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new u("undefined"!=typeof sessionStorage?sessionStorage:new c)),this._session},enumerable:!0,configurable:!0}),e}()}])}); | ||
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";function r(e,t){if(void 0!==t&&null!==t){new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})}}t.a=r},function(e,t,n){"use strict";n.d(t,"b",function(){return u}),n.d(t,"a",function(){return s});var r=n(1),o=n(0),i=n(3),a=n(2),u=function(){function e(e,t){void 0===t&&(t=-1),this.store=e,this.defaultTimeoutMinutes=t,this.enabled=this.test(),i.b.enableCacheExpiration&&(a.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?(a.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(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=i.b.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=r.a.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;a.a.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(r.a.getCtxCallback(e,e.cacheExpirationHandler),i.b.cacheExpirationIntervalMilliseconds)}).catch(function(e){a.a.log({data:e,level:3,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),c=function(){function e(e){void 0===e&&(e=new o.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}(),s=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 u("undefined"!=typeof localStorage?localStorage:new c)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new u("undefined"!=typeof sessionStorage?sessionStorage:new c)),this._session},enumerable:!0,configurable:!0}),e}()}])}); | ||
//# sourceMappingURL=common.es5.umd.bundle.min.js.map |
@@ -421,3 +421,3 @@ (function (global, factory) { | ||
}, | ||
level: logging.LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: "(" + deprecationVersion + ") " + message, | ||
@@ -444,3 +444,3 @@ }); | ||
}, | ||
level: logging.LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: message, | ||
@@ -453,13 +453,2 @@ }); | ||
var FunctionExpectedException = /** @class */ (function (_super) { | ||
tslib_1.__extends(FunctionExpectedException, _super); | ||
function FunctionExpectedException(msg) { | ||
if (msg === void 0) { msg = "Expected a function."; } | ||
var _this = _super.call(this, msg) || this; | ||
_this.name = "FunctionExpectedException"; | ||
logging.Logger.log({ data: {}, level: logging.LogLevel.Error, message: "[" + _this.name + "]::" + _this.message }); | ||
return _this; | ||
} | ||
return FunctionExpectedException; | ||
}(Error)); | ||
var UrlException = /** @class */ (function (_super) { | ||
@@ -470,3 +459,3 @@ tslib_1.__extends(UrlException, _super); | ||
_this.name = "UrlException"; | ||
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; | ||
@@ -586,3 +575,3 @@ } | ||
if (RuntimeConfig.enableCacheExpiration) { | ||
logging.Logger.write("Enabling cache expiration.", logging.LogLevel.Info); | ||
logging.Logger.write("Enabling cache expiration.", 1 /* Info */); | ||
this.cacheExpirationHandler(); | ||
@@ -606,3 +595,3 @@ } | ||
if (new Date(persistable.expiration) <= new Date()) { | ||
logging.Logger.write("Removing item with key '" + key + "' from cache due to expiration.", logging.LogLevel.Info); | ||
logging.Logger.write("Removing item with key '" + key + "' from cache due to expiration.", 1 /* Info */); | ||
this.delete(key); | ||
@@ -722,3 +711,3 @@ return null; | ||
var _this = this; | ||
logging.Logger.write("Called cache expiration handler.", logging.LogLevel.Verbose); | ||
logging.Logger.write("Called cache expiration handler.", 0 /* Verbose */); | ||
this.deleteExpired().then(function (_) { | ||
@@ -731,3 +720,3 @@ // call ourself in the future | ||
data: e, | ||
level: logging.LogLevel.Error, | ||
level: 3 /* Error */, | ||
message: "Error deleting expired cache entries, see data for details. Timeout not reset.", | ||
@@ -822,3 +811,2 @@ }); | ||
exports.beta = beta; | ||
exports.FunctionExpectedException = FunctionExpectedException; | ||
exports.UrlException = UrlException; | ||
@@ -825,0 +813,0 @@ exports.CommonRuntimeConfigKeys = CommonRuntimeConfigKeys; |
@@ -1,1 +0,1 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/logging"),require("tslib")):"function"==typeof define&&define.amd?define(["exports","@pnp/logging","tslib"],t):t((e.pnp=e.pnp||{},e.pnp.common={}),e.logging,e.tslib_1)}(this,function(e,t,n){"use strict";function r(e,t){return new Promise(function(n,r){try{var o=new FileReader;switch(o.onload=function(e){n(e.target.result)},t){case"string":o.readAsText(e);break;case"buffer":o.readAsArrayBuffer(e)}}catch(e){r(e)}})}var o=function(){function e(e,t){void 0===e&&(e=[]),void 0===t&&(t=[]),this.keys=e,this.values=t}return e.prototype.get=function(e){var t=this.keys.indexOf(e);return t<0?null:this.values[t]},e.prototype.add=function(e,t){var n=this.keys.indexOf(e);n>-1?null===t?this.remove(e):this.values[n]=t:null!==t&&(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){var t=this;if("getKeys"in e){var n=e;n.getKeys().map(function(e){t.add(e,n.get(e))})}else{var r=e;for(var o in r)r.hasOwnProperty(o)&&this.add(o,r[o])}},e.prototype.remove=function(e){var t=this.keys.indexOf(e);if(t<0)return null;var n=this.values[t];return this.keys.splice(t,1),this.values.splice(t,1),n},e.prototype.getKeys=function(){return this.keys},e.prototype.getValues=function(){return this.values},e.prototype.clear=function(){this.keys=[],this.values=[]},e.prototype.count=function(){return this.keys.length},e}(),i=function(){function e(){}return e.getCtxCallback=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}},e.urlParamExists=function(e){return e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),new RegExp("[\\?&]"+e+"=([^&#]*)").test(location.search)},e.getUrlParamByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.getUrlParamBoolByName=function(e){var t=this.getUrlParamByName(e);return!(""===t||/false|0/i.test(t))},e.stringInsert=function(e,t,n){return t>0?e.substring(0,t)+n+e.substring(t,e.length):n+e},e.dateAdd=function(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r},e.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var r=document.createElement("link");n[0].appendChild(r),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",e)}},e.combinePaths=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!e.stringIsNullOrEmpty(t)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")},e.getRandomString=function(e){for(var t=new Array(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;r<e;r++)t[r]=n.charAt(Math.floor(Math.random()*n.length));return t.join("")},e.getGUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},e.isFunction=function(e){return"function"==typeof e},e.objectDefinedNotNull=function(e){return void 0!==e&&null!==e},e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.stringIsNullOrEmpty=function(e){return void 0===e||null===e||e.length<1},e.extend=function(t,n,r){if(void 0===r&&(r=!1),!e.objectDefinedNotNull(n))return t;var o=r?function(e,t){return!(t in e)}:function(){return!0};return Object.getOwnPropertyNames(n).filter(function(e){return o(t,e)}).reduce(function(e,t){return e[t]=n[t],e},t)},e.isUrlAbsolute=function(e){return/^https?:\/\/|^\/\//i.test(e)},e}(),a=function(e){function r(n){void 0===n&&(n="Expected a function.");var r=e.call(this,n)||this;return r.name="FunctionExpectedException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return n.__extends(r,e),r}(Error),s=function(e){function r(n){var r=e.call(this,n)||this;return r.name="UrlException",t.Logger.log({data:{},level:t.LogLevel.Error,message:"["+r.name+"]::"+r.message}),r}return n.__extends(r,e),r}(Error),u=function(){function e(){}return e.defaultCachingStore="defaultCachingStore",e.defaultCachingTimeoutSeconds="defaultCachingTimeoutSeconds",e.globalCacheDisable="globalCacheDisable",e.enableCacheExpiration="enableCacheExpiration",e.cacheExpirationIntervalMilliseconds="cacheExpirationIntervalMilliseconds",e.spfxContext="spfxContext",e}(),l=function(){function e(){this._v=new o,this._v.add(u.defaultCachingStore,"session"),this._v.add(u.defaultCachingTimeoutSeconds,60),this._v.add(u.globalCacheDisable,!1),this._v.add(u.enableCacheExpiration,!1),this._v.add(u.cacheExpirationIntervalMilliseconds,750),this._v.add(u.spfxContext,null)}return e.prototype.extend=function(e){var t=this;Object.keys(e).forEach(function(n){t._v.add(n,e[n])})},e.prototype.get=function(e){return this._v.get(e)},Object.defineProperty(e.prototype,"defaultCachingStore",{get:function(){return this.get(u.defaultCachingStore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"defaultCachingTimeoutSeconds",{get:function(){return this.get(u.defaultCachingTimeoutSeconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"globalCacheDisable",{get:function(){return this.get(u.globalCacheDisable)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enableCacheExpiration",{get:function(){return this.get(u.enableCacheExpiration)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cacheExpirationIntervalMilliseconds",{get:function(){return this.get(u.cacheExpirationIntervalMilliseconds)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spfxContext",{get:function(){return this.get(u.spfxContext)},enumerable:!0,configurable:!0}),e}(),c=new l,f=function(){function e(e,n){void 0===n&&(n=-1),this.store=e,this.defaultTimeoutMinutes=n,this.enabled=this.test(),c.enableCacheExpiration&&(t.Logger.write("Enabling cache expiration.",t.LogLevel.Info),this.cacheExpirationHandler())}return e.prototype.get=function(e){if(!this.enabled)return null;var n=this.store.getItem(e);if(null==n)return null;var r=JSON.parse(n);return new Date(r.expiration)<=new Date?(t.Logger.write("Removing item with key '"+e+"' from cache due to expiration.",t.LogLevel.Info),this.delete(e),null):r.value},e.prototype.put=function(e,t,n){this.enabled&&this.store.setItem(e,this.createPersistable(t,n))},e.prototype.delete=function(e){this.enabled&&this.store.removeItem(e)},e.prototype.getOrPut=function(e,t,n){var r=this;return this.enabled?new Promise(function(o){var i=r.get(e);null==i?t().then(function(t){r.put(e,t,n),o(t)}):o(i)}):t()},e.prototype.deleteExpired=function(){var e=this;return new Promise(function(t,n){e.enabled||t();try{for(var r=0;r<e.store.length;r++){var o=e.store.key(r);null!==o&&/["|']?pnp["|']? ?: ?1/i.test(e.store.getItem(o))&&e.get(o)}t()}catch(e){n(e)}})},e.prototype.test=function(){try{return this.store.setItem("test","test"),this.store.removeItem("test"),!0}catch(e){return!1}},e.prototype.createPersistable=function(e,t){if(void 0===t){var n=c.defaultCachingTimeoutSeconds;this.defaultTimeoutMinutes>0&&(n=60*this.defaultTimeoutMinutes),t=i.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;t.Logger.write("Called cache expiration handler.",t.LogLevel.Verbose),this.deleteExpired().then(function(t){setTimeout(i.getCtxCallback(e,e.cacheExpirationHandler),c.cacheExpirationIntervalMilliseconds)}).catch(function(e){t.Logger.log({data:e,level:t.LogLevel.Error,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),p=function(){function e(e){void 0===e&&(e=new o),this._store=e}return Object.defineProperty(e.prototype,"length",{get:function(){return this._store.count()},enumerable:!0,configurable:!0}),e.prototype.clear=function(){this._store.clear()},e.prototype.getItem=function(e){return this._store.get(e)},e.prototype.key=function(e){return this._store.getKeys()[e]},e.prototype.removeItem=function(e){this._store.remove(e)},e.prototype.setItem=function(e,t){this._store.add(e,t)},e}(),g=function(){function e(e,t){void 0===e&&(e=null),void 0===t&&(t=null),this._local=e,this._session=t}return Object.defineProperty(e.prototype,"local",{get:function(){return null===this._local&&(this._local=new f("undefined"!=typeof localStorage?localStorage:new p)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new f("undefined"!=typeof sessionStorage?sessionStorage:new p)),this._session},enumerable:!0,configurable:!0}),e}();e.Util=i,e.readBlobAsText=function(e){return r(e,"string")},e.readBlobAsArrayBuffer=function(e){return r(e,"buffer")},e.Dictionary=o,e.mergeOptions=function(e,t){if(i.objectDefinedNotNull(t)){var n=i.extend(e.headers||{},t.headers);(e=i.extend(e,t)).headers=n}},e.deprecated=function(e,n){return function(r,o,i){var a=i.value;i.value=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return t.Logger.log({data:{descriptor:i,propertyKey:o,target:r},level:t.LogLevel.Warning,message:"("+e+") "+n}),a.apply(this,s)}}},e.beta=function(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(n,r,o){var i=o.value;o.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return t.Logger.log({data:{descriptor:o,propertyKey:r,target:n},level:t.LogLevel.Warning,message:e}),i.apply(this,a)}}},e.FunctionExpectedException=a,e.UrlException=s,e.CommonRuntimeConfigKeys=u,e.RuntimeConfigImpl=l,e.RuntimeConfig=c,e.mergeHeaders=function(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})},e.PnPClientStorageWrapper=f,e.PnPClientStorage=g,Object.defineProperty(e,"__esModule",{value:!0})}); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@pnp/logging"),require("tslib")):"function"==typeof define&&define.amd?define(["exports","@pnp/logging","tslib"],t):t((e.pnp=e.pnp||{},e.pnp.common={}),e.logging,e.tslib_1)}(this,function(e,t,n){"use strict";function r(e,t){return new Promise(function(n,r){try{var i=new FileReader;switch(i.onload=function(e){n(e.target.result)},t){case"string":i.readAsText(e);break;case"buffer":i.readAsArrayBuffer(e)}}catch(e){r(e)}})}var 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 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}(),o=function(){function e(){}return e.getCtxCallback=function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];return function(){t.apply(e,n)}},e.urlParamExists=function(e){return e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]"),new RegExp("[\\?&]"+e+"=([^&#]*)").test(location.search)},e.getUrlParamByName=function(e){e=e.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var t=new RegExp("[\\?&]"+e+"=([^&#]*)").exec(location.search);return null==t?"":decodeURIComponent(t[1].replace(/\+/g," "))},e.getUrlParamBoolByName=function(e){var t=this.getUrlParamByName(e);return!(""===t||/false|0/i.test(t))},e.stringInsert=function(e,t,n){return t>0?e.substring(0,t)+n+e.substring(t,e.length):n+e},e.dateAdd=function(e,t,n){var r=new Date(e);switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r},e.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var r=document.createElement("link");n[0].appendChild(r),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",e)}},e.combinePaths=function(){for(var t=[],n=0;n<arguments.length;n++)t[n]=arguments[n];return t.filter(function(t){return!e.stringIsNullOrEmpty(t)}).map(function(e){return e.replace(/^[\\|\/]/,"").replace(/[\\|\/]$/,"")}).join("/").replace(/\\/g,"/")},e.getRandomString=function(e){for(var t=new Array(e),n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=0;r<e;r++)t[r]=n.charAt(Math.floor(Math.random()*n.length));return t.join("")},e.getGUID=function(){var e=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var n=(e+16*Math.random())%16|0;return e=Math.floor(e/16),("x"===t?n:3&n|8).toString(16)})},e.isFunction=function(e){return"function"==typeof e},e.objectDefinedNotNull=function(e){return void 0!==e&&null!==e},e.isArray=function(e){return Array.isArray?Array.isArray(e):e&&"number"==typeof e.length&&e.constructor===Array},e.stringIsNullOrEmpty=function(e){return void 0===e||null===e||e.length<1},e.extend=function(t,n,r){if(void 0===r&&(r=!1),!e.objectDefinedNotNull(n))return t;var 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}(),a=function(e){function r(n){var r=e.call(this,n)||this;return r.name="UrlException",t.Logger.log({data:{},level:3,message:"["+r.name+"]::"+r.message}),r}return n.__extends(r,e),r}(Error),s=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}(),l=new u,c=function(){function e(e,n){void 0===n&&(n=-1),this.store=e,this.defaultTimeoutMinutes=n,this.enabled=this.test(),l.enableCacheExpiration&&(t.Logger.write("Enabling cache expiration.",1),this.cacheExpirationHandler())}return e.prototype.get=function(e){if(!this.enabled)return null;var n=this.store.getItem(e);if(null==n)return null;var r=JSON.parse(n);return new Date(r.expiration)<=new Date?(t.Logger.write("Removing item with key '"+e+"' from cache due to expiration.",1),this.delete(e),null):r.value},e.prototype.put=function(e,t,n){this.enabled&&this.store.setItem(e,this.createPersistable(t,n))},e.prototype.delete=function(e){this.enabled&&this.store.removeItem(e)},e.prototype.getOrPut=function(e,t,n){var r=this;return this.enabled?new Promise(function(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=o.dateAdd(new Date,"second",n)}return JSON.stringify({pnp:1,expiration:t,value:e})},e.prototype.cacheExpirationHandler=function(){var e=this;t.Logger.write("Called cache expiration handler.",0),this.deleteExpired().then(function(t){setTimeout(o.getCtxCallback(e,e.cacheExpirationHandler),l.cacheExpirationIntervalMilliseconds)}).catch(function(e){t.Logger.log({data:e,level:3,message:"Error deleting expired cache entries, see data for details. Timeout not reset."})})},e}(),f=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}(),p=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 c("undefined"!=typeof localStorage?localStorage:new f)),this._local},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"session",{get:function(){return null===this._session&&(this._session=new c("undefined"!=typeof sessionStorage?sessionStorage:new f)),this._session},enumerable:!0,configurable:!0}),e}();e.Util=o,e.readBlobAsText=function(e){return r(e,"string")},e.readBlobAsArrayBuffer=function(e){return r(e,"buffer")},e.Dictionary=i,e.mergeOptions=function(e,t){if(o.objectDefinedNotNull(t)){var n=o.extend(e.headers||{},t.headers);(e=o.extend(e,t)).headers=n}},e.deprecated=function(e,n){return function(r,i,o){var a=o.value;o.value=function(){for(var s=[],u=0;u<arguments.length;u++)s[u]=arguments[u];return t.Logger.log({data:{descriptor:o,propertyKey:i,target:r},level:2,message:"("+e+") "+n}),a.apply(this,s)}}},e.beta=function(e){return void 0===e&&(e="This feature is flagged as beta and is subject to change."),function(n,r,i){var o=i.value;i.value=function(){for(var a=[],s=0;s<arguments.length;s++)a[s]=arguments[s];return t.Logger.log({data:{descriptor:i,propertyKey:r,target:n},level:2,message:e}),o.apply(this,a)}}},e.UrlException=a,e.CommonRuntimeConfigKeys=s,e.RuntimeConfigImpl=u,e.RuntimeConfig=l,e.mergeHeaders=function(e,t){void 0!==t&&null!==t&&new Request("",{headers:t}).headers.forEach(function(t,n){e.append(n,t)})},e.PnPClientStorageWrapper=c,e.PnPClientStorage=p,Object.defineProperty(e,"__esModule",{value:!0})}); |
@@ -1,2 +0,2 @@ | ||
import { LogLevel, Logger } from '@pnp/logging'; | ||
import { Logger } from '@pnp/logging'; | ||
@@ -397,3 +397,3 @@ /** | ||
}, | ||
level: LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: `(${deprecationVersion}) ${message}`, | ||
@@ -415,3 +415,3 @@ }); | ||
}, | ||
level: LogLevel.Warning, | ||
level: 2 /* Warning */, | ||
message: message, | ||
@@ -424,9 +424,2 @@ }); | ||
class FunctionExpectedException extends Error { | ||
constructor(msg = "Expected a function.") { | ||
super(msg); | ||
this.name = "FunctionExpectedException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: `[${this.name}]::${this.message}` }); | ||
} | ||
} | ||
class UrlException extends Error { | ||
@@ -436,3 +429,3 @@ constructor(msg) { | ||
this.name = "UrlException"; | ||
Logger.log({ data: {}, level: LogLevel.Error, message: `[${this.name}]::${this.message}` }); | ||
Logger.log({ data: {}, level: 3 /* Error */, message: `[${this.name}]::${this.message}` }); | ||
} | ||
@@ -520,3 +513,3 @@ } | ||
if (RuntimeConfig.enableCacheExpiration) { | ||
Logger.write(`Enabling cache expiration.`, LogLevel.Info); | ||
Logger.write(`Enabling cache expiration.`, 1 /* Info */); | ||
this.cacheExpirationHandler(); | ||
@@ -540,3 +533,3 @@ } | ||
if (new Date(persistable.expiration) <= new Date()) { | ||
Logger.write(`Removing item with key '${key}' from cache due to expiration.`, LogLevel.Info); | ||
Logger.write(`Removing item with key '${key}' from cache due to expiration.`, 1 /* Info */); | ||
this.delete(key); | ||
@@ -653,3 +646,3 @@ return null; | ||
cacheExpirationHandler() { | ||
Logger.write("Called cache expiration handler.", LogLevel.Verbose); | ||
Logger.write("Called cache expiration handler.", 0 /* Verbose */); | ||
this.deleteExpired().then(_ => { | ||
@@ -662,3 +655,3 @@ // call ourself in the future | ||
data: e, | ||
level: LogLevel.Error, | ||
level: 3 /* Error */, | ||
message: "Error deleting expired cache entries, see data for details. Timeout not reset.", | ||
@@ -728,3 +721,3 @@ }); | ||
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, FunctionExpectedException, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage }; | ||
export { Util, readBlobAsText, readBlobAsArrayBuffer, Dictionary, mergeOptions, deprecated, beta, UrlException, CommonRuntimeConfigKeys, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, PnPClientStorageWrapper, PnPClientStorage }; | ||
//# sourceMappingURL=common.js.map |
{ | ||
"name": "@pnp/common", | ||
"version": "1.0.0-beta.3", | ||
"version": "1.0.0-beta.5", | ||
"description": "pnp - provides shared functionality across all pnp libraries", | ||
@@ -11,3 +11,3 @@ "main": "./dist/common.es5.umd.js", | ||
"peerDependencies": { | ||
"@pnp/logging": "1.0.0-beta.3" | ||
"@pnp/logging": "1.0.0-beta.5" | ||
}, | ||
@@ -14,0 +14,0 @@ "author": { |
@@ -1,6 +0,3 @@ | ||
export declare class FunctionExpectedException extends Error { | ||
constructor(msg?: string); | ||
} | ||
export declare class UrlException extends Error { | ||
constructor(msg: string); | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
548142
4095