@microsoft/sp-core-library
Advanced tools
Comparing version 1.3.4 to 1.4.0
@@ -5,2 +5,20 @@ { | ||
{ | ||
"version": "1.4.0", | ||
"tag": "@microsoft/sp-core-library_v1.4.0", | ||
"date": "Mon, 04 Dec 2017 18:15:58 GMT", | ||
"comments": { | ||
"patch": [ | ||
{ | ||
"comment": "Replace @types/es6-collections with the typescript compiler's built-in es2015.collection library" | ||
}, | ||
{ | ||
"comment": "Deprecated IServiceCollection and UrlQueryParameterCollection" | ||
}, | ||
{ | ||
"comment": "Remove beta tags from some APIs that are now officially supported" | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
"version": "1.3.4", | ||
@@ -7,0 +25,0 @@ "tag": "@microsoft/sp-core-library_v1.3.4", |
# Change Log - @microsoft/sp-core-library | ||
This log was last generated on Tue, 31 Oct 2017 17:41:22 GMT and should not be manually modified. | ||
This log was last generated on Mon, 04 Dec 2017 21:55:28 GMT and should not be manually modified. | ||
## 1.4.0 | ||
Mon, 04 Dec 2017 18:15:58 GMT | ||
### Patches | ||
- Replace @types/es6-collections with the typescript compiler's built-in es2015.collection library | ||
- Deprecated IServiceCollection and UrlQueryParameterCollection | ||
- Remove beta tags from some APIs that are now officially supported | ||
## 1.3.4 | ||
Thu, 26 Oct 2017 17:35:39 GMT | ||
*Changes not tracked* | ||
*Version update only* | ||
@@ -13,3 +22,3 @@ ## 1.3.0 | ||
*Changes not tracked* | ||
*Version update only* | ||
@@ -16,0 +25,0 @@ ## 1.2.0 |
@@ -5,3 +5,3 @@ { | ||
"componentType": "Library", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"manifestVersion": 2, | ||
@@ -20,7 +20,8 @@ "loaderConfig": { | ||
"type": "component", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"id": "73e1dc6c-8441-42cc-ad47-4bd3659f8a3a" | ||
} | ||
} | ||
} | ||
}, | ||
"isInternal": true | ||
} |
@@ -1,2 +0,2 @@ | ||
define("7263c7d0-1d6a-45ec-8d85-d4d1d234171b_1.3.4", ["@microsoft/sp-lodash-subset"], function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap | ||
define("7263c7d0-1d6a-45ec-8d85-d4d1d234171b_1.4.0", ["@microsoft/sp-lodash-subset"], function(__WEBPACK_EXTERNAL_MODULE_2__) { return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
@@ -137,3 +137,3 @@ /******/ var installedModules = {}; | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/***/ ((function(module, exports, __webpack_require__) { | ||
@@ -172,3 +172,3 @@ "use strict"; | ||
/***/ }), | ||
/***/ })), | ||
/* 1 */ | ||
@@ -208,3 +208,3 @@ /***/ (function(module, exports, __webpack_require__) { | ||
} | ||
return s.replace(Text.FORMAT_REGEX, function (match) { | ||
return s.replace(Text.FORMAT_REGEX, (function (match) { | ||
var matchId = parseInt(match.replace(Text.FORMAT_ARGS_REGEX, ''), 10); | ||
@@ -222,3 +222,3 @@ var matchValue = values[matchId]; | ||
return matchValue; | ||
}); | ||
})); | ||
}; | ||
@@ -287,3 +287,3 @@ Text.FORMAT_REGEX = /\{\d+\}/g; | ||
return 'AAAAAAAA-AAAA-4AAA-BAAA-AAAAAAAAAAAA'.replace(/[AB]/g, | ||
function (character) { | ||
(function (character) { | ||
var randomNumber = randomNumberGenerator ? randomNumberGenerator.generate() : Math.random(); | ||
@@ -293,3 +293,3 @@ var num = randomNumber * 16 | 0; | ||
return masked.toString(16); | ||
}); | ||
})); | ||
}; | ||
@@ -326,5 +326,5 @@ Guid.prototype.equals = function (guid) { | ||
Validate_1.default.isNotNullOrUndefined(serviceClass, 'serviceClass'); | ||
return ServiceKey.createCustom(name, function (serviceScope) { | ||
return ServiceKey.createCustom(name, (function (serviceScope) { | ||
return new serviceClass(serviceScope); | ||
}); | ||
})); | ||
}; | ||
@@ -511,25 +511,12 @@ ServiceKey.createCustom = function (name, defaultCreator) { | ||
}); | ||
EventManager.prototype._raiseEvent = function (eventName, eventArgs) { | ||
var _this = this; | ||
EventManager.prototype.raiseEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
EventManager.prototype.raiseStickyEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
this._raisedEvents.set(eventName, eventArgs); | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach(function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.apply(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
}); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
@@ -555,4 +542,5 @@ EventManager.prototype.registerEvent = function (eventName, observer, eventHandler) { | ||
} | ||
var filteredListeners = this._listeners.get(eventName).filter(function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; }); | ||
if (filteredListeners.length === this._listeners.get(eventName).length) { | ||
var listeners = this._listeners.get(eventName); | ||
var filteredListeners = listeners.filter((function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; })); | ||
if (filteredListeners.length === listeners.length) { | ||
var errorMessage = Text_1.default.format( | ||
@@ -564,2 +552,23 @@ 'Failed to remove event handler for component "{0}". Event handler was not registered.', observer.componentId); | ||
}; | ||
EventManager.prototype._raiseEventInternal = function (eventName, eventArgs) { | ||
var _this = this; | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach((function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.call(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
})); | ||
}; | ||
EventManager._logSource = 'EventManager'; | ||
@@ -627,2 +636,4 @@ return EventManager; | ||
exports._EventManager = EventManager_1.default; | ||
var DeferredClass_1 = __webpack_require__(28); | ||
exports._DeferredClass = DeferredClass_1.default; | ||
@@ -818,6 +829,6 @@ | ||
JsonUtilities._escapableChars.lastIndex = 0; | ||
return JsonUtilities._escapableChars.test(json) ? json.replace(this._escapableChars, function (a) { | ||
return JsonUtilities._escapableChars.test(json) ? json.replace(this._escapableChars, (function (a) { | ||
var c = JsonUtilities._substibuteChars[a]; | ||
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); | ||
}) : json; | ||
})) : json; | ||
}; | ||
@@ -849,8 +860,23 @@ JsonUtilities._escapableChars = /[\\\"\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; | ||
var Validate_1 = __webpack_require__(0); | ||
var URL_PROTOCOL_REGEX = /^\w+\:\/\//; | ||
var UrlUtilities = (function () { | ||
function UrlUtilities() { | ||
} | ||
UrlUtilities.resolve = function (url, baseUrl) { | ||
Validate_1.default.isNonemptyString(url, 'url'); | ||
Validate_1.default.isNonemptyString(baseUrl, 'baseUrl'); | ||
var isRelativeUrl = !url.match(URL_PROTOCOL_REGEX); | ||
if (isRelativeUrl) { | ||
return UrlUtilities.removeEndSlash(baseUrl) + "/" + UrlUtilities.removeLeadingSlash(url); | ||
} | ||
else { | ||
return url; | ||
} | ||
}; | ||
UrlUtilities.removeEndSlash = function (url) { | ||
return lodash.trimEnd(url, '/'); | ||
}; | ||
UrlUtilities.removeLeadingSlash = function (url) { | ||
return lodash.trimStart(url, '/'); | ||
}; | ||
UrlUtilities.convertToODataStringLiteral = function (value) { | ||
@@ -1235,5 +1261,12 @@ Validate_1.default.isNotNullOrUndefined(value, 'value'); | ||
} | ||
SPFlight.initialize = function (flights, debugFlights) { | ||
SPFlight.initialize = function (flights) { | ||
this._isInitialized = true; | ||
this._enabledFlightsMap = flights || []; | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
}; | ||
SPFlight.setDebugFlights = function (debugFlights) { | ||
if (!this._isInitialized) { | ||
throw new Error('Flights are not initialized. Can\'t set debug flights.'); | ||
} | ||
if (debugFlights && debugFlights.length > 0) { | ||
@@ -1243,9 +1276,9 @@ try { | ||
this._forceEnabledFlights = debugFlightStrings | ||
.filter(function (value) { return value[0] !== DISABLED_FLIGHT_PREFIX; }) | ||
.map(function (value) { return parseInt(value, 10); }) | ||
.filter(function (value) { return !isNaN(value); }); | ||
.filter((function (value) { return value[0] !== DISABLED_FLIGHT_PREFIX; })) | ||
.map((function (value) { return parseInt(value, 10); })) | ||
.filter((function (value) { return !isNaN(value); })); | ||
this._forceDisabledFlights = debugFlightStrings | ||
.filter(function (value) { return value[0] === DISABLED_FLIGHT_PREFIX; }) | ||
.map(function (value) { return parseInt(value.slice(1), 10); }) | ||
.filter(function (value) { return !isNaN(value); }); | ||
.filter((function (value) { return value[0] === DISABLED_FLIGHT_PREFIX; })) | ||
.map((function (value) { return parseInt(value.slice(1), 10); })) | ||
.filter((function (value) { return !isNaN(value); })); | ||
console.log("Debug flights are enabled."); | ||
@@ -1265,6 +1298,2 @@ if (this._forceEnabledFlights.length > 0) { | ||
} | ||
else { | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
} | ||
this._validateDebugFlights(); | ||
@@ -1318,3 +1347,3 @@ }; | ||
} | ||
SPKillSwitch.initialize = function (killSwitchGuids, debugKillswitches) { | ||
SPKillSwitch.initialize = function (killSwitchGuids) { | ||
this._isInitialized = true; | ||
@@ -1331,5 +1360,10 @@ this._activatedKillSwitches = new Map(); | ||
} | ||
}; | ||
SPKillSwitch.setDebugKillswitches = function (debugKillswitches) { | ||
if (!this._isInitialized && !false) { | ||
throw new Error('Killswitches are not initialized. Can\'t set debug killswitched.'); | ||
} | ||
if (debugKillswitches && debugKillswitches.length) { | ||
try { | ||
for (var killSwitch in debugKillswitches.split(',').map(function (value) { return Guid_1.default.tryParse(value); })) { | ||
for (var killSwitch in debugKillswitches.split(',').map((function (value) { return Guid_1.default.tryParse(value); }))) { | ||
if (killSwitch) { | ||
@@ -1352,3 +1386,3 @@ this._activatedKillSwitches.set(killSwitch.toString(), true); | ||
} | ||
return this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
return !!this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
}; | ||
@@ -1502,7 +1536,62 @@ SPKillSwitch._isInitialized = false; | ||
/***/ }) | ||
/***/ }), | ||
/* 28 */ | ||
/***/ ((function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var DeferredClass = (function () { | ||
function DeferredClass() { | ||
var _this = this; | ||
this._onAfterLoadPromise = new Promise(function (resolve) { return _this._resolveOnAfterLoadCallbacks = resolve; }); | ||
} | ||
DeferredClass.instance = function () { | ||
if (!this._instance) { | ||
this._instance = new this(); | ||
} | ||
return this._instance; | ||
}; | ||
Object.defineProperty(DeferredClass.prototype, "isLoaded", { | ||
get: function () { | ||
return !!this._classType; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DeferredClass.prototype, "shouldLoad", { | ||
get: function () { | ||
return true; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
DeferredClass.prototype.load = function () { | ||
var _this = this; | ||
if (!this._loadPromise) { | ||
if (this.shouldLoad) { | ||
this._loadPromise = this._internalLoad(); | ||
this._loadPromise.then((function (type) { | ||
_this._classType = type; | ||
_this._resolveOnAfterLoadCallbacks(); | ||
})); | ||
} | ||
else { | ||
this._loadPromise = Promise.reject(new Error('shouldLoad returns false')); | ||
} | ||
} | ||
return this._loadPromise; | ||
}; | ||
DeferredClass.prototype.onAfterLoad = function () { | ||
return this._onAfterLoadPromise; | ||
}; | ||
return DeferredClass; | ||
}()); | ||
exports.default = DeferredClass; | ||
/***/ })) | ||
/******/ ])}.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), | ||
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));; | ||
/***/ }), | ||
@@ -1509,0 +1598,0 @@ /* 1 */ |
@@ -1,2 +0,2 @@ | ||
define("7263c7d0-1d6a-45ec-8d85-d4d1d234171b_1.3.4", ["resx-strings","@microsoft/sp-lodash-subset"], function(__WEBPACK_EXTERNAL_MODULE_10__, __WEBPACK_EXTERNAL_MODULE_15__) { return /******/ (function(modules) { // webpackBootstrap | ||
define("7263c7d0-1d6a-45ec-8d85-d4d1d234171b_1.4.0", ["resx-strings","@microsoft/sp-lodash-subset"], (function(__WEBPACK_EXTERNAL_MODULE_10__, __WEBPACK_EXTERNAL_MODULE_15__) { return /******/ (function(modules) { // webpackBootstrap | ||
/******/ // The module cache | ||
@@ -68,3 +68,3 @@ /******/ var installedModules = {}; | ||
/* 0 */ | ||
/***/ (function(module, exports, __webpack_require__) { | ||
/***/ ((function(module, exports, __webpack_require__) { | ||
@@ -103,3 +103,3 @@ "use strict"; | ||
/***/ }), | ||
/***/ })), | ||
/* 1 */ | ||
@@ -139,3 +139,3 @@ /***/ (function(module, exports, __webpack_require__) { | ||
} | ||
return s.replace(Text.FORMAT_REGEX, function (match) { | ||
return s.replace(Text.FORMAT_REGEX, (function (match) { | ||
var matchId = parseInt(match.replace(Text.FORMAT_ARGS_REGEX, ''), 10); | ||
@@ -153,3 +153,3 @@ var matchValue = values[matchId]; | ||
return matchValue; | ||
}); | ||
})); | ||
}; | ||
@@ -218,3 +218,3 @@ Text.FORMAT_REGEX = /\{\d+\}/g; | ||
return 'AAAAAAAA-AAAA-4AAA-BAAA-AAAAAAAAAAAA'.replace(/[AB]/g, | ||
function (character) { | ||
(function (character) { | ||
var randomNumber = randomNumberGenerator ? randomNumberGenerator.generate() : Math.random(); | ||
@@ -224,3 +224,3 @@ var num = randomNumber * 16 | 0; | ||
return masked.toString(16); | ||
}); | ||
})); | ||
}; | ||
@@ -257,5 +257,5 @@ Guid.prototype.equals = function (guid) { | ||
Validate_1.default.isNotNullOrUndefined(serviceClass, 'serviceClass'); | ||
return ServiceKey.createCustom(name, function (serviceScope) { | ||
return ServiceKey.createCustom(name, (function (serviceScope) { | ||
return new serviceClass(serviceScope); | ||
}); | ||
})); | ||
}; | ||
@@ -442,25 +442,12 @@ ServiceKey.createCustom = function (name, defaultCreator) { | ||
}); | ||
EventManager.prototype._raiseEvent = function (eventName, eventArgs) { | ||
var _this = this; | ||
EventManager.prototype.raiseEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
EventManager.prototype.raiseStickyEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
this._raisedEvents.set(eventName, eventArgs); | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach(function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.apply(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
}); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
@@ -486,4 +473,5 @@ EventManager.prototype.registerEvent = function (eventName, observer, eventHandler) { | ||
} | ||
var filteredListeners = this._listeners.get(eventName).filter(function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; }); | ||
if (filteredListeners.length === this._listeners.get(eventName).length) { | ||
var listeners = this._listeners.get(eventName); | ||
var filteredListeners = listeners.filter((function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; })); | ||
if (filteredListeners.length === listeners.length) { | ||
var errorMessage = Text_1.default.format( | ||
@@ -495,2 +483,23 @@ 'Failed to remove event handler for component "{0}". Event handler was not registered.', observer.componentId); | ||
}; | ||
EventManager.prototype._raiseEventInternal = function (eventName, eventArgs) { | ||
var _this = this; | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach((function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.call(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
})); | ||
}; | ||
EventManager._logSource = 'EventManager'; | ||
@@ -558,2 +567,4 @@ return EventManager; | ||
exports._EventManager = EventManager_1.default; | ||
var DeferredClass_1 = __webpack_require__(28); | ||
exports._DeferredClass = DeferredClass_1.default; | ||
@@ -749,6 +760,6 @@ | ||
JsonUtilities._escapableChars.lastIndex = 0; | ||
return JsonUtilities._escapableChars.test(json) ? json.replace(this._escapableChars, function (a) { | ||
return JsonUtilities._escapableChars.test(json) ? json.replace(this._escapableChars, (function (a) { | ||
var c = JsonUtilities._substibuteChars[a]; | ||
return typeof c === 'string' ? c : '\\u' + ('0000' + a.charCodeAt(0).toString(16)).slice(-4); | ||
}) : json; | ||
})) : json; | ||
}; | ||
@@ -780,8 +791,23 @@ JsonUtilities._escapableChars = /[\\\"\'\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g; | ||
var Validate_1 = __webpack_require__(0); | ||
var URL_PROTOCOL_REGEX = /^\w+\:\/\//; | ||
var UrlUtilities = (function () { | ||
function UrlUtilities() { | ||
} | ||
UrlUtilities.resolve = function (url, baseUrl) { | ||
Validate_1.default.isNonemptyString(url, 'url'); | ||
Validate_1.default.isNonemptyString(baseUrl, 'baseUrl'); | ||
var isRelativeUrl = !url.match(URL_PROTOCOL_REGEX); | ||
if (isRelativeUrl) { | ||
return UrlUtilities.removeEndSlash(baseUrl) + "/" + UrlUtilities.removeLeadingSlash(url); | ||
} | ||
else { | ||
return url; | ||
} | ||
}; | ||
UrlUtilities.removeEndSlash = function (url) { | ||
return lodash.trimEnd(url, '/'); | ||
}; | ||
UrlUtilities.removeLeadingSlash = function (url) { | ||
return lodash.trimStart(url, '/'); | ||
}; | ||
UrlUtilities.convertToODataStringLiteral = function (value) { | ||
@@ -1166,5 +1192,12 @@ Validate_1.default.isNotNullOrUndefined(value, 'value'); | ||
} | ||
SPFlight.initialize = function (flights, debugFlights) { | ||
SPFlight.initialize = function (flights) { | ||
this._isInitialized = true; | ||
this._enabledFlightsMap = flights || []; | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
}; | ||
SPFlight.setDebugFlights = function (debugFlights) { | ||
if (!this._isInitialized) { | ||
throw new Error('Flights are not initialized. Can\'t set debug flights.'); | ||
} | ||
if (debugFlights && debugFlights.length > 0) { | ||
@@ -1174,9 +1207,9 @@ try { | ||
this._forceEnabledFlights = debugFlightStrings | ||
.filter(function (value) { return value[0] !== DISABLED_FLIGHT_PREFIX; }) | ||
.map(function (value) { return parseInt(value, 10); }) | ||
.filter(function (value) { return !isNaN(value); }); | ||
.filter((function (value) { return value[0] !== DISABLED_FLIGHT_PREFIX; })) | ||
.map((function (value) { return parseInt(value, 10); })) | ||
.filter((function (value) { return !isNaN(value); })); | ||
this._forceDisabledFlights = debugFlightStrings | ||
.filter(function (value) { return value[0] === DISABLED_FLIGHT_PREFIX; }) | ||
.map(function (value) { return parseInt(value.slice(1), 10); }) | ||
.filter(function (value) { return !isNaN(value); }); | ||
.filter((function (value) { return value[0] === DISABLED_FLIGHT_PREFIX; })) | ||
.map((function (value) { return parseInt(value.slice(1), 10); })) | ||
.filter((function (value) { return !isNaN(value); })); | ||
console.log("Debug flights are enabled."); | ||
@@ -1196,6 +1229,2 @@ if (this._forceEnabledFlights.length > 0) { | ||
} | ||
else { | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
} | ||
this._validateDebugFlights(); | ||
@@ -1249,3 +1278,3 @@ }; | ||
} | ||
SPKillSwitch.initialize = function (killSwitchGuids, debugKillswitches) { | ||
SPKillSwitch.initialize = function (killSwitchGuids) { | ||
this._isInitialized = true; | ||
@@ -1262,5 +1291,10 @@ this._activatedKillSwitches = new Map(); | ||
} | ||
}; | ||
SPKillSwitch.setDebugKillswitches = function (debugKillswitches) { | ||
if (!this._isInitialized && !false) { | ||
throw new Error('Killswitches are not initialized. Can\'t set debug killswitched.'); | ||
} | ||
if (debugKillswitches && debugKillswitches.length) { | ||
try { | ||
for (var killSwitch in debugKillswitches.split(',').map(function (value) { return Guid_1.default.tryParse(value); })) { | ||
for (var killSwitch in debugKillswitches.split(',').map((function (value) { return Guid_1.default.tryParse(value); }))) { | ||
if (killSwitch) { | ||
@@ -1283,3 +1317,3 @@ this._activatedKillSwitches.set(killSwitch.toString(), true); | ||
} | ||
return this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
return !!this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
}; | ||
@@ -1433,4 +1467,59 @@ SPKillSwitch._isInitialized = false; | ||
/***/ }) | ||
/******/ ])});; | ||
//# sourceMappingURL=sp-core-library.js.map | ||
/***/ }), | ||
/* 28 */ | ||
/***/ ((function(module, exports, __webpack_require__) { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var DeferredClass = (function () { | ||
function DeferredClass() { | ||
var _this = this; | ||
this._onAfterLoadPromise = new Promise(function (resolve) { return _this._resolveOnAfterLoadCallbacks = resolve; }); | ||
} | ||
DeferredClass.instance = function () { | ||
if (!this._instance) { | ||
this._instance = new this(); | ||
} | ||
return this._instance; | ||
}; | ||
Object.defineProperty(DeferredClass.prototype, "isLoaded", { | ||
get: function () { | ||
return !!this._classType; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
Object.defineProperty(DeferredClass.prototype, "shouldLoad", { | ||
get: function () { | ||
return true; | ||
}, | ||
enumerable: true, | ||
configurable: true | ||
}); | ||
DeferredClass.prototype.load = function () { | ||
var _this = this; | ||
if (!this._loadPromise) { | ||
if (this.shouldLoad) { | ||
this._loadPromise = this._internalLoad(); | ||
this._loadPromise.then((function (type) { | ||
_this._classType = type; | ||
_this._resolveOnAfterLoadCallbacks(); | ||
})); | ||
} | ||
else { | ||
this._loadPromise = Promise.reject(new Error('shouldLoad returns false')); | ||
} | ||
} | ||
return this._loadPromise; | ||
}; | ||
DeferredClass.prototype.onAfterLoad = function () { | ||
return this._onAfterLoadPromise; | ||
}; | ||
return DeferredClass; | ||
}()); | ||
exports.default = DeferredClass; | ||
/***/ })) | ||
/******/ ])}));; |
/** | ||
* DisplayMode indicates the mode in which a page and/or its contents (e.g. text and web parts) are dislayed. | ||
* Indicates whether a visual control should display itself for reading or for editing. | ||
* | ||
@@ -7,5 +7,13 @@ * @public | ||
declare enum DisplayMode { | ||
/** | ||
* The page, control, or editing surface is in a mode intended for reading. It may have some interactive | ||
* features, but the authoring controls are not enabled. | ||
*/ | ||
Read = 1, | ||
/** | ||
* The page, control, or editing surface is in a mode intended for authoring new content. It may display | ||
* editing panels or other controls that are not part of the normal reading experience. | ||
*/ | ||
Edit = 2, | ||
} | ||
export default DisplayMode; |
/** | ||
* An enum that describes which type of enviroment the framework is running in. | ||
* Indicates the general type of environment where the SharePoint Framework is running. | ||
* | ||
* @remarks | ||
* This enum is used by the {@link Environment.type} property. It provides a way to distinguish | ||
* environments where certain functionality may be limited or disabled. | ||
* | ||
* @public | ||
@@ -7,18 +12,21 @@ */ | ||
/** | ||
* Represents the scenario of the framework hosted in a unit/integration test. | ||
* Example: A developer running a unit test to verify changes to their web part. | ||
* Indicates that the SharePoint Framework is running inside a test harness, e.g. a unit test. | ||
* There may be no user interaction at all, and network access in general may be disabled. | ||
*/ | ||
Test = 0, | ||
/** | ||
* Represents the scenario of the framework hosted on a localhost server, which typically cannot | ||
* access any SharePoint REST APIs. | ||
* Example: A developer uses gulp serve command to test their changes in their browser of choice. | ||
* Indicates that the SharePoint Framework is running on a page from a "localhost" web server, | ||
* for example the SharePoint Workbench when hosted via "gulp serve". SharePoint REST API calls | ||
* will not be available, and in general network access may not authenticate properly. | ||
* Certain page context information may be using mock values for testing. | ||
*/ | ||
Local = 1, | ||
/** | ||
* Indicates that the framework was loaded by a client-rendered SharePoint page | ||
* Indicates that the SharePoint Framework is running on a modern SharePoint web page, | ||
* with full framework functionality. This is the normal usage scenario. | ||
*/ | ||
SharePoint = 2, | ||
/** | ||
* Indicates that the framework was loaded from a classic server-rendered SharePoint page | ||
* Indicates that the framework was hosted by a classic server-rendered SharePoint page. | ||
* Some functionality may be limited, e.g. various extensibility APIs may not be supported. | ||
*/ | ||
@@ -28,3 +36,3 @@ ClassicSharePoint = 3, | ||
/** | ||
* Interface for properties neccesary for building a Environment object. | ||
* Interface for properties necessary for building a Environment object. | ||
* @internal | ||
@@ -37,4 +45,3 @@ */ | ||
/** | ||
* This class contains contextual information about the enviroment that is hosting the framework and | ||
* its components. | ||
* Information about the system environment where the SharePoint Framework is running. | ||
* @public | ||
@@ -50,5 +57,5 @@ */ | ||
/** | ||
* An enum that describes which type of enviroment the framework is running in. | ||
* Indicates the general type of environment where the SharePoint Framework is running. | ||
*/ | ||
static readonly type: EnvironmentType; | ||
} |
import { IEventObserver } from './IEventObserver'; | ||
import EventArgs from './EventArgs'; | ||
/** | ||
* Representation of an event. | ||
* It exposes an event that third parties can attach handlers to. | ||
* Represents a framework event that components can subscribe to. | ||
* | ||
* @remarks | ||
* When an event is raised, its handlers are executed synchronously. | ||
* An event handler should not throw errors, although the system can recover from an error in a handler. | ||
* Event handlers should be fast. If they need to do expensive operations, they should use Promises for that. | ||
* Examples of events in a web application might include: the user clicking a button, the system navigating to | ||
* another page, or an item being added/removed from an abstract collection. The SharePoint Framework | ||
* represents events using instances of the Event object, one for each kind of event. The Event object | ||
* is typically exposed as a property of an associated class (e.g. the button that can be clicked). | ||
* When a component is interested in an event, it calls add() to register an event handler callback that | ||
* will be invoked each time the event occurs. The handler receives an EventArgs parameter that may | ||
* provide additional details about what happened. This is analogous to the browser's Document Object Model | ||
* (DOM) events. The main difference is the IEventObserver feature, which tracks which component subscribed | ||
* to each event, and automatically unsubscribes the handler when the component is disposed. | ||
* | ||
* @beta | ||
* When an event is raised, all handlers are invoked synchronously. The order in which event handlers | ||
* are called is unspecified. The event handler callback must catch any exceptions that occur during | ||
* processing; an uncaught exception will not prevent other handlers from executing, but it will be | ||
* reported as a problem with the associated component. | ||
* | ||
* @public | ||
*/ | ||
@@ -21,26 +31,27 @@ export default class Event<TEventArgs extends EventArgs> { | ||
/** | ||
* Registers an event handler callback that will be invoked whenever the event occurs. | ||
* The same object can add multiple event handlers to the same event. | ||
* Registers a callback that will be invoked whenever the event occurs. | ||
* | ||
* @remarks | ||
* Since BaseComponent implements the IEventObserver interface, a web part or extension can pass itself as | ||
* the observer. This will cause the event handler to be automatically unsubscribed when the web part | ||
* or extension is disposed. | ||
* The same object can add multiple event handlers to the same event. Since BaseComponent implements | ||
* the IEventObserver interface, a web part or extension can pass itself as the observer. This will cause | ||
* the event handler to be automatically unsubscribed when the web part or extension is disposed. | ||
* | ||
* @param observer - Indicates the object that is subscribing to the event: When the object is disposed, | ||
* the event handler will be automatically removed. | ||
* This object is also used for diagnostic purposes, e.g. if its event handler fails to trap an exception | ||
* @param eventHandler - A callback function that will be invoked whenever the event occurs. | ||
* the event handler will be automatically removed. This object is also used for diagnostic purposes, | ||
* e.g. detecting if the event handler failed to catch an exception. | ||
* @param eventHandler - A callback function that will be invoked whenever the event occurs | ||
*/ | ||
add(observer: IEventObserver, eventHandler: (eventArgs: TEventArgs) => void): void; | ||
/** | ||
* Removes an event handler to the event. | ||
* Only removes the event handler passed as input. | ||
* Unregisters a callback that was registered using add(). | ||
* | ||
* If the event handler has already been removed, or it was never added, this operation does nothing. | ||
* @remarks | ||
* If the event handler has already been removed, or if it was never added, then this | ||
* method has no effect. | ||
* | ||
* @param observer - Object that it's removing the event handler from the event | ||
* @param eventHandler - Event handler to remove. It must be the same object instance that was used in add. | ||
* @param observer - This must be the same observer that was passed to the add() function. | ||
* @param eventHandler - The event handler to remove; this must be the same object instance | ||
* that was passed to the add() function. | ||
*/ | ||
remove(observer: IEventObserver, eventHandler: (eventArgs: TEventArgs) => void): void; | ||
} |
/** | ||
* Base class for event arguments type. | ||
* Use as a parameter for the Event class to provide type safety on the event arguments. | ||
* The base class for event arguments used with the {@link Event} class. | ||
* | ||
* @beta | ||
* @remarks | ||
* If certain event types need to provide additional details, they will define a | ||
* subclass of EventArgs. | ||
* | ||
* @public | ||
*/ | ||
export default class EventArgs { | ||
} |
@@ -8,2 +8,8 @@ import { IEventObserver } from './IEventObserver'; | ||
* | ||
* There are two types of events: regular and sticky. | ||
* Sticky events are events that once raised, every listener that subscribed to the event will be automatically | ||
* executed as if the event was raised. | ||
* Sticky events are useful for framework-level notification, like when a system is initialized (every listener will | ||
* know the system is initialized). | ||
* | ||
* This is an internal architecture underlying the Event class, which provides a handy way to register and unregister | ||
@@ -26,8 +32,20 @@ * events, and provides the type safety. This class should not be exposed to third-parties directly. | ||
* Raises an event. | ||
* | ||
* After this is called, all components registered under the event will execute their callback. | ||
* @param eventName - Name of the event | ||
* @internal | ||
* @param eventArgs - Arguments of the event | ||
* @alpha | ||
*/ | ||
_raiseEvent<TEventArgs>(eventName: string, eventArgs: TEventArgs): void; | ||
raiseEvent<TEventArgs>(eventName: string, eventArgs: TEventArgs): void; | ||
/** | ||
* Raises a sticky event. | ||
* Sticky events are stored, so when new listeners are added to the event, they will be immediately notified. | ||
* | ||
* After this is called, all components registered under the event will execute their callback. | ||
* @param eventName - Name of the event | ||
* @param eventArgs - Arguments of the event | ||
* @alpha | ||
*/ | ||
raiseStickyEvent<TEventArgs>(eventName: string, eventArgs: TEventArgs): void; | ||
/** | ||
* Registers an event handler for an event. | ||
@@ -51,2 +69,12 @@ * @param eventName - Name of the event to register to. | ||
unregisterEvent<TEventArgs>(eventName: string, observer: IEventObserver, eventHandler: (eventArgs: TEventArgs) => void): void; | ||
/** | ||
* Private function to raise an event. | ||
* This include the shared functionality between raising sticky and regular events. | ||
* | ||
* After this is called, all components registered under the event will execute their callback. | ||
* @param eventName - Name of the event | ||
* @param eventArgs - Arguments of the event | ||
* @internal | ||
*/ | ||
private _raiseEventInternal<TEventArgs>(eventName, eventArgs); | ||
} |
@@ -21,25 +21,12 @@ "use strict"; | ||
}); | ||
EventManager.prototype._raiseEvent = function (eventName, eventArgs) { | ||
var _this = this; | ||
EventManager.prototype.raiseEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
EventManager.prototype.raiseStickyEvent = function (eventName, eventArgs) { | ||
Validate_1.default.isNonemptyString(eventName, 'eventName'); | ||
Validate_1.default.isNotNullOrUndefined(eventArgs, 'eventArgs'); | ||
this._raisedEvents.set(eventName, eventArgs); | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach(function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.apply(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
}); | ||
return this._raiseEventInternal(eventName, eventArgs); | ||
}; | ||
@@ -65,4 +52,5 @@ EventManager.prototype.registerEvent = function (eventName, observer, eventHandler) { | ||
} | ||
var filteredListeners = this._listeners.get(eventName).filter(function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; }); | ||
if (filteredListeners.length === this._listeners.get(eventName).length) { | ||
var listeners = this._listeners.get(eventName); | ||
var filteredListeners = listeners.filter(function (el) { return el.observer !== observer || el.eventHandler !== eventHandler; }); | ||
if (filteredListeners.length === listeners.length) { | ||
var errorMessage = Text_1.default.format( | ||
@@ -74,2 +62,23 @@ 'Failed to remove event handler for component "{0}". Event handler was not registered.', observer.componentId); | ||
}; | ||
EventManager.prototype._raiseEventInternal = function (eventName, eventArgs) { | ||
var _this = this; | ||
if (!this._listeners.has(eventName)) { | ||
return; | ||
} | ||
this._listeners.get(eventName).forEach(function (listener) { | ||
if (listener.observer.isDisposed) { | ||
_this.unregisterEvent(eventName, listener.observer, listener.eventHandler); | ||
} | ||
else { | ||
try { | ||
listener.eventHandler.call(listener.observer, eventArgs); | ||
} | ||
catch (e) { | ||
var errorMessage = Text_1.default.format( | ||
'Failed to execute event handler for component "{0}"', listener.observer.componentId); | ||
Log_1.default.error(EventManager._logSource, new Error(errorMessage)); | ||
} | ||
} | ||
}); | ||
}; | ||
EventManager._logSource = 'EventManager'; | ||
@@ -76,0 +85,0 @@ return EventManager; |
import { IDisposable } from '../IDisposable'; | ||
/** | ||
* Interface to define an object that can hook into events. | ||
* It is used by the event system to automatically remove unusued event handlers once the observer | ||
* has been disposed. | ||
* It is also used to detect performance and reliability issues in the event handling. | ||
* Used with the {@link Event} system, this interface is implemented by components that | ||
* can subscribe to events. | ||
* | ||
* @beta | ||
* @remarks | ||
* IEventObserver is an abstraction of the key features that a component must have in order | ||
* to subscribe to a SharePoint Framework event: It must have instanceId and componentId | ||
* information for diagnostics reporting, and it must have a way to notify the event system | ||
* when the component is disposed, so that its handlers can be automatically removed. | ||
* Other objects may implement this contract, as long as they meet these requirements. | ||
* | ||
* @public | ||
*/ | ||
export interface IEventObserver extends IDisposable { | ||
/** | ||
* Instance id of the parent component. | ||
* In the case of the component object, its own instance id. | ||
* The instance identifier for the component. | ||
* | ||
* @remarks | ||
* This will be used for diagnostic reporting, e.g. if the callback function has | ||
* an uncaught exception | ||
*/ | ||
readonly instanceId: string; | ||
/** | ||
* Component id of the parent component. | ||
* In the case of the component object, its own component id. | ||
* The component identifier, from the component's manifest. | ||
* | ||
* @remarks | ||
* This will be used for diagnostic reporting, e.g. if the callback function has | ||
* an uncaught exception | ||
*/ | ||
readonly componentId: string; | ||
} |
import { IRandomNumberGenerator } from './serviceScope/provider/RandomNumberGenerator'; | ||
/** | ||
* This class represents a globally unique identifier, as described by | ||
* IETF RFC 4122. The input string is normalized and validated, which provides | ||
* IETF RFC 4122. | ||
* | ||
* @remarks | ||
* The input string is normalized and validated, which provides | ||
* important guarantees that simplify other code that works with the GUID. | ||
@@ -10,3 +13,3 @@ * This class also provides basic support for generating a pseudo-random GUID; | ||
* | ||
* @see {@link https://www.ietf.org/rfc/rfc4122.txt} | ||
* See {@link https://www.ietf.org/rfc/rfc4122.txt | RFC4122} for more information. | ||
* | ||
@@ -28,3 +31,3 @@ * @public | ||
/** | ||
* Returns a new Guid instance with a pseudo-randomly generated Guid, according | ||
* Returns a new Guid instance with a pseudo-randomly generated GUID, according | ||
* to the version 4 UUID algorithm from RFC 4122. | ||
@@ -38,2 +41,3 @@ * | ||
* If the string cannot be parsed, then an error is thrown. | ||
* | ||
* @remarks | ||
@@ -52,2 +56,3 @@ * Example syntaxes accepted by this function: | ||
* If the string cannot be parsed, then undefined is returned. | ||
* | ||
* @remarks | ||
@@ -64,3 +69,3 @@ * Example syntaxes accepted by this function: | ||
/** | ||
* Indicates whether a guid is valid, i.e. whether it would be successfully | ||
* Indicates whether a GUID is valid, i.e. whether it would be successfully | ||
* parsed by Guid.tryParse(). This function is cheaper than Guid.tryParse() | ||
@@ -86,3 +91,3 @@ * because it does not construct a Guid object. | ||
* @param guid - Guid to be normalized, could already be normalized. | ||
* @return Normalized guid. | ||
* @returns Normalized guid. | ||
*/ | ||
@@ -93,3 +98,3 @@ private static _normalize(guid); | ||
* | ||
* @return A valid guid (according to RFC4122) | ||
* @returns A valid guid (according to RFC4122) | ||
*/ | ||
@@ -105,5 +110,6 @@ private static _generateGuid(randomNumberGenerator); | ||
/** | ||
* Object.prototype.toString override | ||
* Returns a string representation of the GUID | ||
* | ||
* @returns The GUID value in lowercase hexadecimal without braces. | ||
* | ||
* Example: 'd5369f3b-bd7a-412a-9c0f-7f0650bb5489' | ||
@@ -113,6 +119,6 @@ */ | ||
/** | ||
* Use Guid.parse() or Guid.tryParse() instead of the constructor. | ||
* @param guid - a normalized, already valid Guid string | ||
*/ | ||
* Use Guid.parse() or Guid.tryParse() instead of the constructor. | ||
* @param guid - a normalized, already valid Guid string | ||
*/ | ||
private constructor(); | ||
} |
/** | ||
* Interface for classes that can be disposed. | ||
* @beta | ||
* Implemented by an object that supports a disposal lifecycle. | ||
* | ||
* @remarks | ||
* The dispose event allows an object to free any resources that it allocated | ||
* before its lifecycle ends. | ||
* | ||
* @public | ||
*/ | ||
export interface IDisposable { | ||
/** | ||
* Returns true if the component has been already disposed. | ||
* Returns true if the dispose() method has been called. Once an object is disposed, | ||
* it remains in this state permanently. | ||
* | ||
* @remarks | ||
* After the object has been disposed, do not call its methods or access its properties. | ||
*/ | ||
isDisposed: boolean; | ||
/** | ||
* Disposes the component. | ||
* In order to write component-specific dispose mechanism, use onDispose instead. | ||
* This method is called to permanently dispose the object. | ||
* | ||
* @remarks | ||
* After the object has been disposed, do not call its methods or access its properties. | ||
*/ | ||
dispose(): void; | ||
} |
@@ -28,1 +28,2 @@ export { default as _BrowserDetection, Browser as _Browser, IBrowserInformation as _IBrowserInformation, OS as _OS } from './BrowserDetection'; | ||
export { IEventObserver } from './events/IEventObserver'; | ||
export { default as _DeferredClass } from './deferredClass/DeferredClass'; |
@@ -52,1 +52,3 @@ "use strict"; | ||
exports._EventManager = EventManager_1.default; | ||
var DeferredClass_1 = require("./deferredClass/DeferredClass"); | ||
exports._DeferredClass = DeferredClass_1.default; |
/** | ||
* Utililty code to help manipulate JSON objects/strings. | ||
* @see {@link http://www.json.org} | ||
* See {@link http://www.json.org} for more information. | ||
* | ||
@@ -5,0 +5,0 @@ * @alpha |
@@ -1,4 +0,1 @@ | ||
/** | ||
* @copyright Microsoft Corporation. All rights reserved. | ||
*/ | ||
import ILogHandler from './ILogHandler'; | ||
@@ -5,0 +2,0 @@ import ServiceScope from '../serviceScope/ServiceScope'; |
@@ -9,3 +9,3 @@ "use strict"; | ||
DefaultLogHandler.prototype.verbose = function (source, message, scope) { | ||
if (DEBUG && !UNIT_TEST) { | ||
if (DEBUG && !DEPRECATED_UNIT_TEST) { | ||
console.log(Text_1.default.format(SPCoreLibraryStrings_resx_1.default.logVerboseLevelMessage, source)); | ||
@@ -15,3 +15,3 @@ } | ||
DefaultLogHandler.prototype.info = function (source, message, scope) { | ||
if (DEBUG && !UNIT_TEST) { | ||
if (DEBUG && !DEPRECATED_UNIT_TEST) { | ||
console.info(Text_1.default.format(SPCoreLibraryStrings_resx_1.default.logInfoLevelMessage, source)); | ||
@@ -21,3 +21,3 @@ } | ||
DefaultLogHandler.prototype.warn = function (source, message, scope) { | ||
if (DEBUG && !UNIT_TEST) { | ||
if (DEBUG && !DEPRECATED_UNIT_TEST) { | ||
console.warn(Text_1.default.format(SPCoreLibraryStrings_resx_1.default.logWarningLevelMessage, source)); | ||
@@ -27,3 +27,3 @@ } | ||
DefaultLogHandler.prototype.error = function (source, error, scope) { | ||
if (DEBUG && !UNIT_TEST) { | ||
if (DEBUG && !DEPRECATED_UNIT_TEST) { | ||
console.error(Text_1.default.format(SPCoreLibraryStrings_resx_1.default.logErrorLevelMessage, source, error.message)); | ||
@@ -30,0 +30,0 @@ } |
@@ -7,5 +7,9 @@ /** | ||
/** | ||
* A basic redirectable logging system. | ||
* | ||
* @remarks | ||
* The Log class provides static methods for logging messages at different levels (verbose, | ||
* info, warning, error) and with context information. Context information helps identify | ||
* which component generated the messages and makes the messages useful and filterable. | ||
* which component generated the messages and allows for filtering of log events. In a | ||
* SharePoint Framework application, these messages will appear on the developer dashboard. | ||
* | ||
@@ -23,3 +27,4 @@ * @public | ||
/** | ||
* Logs a verbose message | ||
* Logs a message which contains detailed information that is generally only needed for | ||
* troubleshooting. | ||
* @param source - the source from where the message is logged, e.g., the class name. | ||
@@ -35,3 +40,3 @@ * The source provides context information for the logged message. | ||
/** | ||
* Logs an informational message | ||
* Logs a general informational message. | ||
* @param source - the source from where the message is logged, e.g., the class name. | ||
@@ -47,3 +52,3 @@ * The source provides context information for the logged message. | ||
/** | ||
* Logs a warning | ||
* Logs a warning. | ||
* @param source - the source from where the message is logged, e.g., the class name. | ||
@@ -59,3 +64,3 @@ * The source provides context information for the logged message. | ||
/** | ||
* Logs an error | ||
* Logs an error. | ||
* @param source - the source from where the error is logged, e.g., the class name. | ||
@@ -62,0 +67,0 @@ * The source provides context information for the logged error. |
define([], function() { | ||
var strings = { | ||
"_gIErrcTokcw+/VVwa+ReIA": { | ||
"invalidEnvironmentTypeError": "[!!--##***ĖƞvīřőŋmėʼnŧŢɏƥę ĭŝ ĩńvǻľįđ##--!!]", | ||
"invalidGuidStringError": "[!!--##***Ĭƞväĺĭď ĞŨĮĐ şŧŕĭŋġ: \"{0}\"##--!!]", | ||
"isFalseValidateError": "[!!--##***Ţħȅ vãĺũĕ ƒŏŗ \"{0}\" ĭş ƒąŀşĕ##--!!]", | ||
"isNullValidateError": "[!!--##***Ţĥę vǻłũę ƒōŗ \"{0}\" mũśţ ʼnŏť ƅȇ ņŭŀľ##--!!]", | ||
"isUndefinedValidateError": "[!!--##***Ŧħę väĺŭē ƒơŗ \"{0}\" můšŧ ŋōţ Ƅě ŭņđēƒīʼnĕď##--!!]", | ||
"isEmptyStringValidateError": "[!!--##***Ŧħē váļūȅ ƒōŕ \"{0}\" műşţ ńőť ɓȇ âņ ęmƥŧŷ šťŗıƞĝ##--!!]", | ||
"invalidVersionStringError": "[!!--##***Ĩʼnvâĺįđ vęřšīőņ ŝŧřıƞġ: \"{0}\"##--!!]", | ||
"logVerboseLevelMessage": "[!!--##***{0}: VĘŘʙŐŜĘ {1}##--!!]", | ||
"invalidEnvironmentTypeError": "[!!--##***ĖŋvīřơńmȅńťŦƴƿě īś įňväľĩď##--!!]", | ||
"invalidGuidStringError": "[!!--##***Ĭƞvàľīď ĞŪİƊ śţřīńģ: \"{0}\"##--!!]", | ||
"isFalseValidateError": "[!!--##***Ŧĥę vǻļŭę ƒơŕ \"{0}\" ĩş ƒáľšĕ##--!!]", | ||
"isNullValidateError": "[!!--##***Ŧħȅ vãŀůę ƒŏŕ \"{0}\" mųŝŧ ņōŧ Ƅē ʼnűľŀ##--!!]", | ||
"isUndefinedValidateError": "[!!--##***Ŧħȇ vȃŀůȇ ƒőŗ \"{0}\" mūśť ʼnőŧ ƀȇ űńďȅƒıņȇď##--!!]", | ||
"isEmptyStringValidateError": "[!!--##***Ŧĥȇ váľũȅ ƒōř \"{0}\" mųśţ ʼnōţ ɓȇ ąƞ ēmƥţȳ šťŗĭņğ##--!!]", | ||
"invalidVersionStringError": "[!!--##***Īƞvāĺīď vęřśįōň şťŗĩƞġ: \"{0}\"##--!!]", | ||
"logVerboseLevelMessage": "[!!--##***{0}: VȄŔʙŌŠĚ {1}##--!!]", | ||
"logInfoLevelMessage": "[!!--##***{0}: {1}##--!!]", | ||
"logWarningLevelMessage": "[!!--##***{0}: ŴÅŘŇĬƝĢ {1}##--!!]", | ||
"logErrorLevelMessage": "[!!--##***{0}: ĘŔŖƠƦ: {1}##--!!]", | ||
"serviceScopeConsumingBeforeFinished": "[!!--##***Ćȃňŋơţ ćőňśůmě ŝėŕvįĉȅš Ƅėćâŭšē ŧĥě şćōƿė įş ņōŧ ƒĭƞįśĥėđ ɏěť##--!!]", | ||
"serviceScopeConsumingDuringAutoCreation": "[!!--##***Ćǻʼnŋŏť ċơŋšųmę śȇřvīĉėŝ ďůŗįƞĝ ŠėŕvĭĉęŚčơƿĕ åūťŏčŗȇâťĭŏƞ##--!!]", | ||
"serviceScopeAlreadyFinishedError": "[!!--##***Ŧħē ŚėŕvıċěŠčőƿȇ ĭŝ ǻĺŗĕȃđŷ ƒīŋĩšĥėď##--!!]", | ||
"serviceScopeProvideServiceAfterFinishedError": "[!!--##***Čǻŋʼnōţ ŕĕģįšŧėř şęŗvĩćě ɓėĉăūşę ŧĥȇ śčōƥȅ īś ȃŀŕęȁđƴ ƒįƞįšĥȅď##--!!]", | ||
"serviceScopeProvideServiceThatAlreadyExists": "[!!--##***Ŧĥę şēŕvĭċȇ ķėƴ \"{0}\" ĥăş âŀŗȇäđŷ Ƅėȇņ ŗēğĭšťėřēď ĩŋ ŧĥĩś şćōƿē##--!!]", | ||
"spErrorInnerErrorText": "[!!--##***ĮƝŅĚŔĚŖŘŐƦ:##--!!]", | ||
"spErrorCallStackText": "[!!--##***ĈǺĿĻŞŤĂČĶ:##--!!]", | ||
"spErrorLogPropertiesText": "[!!--##***ŁŎĢƤŖƠƤȄŘŦĮĘŞ:##--!!]" | ||
"logWarningLevelMessage": "[!!--##***{0}: ŴÃƦŊĮƝĢ {1}##--!!]", | ||
"logErrorLevelMessage": "[!!--##***{0}: ĘŔŔŌƦ: {1}##--!!]", | ||
"serviceScopeConsumingBeforeFinished": "[!!--##***Ćãňƞơť ćőŋśũmė ŝěŗvĭċĕŝ Ƃȅċâũşě ţħě şćŏƿē ıŝ ňơť ƒıʼnīşĥȇď ȳȅť##--!!]", | ||
"serviceScopeConsumingDuringAutoCreation": "[!!--##***Ċäƞƞōŧ ćőņšųmě šȇŗvıċěš đųřįňġ ŞȇŗvįċěŚĉōƿȅ ăűŧőćŗȇāťĩőʼn##--!!]", | ||
"serviceScopeAlreadyFinishedError": "[!!--##***Ťĥē ŚȅŕvĭčȇŚĉŏƥė ĩś àĺŗęàďƴ ƒıņīšĥĕď##--!!]", | ||
"serviceScopeProvideServiceAfterFinishedError": "[!!--##***Čäņŋőţ ŗěğıŝťěŕ śȇřvıĉě ƀěċâűšę ŧĥę ŝċơƿę įş āĺŗȅȁďɏ ƒıńĩŝħęđ##--!!]", | ||
"serviceScopeProvideServiceThatAlreadyExists": "[!!--##***Ţĥě şȅŗvĩċē ĸēŷ \"{0}\" ħȁš äłřȇǻđƴ Ƃěȇŋ ŗĕġĩŝŧėřȇď ĭƞ ŧĥįš ščơƥě##--!!]", | ||
"spErrorInnerErrorText": "[!!--##***ĬŇŅĖŖĒƦƦŎŖ:##--!!]", | ||
"spErrorCallStackText": "[!!--##***ĊÄĽĹŞŢÁĈƘ:##--!!]", | ||
"spErrorLogPropertiesText": "[!!--##***ĹƠĠƤŔŌƤĔŘŤİĚŚ:##--!!]" | ||
} | ||
@@ -24,0 +24,0 @@ }; |
{ | ||
"_gIErrcTokcw+/VVwa+ReIA": { | ||
"invalidEnvironmentTypeError": "[!!--##***ĖƞvīřőŋmėʼnŧŢɏƥę ĭŝ ĩńvǻľįđ##--!!]", | ||
"invalidGuidStringError": "[!!--##***Ĭƞväĺĭď ĞŨĮĐ şŧŕĭŋġ: \"{0}\"##--!!]", | ||
"isFalseValidateError": "[!!--##***Ţħȅ vãĺũĕ ƒŏŗ \"{0}\" ĭş ƒąŀşĕ##--!!]", | ||
"isNullValidateError": "[!!--##***Ţĥę vǻłũę ƒōŗ \"{0}\" mũśţ ʼnŏť ƅȇ ņŭŀľ##--!!]", | ||
"isUndefinedValidateError": "[!!--##***Ŧħę väĺŭē ƒơŗ \"{0}\" můšŧ ŋōţ Ƅě ŭņđēƒīʼnĕď##--!!]", | ||
"isEmptyStringValidateError": "[!!--##***Ŧħē váļūȅ ƒōŕ \"{0}\" műşţ ńőť ɓȇ âņ ęmƥŧŷ šťŗıƞĝ##--!!]", | ||
"invalidVersionStringError": "[!!--##***Ĩʼnvâĺįđ vęřšīőņ ŝŧřıƞġ: \"{0}\"##--!!]", | ||
"logVerboseLevelMessage": "[!!--##***{0}: VĘŘʙŐŜĘ {1}##--!!]", | ||
"invalidEnvironmentTypeError": "[!!--##***ĖŋvīřơńmȅńťŦƴƿě īś įňväľĩď##--!!]", | ||
"invalidGuidStringError": "[!!--##***Ĭƞvàľīď ĞŪİƊ śţřīńģ: \"{0}\"##--!!]", | ||
"isFalseValidateError": "[!!--##***Ŧĥę vǻļŭę ƒơŕ \"{0}\" ĩş ƒáľšĕ##--!!]", | ||
"isNullValidateError": "[!!--##***Ŧħȅ vãŀůę ƒŏŕ \"{0}\" mųŝŧ ņōŧ Ƅē ʼnűľŀ##--!!]", | ||
"isUndefinedValidateError": "[!!--##***Ŧħȇ vȃŀůȇ ƒőŗ \"{0}\" mūśť ʼnőŧ ƀȇ űńďȅƒıņȇď##--!!]", | ||
"isEmptyStringValidateError": "[!!--##***Ŧĥȇ váľũȅ ƒōř \"{0}\" mųśţ ʼnōţ ɓȇ ąƞ ēmƥţȳ šťŗĭņğ##--!!]", | ||
"invalidVersionStringError": "[!!--##***Īƞvāĺīď vęřśįōň şťŗĩƞġ: \"{0}\"##--!!]", | ||
"logVerboseLevelMessage": "[!!--##***{0}: VȄŔʙŌŠĚ {1}##--!!]", | ||
"logInfoLevelMessage": "[!!--##***{0}: {1}##--!!]", | ||
"logWarningLevelMessage": "[!!--##***{0}: ŴÅŘŇĬƝĢ {1}##--!!]", | ||
"logErrorLevelMessage": "[!!--##***{0}: ĘŔŖƠƦ: {1}##--!!]", | ||
"serviceScopeConsumingBeforeFinished": "[!!--##***Ćȃňŋơţ ćőňśůmě ŝėŕvįĉȅš Ƅėćâŭšē ŧĥě şćōƿė įş ņōŧ ƒĭƞįśĥėđ ɏěť##--!!]", | ||
"serviceScopeConsumingDuringAutoCreation": "[!!--##***Ćǻʼnŋŏť ċơŋšųmę śȇřvīĉėŝ ďůŗįƞĝ ŠėŕvĭĉęŚčơƿĕ åūťŏčŗȇâťĭŏƞ##--!!]", | ||
"serviceScopeAlreadyFinishedError": "[!!--##***Ŧħē ŚėŕvıċěŠčőƿȇ ĭŝ ǻĺŗĕȃđŷ ƒīŋĩšĥėď##--!!]", | ||
"serviceScopeProvideServiceAfterFinishedError": "[!!--##***Čǻŋʼnōţ ŕĕģįšŧėř şęŗvĩćě ɓėĉăūşę ŧĥȇ śčōƥȅ īś ȃŀŕęȁđƴ ƒįƞįšĥȅď##--!!]", | ||
"serviceScopeProvideServiceThatAlreadyExists": "[!!--##***Ŧĥę şēŕvĭċȇ ķėƴ \"{0}\" ĥăş âŀŗȇäđŷ Ƅėȇņ ŗēğĭšťėřēď ĩŋ ŧĥĩś şćōƿē##--!!]", | ||
"spErrorInnerErrorText": "[!!--##***ĮƝŅĚŔĚŖŘŐƦ:##--!!]", | ||
"spErrorCallStackText": "[!!--##***ĈǺĿĻŞŤĂČĶ:##--!!]", | ||
"spErrorLogPropertiesText": "[!!--##***ŁŎĢƤŖƠƤȄŘŦĮĘŞ:##--!!]" | ||
"logWarningLevelMessage": "[!!--##***{0}: ŴÃƦŊĮƝĢ {1}##--!!]", | ||
"logErrorLevelMessage": "[!!--##***{0}: ĘŔŔŌƦ: {1}##--!!]", | ||
"serviceScopeConsumingBeforeFinished": "[!!--##***Ćãňƞơť ćőŋśũmė ŝěŗvĭċĕŝ Ƃȅċâũşě ţħě şćŏƿē ıŝ ňơť ƒıʼnīşĥȇď ȳȅť##--!!]", | ||
"serviceScopeConsumingDuringAutoCreation": "[!!--##***Ċäƞƞōŧ ćőņšųmě šȇŗvıċěš đųřįňġ ŞȇŗvįċěŚĉōƿȅ ăűŧőćŗȇāťĩőʼn##--!!]", | ||
"serviceScopeAlreadyFinishedError": "[!!--##***Ťĥē ŚȅŕvĭčȇŚĉŏƥė ĩś àĺŗęàďƴ ƒıņīšĥĕď##--!!]", | ||
"serviceScopeProvideServiceAfterFinishedError": "[!!--##***Čäņŋőţ ŗěğıŝťěŕ śȇřvıĉě ƀěċâűšę ŧĥę ŝċơƿę įş āĺŗȅȁďɏ ƒıńĩŝħęđ##--!!]", | ||
"serviceScopeProvideServiceThatAlreadyExists": "[!!--##***Ţĥě şȅŗvĩċē ĸēŷ \"{0}\" ħȁš äłřȇǻđƴ Ƃěȇŋ ŗĕġĩŝŧėřȇď ĭƞ ŧĥįš ščơƥě##--!!]", | ||
"spErrorInnerErrorText": "[!!--##***ĬŇŅĖŖĒƦƦŎŖ:##--!!]", | ||
"spErrorCallStackText": "[!!--##***ĊÄĽĹŞŢÁĈƘ:##--!!]", | ||
"spErrorLogPropertiesText": "[!!--##***ĹƠĠƤŔŌƤĔŘŤİĚŚ:##--!!]" | ||
} | ||
} |
define([], function() { | ||
var strings = { | ||
"_gIErrcTokcw+/VVwa+ReIA": { | ||
"invalidEnvironmentTypeError": "***ĚŋvĭřơňmēʼnťŤɏƿě ĭş įňvàļıđ", | ||
"invalidGuidStringError": "***Ĩńvãļįď ĠŬĮĎ ŝŧŗįņģ: \"{0}\"", | ||
"isFalseValidateError": "***Ťħě vãŀŭȅ ƒōř \"{0}\" ĩŝ ƒǻłŝę", | ||
"isNullValidateError": "***Ŧĥĕ vǻľůę ƒőř \"{0}\" mūşť ʼnőţ ƅę ƞūļľ", | ||
"isUndefinedValidateError": "***Ťħę vãłŭȅ ƒőř \"{0}\" můśţ ńŏţ Ƃĕ űńđěƒıńȇď", | ||
"isEmptyStringValidateError": "***Ťħę vȁľűē ƒŏŗ \"{0}\" můŝť ńōţ Ƅě åň ėmƿţɏ šŧřĭŋģ", | ||
"invalidVersionStringError": "***Įņväłıđ vȅŗşįōń ŝţřįŋĝ: \"{0}\"", | ||
"logVerboseLevelMessage": "***{0}: VȄŖƁŌŜĚ {1}", | ||
"invalidEnvironmentTypeError": "***ĖńvĭŗơƞměňţŦȳƥȅ īš īŋvàľįđ", | ||
"invalidGuidStringError": "***Įňvǻĺĩď ĜŨĬƊ šţŕıńġ: \"{0}\"", | ||
"isFalseValidateError": "***Ťĥě vãŀūĕ ƒơř \"{0}\" įš ƒãĺšė", | ||
"isNullValidateError": "***Ţĥę väŀůȅ ƒőŕ \"{0}\" műšŧ ņőť ƅĕ ňūļļ", | ||
"isUndefinedValidateError": "***Ŧħȅ vāľŭĕ ƒőŕ \"{0}\" můšţ ńŏţ ƃē űńđȇƒīńȅď", | ||
"isEmptyStringValidateError": "***Ťħĕ vãľũȅ ƒơŗ \"{0}\" mūśŧ ʼnơţ ƀě ąŋ ēmƥŧƴ ŝŧŕĭńĝ", | ||
"invalidVersionStringError": "***İńvāłıđ vȅŗśĭōŋ ŝťŗĭņģ: \"{0}\"", | ||
"logVerboseLevelMessage": "***{0}: VĔƦßŎŞĘ {1}", | ||
"logInfoLevelMessage": "***{0}: {1}", | ||
"logWarningLevelMessage": "***{0}: ŴÄŖŊĮŅĞ {1}", | ||
"logErrorLevelMessage": "***{0}: ĘŘŖŌŖ: {1}", | ||
"serviceScopeConsumingBeforeFinished": "***Ćåʼnƞŏţ ćōƞśŭmȇ ŝȅřvīċęś ɓėċåŭšē ţħě śčōƥě ĩş ʼnőť ƒĭňīŝħȅď ȳĕť", | ||
"serviceScopeConsumingDuringAutoCreation": "***Ćǻƞńơŧ čŏʼnŝůmę śĕŗvįĉęş đűŗīńġ ŚěřvĭčȅŞĉơƿě ǻűťŏćŕėâţĩŏʼn", | ||
"serviceScopeAlreadyFinishedError": "***Ţĥė ŠěřvįčěŠčơƥȇ ıŝ ǻļŗȇáďŷ ƒĭƞįŝĥēđ", | ||
"serviceScopeProvideServiceAfterFinishedError": "***Ĉäƞʼnōť ŕęĝıśŧėŗ śěřvĩĉȇ Ƅĕċåůśȇ ŧħĕ śćŏƥȅ ıś āŀŕėãđȳ ƒįʼnıšĥēď", | ||
"serviceScopeProvideServiceThatAlreadyExists": "***Ťħě ŝēŕvıċě ĸęƴ \"{0}\" ĥȃš ȃĺřėâďŷ ƃĕěń ŗĕĝĩşţĕŗēđ ĩƞ ţĥĩš şčōƿȅ", | ||
"spErrorInnerErrorText": "***ĪŃŃĔƦȆƦŖŌŘ:", | ||
"spErrorCallStackText": "***ĆÃŁĻŚŢȀĆƘ:", | ||
"spErrorLogPropertiesText": "***ĿŐĠƤƦŐƤĖƦŢĬȆŜ:" | ||
"logWarningLevelMessage": "***{0}: ŴĄŖŅĪŃĢ {1}", | ||
"logErrorLevelMessage": "***{0}: ĒƦŘŐŔ: {1}", | ||
"serviceScopeConsumingBeforeFinished": "***Ċâŋňőť ćőŋšŭmę śęŗvĭčęś ɓȇĉąųŝĕ ŧĥȇ ŝċōƿȅ įś ńōŧ ƒīƞįśħēđ ɏȇţ", | ||
"serviceScopeConsumingDuringAutoCreation": "***Čáʼnņōţ čőʼnşūmę ŝěřvĭčėŝ đųřĭŋġ ŚēřvĩĉȇŠċơƥė ȁŭŧơċřęąţĩơƞ", | ||
"serviceScopeAlreadyFinishedError": "***Ťħȇ ŠȅŕvĭćȇŚċŏƿȅ įś āłŗĕȃďŷ ƒĩʼnĩšħěď", | ||
"serviceScopeProvideServiceAfterFinishedError": "***Čăʼnņŏţ řęģıšŧěŕ śēŗvĩčė ƀĕčåūśē ŧĥȇ šċŏƿȇ īş ȃļřēäđƴ ƒįňīŝĥęď", | ||
"serviceScopeProvideServiceThatAlreadyExists": "***Ťĥȇ śȇŕvĭćě ķĕɏ \"{0}\" ĥâš áľřȇȃđƴ Ƅȅęň ŗęĝīŝŧęŕȇď ĭń ţĥīš śčōƿė", | ||
"spErrorInnerErrorText": "***ĪŇŅĔŘĔŘƦŐŔ:", | ||
"spErrorCallStackText": "***ĆĂĽĹŠŦÄČƘ:", | ||
"spErrorLogPropertiesText": "***ŁƠĞƤŘŌƤĖŔŦĬȄŚ:" | ||
} | ||
@@ -24,0 +24,0 @@ }; |
{ | ||
"_gIErrcTokcw+/VVwa+ReIA": { | ||
"invalidEnvironmentTypeError": "***ĚŋvĭřơňmēʼnťŤɏƿě ĭş įňvàļıđ", | ||
"invalidGuidStringError": "***Ĩńvãļįď ĠŬĮĎ ŝŧŗįņģ: \"{0}\"", | ||
"isFalseValidateError": "***Ťħě vãŀŭȅ ƒōř \"{0}\" ĩŝ ƒǻłŝę", | ||
"isNullValidateError": "***Ŧĥĕ vǻľůę ƒőř \"{0}\" mūşť ʼnőţ ƅę ƞūļľ", | ||
"isUndefinedValidateError": "***Ťħę vãłŭȅ ƒőř \"{0}\" můśţ ńŏţ Ƃĕ űńđěƒıńȇď", | ||
"isEmptyStringValidateError": "***Ťħę vȁľűē ƒŏŗ \"{0}\" můŝť ńōţ Ƅě åň ėmƿţɏ šŧřĭŋģ", | ||
"invalidVersionStringError": "***Įņväłıđ vȅŗşįōń ŝţřįŋĝ: \"{0}\"", | ||
"logVerboseLevelMessage": "***{0}: VȄŖƁŌŜĚ {1}", | ||
"invalidEnvironmentTypeError": "***ĖńvĭŗơƞměňţŦȳƥȅ īš īŋvàľįđ", | ||
"invalidGuidStringError": "***Įňvǻĺĩď ĜŨĬƊ šţŕıńġ: \"{0}\"", | ||
"isFalseValidateError": "***Ťĥě vãŀūĕ ƒơř \"{0}\" įš ƒãĺšė", | ||
"isNullValidateError": "***Ţĥę väŀůȅ ƒőŕ \"{0}\" műšŧ ņőť ƅĕ ňūļļ", | ||
"isUndefinedValidateError": "***Ŧħȅ vāľŭĕ ƒőŕ \"{0}\" můšţ ńŏţ ƃē űńđȇƒīńȅď", | ||
"isEmptyStringValidateError": "***Ťħĕ vãľũȅ ƒơŗ \"{0}\" mūśŧ ʼnơţ ƀě ąŋ ēmƥŧƴ ŝŧŕĭńĝ", | ||
"invalidVersionStringError": "***İńvāłıđ vȅŗśĭōŋ ŝťŗĭņģ: \"{0}\"", | ||
"logVerboseLevelMessage": "***{0}: VĔƦßŎŞĘ {1}", | ||
"logInfoLevelMessage": "***{0}: {1}", | ||
"logWarningLevelMessage": "***{0}: ŴÄŖŊĮŅĞ {1}", | ||
"logErrorLevelMessage": "***{0}: ĘŘŖŌŖ: {1}", | ||
"serviceScopeConsumingBeforeFinished": "***Ćåʼnƞŏţ ćōƞśŭmȇ ŝȅřvīċęś ɓėċåŭšē ţħě śčōƥě ĩş ʼnőť ƒĭňīŝħȅď ȳĕť", | ||
"serviceScopeConsumingDuringAutoCreation": "***Ćǻƞńơŧ čŏʼnŝůmę śĕŗvįĉęş đűŗīńġ ŚěřvĭčȅŞĉơƿě ǻűťŏćŕėâţĩŏʼn", | ||
"serviceScopeAlreadyFinishedError": "***Ţĥė ŠěřvįčěŠčơƥȇ ıŝ ǻļŗȇáďŷ ƒĭƞįŝĥēđ", | ||
"serviceScopeProvideServiceAfterFinishedError": "***Ĉäƞʼnōť ŕęĝıśŧėŗ śěřvĩĉȇ Ƅĕċåůśȇ ŧħĕ śćŏƥȅ ıś āŀŕėãđȳ ƒįʼnıšĥēď", | ||
"serviceScopeProvideServiceThatAlreadyExists": "***Ťħě ŝēŕvıċě ĸęƴ \"{0}\" ĥȃš ȃĺřėâďŷ ƃĕěń ŗĕĝĩşţĕŗēđ ĩƞ ţĥĩš şčōƿȅ", | ||
"spErrorInnerErrorText": "***ĪŃŃĔƦȆƦŖŌŘ:", | ||
"spErrorCallStackText": "***ĆÃŁĻŚŢȀĆƘ:", | ||
"spErrorLogPropertiesText": "***ĿŐĠƤƦŐƤĖƦŢĬȆŜ:" | ||
"logWarningLevelMessage": "***{0}: ŴĄŖŅĪŃĢ {1}", | ||
"logErrorLevelMessage": "***{0}: ĒƦŘŐŔ: {1}", | ||
"serviceScopeConsumingBeforeFinished": "***Ċâŋňőť ćőŋšŭmę śęŗvĭčęś ɓȇĉąųŝĕ ŧĥȇ ŝċōƿȅ įś ńōŧ ƒīƞįśħēđ ɏȇţ", | ||
"serviceScopeConsumingDuringAutoCreation": "***Čáʼnņōţ čőʼnşūmę ŝěřvĭčėŝ đųřĭŋġ ŚēřvĩĉȇŠċơƥė ȁŭŧơċřęąţĩơƞ", | ||
"serviceScopeAlreadyFinishedError": "***Ťħȇ ŠȅŕvĭćȇŚċŏƿȅ įś āłŗĕȃďŷ ƒĩʼnĩšħěď", | ||
"serviceScopeProvideServiceAfterFinishedError": "***Čăʼnņŏţ řęģıšŧěŕ śēŗvĩčė ƀĕčåūśē ŧĥȇ šċŏƿȇ īş ȃļřēäđƴ ƒįňīŝĥęď", | ||
"serviceScopeProvideServiceThatAlreadyExists": "***Ťĥȇ śȇŕvĭćě ķĕɏ \"{0}\" ĥâš áľřȇȃđƴ Ƅȅęň ŗęĝīŝŧęŕȇď ĭń ţĥīš śčōƿė", | ||
"spErrorInnerErrorText": "***ĪŇŅĔŘĔŘƦŐŔ:", | ||
"spErrorCallStackText": "***ĆĂĽĹŠŦÄČƘ:", | ||
"spErrorLogPropertiesText": "***ŁƠĞƤŘŌƤĖŔŦĬȄŚ:" | ||
} | ||
} |
@@ -5,44 +5,6 @@ import ServiceScope from './ServiceScope'; | ||
* | ||
* @remarks | ||
* Reusable library components typically declare their service dependencies | ||
* by calling ServiceScope.consume() using the corresponding ServiceKey for each service. | ||
* For application business logic or small-sized projects, this formalism may be unnecessary | ||
* and would increase the learning curve for developers. As a lightweight alternative, | ||
* the IServiceCollection pattern allows the common services for a particular scenario | ||
* to be passed around as a simple, convenient collection. | ||
* @public | ||
* | ||
* For example, a widget feature might introduce an interface like this: | ||
* | ||
* interface IWidgetServiceCollection extends IServiceCollection { | ||
* spHttpClient: SPHttpClient; | ||
* widgetManager: IWidgetManager; | ||
* } | ||
* | ||
* Then the Widget class might initialize a "services" property, like this: | ||
* | ||
* class Widget { | ||
* private _services: IWidgetServiceCollection; | ||
* | ||
* constructor(serviceScope: ServiceScope) { | ||
* serviceScope.whenFinished(() => { | ||
* this._services = { | ||
* serviceScope, | ||
* spHttpClient: serviceScope.consume(SPHttpClient.serviceKey), | ||
* widgetManager: serviceScope.consume(WidgetManager.ServiceKey), | ||
* }; | ||
* }); | ||
* } | ||
* | ||
* public get services(): IWidgetServiceCollection { return this._services; } | ||
* } | ||
* | ||
* For a group of components that all have these dependencies, this "services" object | ||
* can be passed around instead of the abstract ServiceScope. This enables direct | ||
* references such as services.widgetManager, services.spHttpClient, etc. For atypical | ||
* dependencies, the services.serviceScope is still available for use. | ||
* | ||
* IMPORTANT: To keep the pattern clean and understandable, IServiceCollection | ||
* should NOT be extended with any additional members that are not ServiceScope services. | ||
* | ||
* @public | ||
* @deprecated This pattern has been superceded by the BaseComponentContext pattern. | ||
* This interface will be removed in a future release. | ||
*/ | ||
@@ -49,0 +11,0 @@ interface IServiceCollection { |
import ServiceScope from '../ServiceScope'; | ||
import ServiceKey from '../ServiceKey'; | ||
/** | ||
* This is a ServiceScope interface that enables unit tests to provide | ||
* a deterministic source of pseudorandom numbers. | ||
* This is a {@link ServiceScope} contract for generating pseudorandom random numbers. | ||
* | ||
* @remarks | ||
* This interface abstracts the functionality of the system Math.random() API | ||
* for usage with a {@link ServiceScope}. For example, a unit test might replace | ||
* the default {@link RandomNumberGenerator} service with a mock implementation | ||
* that always returns the same sequence of random numbers, in order to ensure that | ||
* test failures are always repeatable. | ||
* | ||
* @public | ||
@@ -11,3 +17,3 @@ */ | ||
/** | ||
* Returns a psuedorandom number between 0 (inclusive) and 1 (exclusive), | ||
* Returns a pseudorandom number between 0 (inclusive) and 1 (exclusive), | ||
* following the contract of Math.random(). | ||
@@ -18,3 +24,3 @@ */ | ||
/** | ||
* This is the default implementation of IRandomNumberGenerator that simply | ||
* This is the default implementation of {@link IRandomNumberGenerator} that simply | ||
* calls Math.random(). | ||
@@ -30,3 +36,4 @@ * | ||
constructor(serviceScope: ServiceScope); | ||
/** {@inheritdoc IRandomNumberGenerator.generate} */ | ||
generate(): number; | ||
} |
import ServiceScope from '../ServiceScope'; | ||
import ServiceKey from '../ServiceKey'; | ||
/** | ||
* This is a ServiceScope interface that enables unit tests to simulate | ||
* the system clock. | ||
* This is a {@link ServiceScope} contract for reading the system clock. | ||
* | ||
* @remarks | ||
* This interface abstracts the functionality of the system time APIs | ||
* for usage with a {@link ServiceScope}. For example, a unit test might replace | ||
* the default {@link TimeProvider} service with a mock implementation | ||
* that follows a manually incremented timeline, in order to ensure that | ||
* test failures are always repeatable. | ||
* | ||
* @public | ||
@@ -11,3 +17,3 @@ */ | ||
/** | ||
* Returns the current date/time. | ||
* Returns the current date/time, similar to the Date class constructor. | ||
*/ | ||
@@ -22,3 +28,3 @@ getDate(): Date; | ||
/** | ||
* This is the default implementation of ITimeProvider that simply | ||
* This is the default implementation of {@link ITimeProvider} that simply | ||
* calls the real browser APIs. | ||
@@ -31,9 +37,9 @@ * | ||
* The service key for ITimeProvider. | ||
* | ||
* @beta | ||
*/ | ||
static readonly serviceKey: ServiceKey<ITimeProvider>; | ||
constructor(serviceScope: ServiceScope); | ||
/** {@inheritdoc ITimeProvider.getDate} */ | ||
getDate(): Date; | ||
/** {@inheritdoc ITimeProvider.getTimestamp} */ | ||
getTimestamp(): number; | ||
} |
@@ -7,8 +7,11 @@ import ServiceScope from './ServiceScope'; | ||
/** | ||
* The ServiceKey is a lookup key that is used when calling ServiceScope.consume() | ||
* to fetch a dependency. The key also defines a default implementation of the | ||
* dependency, which will be autocreated by the root scope if the dependency is not found. | ||
* Providing a default implementation ensures that new dependencies can be safely | ||
* introduced without inadvertently breaking components that are loaded by an older host | ||
* (that does not provide the new dependency). | ||
* The ServiceKey is a lookup key that is used when calling {@link ServiceScope.consume} | ||
* to fetch a dependency. | ||
* | ||
* @remarks | ||
* Every service key also provides a default implementation of the dependency, which will | ||
* be automatically created in the root scope if the dependency is not found. Providing a default | ||
* implementation ensures that new dependencies can be safely introduced without inadvertently | ||
* breaking components that are loaded by an older host that does not provide the new dependency. | ||
* | ||
* @public | ||
@@ -18,13 +21,37 @@ */ | ||
private static _lastId; | ||
id: string; | ||
name: string; | ||
defaultCreator: ServiceCreator<T>; | ||
/** | ||
* A unique identifier for this service. | ||
* | ||
* @remarks | ||
* The identifier is a currently generated by incrementing an integer counter; however | ||
* this may change in the future. | ||
*/ | ||
readonly id: string; | ||
/** | ||
* The name of the service. | ||
* | ||
* @remarks | ||
* This name is used for logging and diagnostic purposes only. To make it unique, the | ||
* recommended convention is the package name, followed by a period, followed by the | ||
* class or interface name. | ||
* | ||
* The system does not assume that this string is unique. Instead, the {@link ServiceKey.id} | ||
* is used wherever a lookup key is needed. | ||
*/ | ||
readonly name: string; | ||
/** | ||
* A callback function that constructs the default instance of this service. | ||
*/ | ||
readonly defaultCreator: ServiceCreator<T>; | ||
/** | ||
* Constructs a new ServiceKey whose default implementation will be a new instance of | ||
* a TypeScript class that accepts the standard constructor parameter. If you want to | ||
* specify custom constructor parameters, use createCustom() instead. | ||
* @param name - A name such as "MyApplication.IMyService" which should be unique within | ||
* your application. | ||
* a TypeScript class that accepts the standard constructor parameter. | ||
* | ||
* @remarks | ||
* If you want to specify custom constructor parameters, use {@link ServiceKey.createCustom} | ||
* instead. | ||
* | ||
* @param name - A name such as "my-package.IMyService" which should be unique across packages. | ||
* @param serviceClass - the TypeScript class that implements the service. | ||
* @returns - the newly created ServiceKey | ||
* @returns the newly created ServiceKey | ||
*/ | ||
@@ -37,6 +64,6 @@ static create<TKey>(name: string, serviceClass: { | ||
* by invoking the specified callback. | ||
* @param name - A name such as "MyApplication.IMyService" which should be unique within | ||
* your application. | ||
* @param defaultCreator - A callback that returns an object that implements the T interface | ||
* @returns - the newly created ServiceKey | ||
* | ||
* @param name - A name such as "my-package.IMyService" which should be unique across packages. | ||
* @param defaultCreator - a callback that returns an object that implements the T interface | ||
* @returns the newly created service key | ||
*/ | ||
@@ -43,0 +70,0 @@ static createCustom<TKey>(name: string, defaultCreator: ServiceCreator<TKey>): ServiceKey<TKey>; |
import ServiceKey from './ServiceKey'; | ||
/** | ||
* The service locator pattern used by the SharePoint Framework. | ||
* | ||
* @remarks | ||
* ServiceScope provides a formalized way for components to register and consume dependencies | ||
@@ -14,3 +17,3 @@ * ("services"), and to enable different implementations to be registered in different scopes. | ||
* logic that ties together many subsystems would eventually pick up a constructor parameter | ||
* for every possible dependency, which is unwieldy. A natural solution would be to move all the | ||
* for every possible dependency, which is awkward. A natural solution would be to move all the | ||
* dependencies into a class with name like "ApplicationContext", and then pass this around as our | ||
@@ -25,3 +28,3 @@ * constructor parameter. This enables the PageManager to be passed to classes that need it | ||
* ServiceScope takes this idea a step further in two important ways: First, it provides a scoping | ||
* mechanism so that e.g. if we had two different pages, they could each consume a unique PageManager | ||
* mechanism so that e.g. if we have two different pages, they can each provide a unique PageManager | ||
* instance while still sharing other common dependencies. Secondly, it allows for a ServiceKey | ||
@@ -34,13 +37,16 @@ * to provide a default implementation of the dependency. This is important for API stability in | ||
* but it would require a lot of checks. A better solution is to ensure that a default implementation | ||
* always exists, perhaps just a trivial behavior, so that components don't have to worry about it. | ||
* always exists, perhaps just a trivial behavior, so that components can assume that consume() will | ||
* always return some object that implements the contract. | ||
* | ||
* Usage: ServiceScope instances are created by calling either ServiceScope.startNewRoot() or | ||
* ServiceScope.startNewChild(). They are initially in an "unfinished" state, during which provide() | ||
* can be called to register service keys, but consume() is forbidden. After ServiceScope.finish() | ||
* is called, consume() is allowed and provide() is now forbidden. These semantics ensure that | ||
* can be called to register service keys, but consume() is disallowed. After ServiceScope.finish() | ||
* is called, consume() is allowed and provide() is now disallowed. These semantics ensure that | ||
* ServiceScope.consume() always returns the same result for the same key, and does not depend on | ||
* order of initialization. It also allows us to support circular dependencies without worrying | ||
* about infinite loops, even when working with external components that were implemented by | ||
* third parties. To avoid mistakes, it's best to always call consume() inside a callback from | ||
* about infinite loops. (Circular dependencies are best avoided, however this is difficult to | ||
* guarantee when working with components that were contributed by various third parties without | ||
* any coordination.) To avoid mistakes, it's best to always call consume() inside a callback from | ||
* serviceScope.whenFinished(). | ||
* | ||
* @public | ||
@@ -57,11 +63,13 @@ */ | ||
* default implementations of ServiceKeys. | ||
* @returns - the newly created root ServiceScope | ||
* | ||
* @returns the newly created root ServiceScope | ||
*/ | ||
static startNewRoot(): ServiceScope; | ||
/** | ||
* This is a shorthand function that its equivalent to constructing a new instance of the | ||
* This is a shorthand function that is equivalent to constructing a new instance of the | ||
* simpleServiceClass, then registering it by calling ServiceScope.provide(). | ||
* | ||
* @param serviceKey - the key that can be used later to consume the service | ||
* @param simpleServiceClass - the TypeScript class to be constructed | ||
* @returns - a newly constructed instance of simpleServiceClass | ||
* @returns a newly constructed instance of simpleServiceClass | ||
*/ | ||
@@ -74,22 +82,33 @@ createAndProvide<T>(serviceKey: ServiceKey<T>, simpleServiceClass: { | ||
* serviceKey, and then registers it by calling ServiceScope.provide(). | ||
* | ||
* @param serviceKey - the key that can be used later to consume the service | ||
* @returns - a service instance that was constructed using ServiceKey.defaultCreator | ||
* @returns a service instance that was constructed using ServiceKey.defaultCreator | ||
*/ | ||
createDefaultAndProvide<T>(serviceKey: ServiceKey<T>): T; | ||
/** | ||
* Consumes a service from the service scope. | ||
* | ||
* @remarks | ||
* Components should call this function to "consume" a dependency, i.e. look up the serviceKey | ||
* and return the registered service instance. If the instance cannot be found, then a default | ||
* instance will be autocreated and registered with the root ServiceScope. | ||
* instance will be automatically created and registered with the root ServiceScope. | ||
* | ||
* @param serviceKey - the key that was used when provide() was called to register the service | ||
* @returns - the service instance | ||
* @returns the service instance | ||
*/ | ||
consume<T>(serviceKey: ServiceKey<T>): T; | ||
/** | ||
* Completes the initialization sequence for a service scope. | ||
* | ||
* @remarks | ||
* When a ServiceScope is first started, it is in an "unfinished" state where provide() is | ||
* allowed but consume() is not allowed. After calling finish(), then consume() is allowed | ||
* but provide() is not allowed. This formalism completely eliminates a number of tricky bugs | ||
* such as: Scope2 is a child of Scope1, and Scope1 provides instance A1 of interface A; | ||
* if someone consumes A1 from Scope2 (via inheritance) before Scope2.provide() is called | ||
* allowed but consume() is disallowed. After calling finish(), then consume() is allowed | ||
* but provide() is disallowed. | ||
* | ||
* This formalism prevents a number of complex situations that could lead to bugs. For example, | ||
* supposed that Scope2 is a child of Scope1, and Scope1 provides instance A1 of interface A. | ||
* If someone consumes A1 from Scope2 (via inheritance) before Scope2.provide() is called | ||
* with A2, then a subsequent call to Scope2.consume() might return a different result than | ||
* the previous call, which would be very confusing for developers. | ||
* the previous call. This nondeterminism could cause unpredictable results that are | ||
* difficult to diagnose. | ||
*/ | ||
@@ -99,6 +118,10 @@ finish(): void; | ||
* Returns the parent of the current ServiceScope, or undefined if this is a root scope. | ||
* @returns - the parent service scope | ||
* | ||
* @returns the parent service scope | ||
*/ | ||
getParent(): ServiceScope | undefined; | ||
/** | ||
* Defer an operation until after {@link ServiceScope.finish} has completed. | ||
* | ||
* @remarks | ||
* It is an error to call ServiceScope.consume() before finish() has been called. | ||
@@ -109,2 +132,7 @@ * The most reliable way to protect your component against this error is to perform the | ||
* later when the scope is finished. | ||
* | ||
* NOTE: This is not an asynchronous callback. ServiceScope initialization is typically | ||
* inexpensive and short lived. However, the control flow often threads through numerous | ||
* constructors and base classes, which can be simplified using whenFinished(). | ||
* | ||
* @param callback - A block of code that needs to call ServiceScope.consume() | ||
@@ -114,15 +142,23 @@ */ | ||
/** | ||
* ServiceScope.provide() is used to register an implemententation of the given serviceKey | ||
* Add a new service to a service scope. | ||
* | ||
* @remarks | ||
* ServiceScope.provide() is used to register an implementation of the given serviceKey | ||
* for the current scope. It may only be used when the ServiceScope is in an "unfinished" | ||
* state, i.e. before finish() has been called. | ||
* | ||
* @param serviceKey - the key that will later be used to consume the service | ||
* @param service - the service instance that is being registered | ||
* @returns - the same object that was passed as the "service" parameter | ||
* @returns the same object that was passed as the "service" parameter | ||
*/ | ||
provide<T>(serviceKey: ServiceKey<T>, service: T): T; | ||
/** | ||
* Constructs a new ServiceScope that is a child of the current scope. For any keys | ||
* that are not explicitly provided by the child scope, the parent hierarchy will be | ||
* consulted. | ||
* @returns - the newly created root ServiceScope | ||
* Constructs a new ServiceScope that is a child of the current scope. | ||
* | ||
* @remarks | ||
* The service scopes form a tree structure, such that when consuming a service, | ||
* if the key is not explicitly provided by a child scope, the parent hierarchy | ||
* will be consulted. | ||
* | ||
* @returns the newly created root ServiceScope | ||
*/ | ||
@@ -129,0 +165,0 @@ startNewChild(): ServiceScope; |
@@ -13,3 +13,4 @@ import Guid from './Guid'; | ||
/** | ||
* This class contains contextual information about the application's current session. | ||
* Provides access to the application's browser session and active page. | ||
* | ||
* @public | ||
@@ -31,2 +32,5 @@ */ | ||
/** | ||
* A unique identifier for the current instance of the client-side application. | ||
* | ||
* @remarks | ||
* A unique identifier used to correlate logging and other diagnostic information. Its lifetime | ||
@@ -40,12 +44,18 @@ * persists for the duration of the client-side application instance, i.e. it begins with the | ||
/** | ||
* A unique identifier for the current page within the client-side application. | ||
* | ||
* @remarks | ||
* A unique identifier used to correlate logging and other diagnostic information. Whereas the | ||
* applicationId tracks the entire lifetime of the client-side application instance, the | ||
* pageId tracks an individual "page" that is rendered. For example, suppose that the | ||
* application initially loads PageA, then the user does in-place navigation (via the history.pushState() | ||
* API) to PageB, then navigates back to PageA, and finally they close the browser tab. During this | ||
* sequence, the applicationId will remain the same, however the pageId will change on each | ||
* navigation. The 3 different pageId values are used by the diagnostics e.g. to track success/failure | ||
* statistics for PageA independently of PageB. The concept of a "page" is application-defined. | ||
* {@link Session.applicationId} tracks the entire lifetime of the client-side application instance, | ||
* the pageId tracks an individual "page" that is rendered. | ||
* | ||
* For example, suppose that the application initially loads PageA, then the user does in-place | ||
* navigation (via the history.pushState() API) to PageB, then navigates back to PageA, and finally | ||
* they close the browser tab. During this sequence, the applicationId will remain the same, however | ||
* the pageId will change on each navigation. The 3 different pageId values are used by the diagnostics | ||
* e.g. to track success/failure statistics for PageA independently of PageB. | ||
* | ||
* The concept of a page is subjective and defined by the router for a particular application. | ||
*/ | ||
static readonly pageId: Guid; | ||
} |
@@ -1,4 +0,1 @@ | ||
/** | ||
* This file was generated by a tool. Modifying it will produce unexpected behavior. | ||
*/ | ||
export interface IStrings { | ||
@@ -5,0 +2,0 @@ invalidEnvironmentTypeError: string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var strings = (typeof UNIT_TEST === 'undefined' || UNIT_TEST) | ||
var strings = (typeof DEPRECATED_UNIT_TEST === 'undefined' || DEPRECATED_UNIT_TEST) | ||
? require('resx-strings/en-us.json') | ||
: require('resx-strings'); | ||
exports.default = strings['_gIErrcTokcw+/VVwa+ReIA']; |
@@ -7,5 +7,8 @@ /** | ||
* | ||
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} | ||
* @see {@link http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript} | ||
* References: | ||
* | ||
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error} | ||
* | ||
* {@link http://stackoverflow.com/questions/1382107/whats-a-good-way-to-extend-error-in-javascript} | ||
* | ||
* @alpha | ||
@@ -12,0 +15,0 @@ */ |
@@ -34,4 +34,9 @@ /** | ||
*/ | ||
static initialize(flights: number[], debugFlights?: string): void; | ||
static initialize(flights: number[]): void; | ||
/** | ||
* RESERVED FOR INTERNAL USAGE. This method is invoked automatically by the system shell. | ||
* The application code should not call it directly. | ||
*/ | ||
static setDebugFlights(debugFlights?: string): void; | ||
/** | ||
* NOT FOR USE BY THIRD PARTY DEVELOPERS | ||
@@ -38,0 +43,0 @@ * |
@@ -7,5 +7,12 @@ "use strict"; | ||
} | ||
SPFlight.initialize = function (flights, debugFlights) { | ||
SPFlight.initialize = function (flights) { | ||
this._isInitialized = true; | ||
this._enabledFlightsMap = flights || []; | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
}; | ||
SPFlight.setDebugFlights = function (debugFlights) { | ||
if (!this._isInitialized) { | ||
throw new Error('Flights are not initialized. Can\'t set debug flights.'); | ||
} | ||
if (debugFlights && debugFlights.length > 0) { | ||
@@ -36,10 +43,6 @@ try { | ||
} | ||
else { | ||
this._forceEnabledFlights = []; | ||
this._forceDisabledFlights = []; | ||
} | ||
this._validateDebugFlights(); | ||
}; | ||
SPFlight.isEnabled = function (flight) { | ||
if (!this._isInitialized && !UNIT_TEST) { | ||
if (!this._isInitialized && !DEPRECATED_UNIT_TEST) { | ||
throw new Error("Flights are not initialized. Flight requested: " + flight); | ||
@@ -46,0 +49,0 @@ } |
@@ -11,9 +11,14 @@ import Guid from './Guid'; | ||
/** | ||
* This method is invoked automatically by the system shell. The application code should | ||
* not call it directly. | ||
* RESERVED FOR INTERNAL USAGE. This method is invoked automatically by the system shell. | ||
* The application code should not call it directly. | ||
*/ | ||
static initialize(killSwitchGuids: { | ||
[key: string]: boolean; | ||
}, debugKillswitches?: string): void; | ||
}): void; | ||
/** | ||
* RESERVED FOR INTERNAL USAGE. This method is invoked automatically by the system shell. | ||
* The application code should not call it directly. | ||
*/ | ||
static setDebugKillswitches(debugKillswitches?: string): void; | ||
/** | ||
* Returns true if the switch is activated. | ||
@@ -20,0 +25,0 @@ * @param killSwitchGuid - identifier for the kill switch |
@@ -7,3 +7,3 @@ "use strict"; | ||
} | ||
SPKillSwitch.initialize = function (killSwitchGuids, debugKillswitches) { | ||
SPKillSwitch.initialize = function (killSwitchGuids) { | ||
this._isInitialized = true; | ||
@@ -20,2 +20,7 @@ this._activatedKillSwitches = new Map(); | ||
} | ||
}; | ||
SPKillSwitch.setDebugKillswitches = function (debugKillswitches) { | ||
if (!this._isInitialized && !DEPRECATED_UNIT_TEST) { | ||
throw new Error('Killswitches are not initialized. Can\'t set debug killswitched.'); | ||
} | ||
if (debugKillswitches && debugKillswitches.length) { | ||
@@ -35,3 +40,3 @@ try { | ||
SPKillSwitch.isActivated = function (killSwitchGuid, date, featureName) { | ||
if (!this._isInitialized && !UNIT_TEST) { | ||
if (!this._isInitialized && !DEPRECATED_UNIT_TEST) { | ||
throw new Error("Killswitches are not initialized. Killswitch requested: " + killSwitchGuid); | ||
@@ -42,3 +47,3 @@ } | ||
} | ||
return this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
return !!this._activatedKillSwitches.get(killSwitchGuid.toString()); | ||
}; | ||
@@ -45,0 +50,0 @@ SPKillSwitch._isInitialized = false; |
/** | ||
* Common helper functions for working with strings. These utilities are intended to be simple, | ||
* small, and very broadly applicable. | ||
* Operations for working with strings that contain text. | ||
* | ||
* @remarks | ||
* The utilities provided by this class are intended to be simple, small, and very | ||
* broadly applicable. | ||
* | ||
* @public | ||
@@ -11,6 +14,15 @@ */ | ||
/** | ||
* String Format, like C# string format. | ||
* Usage Example: StringUtilities.format("hello {0}!", "mike") will return "hello mike!" | ||
* Format a string by substituting parameters. | ||
* | ||
* @remarks | ||
* This function replaces template parameters such as "{0}" or "{1}" with the | ||
* corresponding argument. If the value is null or undefined, it will be replaced | ||
* by the word "null" or "undefined". The format string s must not be null or | ||
* undefined. | ||
* | ||
* Usage example: | ||
* | ||
* Text.format("hello {0}!", "world") will return "hello world!" | ||
*/ | ||
static format(s: string, ...values: any[]): string; | ||
} |
/** | ||
* Class for storing and retrieving query parameters. | ||
* The URL can be server-relative and it will parse empty/null strings. | ||
* The query parameters must start with ? to indicate the first query parameter and | ||
* use & for all subsequent parameters. The class also supports fragments. | ||
* Edge cases behavior: | ||
* Provides features for storing and retrieving URL query parameters. | ||
* | ||
* @remarks | ||
* The URL can be server-relative, and it can also be an empty or null string. | ||
* The query parameters must start with "?" to indicate the first query parameter and | ||
* use "&" for all subsequent parameters. The class also supports fragments. | ||
* | ||
* Edge case behavior: | ||
* | ||
* Empty value (www.example.com/?test=) stores key and empty value | ||
@@ -16,5 +20,7 @@ * No equals in queryParam (www.example.com/?test) stores key and undefined value | ||
* This weird design would ensure that e.g. if no change was made to the data structure, then the | ||
* roundtrip wouldn't change the characters in the URL at all, which might be useful e.g. if we're | ||
* round trip wouldn't change the characters in the URL at all, which might be useful e.g. if we're | ||
* comparing URLs. | ||
* | ||
* @deprecated Use the URLSearchParams browser API instead. The SharePoint Framework includes a | ||
* polyfill for older browsers. | ||
* @public | ||
@@ -27,2 +33,4 @@ */ | ||
* Returns the value of the first matching query parameter or undefined if the key doesn't exist. | ||
* | ||
* @remarks | ||
* Examples: this._queryParameterList = [ | ||
@@ -40,2 +48,4 @@ * {key: TEST, value: done}, | ||
* Returns the values of all of the matching query parameters or undefined if the key doesn't exist. | ||
* | ||
* @remarks | ||
* Examples: this._queryParameterList = [ | ||
@@ -42,0 +52,0 @@ * {key: TEST, value: done}, |
@@ -9,2 +9,14 @@ /** | ||
/** | ||
* If the provided URL is relative, resolve it under the provided base URL. If the provided URL is absolute, | ||
* return it. | ||
* Examples: | ||
* resolve('/foo/bar.js', 'http://cdn.com/path/') ---> 'http://cdn.com/path/foo/bar.js' | ||
* resolve('http://cdn.com/foo/bar.js', 'http://cdn.com/path/') ---> 'http://cdn.com/foo/bar.js' | ||
* resolve('/foo/bar.js', 'path/') ---> 'path/foo/bar.js' | ||
* | ||
* @param url - the URL to be resolved | ||
* @param baseUrl - the base URL to use if the URL is relative | ||
*/ | ||
static resolve(url: string, baseUrl: string): string; | ||
/** | ||
* Removes any slash characters from the end of the URL. | ||
@@ -20,2 +32,12 @@ * This function assumes that the input is already a valid absolute or server-relative URL. | ||
/** | ||
* Removes any slash characters from the beginning of the URL. | ||
* This function assumes that the input is already a valid absolute or server-relative URL. | ||
* Examples: | ||
* removeLeadingSlash('/example/path.js') ---> 'example/path.js' | ||
* removeLeadingSlash('example/') ---> 'example/' | ||
* removeLeadingSlash('/') ---> '' | ||
* @param url - the URL to be normalized | ||
*/ | ||
static removeLeadingSlash(url: string): string; | ||
/** | ||
* Converts a variable to an OData string literal suitable for usage in a REST URL. | ||
@@ -22,0 +44,0 @@ * The returned string will be enclosed in single quotes, and any single quotes |
@@ -5,8 +5,23 @@ "use strict"; | ||
var Validate_1 = require("../Validate"); | ||
var URL_PROTOCOL_REGEX = /^\w+\:\/\//; | ||
var UrlUtilities = (function () { | ||
function UrlUtilities() { | ||
} | ||
UrlUtilities.resolve = function (url, baseUrl) { | ||
Validate_1.default.isNonemptyString(url, 'url'); | ||
Validate_1.default.isNonemptyString(baseUrl, 'baseUrl'); | ||
var isRelativeUrl = !url.match(URL_PROTOCOL_REGEX); | ||
if (isRelativeUrl) { | ||
return UrlUtilities.removeEndSlash(baseUrl) + "/" + UrlUtilities.removeLeadingSlash(url); | ||
} | ||
else { | ||
return url; | ||
} | ||
}; | ||
UrlUtilities.removeEndSlash = function (url) { | ||
return lodash.trimEnd(url, '/'); | ||
}; | ||
UrlUtilities.removeLeadingSlash = function (url) { | ||
return lodash.trimStart(url, '/'); | ||
}; | ||
UrlUtilities.convertToODataStringLiteral = function (value) { | ||
@@ -13,0 +28,0 @@ Validate_1.default.isNotNullOrUndefined(value, 'value'); |
/** | ||
* Performs common validation tests for properties and function parameters. | ||
* | ||
* @remarks | ||
* | ||
* This class implements provides a standard way to validate properties and function parameters. | ||
@@ -3,0 +7,0 @@ * Unlike debug assertions, Validate checks are always performed and will always throw an error, |
/** | ||
* Represents a version number with two, three, or four parts. | ||
* | ||
* @remarks | ||
* This class represents versions that follow the string format of MAJOR.MINOR[.PATCH[.REVISION]] | ||
* where MAJOR, MINOR, PATCH and REVISION are integers. PATCH and REVISION are optional. | ||
* Leading zeros are allowed, but have no meaning in comparisons. | ||
* where the MAJOR, MINOR, PATCH and REVISION parts are integers. PATCH and REVISION are optional. | ||
* Leading zero digits are allowed, but they are discarded. Missing parts are treated | ||
* as zeroes for comparisons. | ||
* | ||
@@ -16,30 +20,31 @@ * Examples: 1.0, 1.0.0, 1.0.0.0, 1.01, 01.02.03, 001.002.003.004 | ||
/** | ||
* Indicates whether a version string is valid | ||
* Test whether a string is a valid version specifier. | ||
* | ||
* @param versionString - The version string | ||
* @returns Value indicating whether the version is valid. | ||
* @returns true if the versionString is a valid version specifier | ||
*/ | ||
static isValid(versionString: string | undefined | null): boolean; | ||
/** | ||
* Constructs a new Version instance using the version string. tryParse validates the input version string | ||
* and throws error if it is invalid | ||
* Constructs a new Version instance using the version string. An exception is thrown | ||
* if the string cannot be parsed. | ||
* | ||
* @param versionString - A version string | ||
* @returns If valid, a new Version instace | ||
* @returns a new Version object | ||
*/ | ||
static parse(versionString: string | undefined | null): Version; | ||
/** | ||
* Tries to construct a new Version instance using the version string. Returns undefined if not successful. | ||
* Attempts to parse the input string to construct a new Version object. | ||
* If the string cannot be parsed, then undefined is returned. | ||
* | ||
* @param versionString - A version string | ||
* @returns If valid, a new Version instace. Otherwise, undefined. | ||
* @returns The Version object, or undefined if the string could not be parsed. | ||
*/ | ||
static tryParse(versionString: string | undefined | null): Version | undefined; | ||
/** | ||
* Compares two Version classes | ||
* Compares two Version objects to determine which version is newer. | ||
* | ||
* @param v1 - The first version class for comparison | ||
* @param v2 - The second version class for comparison | ||
* @returns -1 if the first input is less than the second input, | ||
* 0 if the first input is equal to the second input, | ||
* @returns -1 if the first input is less than the second input; | ||
* 0 if the first input is equal to the second input; | ||
* 1 if the first input is greater than the second input. | ||
@@ -49,26 +54,44 @@ */ | ||
/** | ||
* The first number in the version string indicating the major version | ||
* Returns the first component of the version string. | ||
* | ||
* @remarks | ||
* Typically a change in the major version number indicates a compatibility | ||
* break with previous versions. | ||
*/ | ||
readonly major: number; | ||
/** | ||
* The second number in the version string indicating the minor version | ||
* Returns the second component of the version string. | ||
* | ||
* @remarks | ||
* Typically a change in the minor version number indicates that new features | ||
* were added, while remaining backwards compatible with previous releases. | ||
*/ | ||
readonly minor: number; | ||
/** | ||
* The thrid number in the version string indicating the patch number in a semantic version or the build number in | ||
* a .NET System.Version class | ||
* Set to undefined if the third number does not exist | ||
* The third number in the version string, or undefined if unspecified. | ||
* | ||
* @remarks | ||
* Typically a change in the patch version number indicates a small fix that | ||
* does not affect the compatibility contract for the library. For a .NET | ||
* System.Version object, this is referred to as the "build" number. | ||
*/ | ||
readonly patch: number | undefined; | ||
/** | ||
* The fourth number in the version string indicating the revision number | ||
* Set to undefined if the fourth number does not exist | ||
* The fourth number in the version string, or undefined if unspecified. | ||
* | ||
* @remarks | ||
* This number is not part of the Semantic Versioning (SemVer) standard used | ||
* in JavaScript, but it is used by .NET version numbers. | ||
*/ | ||
readonly revision: number | undefined; | ||
/** | ||
* Checks if this version is less (i.e. older) than the input parameter. Missing patch number is treated as zero | ||
* Tests whether this version is less than (i.e. older than) the input parameter. | ||
* | ||
* @remarks | ||
* | ||
* Examples: | ||
* 0.9.9 lessThan 1.0.0 -> true | ||
* 2.0 lessThan 2.0.0 -> false | ||
* 3.0 lessThan 3.0.1 -> true | ||
* | ||
* 0.9.9 lessThan 1.0.0 -> true; | ||
* 2.0 lessThan 2.0.0 -> false; | ||
* 3.0 lessThan 3.0.1 -> true; | ||
* 04.01 lessThan 4.1 -> false | ||
@@ -81,6 +104,10 @@ * | ||
/** | ||
* Checks if this version is greater (i.e. newer) than the input parameter. Missing patch number is treated as zero | ||
* Tests whether this version is greater than (i.e. newer than) the input parameter. | ||
* | ||
* @remarks | ||
* | ||
* Examples: | ||
* 1.0.0 greaterThan 0.0.9 -> true | ||
* 2.0 greaterThan 2.0.0 -> false | ||
* | ||
* 1.0.0 greaterThan 0.0.9 -> true; | ||
* 2.0 greaterThan 2.0.0 -> false; | ||
* 3.0.1 greaterThan 3.0 -> true | ||
@@ -93,8 +120,11 @@ * | ||
/** | ||
* Checks if this version is equal to the input parameter. Missing patch number is treated as zero. | ||
* Tests whether this version is equal to the input parameter. | ||
* | ||
* @remarks | ||
* | ||
* Examples: | ||
* 1.0.0 equals 1.0.0 -> true | ||
* 2.0.1 equals 2.0.0 -> false | ||
* 3.0 equals 3.0.0 -> true | ||
* | ||
* 1.0.0 equals 1.0.0 -> true; | ||
* 2.0.1 equals 2.0.0 -> false; | ||
* 3.0 equals 3.0.0 -> true; | ||
* 04.01 equals 4.1 -> true | ||
@@ -107,10 +137,15 @@ * | ||
/** | ||
* Checks if this version satisfies the input parameter, therefore it's backwards compatible. | ||
* They have to share the same major version, and the input parameter must be an | ||
* equal or more recent version. | ||
* Tests whether this version satisfies the compatibility requirements of the input version, | ||
* i.e. is backwards compatible. | ||
* | ||
* @remarks | ||
* In order to satisfy the compatibility requirements, this object must have the same | ||
* major version number as the input parameter, and it must NOT be older than the | ||
* input parameter. | ||
* | ||
* Examples: | ||
* 1.0.0 satisfies 1.0.0 -> true | ||
* 1.1.0 satisfies 1.0.0 -> true | ||
* 2.0.0 satisfies 1.0.0 -> false | ||
* | ||
* 1.0.0 satisfies 1.0.0 -> true; | ||
* 1.1.0 satisfies 1.0.0 -> true; | ||
* 2.0.0 satisfies 1.0.0 -> false; | ||
* 1.0.0 satisfies 1.1.0 -> false | ||
@@ -123,5 +158,7 @@ * | ||
/** | ||
* Object.prototype.toString override | ||
* Returns a string representation of the version. | ||
* | ||
* The version string in MAJOR.MINOR[.PATCH[.REVISION]] | ||
* @remarks | ||
* The value is normalized and may be different from the original string (e.g. leading zeroes | ||
* may be removed). However, the number of version parts will be unchanged. | ||
*/ | ||
@@ -128,0 +165,0 @@ toString(): string; |
{ | ||
"name": "@microsoft/sp-core-library", | ||
"version": "1.3.4", | ||
"version": "1.4.0", | ||
"description": "SharePoint Framework core libraries", | ||
@@ -10,3 +10,3 @@ "license": "SEE LICENSE IN \"EULA\" FOLDER", | ||
"devDependencies": { | ||
"@ms/sp-build-internal-web": "~0.7.1", | ||
"@ms/sp-build-internal-web": "~0.9.2", | ||
"@types/chai": "3.4.34", | ||
@@ -18,13 +18,10 @@ "@types/mocha": "2.2.38", | ||
"dependencies": { | ||
"@microsoft/sp-lodash-subset": "~1.3.4", | ||
"@microsoft/sp-module-interfaces": "~1.3.4", | ||
"@types/es6-collections": "0.5.29", | ||
"@types/webpack-env": "1.13.0", | ||
"es6-collections": "0.5.6" | ||
"@microsoft/sp-lodash-subset": "1.4.0", | ||
"@microsoft/sp-module-interfaces": "1.4.0", | ||
"@types/es6-promise": "0.0.33", | ||
"@types/webpack-env": "1.13.1" | ||
}, | ||
"scripts": { | ||
"build": "gulp bundle", | ||
"clean": "gulp clean", | ||
"test": "gulp test" | ||
"build": "gulp test --clean" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
4
10933
2213284
180
+ Added@types/es6-promise@0.0.33
+ Added@microsoft/sp-lodash-subset@1.4.0(transitive)
+ Added@microsoft/sp-module-interfaces@1.4.0(transitive)
+ Added@types/es6-promise@0.0.33(transitive)
+ Added@types/lodash@4.14.74(transitive)
+ Added@types/webpack-env@1.13.1(transitive)
+ Addedtslib@1.8.1(transitive)
- Removed@types/es6-collections@0.5.29
- Removedes6-collections@0.5.6
- Removed@microsoft/sp-lodash-subset@1.3.4(transitive)
- Removed@microsoft/sp-module-interfaces@1.3.4(transitive)
- Removed@types/es6-collections@0.5.29(transitive)
- Removed@types/lodash@4.14.52(transitive)
- Removed@types/webpack-env@1.13.0(transitive)
- Removedes6-collections@0.5.6(transitive)
- Removedlodash@4.15.0(transitive)
Updated@types/webpack-env@1.13.1