Skip to content

Instantly share code, notes, and snippets.

@navarrorc
Created May 22, 2019 16:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save navarrorc/b1d9f69a1ae2bbb5580a8ee59d7959b7 to your computer and use it in GitHub Desktop.
Save navarrorc/b1d9f69a1ae2bbb5580a8ee59d7959b7 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
(window["noconflictJsonp"] = window["noconflictJsonp"] || []).push([["vendors~main"],{
/***/ "./node_modules/@pnp/common/dist/common.es5.js":
/*!*****************************************************!*\
!*** ./node_modules/@pnp/common/dist/common.es5.js ***!
\*****************************************************/
/*! exports provided: AdalClient, SPFxAdalClient, objectToMap, mergeMaps, setup, RuntimeConfigImpl, RuntimeConfig, mergeHeaders, mergeOptions, FetchClient, BearerTokenFetchClient, PnPClientStorageWrapper, PnPClientStorage, getCtxCallback, dateAdd, combine, getRandomString, getGUID, isFunc, objectDefinedNotNull, isArray, extend, isUrlAbsolute, stringIsNullOrEmpty, getAttrValueFromString, sanitizeGuid, jsS, hOP, getHashCode */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AdalClient", function() { return AdalClient; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPFxAdalClient", function() { return SPFxAdalClient; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectToMap", function() { return objectToMap; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeMaps", function() { return mergeMaps; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setup", function() { return setup; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfigImpl", function() { return RuntimeConfigImpl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RuntimeConfig", function() { return RuntimeConfig; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeHeaders", function() { return mergeHeaders; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeOptions", function() { return mergeOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FetchClient", function() { return FetchClient; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BearerTokenFetchClient", function() { return BearerTokenFetchClient; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorageWrapper", function() { return PnPClientStorageWrapper; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PnPClientStorage", function() { return PnPClientStorage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCtxCallback", function() { return getCtxCallback; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dateAdd", function() { return dateAdd; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combine", function() { return combine; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getRandomString", function() { return getRandomString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getGUID", function() { return getGUID; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFunc", function() { return isFunc; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectDefinedNotNull", function() { return objectDefinedNotNull; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return isArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extend", function() { return extend; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isUrlAbsolute", function() { return isUrlAbsolute; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "stringIsNullOrEmpty", function() { return stringIsNullOrEmpty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getAttrValueFromString", function() { return getAttrValueFromString; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeGuid", function() { return sanitizeGuid; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jsS", function() { return jsS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hOP", function() { return hOP; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHashCode", function() { return getHashCode; });
/* harmony import */ var adal_angular_dist_adal_min_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! adal-angular/dist/adal.min.js */ "./node_modules/adal-angular/dist/adal.min.js");
/* harmony import */ var adal_angular_dist_adal_min_js__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(adal_angular_dist_adal_min_js__WEBPACK_IMPORTED_MODULE_0__);
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
/**
* Gets a callback function which will maintain context across async calls.
* Allows for the calling pattern getCtxCallback(thisobj, method, methodarg1, methodarg2, ...)
*
* @param context The object that will be the 'this' value in the callback
* @param method The method to which we will apply the context and parameters
* @param params Optional, additional arguments to supply to the wrapped method when it is invoked
*/
function getCtxCallback(context, method) {
var params = [];
for (var _i = 2; _i < arguments.length; _i++) {
params[_i - 2] = arguments[_i];
}
return function () {
method.apply(context, params);
};
}
/**
* Adds a value to a date
*
* @param date The date to which we will add units, done in local time
* @param interval The name of the interval to add, one of: ['year', 'quarter', 'month', 'week', 'day', 'hour', 'minute', 'second']
* @param units The amount to add to date of the given interval
*
* http://stackoverflow.com/questions/1197928/how-to-add-30-minutes-to-a-javascript-date-object
*/
function dateAdd(date, interval, units) {
var ret = new Date(date); // don't change original date
switch (interval.toLowerCase()) {
case "year":
ret.setFullYear(ret.getFullYear() + units);
break;
case "quarter":
ret.setMonth(ret.getMonth() + 3 * units);
break;
case "month":
ret.setMonth(ret.getMonth() + units);
break;
case "week":
ret.setDate(ret.getDate() + 7 * units);
break;
case "day":
ret.setDate(ret.getDate() + units);
break;
case "hour":
ret.setTime(ret.getTime() + units * 3600000);
break;
case "minute":
ret.setTime(ret.getTime() + units * 60000);
break;
case "second":
ret.setTime(ret.getTime() + units * 1000);
break;
default:
ret = undefined;
break;
}
return ret;
}
/**
* Combines an arbitrary set of paths ensuring and normalizes the slashes
*
* @param paths 0 to n path parts to combine
*/
function combine() {
var paths = [];
for (var _i = 0; _i < arguments.length; _i++) {
paths[_i] = arguments[_i];
}
return paths
.filter(function (path) { return !stringIsNullOrEmpty(path); })
.map(function (path) { return path.replace(/^[\\|\/]/, "").replace(/[\\|\/]$/, ""); })
.join("/")
.replace(/\\/g, "/");
}
/**
* Gets a random string of chars length
*
* https://stackoverflow.com/questions/1349404/generate-random-string-characters-in-javascript
*
* @param chars The length of the random string to generate
*/
function getRandomString(chars) {
var text = new Array(chars);
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
for (var i = 0; i < chars; i++) {
text[i] = possible.charAt(Math.floor(Math.random() * possible.length));
}
return text.join("");
}
/**
* Gets a random GUID value
*
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
* https://stackoverflow.com/a/8809472 updated to prevent collisions.
*/
/* tslint:disable no-bitwise */
function getGUID() {
var d = Date.now();
if (typeof performance !== "undefined" && typeof performance.now === "function") {
d += performance.now(); // use high-precision timer if available
}
var guid = "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
var r = (d + Math.random() * 16) % 16 | 0;
d = Math.floor(d / 16);
return (c === "x" ? r : (r & 0x3 | 0x8)).toString(16);
});
return guid;
}
/* tslint:enable */
/**
* Determines if a given value is a function
*
* @param cf The thing to test for functionness
*/
function isFunc(cf) {
return typeof cf === "function";
}
/**
* Determines if an object is both defined and not null
* @param obj Object to test
*/
function objectDefinedNotNull(obj) {
return typeof obj !== "undefined" && obj !== null;
}
/**
* @returns whether the provided parameter is a JavaScript Array or not.
*/
function isArray(array) {
if (Array.isArray) {
return Array.isArray(array);
}
return array && typeof array.length === "number" && array.constructor === Array;
}
/**
* Provides functionality to extend the given object by doing a shallow copy
*
* @param target The object to which properties will be copied
* @param source The source object from which properties will be copied
* @param noOverwrite If true existing properties on the target are not overwritten from the source
* @param filter If provided allows additional filtering on what properties are copied (propName: string) => boolean
*
*/
function extend(target, source, noOverwrite, filter) {
if (noOverwrite === void 0) { noOverwrite = false; }
if (filter === void 0) { filter = function () { return true; }; }
if (!objectDefinedNotNull(source)) {
return target;
}
// ensure we don't overwrite things we don't want overwritten
var check = noOverwrite ? function (o, i) { return !(i in o); } : function () { return true; };
// final filter we will use
var f = function (v) { return check(target, v) && filter(v); };
return Object.getOwnPropertyNames(source)
.filter(f)
.reduce(function (t, v) {
t[v] = source[v];
return t;
}, target);
}
/**
* Determines if a given url is absolute
*
* @param url The url to check to see if it is absolute
*/
function isUrlAbsolute(url) {
return /^https?:\/\/|^\/\//i.test(url);
}
/**
* Determines if a string is null or empty or undefined
*
* @param s The string to test
*/
function stringIsNullOrEmpty(s) {
return s === undefined || s === null || s.length < 1;
}
/**
* Gets an attribute value from an html/xml string block. NOTE: if the input attribute value has
* RegEx special characters they will be escaped in the returned string
*
* @param html HTML to search
* @param attrName The name of the attribute to find
*/
function getAttrValueFromString(html, attrName) {
// make the input safe for regex
html = html.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
var reg = new RegExp(attrName + "\\s*?=\\s*?(\"|')([^\\1]*?)\\1", "i");
var match = reg.exec(html);
return match !== null && match.length > 0 ? match[2] : null;
}
/**
* Ensures guid values are represented consistently as "ea123463-137d-4ae3-89b8-cf3fc578ca05"
*
* @param guid The candidate guid
*/
function sanitizeGuid(guid) {
if (stringIsNullOrEmpty(guid)) {
return guid;
}
var matches = /([0-9A-F]{8}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{4}-[0-9A-F]{12})/i.exec(guid);
return matches === null ? guid : matches[1];
}
/**
* Shorthand for JSON.stringify
*
* @param o Any type of object
*/
function jsS(o) {
return JSON.stringify(o);
}
/**
* Shorthand for Object.hasOwnProperty
*
* @param o Object to check for
* @param p Name of the property
*/
function hOP(o, p) {
return Object.hasOwnProperty.call(o, p);
}
/**
* Generates a ~unique hash code
*
* From: https://stackoverflow.com/questions/6122571/simple-non-secure-hash-function-for-javascript
*/
// tslint:disable:no-bitwise
function getHashCode(s) {
var hash = 0;
if (s.length === 0) {
return hash;
}
for (var i = 0; i < s.length; i++) {
var chr = s.charCodeAt(i);
hash = ((hash << 5) - hash) + chr;
hash |= 0; // Convert to 32bit integer
}
return hash;
}
// tslint:enable:no-bitwise
function mergeHeaders(target, source) {
if (source !== undefined && source !== null) {
var temp = new Request("", { headers: source });
temp.headers.forEach(function (value, name) {
target.append(name, value);
});
}
}
function mergeOptions(target, source) {
if (objectDefinedNotNull(source)) {
var headers = extend(target.headers || {}, source.headers);
target = extend(target, source);
target.headers = headers;
}
}
/**
* Makes requests using the global/window fetch API
*/
var FetchClient = /** @class */ (function () {
function FetchClient() {
}
FetchClient.prototype.fetch = function (url, options) {
return global$1.fetch(url, options);
};
return FetchClient;
}());
/**
* Makes requests using the fetch API adding the supplied token to the Authorization header
*/
var BearerTokenFetchClient = /** @class */ (function (_super) {
__extends(BearerTokenFetchClient, _super);
function BearerTokenFetchClient(_token) {
var _this = _super.call(this) || this;
_this._token = _token;
return _this;
}
Object.defineProperty(BearerTokenFetchClient.prototype, "token", {
get: function () {
return this._token || "";
},
set: function (token) {
this._token = token;
},
enumerable: true,
configurable: true
});
BearerTokenFetchClient.prototype.fetch = function (url, options) {
if (options === void 0) { options = {}; }
var headers = new Headers();
mergeHeaders(headers, options.headers);
headers.set("Authorization", "Bearer " + this._token);
options.headers = headers;
return _super.prototype.fetch.call(this, url, options);
};
return BearerTokenFetchClient;
}(FetchClient));
/**
* Parses out the root of the request url to use as the resource when getting the token
*
* After: https://gist.github.com/jlong/2428561
* @param url The url to parse
*/
function getResource(url) {
var parser = document.createElement("a");
parser.href = url;
return parser.protocol + "//" + parser.hostname;
}
/**
* Azure AD Client for use in the browser
*/
var AdalClient = /** @class */ (function (_super) {
__extends(AdalClient, _super);
/**
* Creates a new instance of AdalClient
* @param clientId Azure App Id
* @param tenant Office 365 tenant (Ex: {tenant}.onmicrosoft.com)
* @param redirectUri The redirect url used to authenticate the
*/
function AdalClient(clientId, tenant, redirectUri) {
var _this = _super.call(this, null) || this;
_this.clientId = clientId;
_this.tenant = tenant;
_this.redirectUri = redirectUri;
_this._displayCallback = null;
_this._loginPromise = null;
return _this;
}
/**
* Creates a new AdalClient using the values of the supplied SPFx context (requires SPFx >= 1.6)
*
* @param spfxContext Current SPFx context
* @description Using this method requires that the features described in this article
* https://docs.microsoft.com/en-us/sharepoint/dev/spfx/use-aadhttpclient are activated in the tenant.
*/
AdalClient.fromSPFxContext = function (spfxContext) {
return new SPFxAdalClient(spfxContext);
};
/**
* Conducts the fetch opertation against the AAD secured resource
*
* @param url Absolute URL for the request
* @param options Any fetch options passed to the underlying fetch implementation
*/
AdalClient.prototype.fetch = function (url, options) {
var _this = this;
if (!isUrlAbsolute(url)) {
throw Error("You must supply absolute urls to AdalClient.fetch.");
}
// the url we are calling is the resource
return this.getToken(getResource(url)).then(function (token) {
_this.token = token;
return _super.prototype.fetch.call(_this, url, options);
});
};
/**
* Gets a token based on the current user
*
* @param resource The resource for which we are requesting a token
*/
AdalClient.prototype.getToken = function (resource) {
var _this = this;
return new Promise(function (resolve, reject) {
_this.ensureAuthContext().then(function (_) { return _this.login(); }).then(function (_) {
AdalClient._authContext.acquireToken(resource, function (message, token) {
if (message) {
return reject(Error(message));
}
resolve(token);
});
}).catch(reject);
});
};
/**
* Ensures we have created and setup the adal AuthenticationContext instance
*/
AdalClient.prototype.ensureAuthContext = function () {
var _this = this;
return new Promise(function (resolve) {
if (AdalClient._authContext === null) {
AdalClient._authContext = Object(adal_angular_dist_adal_min_js__WEBPACK_IMPORTED_MODULE_0__["inject"])({
clientId: _this.clientId,
displayCall: function (url) {
if (_this._displayCallback) {
_this._displayCallback(url);
}
},
navigateToLoginRequestUrl: false,
redirectUri: _this.redirectUri,
tenant: _this.tenant,
});
}
resolve();
});
};
/**
* Ensures the current user is logged in
*/
AdalClient.prototype.login = function () {
var _this = this;
if (this._loginPromise) {
return this._loginPromise;
}
this._loginPromise = new Promise(function (resolve, reject) {
if (AdalClient._authContext.getCachedUser()) {
return resolve();
}
_this._displayCallback = function (url) {
var popupWindow = window.open(url, "login", "width=483, height=600");
if (!popupWindow) {
return reject(Error("Could not open pop-up window for auth. Likely pop-ups are blocked by the browser."));
}
if (popupWindow && popupWindow.focus) {
popupWindow.focus();
}
var pollTimer = window.setInterval(function () {
if (!popupWindow || popupWindow.closed || popupWindow.closed === undefined) {
window.clearInterval(pollTimer);
}
try {
if (popupWindow.document.URL.indexOf(_this.redirectUri) !== -1) {
window.clearInterval(pollTimer);
AdalClient._authContext.handleWindowCallback(popupWindow.location.hash);
popupWindow.close();
resolve();
}
}
catch (e) {
reject(e);
}
}, 30);
};
// this triggers the login process
_this.ensureAuthContext().then(function (_) {
AdalClient._authContext._loginInProgress = false;
AdalClient._authContext.login();
_this._displayCallback = null;
});
});
return this._loginPromise;
};
/**
* Our auth context
*/
AdalClient._authContext = null;
return AdalClient;
}(BearerTokenFetchClient));
/**
* Client wrapping the aadTokenProvider available from SPFx >= 1.6
*/
var SPFxAdalClient = /** @class */ (function (_super) {
__extends(SPFxAdalClient, _super);
/**
*
* @param context provide the appropriate SPFx Context object
*/
function SPFxAdalClient(context) {
var _this = _super.call(this, null) || this;
_this.context = context;
return _this;
}
/**
* Executes a fetch request using the supplied url and options
*
* @param url Absolute url of the request
* @param options Any options
*/
SPFxAdalClient.prototype.fetch = function (url, options) {
var _this = this;
return this.getToken(getResource(url)).then(function (token) {
_this.token = token;
return _super.prototype.fetch.call(_this, url, options);
});
};
/**
* Gets an AAD token for the provided resource using the SPFx AADTokenProvider
*
* @param resource Resource for which a token is to be requested (ex: https://graph.microsoft.com)
*/
SPFxAdalClient.prototype.getToken = function (resource) {
return this.context.aadTokenProviderFactory.getTokenProvider().then(function (provider) {
return provider.getToken(resource);
});
};
return SPFxAdalClient;
}(BearerTokenFetchClient));
/**
* Used to calculate the object properties, with polyfill if needed
*/
var objectEntries = isFunc(Object.entries) ? Object.entries : function (o) { return Object.keys(o).map(function (k) { return [k, o[k]]; }); };
/**
* Converts the supplied object to a map
*
* @param o The object to map
*/
function objectToMap(o) {
if (o !== undefined && o !== null) {
return new Map(objectEntries(o));
}
return new Map();
}
/**
* Merges to Map instances together, overwriting values in target with matching keys, last in wins
*
* @param target map into which the other maps are merged
* @param maps One or more maps to merge into the target
*/
function mergeMaps(target) {
var maps = [];
for (var _i = 1; _i < arguments.length; _i++) {
maps[_i - 1] = arguments[_i];
}
for (var i = 0; i < maps.length; i++) {
maps[i].forEach(function (v, k) {
target.set(k, v);
});
}
return target;
}
function setup(config) {
RuntimeConfig.extend(config);
}
// lable mapping for known config values
var s = [
"defaultCachingStore",
"defaultCachingTimeoutSeconds",
"globalCacheDisable",
"enableCacheExpiration",
"cacheExpirationIntervalMilliseconds",
"spfxContext",
];
var RuntimeConfigImpl = /** @class */ (function () {
function RuntimeConfigImpl(_v) {
if (_v === void 0) { _v = new Map(); }
this._v = _v;
// setup defaults
this._v.set(s[0], "session");
this._v.set(s[1], 60);
this._v.set(s[2], false);
this._v.set(s[3], false);
this._v.set(s[4], 750);
this._v.set(s[5], null);
}
/**
*
* @param config The set of properties to add to the globa configuration instance
*/
RuntimeConfigImpl.prototype.extend = function (config) {
this._v = mergeMaps(this._v, objectToMap(config));
};
RuntimeConfigImpl.prototype.get = function (key) {
return this._v.get(key);
};
Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingStore", {
get: function () {
return this.get(s[0]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingTimeoutSeconds", {
get: function () {
return this.get(s[1]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "globalCacheDisable", {
get: function () {
return this.get(s[2]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "enableCacheExpiration", {
get: function () {
return this.get(s[3]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "cacheExpirationIntervalMilliseconds", {
get: function () {
return this.get(s[4]);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RuntimeConfigImpl.prototype, "spfxContext", {
get: function () {
return this.get(s[5]);
},
enumerable: true,
configurable: true
});
return RuntimeConfigImpl;
}());
var _runtimeConfig = new RuntimeConfigImpl();
var RuntimeConfig = _runtimeConfig;
/**
* A wrapper class to provide a consistent interface to browser based storage
*
*/
var PnPClientStorageWrapper = /** @class */ (function () {
/**
* Creates a new instance of the PnPClientStorageWrapper class
*
* @constructor
*/
function PnPClientStorageWrapper(store, defaultTimeoutMinutes) {
if (defaultTimeoutMinutes === void 0) { defaultTimeoutMinutes = -1; }
this.store = store;
this.defaultTimeoutMinutes = defaultTimeoutMinutes;
this.enabled = this.test();
// if the cache timeout is enabled call the handler
// this will clear any expired items and set the timeout function
if (RuntimeConfig.enableCacheExpiration) {
this.cacheExpirationHandler();
}
}
/**
* Get a value from storage, or null if that value does not exist
*
* @param key The key whose value we want to retrieve
*/
PnPClientStorageWrapper.prototype.get = function (key) {
if (!this.enabled) {
return null;
}
var o = this.store.getItem(key);
if (!objectDefinedNotNull(o)) {
return null;
}
var persistable = JSON.parse(o);
if (new Date(persistable.expiration) <= new Date()) {
this.delete(key);
return null;
}
else {
return persistable.value;
}
};
/**
* Adds a value to the underlying storage
*
* @param key The key to use when storing the provided value
* @param o The value to store
* @param expire Optional, if provided the expiration of the item, otherwise the default is used
*/
PnPClientStorageWrapper.prototype.put = function (key, o, expire) {
if (this.enabled) {
this.store.setItem(key, this.createPersistable(o, expire));
}
};
/**
* Deletes a value from the underlying storage
*
* @param key The key of the pair we want to remove from storage
*/
PnPClientStorageWrapper.prototype.delete = function (key) {
if (this.enabled) {
this.store.removeItem(key);
}
};
/**
* Gets an item from the underlying storage, or adds it if it does not exist using the supplied getter function
*
* @param key The key to use when storing the provided value
* @param getter A function which will upon execution provide the desired value
* @param expire Optional, if provided the expiration of the item, otherwise the default is used
*/
PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {
var _this = this;
if (!this.enabled) {
return getter();
}
var o = this.get(key);
if (o === null) {
return getter().then(function (d) {
_this.put(key, d, expire);
return d;
});
}
return Promise.resolve(o);
};
/**
* Deletes any expired items placed in the store by the pnp library, leaves other items untouched
*/
PnPClientStorageWrapper.prototype.deleteExpired = function () {
var _this = this;
return new Promise(function (resolve, reject) {
if (!_this.enabled) {
resolve();
}
try {
for (var i = 0; i < _this.store.length; i++) {
var key = _this.store.key(i);
if (key !== null) {
// test the stored item to see if we stored it
if (/["|']?pnp["|']? ?: ?1/i.test(_this.store.getItem(key))) {
// get those items as get will delete from cache if they are expired
_this.get(key);
}
}
}
resolve();
}
catch (e) {
reject(e);
}
});
};
/**
* Used to determine if the wrapped storage is available currently
*/
PnPClientStorageWrapper.prototype.test = function () {
var str = "t";
try {
this.store.setItem(str, str);
this.store.removeItem(str);
return true;
}
catch (e) {
return false;
}
};
/**
* Creates the persistable to store
*/
PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) {
if (expire === undefined) {
// ensure we are by default inline with the global library setting
var defaultTimeout = RuntimeConfig.defaultCachingTimeoutSeconds;
if (this.defaultTimeoutMinutes > 0) {
defaultTimeout = this.defaultTimeoutMinutes * 60;
}
expire = dateAdd(new Date(), "second", defaultTimeout);
}
return jsS({ pnp: 1, expiration: expire, value: o });
};
/**
* Deletes expired items added by this library in this.store and sets a timeout to call itself
*/
PnPClientStorageWrapper.prototype.cacheExpirationHandler = function () {
var _this = this;
this.deleteExpired().then(function (_) {
// call ourself in the future
setTimeout(getCtxCallback(_this, _this.cacheExpirationHandler), RuntimeConfig.cacheExpirationIntervalMilliseconds);
}).catch(function (e) {
console.error(e);
});
};
return PnPClientStorageWrapper;
}());
/**
* A thin implementation of in-memory storage for use in nodejs
*/
var MemoryStorage = /** @class */ (function () {
function MemoryStorage(_store) {
if (_store === void 0) { _store = new Map(); }
this._store = _store;
}
Object.defineProperty(MemoryStorage.prototype, "length", {
get: function () {
return this._store.size;
},
enumerable: true,
configurable: true
});
MemoryStorage.prototype.clear = function () {
this._store.clear();
};
MemoryStorage.prototype.getItem = function (key) {
return this._store.get(key);
};
MemoryStorage.prototype.key = function (index) {
return Array.from(this._store)[index][0];
};
MemoryStorage.prototype.removeItem = function (key) {
this._store.delete(key);
};
MemoryStorage.prototype.setItem = function (key, data) {
this._store.set(key, data);
};
return MemoryStorage;
}());
/**
* A class that will establish wrappers for both local and session storage
*/
var PnPClientStorage = /** @class */ (function () {
/**
* Creates a new instance of the PnPClientStorage class
*
* @constructor
*/
function PnPClientStorage(_local, _session) {
if (_local === void 0) { _local = null; }
if (_session === void 0) { _session = null; }
this._local = _local;
this._session = _session;
}
Object.defineProperty(PnPClientStorage.prototype, "local", {
/**
* Provides access to the local storage of the browser
*/
get: function () {
if (this._local === null) {
this._local = this.getStore("local");
}
return this._local;
},
enumerable: true,
configurable: true
});
Object.defineProperty(PnPClientStorage.prototype, "session", {
/**
* Provides access to the session storage of the browser
*/
get: function () {
if (this._session === null) {
this._session = this.getStore("session");
}
return this._session;
},
enumerable: true,
configurable: true
});
PnPClientStorage.prototype.getStore = function (name) {
if (name === "local") {
return new PnPClientStorageWrapper(typeof (localStorage) === "undefined" ? new MemoryStorage() : localStorage);
}
return new PnPClientStorageWrapper(typeof (sessionStorage) === "undefined" ? new MemoryStorage() : sessionStorage);
};
return PnPClientStorage;
}());
//# sourceMappingURL=common.es5.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/@pnp/logging/dist/logging.es5.js":
/*!*******************************************************!*\
!*** ./node_modules/@pnp/logging/dist/logging.es5.js ***!
\*******************************************************/
/*! exports provided: Logger, LogLevel, ConsoleListener, FunctionListener */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Logger", function() { return Logger; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LogLevel", function() { return LogLevel; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConsoleListener", function() { return ConsoleListener; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionListener", function() { return FunctionListener; });
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
/**
* Class used to subscribe ILogListener and log messages throughout an application
*
*/
var Logger = /** @class */ (function () {
function Logger() {
}
Object.defineProperty(Logger, "activeLogLevel", {
/**
* Gets or sets the active log level to apply for log filtering
*/
get: function () {
return Logger.instance.activeLogLevel;
},
set: function (value) {
Logger.instance.activeLogLevel = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(Logger, "instance", {
get: function () {
if (Logger._instance === undefined || Logger._instance === null) {
Logger._instance = new LoggerImpl();
}
return Logger._instance;
},
enumerable: true,
configurable: true
});
/**
* Adds ILogListener instances to the set of subscribed listeners
*
* @param listeners One or more listeners to subscribe to this log
*/
Logger.subscribe = function () {
var listeners = [];
for (var _i = 0; _i < arguments.length; _i++) {
listeners[_i] = arguments[_i];
}
listeners.map(function (listener) { return Logger.instance.subscribe(listener); });
};
/**
* Clears the subscribers collection, returning the collection before modifiction
*/
Logger.clearSubscribers = function () {
return Logger.instance.clearSubscribers();
};
Object.defineProperty(Logger, "count", {
/**
* Gets the current subscriber count
*/
get: function () {
return Logger.instance.count;
},
enumerable: true,
configurable: true
});
/**
* Writes the supplied string to the subscribed listeners
*
* @param message The message to write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Info)
*/
Logger.write = function (message, level) {
if (level === void 0) { level = 1 /* Info */; }
Logger.instance.log({ level: level, message: message });
};
/**
* Writes the supplied string to the subscribed listeners
*
* @param json The json object to stringify and write
* @param level [Optional] if supplied will be used as the level of the entry (Default: LogLevel.Info)
*/
Logger.writeJSON = function (json, level) {
if (level === void 0) { level = 1 /* Info */; }
this.write(JSON.stringify(json), level);
};
/**
* Logs the supplied entry to the subscribed listeners
*
* @param entry The message to log
*/
Logger.log = function (entry) {
Logger.instance.log(entry);
};
/**
* Logs an error object to the subscribed listeners
*
* @param err The error object
*/
Logger.error = function (err) {
Logger.instance.log({ data: err, level: 3 /* Error */, message: err.message });
};
return Logger;
}());
var LoggerImpl = /** @class */ (function () {
function LoggerImpl(activeLogLevel, subscribers) {
if (activeLogLevel === void 0) { activeLogLevel = 2 /* Warning */; }
if (subscribers === void 0) { subscribers = []; }
this.activeLogLevel = activeLogLevel;
this.subscribers = subscribers;
}
LoggerImpl.prototype.subscribe = function (listener) {
this.subscribers.push(listener);
};
LoggerImpl.prototype.clearSubscribers = function () {
var s = this.subscribers.slice(0);
this.subscribers.length = 0;
return s;
};
Object.defineProperty(LoggerImpl.prototype, "count", {
get: function () {
return this.subscribers.length;
},
enumerable: true,
configurable: true
});
LoggerImpl.prototype.write = function (message, level) {
if (level === void 0) { level = 1 /* Info */; }
this.log({ level: level, message: message });
};
LoggerImpl.prototype.log = function (entry) {
if (entry !== undefined && this.activeLogLevel <= entry.level) {
this.subscribers.map(function (subscriber) { return subscriber.log(entry); });
}
};
return LoggerImpl;
}());
/**
* A set of logging levels
*/
var LogLevel;
(function (LogLevel) {
LogLevel[LogLevel["Verbose"] = 0] = "Verbose";
LogLevel[LogLevel["Info"] = 1] = "Info";
LogLevel[LogLevel["Warning"] = 2] = "Warning";
LogLevel[LogLevel["Error"] = 3] = "Error";
LogLevel[LogLevel["Off"] = 99] = "Off";
})(LogLevel || (LogLevel = {}));
/**
* Implementation of LogListener which logs to the console
*
*/
var ConsoleListener = /** @class */ (function () {
function ConsoleListener() {
}
/**
* Any associated data that a given logging listener may choose to log or ignore
*
* @param entry The information to be logged
*/
ConsoleListener.prototype.log = function (entry) {
var msg = this.format(entry);
switch (entry.level) {
case 0 /* Verbose */:
case 1 /* Info */:
console.log(msg);
break;
case 2 /* Warning */:
console.warn(msg);
break;
case 3 /* Error */:
console.error(msg);
break;
}
};
/**
* Formats the message
*
* @param entry The information to format into a string
*/
ConsoleListener.prototype.format = function (entry) {
var msg = [];
msg.push("Message: " + entry.message);
if (entry.data !== undefined) {
try {
msg.push(" Data: " + JSON.stringify(entry.data));
}
catch (e) {
msg.push(" Data: Error in stringify of supplied data " + e);
}
}
return msg.join("");
};
return ConsoleListener;
}());
/**
* Implementation of LogListener which logs to the supplied function
*
*/
var FunctionListener = /** @class */ (function () {
/**
* Creates a new instance of the FunctionListener class
*
* @constructor
* @param method The method to which any logging data will be passed
*/
function FunctionListener(method) {
this.method = method;
}
/**
* Any associated data that a given logging listener may choose to log or ignore
*
* @param entry The information to be logged
*/
FunctionListener.prototype.log = function (entry) {
this.method(entry);
};
return FunctionListener;
}());
//# sourceMappingURL=logging.es5.js.map
/***/ }),
/***/ "./node_modules/@pnp/odata/dist/odata.es5.js":
/*!***************************************************!*\
!*** ./node_modules/@pnp/odata/dist/odata.es5.js ***!
\***************************************************/
/*! exports provided: CachingOptions, CachingParserWrapper, HttpRequestError, ODataParserBase, ODataDefaultParser, TextParser, BlobParser, JSONParser, BufferParser, LambdaParser, setResult, pipe, requestPipelineMethod, PipelineMethods, getDefaultPipeline, Queryable, ODataQueryable, ODataBatch */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CachingOptions", function() { return CachingOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CachingParserWrapper", function() { return CachingParserWrapper; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpRequestError", function() { return HttpRequestError; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ODataParserBase", function() { return ODataParserBase; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ODataDefaultParser", function() { return ODataDefaultParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextParser", function() { return TextParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BlobParser", function() { return BlobParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JSONParser", function() { return JSONParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BufferParser", function() { return BufferParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LambdaParser", function() { return LambdaParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setResult", function() { return setResult; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pipe", function() { return pipe; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "requestPipelineMethod", function() { return requestPipelineMethod; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PipelineMethods", function() { return PipelineMethods; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDefaultPipeline", function() { return getDefaultPipeline; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Queryable", function() { return Queryable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ODataQueryable", function() { return ODataQueryable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ODataBatch", function() { return ODataBatch; });
/* harmony import */ var _pnp_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pnp/common */ "./node_modules/@pnp/common/dist/common.es5.js");
/* harmony import */ var _pnp_logging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pnp/logging */ "./node_modules/@pnp/logging/dist/logging.es5.js");
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
var CachingOptions = /** @class */ (function () {
function CachingOptions(key) {
this.key = key;
this.expiration = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["dateAdd"])(new Date(), "second", _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].defaultCachingTimeoutSeconds);
this.storeName = _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].defaultCachingStore;
}
Object.defineProperty(CachingOptions.prototype, "store", {
get: function () {
if (this.storeName === "local") {
return CachingOptions.storage.local;
}
else {
return CachingOptions.storage.session;
}
},
enumerable: true,
configurable: true
});
CachingOptions.storage = new _pnp_common__WEBPACK_IMPORTED_MODULE_0__["PnPClientStorage"]();
return CachingOptions;
}());
var CachingParserWrapper = /** @class */ (function () {
function CachingParserWrapper(parser, cacheOptions) {
this.parser = parser;
this.cacheOptions = cacheOptions;
}
CachingParserWrapper.prototype.parse = function (response) {
var _this = this;
return this.parser.parse(response).then(function (r) { return _this.cacheData(r); });
};
CachingParserWrapper.prototype.cacheData = function (data) {
if (this.cacheOptions.store !== null) {
this.cacheOptions.store.put(this.cacheOptions.key, data, this.cacheOptions.expiration);
}
return data;
};
return CachingParserWrapper;
}());
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
var HttpRequestError = /** @class */ (function (_super) {
__extends(HttpRequestError, _super);
function HttpRequestError(message, response, status, statusText) {
if (status === void 0) { status = response.status; }
if (statusText === void 0) { statusText = response.statusText; }
var _this = _super.call(this, message) || this;
_this.response = response;
_this.status = status;
_this.statusText = statusText;
_this.isHttpRequestError = true;
return _this;
}
HttpRequestError.init = function (r) {
return r.clone().text().then(function (t) {
return new HttpRequestError("Error making HttpClient request in queryable [" + r.status + "] " + r.statusText + " ::> " + t, r.clone());
});
};
return HttpRequestError;
}(Error));
var ODataParserBase = /** @class */ (function () {
function ODataParserBase() {
}
ODataParserBase.prototype.parse = function (r) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.handleError(r, reject)) {
_this.parseImpl(r, resolve, reject);
}
});
};
ODataParserBase.prototype.parseImpl = function (r, resolve, reject) {
var _this = this;
if ((r.headers.has("Content-Length") && parseFloat(r.headers.get("Content-Length")) === 0) || r.status === 204) {
resolve({});
}
else {
// patch to handle cases of 200 response with no or whitespace only bodies (#487 & #545)
r.text()
.then(function (txt) { return txt.replace(/\s/ig, "").length > 0 ? JSON.parse(txt) : {}; })
.then(function (json) { return resolve(_this.parseODataJSON(json)); })
.catch(function (e) { return reject(e); });
}
};
/**
* Handles a response with ok === false by parsing the body and creating a ProcessHttpClientResponseException
* which is passed to the reject delegate. This method returns true if there is no error, otherwise false
*
* @param r Current response object
* @param reject reject delegate for the surrounding promise
*/
ODataParserBase.prototype.handleError = function (r, reject) {
if (!r.ok) {
HttpRequestError.init(r).then(reject);
}
return r.ok;
};
/**
* Normalizes the json response by removing the various nested levels
*
* @param json json object to parse
*/
ODataParserBase.prototype.parseODataJSON = function (json) {
var result = json;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(json, "d")) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(json.d, "results")) {
result = json.d.results;
}
else {
result = json.d;
}
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(json, "value")) {
result = json.value;
}
return result;
};
return ODataParserBase;
}());
var ODataDefaultParser = /** @class */ (function (_super) {
__extends(ODataDefaultParser, _super);
function ODataDefaultParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
return ODataDefaultParser;
}(ODataParserBase));
var TextParser = /** @class */ (function (_super) {
__extends(TextParser, _super);
function TextParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
TextParser.prototype.parseImpl = function (r, resolve) {
r.text().then(resolve);
};
return TextParser;
}(ODataParserBase));
var BlobParser = /** @class */ (function (_super) {
__extends(BlobParser, _super);
function BlobParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
BlobParser.prototype.parseImpl = function (r, resolve) {
r.blob().then(resolve);
};
return BlobParser;
}(ODataParserBase));
var JSONParser = /** @class */ (function (_super) {
__extends(JSONParser, _super);
function JSONParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
JSONParser.prototype.parseImpl = function (r, resolve) {
r.json().then(resolve);
};
return JSONParser;
}(ODataParserBase));
var BufferParser = /** @class */ (function (_super) {
__extends(BufferParser, _super);
function BufferParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
BufferParser.prototype.parseImpl = function (r, resolve) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isFunc"])(r.arrayBuffer)) {
r.arrayBuffer().then(resolve);
}
else {
r.buffer().then(resolve);
}
};
return BufferParser;
}(ODataParserBase));
var LambdaParser = /** @class */ (function (_super) {
__extends(LambdaParser, _super);
function LambdaParser(parser) {
var _this = _super.call(this) || this;
_this.parser = parser;
return _this;
}
LambdaParser.prototype.parseImpl = function (r, resolve) {
this.parser(r).then(resolve);
};
return LambdaParser;
}(ODataParserBase));
/**
* Resolves the context's result value
*
* @param context The current context
*/
function returnResult(context) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].log({
data: _pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].activeLogLevel === 0 /* Verbose */ ? context.result : {},
level: 1 /* Info */,
message: "[" + context.requestId + "] (" + (new Date()).getTime() + ") Returning result from pipeline. Set logging to verbose to see data.",
});
return Promise.resolve(context.result);
}
/**
* Sets the result on the context
*/
function setResult(context, value) {
return new Promise(function (resolve) {
context.result = value;
context.hasResult = true;
resolve(context);
});
}
/**
* Invokes the next method in the provided context's pipeline
*
* @param c The current request context
*/
function next(c) {
if (c.pipeline.length > 0) {
return c.pipeline.shift()(c);
}
else {
return Promise.resolve(c);
}
}
/**
* Executes the current request context's pipeline
*
* @param context Current context
*/
function pipe(context) {
if (context.pipeline.length < 1) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + context.requestId + "] (" + (new Date()).getTime() + ") Request pipeline contains no methods!", 2 /* Warning */);
}
var promise = next(context).then(function (ctx) { return returnResult(ctx); }).catch(function (e) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].error(e);
throw e;
});
if (context.isBatched) {
// this will block the batch's execute method from returning until the child requets have been resolved
context.batch.addResolveBatchDependency(promise);
}
return promise;
}
/**
* decorator factory applied to methods in the pipeline to control behavior
*/
function requestPipelineMethod(alwaysRun) {
if (alwaysRun === void 0) { alwaysRun = false; }
return function (target, propertyKey, descriptor) {
var method = descriptor.value;
descriptor.value = function () {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
// if we have a result already in the pipeline, pass it along and don't call the tagged method
if (!alwaysRun && args.length > 0 && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(args[0], "hasResult") && args[0].hasResult) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + args[0].requestId + "] (" + (new Date()).getTime() + ") Skipping request pipeline method " + propertyKey + ", existing result in pipeline.", 0 /* Verbose */);
return Promise.resolve(args[0]);
}
// apply the tagged method
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + args[0].requestId + "] (" + (new Date()).getTime() + ") Calling request pipeline method " + propertyKey + ".", 0 /* Verbose */);
// then chain the next method in the context's pipeline - allows for dynamic pipeline
return method.apply(target, args).then(function (ctx) { return next(ctx); });
};
};
}
/**
* Contains the methods used within the request pipeline
*/
var PipelineMethods = /** @class */ (function () {
function PipelineMethods() {
}
/**
* Logs the start of the request
*/
PipelineMethods.logStart = function (context) {
return new Promise(function (resolve) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].log({
data: _pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].activeLogLevel === 1 /* Info */ ? {} : context,
level: 1 /* Info */,
message: "[" + context.requestId + "] (" + (new Date()).getTime() + ") Beginning " + context.verb + " request (" + context.requestAbsoluteUrl + ")",
});
resolve(context);
});
};
/**
* Handles caching of the request
*/
PipelineMethods.caching = function (context) {
return new Promise(function (resolve) {
// handle caching, if applicable
if (context.isCached) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + context.requestId + "] (" + (new Date()).getTime() + ") Caching is enabled for request, checking cache...", 1 /* Info */);
var cacheOptions = new CachingOptions(context.requestAbsoluteUrl.toLowerCase());
if (context.cachingOptions !== undefined) {
cacheOptions = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(cacheOptions, context.cachingOptions);
}
// we may not have a valid store
if (cacheOptions.store !== null) {
// check if we have the data in cache and if so resolve the promise and return
var data = cacheOptions.store.get(cacheOptions.key);
if (data !== null) {
// ensure we clear any held batch dependency we are resolving from the cache
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].log({
data: _pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].activeLogLevel === 1 /* Info */ ? {} : data,
level: 1 /* Info */,
message: "[" + context.requestId + "] (" + (new Date()).getTime() + ") Value returned from cache.",
});
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isFunc"])(context.batchDependency)) {
context.batchDependency();
}
// handle the case where a parser needs to take special actions with a cached result
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(context.parser, "hydrate")) {
data = context.parser.hydrate(data);
}
return setResult(context, data).then(function (ctx) { return resolve(ctx); });
}
}
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + context.requestId + "] (" + (new Date()).getTime() + ") Value not found in cache.", 1 /* Info */);
// if we don't then wrap the supplied parser in the caching parser wrapper
// and send things on their way
context.parser = new CachingParserWrapper(context.parser, cacheOptions);
}
return resolve(context);
});
};
/**
* Sends the request
*/
PipelineMethods.send = function (context) {
return new Promise(function (resolve, reject) {
// send or batch the request
if (context.isBatched) {
// we are in a batch, so add to batch, remove dependency, and resolve with the batch's promise
var p = context.batch.add(context.requestAbsoluteUrl, context.verb, context.options, context.parser, context.requestId);
// we release the dependency here to ensure the batch does not execute until the request is added to the batch
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isFunc"])(context.batchDependency)) {
context.batchDependency();
}
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + context.requestId + "] (" + (new Date()).getTime() + ") Batching request in batch " + context.batch.batchId + ".", 1 /* Info */);
// we set the result as the promise which will be resolved by the batch's execution
resolve(setResult(context, p));
}
else {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + context.requestId + "] (" + (new Date()).getTime() + ") Sending request.", 1 /* Info */);
// we are not part of a batch, so proceed as normal
var client = context.clientFactory();
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(context.options || {}, { method: context.verb });
client.fetch(context.requestAbsoluteUrl, opts)
.then(function (response) { return context.parser.parse(response); })
.then(function (result) { return setResult(context, result); })
.then(function (ctx) { return resolve(ctx); })
.catch(function (e) { return reject(e); });
}
});
};
/**
* Logs the end of the request
*/
PipelineMethods.logEnd = function (context) {
return new Promise(function (resolve) {
if (context.isBatched) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].log({
data: _pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].activeLogLevel === 1 /* Info */ ? {} : context,
level: 1 /* Info */,
message: "[" + context.requestId + "] (" + (new Date()).getTime() + ") " + context.verb + " request will complete in batch " + context.batch.batchId + ".",
});
}
else {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].log({
data: _pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].activeLogLevel === 1 /* Info */ ? {} : context,
level: 1 /* Info */,
message: "[" + context.requestId + "] (" + (new Date()).getTime() + ") Completing " + context.verb + " request.",
});
}
resolve(context);
});
};
__decorate([
requestPipelineMethod(true)
], PipelineMethods, "logStart", null);
__decorate([
requestPipelineMethod()
], PipelineMethods, "caching", null);
__decorate([
requestPipelineMethod()
], PipelineMethods, "send", null);
__decorate([
requestPipelineMethod(true)
], PipelineMethods, "logEnd", null);
return PipelineMethods;
}());
function getDefaultPipeline() {
return [
PipelineMethods.logStart,
PipelineMethods.caching,
PipelineMethods.send,
PipelineMethods.logEnd,
].slice(0);
}
var Queryable = /** @class */ (function () {
function Queryable() {
this._query = new Map();
this._options = {};
this._url = "";
this._parentUrl = "";
this._useCaching = false;
this._cachingOptions = null;
this._cloneParentWasCaching = false;
this._cloneParentCacheOptions = null;
this._requestPipeline = null;
}
/**
* Gets the currentl url
*
*/
Queryable.prototype.toUrl = function () {
return this._url;
};
/**
* Directly concatonates the supplied string to the current url, not normalizing "/" chars
*
* @param pathPart The string to concatonate to the url
*/
Queryable.prototype.concat = function (pathPart) {
this._url += pathPart;
return this;
};
Object.defineProperty(Queryable.prototype, "query", {
/**
* Provides access to the query builder for this url
*
*/
get: function () {
return this._query;
},
enumerable: true,
configurable: true
});
/**
* Sets custom options for current object and all derived objects accessible via chaining
*
* @param options custom options
*/
Queryable.prototype.configure = function (options) {
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeOptions"])(this._options, options);
return this;
};
/**
* Configures this instance from the configure options of the supplied instance
*
* @param o Instance from which options should be taken
*/
Queryable.prototype.configureFrom = function (o) {
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeOptions"])(this._options, o._options);
return this;
};
/**
* Enables caching for this request
*
* @param options Defines the options used when caching this request
*/
Queryable.prototype.usingCaching = function (options) {
if (!_pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].globalCacheDisable) {
this._useCaching = true;
if (options !== undefined) {
this._cachingOptions = options;
}
}
return this;
};
/**
* Allows you to set a request specific processing pipeline
*
* @param pipeline The set of methods, in order, to execute a given request
*/
Queryable.prototype.withPipeline = function (pipeline) {
this._requestPipeline = pipeline.slice(0);
return this;
};
Queryable.prototype.getCore = function (parser, options) {
if (parser === void 0) { parser = new JSONParser(); }
if (options === void 0) { options = {}; }
// Fix for #304 - when we clone objects we in some cases then execute a get request
// in these cases the caching settings were getting dropped from the request
// this tracks if the object from which this was cloned was caching and applies that to an immediate get request
// does not affect objects cloned from this as we are using different fields to track the settings so it won't
// be triggered
if (this._cloneParentWasCaching) {
this.usingCaching(this._cloneParentCacheOptions);
}
return this.reqImpl("GET", options, parser);
};
Queryable.prototype.postCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new JSONParser(); }
return this.reqImpl("POST", options, parser);
};
Queryable.prototype.patchCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new JSONParser(); }
return this.reqImpl("PATCH", options, parser);
};
Queryable.prototype.deleteCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new JSONParser(); }
return this.reqImpl("DELETE", options, parser);
};
Queryable.prototype.putCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new JSONParser(); }
return this.reqImpl("PUT", options, parser);
};
Queryable.prototype.reqImpl = function (method, options, parser) {
var _this = this;
if (options === void 0) { options = {}; }
return this.getRequestPipeline(method, options, parser)
.then(function (pipeline) { return _this.toRequestContext(method, options, parser, pipeline); })
.then(function (context) { return pipe(context); });
};
/**
* Appends the given string and normalizes "/" chars
*
* @param pathPart The string to append
*/
Queryable.prototype.append = function (pathPart) {
this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(this._url, pathPart);
};
Object.defineProperty(Queryable.prototype, "parentUrl", {
/**
* Gets the parent url used when creating this instance
*
*/
get: function () {
return this._parentUrl;
},
enumerable: true,
configurable: true
});
/**
* Extends this queryable from the provided parent
*
* @param parent Parent queryable from which we will derive a base url
* @param path Additional path
*/
Queryable.prototype.extend = function (parent, path) {
this._parentUrl = parent._url;
this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(this._parentUrl, path || "");
this.configureFrom(parent);
};
/**
* Configures a cloned object from this instance
*
* @param clone
*/
Queryable.prototype._clone = function (clone, _0) {
clone.configureFrom(this);
if (this._useCaching) {
clone._cloneParentWasCaching = true;
clone._cloneParentCacheOptions = this._cachingOptions;
}
return clone;
};
/**
* Handles getting the request pipeline to run for a given request
*/
// @ts-ignore
// justified because we want to show that all these arguments are passed to the method so folks inheriting and potentially overriding
// clearly see how the method is invoked inside the class
Queryable.prototype.getRequestPipeline = function (method, options, parser) {
var _this = this;
if (options === void 0) { options = {}; }
return new Promise(function (resolve) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(_this._requestPipeline) && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isArray"])(_this._requestPipeline)) {
resolve(_this._requestPipeline);
}
else {
resolve(getDefaultPipeline());
}
});
};
return Queryable;
}());
var ODataQueryable = /** @class */ (function (_super) {
__extends(ODataQueryable, _super);
function ODataQueryable() {
var _this = _super.call(this) || this;
_this._batch = null;
_this._batchDependency = null;
return _this;
}
/**
* Adds this query to the supplied batch
*
* @example
* ```
*
* let b = pnp.sp.createBatch();
* pnp.sp.web.inBatch(b).get().then(...);
* b.execute().then(...)
* ```
*/
ODataQueryable.prototype.inBatch = function (batch) {
if (this.batch !== null) {
throw Error("This query is already part of a batch.");
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(batch)) {
this._batch = batch;
this._batchDependency = batch.addDependency();
}
return this;
};
/**
* Gets the currentl url
*
*/
ODataQueryable.prototype.toUrl = function () {
return this._url;
};
/**
* Executes the currently built request
*
* @param parser Allows you to specify a parser to handle the result
* @param getOptions The options used for this request
*/
ODataQueryable.prototype.get = function (parser, options) {
if (parser === void 0) { parser = new ODataDefaultParser(); }
if (options === void 0) { options = {}; }
return this.getCore(parser, options);
};
ODataQueryable.prototype.getCore = function (parser, options) {
if (parser === void 0) { parser = new ODataDefaultParser(); }
if (options === void 0) { options = {}; }
return _super.prototype.getCore.call(this, parser, options);
};
ODataQueryable.prototype.postCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new ODataDefaultParser(); }
return _super.prototype.postCore.call(this, options, parser);
};
ODataQueryable.prototype.patchCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new ODataDefaultParser(); }
return _super.prototype.patchCore.call(this, options, parser);
};
ODataQueryable.prototype.deleteCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new ODataDefaultParser(); }
return _super.prototype.deleteCore.call(this, options, parser);
};
ODataQueryable.prototype.putCore = function (options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = new ODataDefaultParser(); }
return _super.prototype.putCore.call(this, options, parser);
};
/**
* Blocks a batch call from occuring, MUST be cleared by calling the returned function
*/
ODataQueryable.prototype.addBatchDependency = function () {
if (this._batch !== null) {
return this._batch.addDependency();
}
return function () { return null; };
};
Object.defineProperty(ODataQueryable.prototype, "hasBatch", {
/**
* Indicates if the current query has a batch associated
*
*/
get: function () {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._batch);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODataQueryable.prototype, "batch", {
/**
* The batch currently associated with this query or null
*
*/
get: function () {
return this.hasBatch ? this._batch : null;
},
enumerable: true,
configurable: true
});
/**
* Configures a cloned object from this instance
*
* @param clone
*/
ODataQueryable.prototype._clone = function (clone, cloneSettings) {
clone = _super.prototype._clone.call(this, clone, cloneSettings);
if (cloneSettings.includeBatch) {
clone = clone.inBatch(this._batch);
}
return clone;
};
return ODataQueryable;
}(Queryable));
var ODataBatch = /** @class */ (function () {
function ODataBatch(_batchId) {
if (_batchId === void 0) { _batchId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])(); }
this._batchId = _batchId;
this._reqs = [];
this._deps = [];
this._rDeps = [];
}
Object.defineProperty(ODataBatch.prototype, "batchId", {
get: function () {
return this._batchId;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ODataBatch.prototype, "requests", {
/**
* The requests contained in this batch
*/
get: function () {
return this._reqs;
},
enumerable: true,
configurable: true
});
/**
*
* @param url Request url
* @param method Request method (GET, POST, etc)
* @param options Any request options
* @param parser The parser used to handle the eventual return from the query
* @param id An identifier used to track a request within a batch
*/
ODataBatch.prototype.add = function (url, method, options, parser, id) {
var info = {
id: id,
method: method.toUpperCase(),
options: options,
parser: parser,
reject: null,
resolve: null,
url: url,
};
var p = new Promise(function (resolve, reject) {
info.resolve = resolve;
info.reject = reject;
});
this._reqs.push(info);
return p;
};
/**
* Adds a dependency insuring that some set of actions will occur before a batch is processed.
* MUST be cleared using the returned resolve delegate to allow batches to run
*/
ODataBatch.prototype.addDependency = function () {
var resolver = function () { return void (0); };
this._deps.push(new Promise(function (resolve) {
resolver = resolve;
}));
return resolver;
};
/**
* The batch's execute method will not resolve util any promises added here resolve
*
* @param p The dependent promise
*/
ODataBatch.prototype.addResolveBatchDependency = function (p) {
this._rDeps.push(p);
};
/**
* Execute the current batch and resolve the associated promises
*
* @returns A promise which will be resolved once all of the batch's child promises have resolved
*/
ODataBatch.prototype.execute = function () {
var _this = this;
// we need to check the dependencies twice due to how different engines handle things.
// We can get a second set of promises added during the first set resolving
return Promise.all(this._deps)
.then(function () { return _this.executeImpl(); })
.then(function () { return Promise.all(_this._rDeps); })
.then(function () { return void (0); });
};
return ODataBatch;
}());
//# sourceMappingURL=odata.es5.js.map
/***/ }),
/***/ "./node_modules/@pnp/sp-clientsvc/dist/sp-clientsvc.es5.js":
/*!*****************************************************************!*\
!*** ./node_modules/@pnp/sp-clientsvc/dist/sp-clientsvc.es5.js ***!
\*****************************************************************/
/*! exports provided: ObjectPathBatch, ClientSvcQueryable, ObjectPath, opSetId, opSetPathId, opSetParentId, opSetPathParamId, ObjectPathQueue, objectPath, identityQuery, opQuery, setProperty, methodAction, objectProperties, property, staticMethod, staticProperty, objConstructor, MethodParams, method, ProcessQueryParser, writeObjectPathBody */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectPathBatch", function() { return ObjectPathBatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClientSvcQueryable", function() { return ClientSvcQueryable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectPath", function() { return ObjectPath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "opSetId", function() { return opSetId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "opSetPathId", function() { return opSetPathId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "opSetParentId", function() { return opSetParentId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "opSetPathParamId", function() { return opSetPathParamId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectPathQueue", function() { return ObjectPathQueue; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectPath", function() { return objectPath; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identityQuery", function() { return identityQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "opQuery", function() { return opQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setProperty", function() { return setProperty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "methodAction", function() { return methodAction; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objectProperties", function() { return objectProperties; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "property", function() { return property; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticMethod", function() { return staticMethod; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "staticProperty", function() { return staticProperty; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "objConstructor", function() { return objConstructor; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MethodParams", function() { return MethodParams; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "method", function() { return method; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProcessQueryParser", function() { return ProcessQueryParser; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "writeObjectPathBody", function() { return writeObjectPathBody; });
/* harmony import */ var _pnp_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pnp/common */ "./node_modules/@pnp/common/dist/common.es5.js");
/* harmony import */ var _pnp_odata__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pnp/odata */ "./node_modules/@pnp/odata/dist/odata.es5.js");
/* harmony import */ var _pnp_sp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pnp/sp */ "./node_modules/@pnp/sp/dist/sp.es5.js");
/* harmony import */ var _pnp_logging__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @pnp/logging */ "./node_modules/@pnp/logging/dist/logging.es5.js");
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function objectPath() {
return "<ObjectPath Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" />";
}
function identityQuery() {
return "<ObjectIdentityQuery Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" />";
}
function opQuery(selectProperties, childSelectProperties) {
// this is fairly opaque behavior, but is the simplest way to convey the required information.
// if selectProperties.length === 0 or null then select all
// else select indicated properties
if (selectProperties === void 0) { selectProperties = null; }
if (childSelectProperties === void 0) { childSelectProperties = null; }
// if childSelectProperties === null do not include that block
// if childSelectProperties.length === 0 then select all
// else select indicated properties
var builder = [];
builder.push("<Query Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\">");
if (selectProperties === null || selectProperties.length < 1) {
builder.push("<Query SelectAllProperties=\"true\" >");
builder.push("<Properties />");
builder.push("</Query >");
}
else {
builder.push("<Query SelectAllProperties=\"false\" >");
builder.push("<Properties>");
[].push.apply(builder, selectProperties.map(function (p) { return "<Property Name=\"" + p + "\" SelectAll=\"true\" />"; }));
builder.push("</Properties>");
builder.push("</Query >");
}
if (childSelectProperties !== null) {
if (childSelectProperties.length < 1) {
builder.push("<ChildItemQuery SelectAllProperties=\"true\" >");
builder.push("<Properties />");
builder.push("</ChildItemQuery >");
}
else {
builder.push("<ChildItemQuery SelectAllProperties=\"false\" >");
builder.push("<Properties>");
[].push.apply(builder, childSelectProperties.map(function (p) { return "<Property Name=\"" + p + "\" SelectAll=\"true\" />"; }));
builder.push("</Properties>");
builder.push("</ChildItemQuery >");
}
}
builder.push("</Query >");
return builder.join("");
}
function setProperty(name, type, value) {
var builder = [];
builder.push("<SetProperty Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" Name=\"" + name + "\">");
builder.push("<Parameter Type=\"" + type + "\">" + value + "</Parameter>");
builder.push("</SetProperty>");
return builder.join("");
}
function methodAction(name, params) {
var builder = [];
builder.push("<Method Id=\"$$ID$$\" ObjectPathId=\"$$PATH_ID$$\" Name=\"" + name + "\">");
if (params !== null) {
var arrParams = params.toArray();
if (arrParams.length < 1) {
builder.push("<Parameters />");
}
else {
builder.push("<Parameters>");
[].push.apply(builder, arrParams.map(function (p) { return "<Parameter Type=\"" + p.type + "\">" + p.value + "</Parameter>"; }));
builder.push("</Parameters>");
}
}
builder.push("</Method>");
return builder.join("");
}
function objectProperties(o) {
return Object.getOwnPropertyNames(o).map(function (name) {
var value = o[name];
if (typeof value === "boolean") {
return setProperty(name, "Boolean", "" + value);
}
else if (typeof value === "number") {
return setProperty(name, "Number", "" + value);
}
else if (typeof value === "string") {
return setProperty(name, "String", "" + value);
}
return "";
}, []);
}
function property(name) {
var actions = [];
for (var _i = 1; _i < arguments.length; _i++) {
actions[_i - 1] = arguments[_i];
}
return new ObjectPath("<Property Id=\"$$ID$$\" ParentId=\"$$PARENT_ID$$\" Name=\"" + name + "\" />", actions);
}
function staticMethod(name, typeId) {
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
return new ObjectPath("<StaticMethod Id=\"$$ID$$\" Name=\"" + name + "\" TypeId=\"" + typeId + "\" />", actions);
}
function staticProperty(name, typeId) {
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
return new ObjectPath("<StaticProperty Id=\"$$ID$$\" Name=\"" + name + "\" TypeId=\"" + typeId + "\" />", actions);
}
function objConstructor(typeId) {
var actions = [];
for (var _i = 1; _i < arguments.length; _i++) {
actions[_i - 1] = arguments[_i];
}
return new ObjectPath("<Constructor Id=\"$$ID$$\" TypeId=\"" + typeId + "\" />", actions);
}
/**
* Used to build parameters when calling methods
*/
var MethodParams = /** @class */ (function () {
function MethodParams(_p) {
if (_p === void 0) { _p = []; }
this._p = _p;
}
MethodParams.build = function (initValues) {
if (initValues === void 0) { initValues = []; }
var params = new MethodParams();
[].push.apply(params._p, initValues);
return params;
};
MethodParams.prototype.string = function (value) {
return this.a("String", value);
};
MethodParams.prototype.number = function (value) {
return this.a("Number", value.toString());
};
MethodParams.prototype.boolean = function (value) {
return this.a("Boolean", value.toString());
};
MethodParams.prototype.strArray = function (values) {
return this.a("Array", values.map(function (v) { return "<Object Type=\"String\">" + v + "</Object>"; }).join(""));
};
MethodParams.prototype.objectPath = function (inputIndex) {
return this.a("ObjectPath", inputIndex.toString());
};
MethodParams.prototype.toArray = function () {
return this._p;
};
MethodParams.prototype.a = function (type, value) {
this._p.push({ type: type, value: value });
return this;
};
return MethodParams;
}());
function method(name, params) {
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
var builder = [];
builder.push("<Method Id=\"$$ID$$\" ParentId=\"$$PARENT_ID$$\" Name=\"" + name + "\">");
if (params !== null) {
var arrParams = params.toArray();
if (arrParams.length < 1) {
builder.push("<Parameters />");
}
else {
builder.push("<Parameters>");
[].push.apply(builder, arrParams.map(function (p) {
if (p.type === "ObjectPath") {
return "<Parameter ObjectPathId=\"$$OP_PARAM_ID_" + p.value + "$$\" />";
}
return "<Parameter Type=\"" + p.type + "\">" + p.value + "</Parameter>";
}));
builder.push("</Parameters>");
}
}
builder.push("</Method>");
return new ObjectPath(builder.join(""), actions);
}
/**
* Transforms an array of object paths into a request xml body. Does not do placeholder substitutions.
*
* @param objectPaths The object paths for which we want to generate a body
*/
function writeObjectPathBody(objectPaths) {
var actions = [];
var paths = [];
objectPaths.forEach(function (op) {
paths.push(op.path);
actions.push.apply(actions, op.actions);
});
// create our xml payload
return [
"<Request xmlns=\"http://schemas.microsoft.com/sharepoint/clientquery/2009\" SchemaVersion=\"15.0.0.0\" LibraryVersion=\"16.0.0.0\" ApplicationName=\"PnPjs\">",
"<Actions>",
actions.join(""),
"</Actions>",
"<ObjectPaths>",
paths.join(""),
"</ObjectPaths>",
"</Request>",
].join("");
}
/**
* Represents an ObjectPath used when querying ProcessQuery
*/
var ObjectPath = /** @class */ (function () {
function ObjectPath(path, actions, id, replaceAfter) {
if (actions === void 0) { actions = []; }
if (id === void 0) { id = -1; }
if (replaceAfter === void 0) { replaceAfter = []; }
this.path = path;
this.actions = actions;
this.id = id;
this.replaceAfter = replaceAfter;
}
return ObjectPath;
}());
/**
* Replaces all found instance of the $$ID$$ placeholder in the supplied xml string
*
* @param id New value to be insterted
* @param xml The existing xml fragment in which the replace should occur
*/
function opSetId(id, xml) {
return xml.replace(/\$\$ID\$\$/g, id);
}
/**
* Replaces all found instance of the $$PATH_ID$$ placeholder in the supplied xml string
*
* @param id New value to be insterted
* @param xml The existing xml fragment in which the replace should occur
*/
function opSetPathId(id, xml) {
return xml.replace(/\$\$PATH_ID\$\$/g, id);
}
/**
* Replaces all found instance of the $$PARENT_ID$$ placeholder in the supplied xml string
*
* @param id New value to be insterted
* @param xml The existing xml fragment in which the replace should occur
*/
function opSetParentId(id, xml) {
return xml.replace(/\$\$PARENT_ID\$\$/g, id);
}
/**
* Replaces all found instance of the $$OP_PARAM_ID$$ placeholder in the supplied xml string
*
* @param map A mapping where [index] = replaced_object_path_id
* @param xml The existing xml fragment in which the replace should occur
* @param indexMapper Used when creating batches, not meant for direct use external to this library
*/
function opSetPathParamId(map, xml, indexMapper) {
if (indexMapper === void 0) { indexMapper = function (n) { return n; }; }
// this approach works because input params must come before the things that need them
// meaning the right id will always be in the map
var matches = /\$\$OP_PARAM_ID_(\d+)\$\$/ig.exec(xml);
if (matches !== null) {
for (var i = 1; i < matches.length; i++) {
var index = parseInt(matches[i], 10);
var regex = new RegExp("\\$\\$OP_PARAM_ID_" + index + "\\$\\$", "ig");
xml = xml.replace(regex, map[indexMapper(index)].toString());
}
}
return xml;
}
/**
* Represents a collection of IObjectPaths
*/
var ObjectPathQueue = /** @class */ (function () {
function ObjectPathQueue(_paths, _relationships) {
if (_paths === void 0) { _paths = []; }
if (_relationships === void 0) { _relationships = {}; }
this._paths = _paths;
this._relationships = _relationships;
this._contextIndex = -1;
this._siteIndex = -1;
this._webIndex = -1;
}
/**
* Adds an object path to the queue
*
* @param op The action to add
* @returns The index of the added object path
*/
ObjectPathQueue.prototype.add = function (op) {
this.dirty();
this._paths.push(op);
return this.lastIndex;
};
ObjectPathQueue.prototype.addChildRelationship = function (parentIndex, childIndex) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._relationships["_" + parentIndex])) {
this._relationships["_" + parentIndex].push(childIndex);
}
else {
this._relationships["_" + parentIndex] = [childIndex];
}
};
ObjectPathQueue.prototype.getChildRelationship = function (parentIndex) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._relationships["_" + parentIndex])) {
return this._relationships["_" + parentIndex];
}
else {
return [];
}
};
ObjectPathQueue.prototype.getChildRelationships = function () {
return this._relationships;
};
/**
* Appends an action to the supplied IObjectPath, replacing placeholders
*
* @param op IObjectPath to which the action will be appended
* @param action The action to append
*/
ObjectPathQueue.prototype.appendAction = function (op, action) {
this.dirty();
op.actions.push(action);
return this;
};
/**
* Appends an action to the last IObjectPath in the collection
*
* @param action
*/
ObjectPathQueue.prototype.appendActionToLast = function (action) {
return this.appendAction(this.last, action);
};
/**
* Creates a linked copy of this ObjectPathQueue
*/
ObjectPathQueue.prototype.copy = function () {
var copy = new ObjectPathQueue(this.toArray(), Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({}, this._relationships));
copy._contextIndex = this._contextIndex;
copy._siteIndex = this._siteIndex;
copy._webIndex = this._webIndex;
return copy;
};
/**
* Creates an independent clone of this ObjectPathQueue
*/
ObjectPathQueue.prototype.clone = function () {
var clone = new ObjectPathQueue(this.toArray().map(function (p) { return Object.assign({}, p); }), Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({}, this._relationships));
clone._contextIndex = this._contextIndex;
clone._siteIndex = this._siteIndex;
clone._webIndex = this._webIndex;
return clone;
};
/**
* Gets a copy of this instance's paths
*/
ObjectPathQueue.prototype.toArray = function () {
return this._paths.slice(0);
};
Object.defineProperty(ObjectPathQueue.prototype, "last", {
/**
* The last IObjectPath instance added to this collection
*/
get: function () {
if (this._paths.length < 1) {
return null;
}
return this._paths[this.lastIndex];
},
enumerable: true,
configurable: true
});
Object.defineProperty(ObjectPathQueue.prototype, "lastIndex", {
/**
* Index of the last IObjectPath added to the queue
*/
get: function () {
return this._paths.length - 1;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ObjectPathQueue.prototype, "siteIndex", {
/**
* Gets the index of the current site in the queue
*/
get: function () {
if (this._siteIndex < 0) {
// this needs to be here in case we create it
var contextIndex = this.contextIndex;
this._siteIndex = this.add(property("Site",
// actions
objectPath()));
this.addChildRelationship(contextIndex, this._siteIndex);
}
return this._siteIndex;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ObjectPathQueue.prototype, "webIndex", {
/**
* Gets the index of the current web in the queue
*/
get: function () {
if (this._webIndex < 0) {
// this needs to be here in case we create it
var contextIndex = this.contextIndex;
this._webIndex = this.add(property("Web",
// actions
objectPath()));
this.addChildRelationship(contextIndex, this._webIndex);
}
return this._webIndex;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ObjectPathQueue.prototype, "contextIndex", {
/**
* Gets the index of the Current context in the queue, can be used to establish parent -> child rels
*/
get: function () {
if (this._contextIndex < 0) {
this._contextIndex = this.add(staticProperty("Current", "{3747adcd-a3c3-41b9-bfab-4a64dd2f1e0a}",
// actions
objectPath()));
}
return this._contextIndex;
},
enumerable: true,
configurable: true
});
ObjectPathQueue.prototype.toBody = function () {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._xml)) {
return this._xml;
}
// create our xml payload
this._xml = writeObjectPathBody(this.toIndexedTree());
return this._xml;
};
/**
* Conducts the string replacements for id, parent id, and path id
*
* @returns The tree with all string replacements made
*/
ObjectPathQueue.prototype.toIndexedTree = function () {
var _this = this;
var builderIndex = -1;
var lastOpId = -1;
var idIndexMap = [];
return this.toArray().map(function (op, index, arr) {
var opId = ++builderIndex;
// track the array index => opId relationship
idIndexMap.push(opId);
// do path replacements
op.path = opSetPathParamId(idIndexMap, opSetId(opId.toString(), op.path));
if (lastOpId >= 0) {
// if we have a parent do the replace
op.path = opSetParentId(lastOpId.toString(), op.path);
}
// rewrite actions with placeholders replaced
op.actions = op.actions.map(function (a) {
var actionId = ++builderIndex;
return opSetId(actionId.toString(), opSetPathId(opId.toString(), a));
});
// handle any specific child relationships
_this.getChildRelationship(index).forEach(function (childIndex) {
// set the parent id for our non-immediate children, thus removing the token so it isn't overwritten
arr[childIndex].path = opSetParentId(opId.toString(), arr[childIndex].path);
});
// and remember our last object path id for the parent replace above
lastOpId = opId;
return op;
});
};
/**
* Dirties this queue clearing any cached data
*/
ObjectPathQueue.prototype.dirty = function () {
this._xml = null;
};
return ObjectPathQueue;
}());
/**
* Used within the request pipeline to parse ProcessQuery results
*/
var ProcessQueryParser = /** @class */ (function () {
function ProcessQueryParser(op) {
this.op = op;
}
/**
* Parses the response checking for errors
*
* @param r Response object
*/
ProcessQueryParser.prototype.parse = function (r) {
var _this = this;
return r.text().then(function (t) {
if (!r.ok) {
throw Error(t);
}
try {
return JSON.parse(t);
}
catch (e) {
// special case in ProcessQuery where we got an error back, but it is not in json format
throw Error(t);
}
}).then(function (parsed) {
// here we need to check for an error body
if (parsed.length > 0 && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(parsed[0], "ErrorInfo") && parsed[0].ErrorInfo !== null) {
throw Error(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(parsed[0].ErrorInfo));
}
return _this.findResult(parsed);
});
};
ProcessQueryParser.prototype.findResult = function (json) {
for (var i = 0; i < this.op.actions.length; i++) {
var a = this.op.actions[i];
// let's see if the result is null based on the ObjectPath action, if it exists
// <ObjectPath Id="8" ObjectPathId="7" />
if (/^<ObjectPath /i.test(a)) {
var result = this.getParsedResultById(json, parseInt(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getAttrValueFromString"])(a, "Id"), 10));
if (!result || (result && result.IsNull)) {
return Promise.resolve(null);
}
}
// let's see if we have a query result
// <Query Id="5" ObjectPathId = "3" >
if (/^<Query /i.test(a)) {
var result = this.getParsedResultById(json, parseInt(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getAttrValueFromString"])(a, "Id"), 10));
if (result && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(result, "_Child_Items_")) {
// this is a collection result
/* tslint:disable:no-string-literal */
return Promise.resolve(result["_Child_Items_"]);
/* tslint:enable:no-string-literal */
}
else {
// this is an instance result
return Promise.resolve(result);
}
}
// this is an invokeMethodAction so the last method action corresponds to our result
if (i === (this.op.actions.length - 1) && /^<Method /i.test(a)) {
return Promise.resolve(this.getParsedResultById(json, parseInt(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getAttrValueFromString"])(a, "Id"), 10)));
}
}
// no result could be found so we are effectively returning void
// issue is we really don't know if we should be returning void (a method invocation with a void return) or
// if we just didn't find something above. We will let downstream things worry about that
};
/**
* Locates a result by ObjectPath id
*
* @param parsed the parsed JSON body from the response
* @param id The ObjectPath id whose result we want
*/
ProcessQueryParser.prototype.getParsedResultById = function (parsed, id) {
for (var i = 0; i < parsed.length; i++) {
if (parsed[i] === id) {
return parsed[i + 1];
}
}
return null;
};
return ProcessQueryParser;
}());
var ProcessQueryPath = "_vti_bin/client.svc/ProcessQuery";
var ClientSvcQueryable = /** @class */ (function (_super) {
__extends(ClientSvcQueryable, _super);
function ClientSvcQueryable(parent, _objectPaths) {
if (parent === void 0) { parent = ""; }
if (_objectPaths === void 0) { _objectPaths = null; }
var _this = _super.call(this) || this;
_this._objectPaths = _objectPaths;
_this._selects = [];
_this._batch = null;
_this._batchDependency = null;
if (typeof parent === "string") {
// we assume the parent here is an absolute url to a web
_this._parentUrl = parent;
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(parent.replace(ProcessQueryPath, ""), ProcessQueryPath);
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(_this._objectPaths)) {
_this._objectPaths = new ObjectPathQueue();
}
}
else {
_this._parentUrl = parent._parentUrl;
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(parent._parentUrl, ProcessQueryPath);
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(_objectPaths)) {
_this._objectPaths = parent._objectPaths.clone();
}
_this.configureFrom(parent);
}
return _this;
}
/**
* Choose which fields to return
*
* @param selects One or more fields to return
*/
ClientSvcQueryable.prototype.select = function () {
var selects = [];
for (var _i = 0; _i < arguments.length; _i++) {
selects[_i] = arguments[_i];
}
[].push.apply(this._selects, selects);
return this;
};
/**
* Adds this query to the supplied batch
*
*/
ClientSvcQueryable.prototype.inBatch = function (batch) {
if (this.batch !== null) {
throw Error("This query is already part of a batch.");
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(batch)) {
this._batch = batch;
this._batchDependency = batch.addDependency();
}
return this;
};
/**
* Gets the full url with query information
*
*/
ClientSvcQueryable.prototype.toUrlAndQuery = function () {
return _super.prototype.toUrl.call(this) + "?" + Array.from(this.query).map(function (v) { return v[0] + "=" + v[1]; }).join("&");
};
ClientSvcQueryable.prototype.getSelects = function () {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._selects) ? this._selects : [];
};
/**
* Gets a child object based on this instance's paths and the supplied paramters
*
* @param factory Instance factory of the child type
* @param methodName Name of the method used to load the child
* @param params Parameters required by the method to load the child
*/
ClientSvcQueryable.prototype.getChild = function (factory, methodName, params) {
var objectPaths = this._objectPaths.copy();
objectPaths.add(method(methodName, params,
// actions
objectPath()));
return new factory(this, objectPaths);
};
/**
* Gets a property of the current instance
*
* @param factory Instance factory of the child type
* @param propertyName Name of the property to load
*/
ClientSvcQueryable.prototype.getChildProperty = function (factory, propertyName) {
var objectPaths = this._objectPaths.copy();
objectPaths.add(property(propertyName));
return new factory(this, objectPaths);
};
/**
* Sends a request
*
* @param op
* @param options
* @param parser
*/
ClientSvcQueryable.prototype.send = function (objectPaths, options, parser) {
if (options === void 0) { options = {}; }
if (parser === void 0) { parser = null; }
// here we need to create a clone because all the string indexes and references
// will be updated and all need to relate for this operation being sent. The parser
// and the postCore method need to share an independent value of the objectPaths
// See for https://github.com/pnp/pnpjs/issues/419 for details
var clonedOps = objectPaths.clone();
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(parser)) {
// we assume here that we want to return for this index path
parser = new ProcessQueryParser(clonedOps.last);
}
if (this.hasBatch) {
// this is using the options variable to pass some extra information downstream to the batch
options = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, {
clientsvc_ObjectPaths: clonedOps,
});
}
else {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(options, "body")) {
options = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, {
body: clonedOps.toBody(),
});
}
}
return _super.prototype.postCore.call(this, options, parser);
};
/**
* Sends the request, merging the result data with a new instance of factory
*/
ClientSvcQueryable.prototype.sendGet = function (factory) {
var _this = this;
var ops = this._objectPaths.copy().appendActionToLast(opQuery(this.getSelects()));
return this.send(ops).then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(new factory(_this), r); });
};
/**
* Sends the request, merging the result data array with a new instances of factory
*/
ClientSvcQueryable.prototype.sendGetCollection = function (factory) {
var ops = this._objectPaths.copy().appendActionToLast(opQuery([], this.getSelects()));
return this.send(ops).then(function (r) { return r.map(function (d) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(factory(d), d); }); });
};
/**
* Invokes the specified method on the server and returns the result
*
* @param methodName Name of the method to invoke
* @param params Method parameters
* @param actions Any additional actions to execute in addition to the method invocation (set property for example)
*/
ClientSvcQueryable.prototype.invokeMethod = function (methodName, params) {
if (params === void 0) { params = null; }
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
return this.invokeMethodImpl(methodName, params, actions, opQuery([], null));
};
/**
* Invokes a method action that returns a single result and does not have an associated query (ex: GetDescription on Term)
*
* @param methodName Name of the method to invoke
* @param params Method parameters
* @param actions Any additional actions to execute in addition to the method invocation (set property for example)
*/
ClientSvcQueryable.prototype.invokeMethodAction = function (methodName, params) {
if (params === void 0) { params = null; }
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
return this.invokeMethodImpl(methodName, params, actions, null, true);
};
/**
* Invokes the specified non-query method on the server
*
* @param methodName Name of the method to invoke
* @param params Method parameters
* @param actions Any additional actions to execute in addition to the method invocation (set property for example)
*/
ClientSvcQueryable.prototype.invokeNonQuery = function (methodName, params) {
if (params === void 0) { params = null; }
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
// by definition we are not returning anything from these calls so we should not be caching the results
this._useCaching = false;
return this.invokeMethodImpl(methodName, params, actions, null, true);
};
/**
* Invokes the specified method on the server and returns the resulting collection
*
* @param methodName Name of the method to invoke
* @param params Method parameters
* @param actions Any additional actions to execute in addition to the method invocation (set property for example)
*/
ClientSvcQueryable.prototype.invokeMethodCollection = function (methodName, params) {
if (params === void 0) { params = null; }
var actions = [];
for (var _i = 2; _i < arguments.length; _i++) {
actions[_i - 2] = arguments[_i];
}
return this.invokeMethodImpl(methodName, params, actions, opQuery([], []));
};
/**
* Updates this instance, returning a copy merged with the updated data after the update
*
* @param properties Plain object of the properties and values to update
* @param factory Factory method use to create a new instance of FactoryType
*/
ClientSvcQueryable.prototype.invokeUpdate = function (properties, factory) {
var _this = this;
var ops = this._objectPaths.copy();
// append setting all the properties to this instance
objectProperties(properties).map(function (a) { return ops.appendActionToLast(a); });
ops.appendActionToLast(opQuery([], null));
return this.send(ops).then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(new factory(_this), r); });
};
/**
* Converts the current instance to a request context
*
* @param verb The request verb
* @param options The set of supplied request options
* @param parser The supplied ODataParser instance
* @param pipeline Optional request processing pipeline
*/
ClientSvcQueryable.prototype.toRequestContext = function (verb, options, parser, pipeline) {
var _this = this;
return Object(_pnp_sp__WEBPACK_IMPORTED_MODULE_2__["toAbsoluteUrl"])(this.toUrlAndQuery()).then(function (url) {
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeOptions"])(options, _this._options);
var headers = new Headers();
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, options.headers);
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, {
"accept": "*/*",
"content-type": "text/xml",
});
options = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { headers: headers });
// we need to do some special cache handling to ensure we have a good key
if (_this._useCaching) {
var keyStr = options.body;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["stringIsNullOrEmpty"])(keyStr)) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(options, "clientsvc_ObjectPaths")) {
// if we are using caching and batching together we need to create our string from the paths stored for the
// batching operation (see: https://github.com/pnp/pnpjs/issues/449) but not update the ones passed to
// the batch as they will be indexed during the batch creation process
keyStr = options.clientsvc_ObjectPaths.clone().toBody();
}
else {
// this case shouldn't happen
keyStr = "";
}
}
// because all the requests use the same url they would collide in the cache we use a special key
var cacheKey = "PnPjs.ProcessQueryClient(" + Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getHashCode"])(keyStr) + ")";
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(_this._cachingOptions)) {
// if our key ends in the ProcessQuery url we overwrite it
if (/\/client\.svc\/ProcessQuery\?$/i.test(_this._cachingOptions.key)) {
_this._cachingOptions.key = cacheKey;
}
}
else {
_this._cachingOptions = new _pnp_odata__WEBPACK_IMPORTED_MODULE_1__["CachingOptions"](cacheKey);
}
}
var dependencyDispose = _this.hasBatch ? _this._batchDependency : function () { return; };
// build our request context
var context = {
batch: _this.batch,
batchDependency: dependencyDispose,
cachingOptions: _this._cachingOptions,
clientFactory: function () { return new _pnp_sp__WEBPACK_IMPORTED_MODULE_2__["SPHttpClient"](); },
isBatched: _this.hasBatch,
isCached: _this._useCaching,
options: options,
parser: parser,
pipeline: pipeline,
requestAbsoluteUrl: url,
requestId: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])(),
verb: verb,
};
return context;
});
};
/**
* Blocks a batch call from occuring, MUST be cleared by calling the returned function
*/
ClientSvcQueryable.prototype.addBatchDependency = function () {
if (this._batch !== null) {
return this._batch.addDependency();
}
return function () { return null; };
};
Object.defineProperty(ClientSvcQueryable.prototype, "hasBatch", {
/**
* Indicates if the current query has a batch associated
*
*/
get: function () {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._batch);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSvcQueryable.prototype, "batch", {
/**
* The batch currently associated with this query or null
*
*/
get: function () {
return this.hasBatch ? this._batch : null;
},
enumerable: true,
configurable: true
});
/**
* Executes the actual invoke method call
*
* @param methodName Name of the method to invoke
* @param params Method parameters
* @param queryAction Specifies the query action to take
*/
ClientSvcQueryable.prototype.invokeMethodImpl = function (methodName, params, actions, queryAction, isAction) {
if (isAction === void 0) { isAction = false; }
var ops = this._objectPaths.copy();
if (isAction) {
ops.appendActionToLast(methodAction(methodName, params));
}
else {
ops.add(method.apply(void 0, [methodName, params].concat([objectPath()].concat(actions, [queryAction]))));
}
return this.send(ops);
};
return ClientSvcQueryable;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_1__["Queryable"]));
/**
* Implements ODataBatch for use with the ObjectPath framework
*/
var ObjectPathBatch = /** @class */ (function (_super) {
__extends(ObjectPathBatch, _super);
function ObjectPathBatch(parentUrl, _batchId) {
var _this = _super.call(this, _batchId) || this;
_this.parentUrl = parentUrl;
return _this;
}
ObjectPathBatch.prototype.executeImpl = function () {
// if we don't have any requests, don't bother sending anything
// this could be due to caching further upstream, or just an empty batch
if (this.requests.length < 1) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_3__["Logger"].write("Resolving empty batch.", 1 /* Info */);
return Promise.resolve();
}
var executor = new BatchExecutor(this.parentUrl, this.batchId);
executor.appendRequests(this.requests);
return executor.execute();
};
return ObjectPathBatch;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_1__["ODataBatch"]));
var BatchExecutor = /** @class */ (function (_super) {
__extends(BatchExecutor, _super);
function BatchExecutor(parentUrl, batchId) {
var _this = _super.call(this, parentUrl) || this;
_this.batchId = batchId;
_this._requests = [];
_this._builderIndex = 1;
// we add our session object path and hard code in the IDs so we can reference it
var method$$1 = staticMethod("GetTaxonomySession", "{981cbc68-9edc-4f8d-872f-71146fcbb84f}");
method$$1.path = opSetId("0", method$$1.path);
method$$1.actions.push(opSetId("1", opSetPathId("0", objectPath())));
_this._objectPaths.add(method$$1);
return _this;
}
BatchExecutor.prototype.appendRequests = function (requests) {
var _this = this;
requests.forEach(function (request) {
// grab the special property we added to options when we created the batch info
var pathQueue = request.options.clientsvc_ObjectPaths;
var paths = pathQueue.toArray();
// getChildRelationships
if (paths.length < 0) {
return;
}
var indexMappingFunction = function (n) { return n; };
if (/GetTaxonomySession/i.test(paths[0].path)) {
// drop the first thing as it is a get session object path, which we add once for the entire batch
paths = paths.slice(1);
// replace the next item's parent id with 0, which will be the id of the session call at the root of this request
paths[0].path = opSetParentId("0", paths[0].path);
indexMappingFunction = function (n) { return n - 1; };
}
var lastOpId = -1;
var idIndexMap = [];
paths.map(function (op, index, arr) {
// rewrite the path string
var opId = ++_this._builderIndex;
// track the array index => opId relationship
idIndexMap.push(opId);
var path = opSetPathParamId(idIndexMap, opSetId(opId.toString(), op.path), indexMappingFunction);
if (lastOpId >= 0) {
path = opSetParentId(lastOpId.toString(), path);
}
// rewrite actions with placeholders replaced
var opActions = op.actions.map(function (a) {
var actionId = ++_this._builderIndex;
return opSetId(actionId.toString(), opSetPathId(opId.toString(), a));
});
// handle any specific child relationships
// the childIndex is reduced by 1 because we are removing the Session Path
pathQueue.getChildRelationship(index + 1).map(function (i) { return i - 1; }).forEach(function (childIndex) {
// set the parent id for our non-immediate children
arr[childIndex].path = opSetParentId(opId.toString(), arr[childIndex].path);
});
// and remember our last object path id for the parent replace above
lastOpId = opId;
// return our now substituted path and actions as a new object path instance
return new ObjectPath(path, opActions);
}).forEach(function (op) { return _this._objectPaths.add(op); });
// get this once
var obPaths = _this._objectPaths.toArray();
// create a new parser to handle finding the result based on the path
var parser = new ProcessQueryParser(obPaths[obPaths.length - 1]);
if (request.parser instanceof _pnp_odata__WEBPACK_IMPORTED_MODULE_1__["CachingParserWrapper"]) {
// handle special case of caching
request.parser = new ProcessQueryCachingParserWrapper(parser, request.parser);
}
else {
request.parser = parser;
}
// add the request to our batch requests
_this._requests.push(request);
// remove the temp property
delete request.options.clientsvc_ObjectPaths;
});
};
BatchExecutor.prototype.execute = function () {
var _this = this;
_pnp_logging__WEBPACK_IMPORTED_MODULE_3__["Logger"].write("[" + this.batchId + "] (" + (new Date()).getTime() + ") Executing batch with " + this._requests.length + " requests.", 1 /* Info */);
// create our request body from all the merged object paths
var options = {
body: writeObjectPathBody(this._objectPaths.toArray()),
};
_pnp_logging__WEBPACK_IMPORTED_MODULE_3__["Logger"].write("[" + this.batchId + "] (" + (new Date()).getTime() + ") Sending batch request.", 1 /* Info */);
// send the batch
return _super.prototype.postCore.call(this, options, new BatchParser()).then(function (rawResponse) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_3__["Logger"].write("[" + _this.batchId + "] (" + (new Date()).getTime() + ") Resolving batched requests.", 1 /* Info */);
return _this._requests.reduce(function (chain, request) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_3__["Logger"].write("[" + request.id + "] (" + (new Date()).getTime() + ") Resolving request in batch " + _this.batchId + ".", 1 /* Info */);
return chain.then(function (_) { return request.parser.findResult(rawResponse).then(request.resolve).catch(request.reject); });
}, Promise.resolve());
});
};
return BatchExecutor;
}(ClientSvcQueryable));
/**
* Used to return the raw results from parsing the batch
*/
var BatchParser = /** @class */ (function (_super) {
__extends(BatchParser, _super);
function BatchParser() {
return _super.call(this, null) || this;
}
BatchParser.prototype.findResult = function (json) {
// we leave it to the individual request parsers to find their results in the raw json body
return json;
};
return BatchParser;
}(ProcessQueryParser));
/**
* Handles processing batched results that are also cached
*/
var ProcessQueryCachingParserWrapper = /** @class */ (function (_super) {
__extends(ProcessQueryCachingParserWrapper, _super);
function ProcessQueryCachingParserWrapper(parser, wrapper) {
return _super.call(this, parser, wrapper.cacheOptions) || this;
}
ProcessQueryCachingParserWrapper.prototype.findResult = function (json) {
var _this = this;
return this.parser.findResult(json).then(function (d) { return _this.cacheData(d); });
};
return ProcessQueryCachingParserWrapper;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_1__["CachingParserWrapper"]));
//# sourceMappingURL=sp-clientsvc.es5.js.map
/***/ }),
/***/ "./node_modules/@pnp/sp-taxonomy/dist/sp-taxonomy.es5.js":
/*!***************************************************************!*\
!*** ./node_modules/@pnp/sp-taxonomy/dist/sp-taxonomy.es5.js ***!
\***************************************************************/
/*! exports provided: taxonomy, Labels, Label, Session, TermGroups, TermGroup, Terms, Term, TermSets, TermSet, TermStores, TermStore, StringMatchOption, ChangedItemType, ChangedOperationType, setItemMetaDataField, setItemMetaDataMultiField */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "taxonomy", function() { return taxonomy; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Labels", function() { return Labels; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Label", function() { return Label; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Session", function() { return Session; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermGroups", function() { return TermGroups; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermGroup", function() { return TermGroup; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Terms", function() { return Terms; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Term", function() { return Term; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermSets", function() { return TermSets; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermSet", function() { return TermSet; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermStores", function() { return TermStores; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TermStore", function() { return TermStore; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StringMatchOption", function() { return StringMatchOption; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangedItemType", function() { return ChangedItemType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangedOperationType", function() { return ChangedOperationType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setItemMetaDataField", function() { return setItemMetaDataField; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setItemMetaDataMultiField", function() { return setItemMetaDataMultiField; });
/* harmony import */ var _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pnp/sp-clientsvc */ "./node_modules/@pnp/sp-clientsvc/dist/sp-clientsvc.es5.js");
/* harmony import */ var _pnp_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pnp/common */ "./node_modules/@pnp/common/dist/common.es5.js");
/* harmony import */ var _pnp_sp__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pnp/sp */ "./node_modules/@pnp/sp/dist/sp.es5.js");
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
/**
* Represents a collection of labels
*/
var Labels = /** @class */ (function (_super) {
__extends(Labels, _super);
function Labels(parent, _objectPaths) {
if (parent === void 0) { parent = ""; }
if (_objectPaths === void 0) { _objectPaths = null; }
var _this = _super.call(this, parent, _objectPaths) || this;
_this._objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["property"])("Labels"));
return _this;
}
/**
* Gets a label from the collection by its value
*
* @param value The value to retrieve
*/
Labels.prototype.getByValue = function (value) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(value);
return this.getChild(Label, "GetByValue", params);
};
/**
* Loads the data and merges with with the ILabel instances
*/
Labels.prototype.get = function () {
var _this = this;
return this.sendGetCollection(function (d) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Value)) {
return _this.getByValue(d.Value);
}
throw Error("Could not find Value in Labels.get(). You must include at least one of these in your select fields.");
});
};
return Labels;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* Represents a label instance
*/
var Label = /** @class */ (function (_super) {
__extends(Label, _super);
function Label() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets the data for this Label
*/
Label.prototype.get = function () {
return this.sendGet(Label);
};
/**
* Sets this label as the default
*/
Label.prototype.setAsDefaultForLanguage = function () {
return this.invokeNonQuery("SetAsDefaultForLanguage");
};
/**
* Deletes this label
*/
Label.prototype.delete = function () {
return this.invokeNonQuery("DeleteObject");
};
return Label;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
var Terms = /** @class */ (function (_super) {
__extends(Terms, _super);
function Terms() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets the terms in this collection
*/
Terms.prototype.get = function () {
var _this = this;
return this.sendGetCollection(function (d) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Name)) {
return _this.getByName(d.Name);
}
else if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Id)) {
return _this.getById(d.Id);
}
throw Error("Could not find Name or Id in Terms.get(). You must include at least one of these in your select fields.");
});
};
/**
* Gets a term by id
*
* @param id The id of the term
*/
Terms.prototype.getById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(Term, "GetById", params);
};
/**
* Gets a term by name
*
* @param name Term name
*/
Terms.prototype.getByName = function (name) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name);
return this.getChild(Term, "GetByName", params);
};
return Terms;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* Represents the operations available on a given term
*/
var Term = /** @class */ (function (_super) {
__extends(Term, _super);
function Term() {
return _super !== null && _super.apply(this, arguments) || this;
}
Term.prototype.addTerm = function (name, lcid, isAvailableForTagging, id) {
var _this = this;
if (isAvailableForTagging === void 0) { isAvailableForTagging = true; }
if (id === void 0) { id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["getGUID"])(); }
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.number(lcid)
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
this._useCaching = false;
return this.invokeMethod("CreateTerm", params, Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["setProperty"])("IsAvailableForTagging", "Boolean", "" + isAvailableForTagging))
.then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["extend"])(_this.termSet.getTermById(r.Id), r); });
};
Object.defineProperty(Term.prototype, "terms", {
get: function () {
return this.getChildProperty(Terms, "Terms");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "labels", {
get: function () {
return new Labels(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "parent", {
get: function () {
return this.getChildProperty(Term, "Parent");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "pinSourceTermSet", {
get: function () {
return this.getChildProperty(TermSet, "PinSourceTermSet");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "reusedTerms", {
get: function () {
return this.getChildProperty(Terms, "ReusedTerms");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "sourceTerm", {
get: function () {
return this.getChildProperty(Term, "SourceTerm");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "termSet", {
get: function () {
return this.getChildProperty(TermSet, "TermSet");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Term.prototype, "termSets", {
get: function () {
return this.getChildProperty(TermSets, "TermSets");
},
enumerable: true,
configurable: true
});
/**
* Creates a new label for this Term
*
* @param name label value
* @param lcid language code
* @param isDefault Is the default label
*/
Term.prototype.createLabel = function (name, lcid, isDefault) {
var _this = this;
if (isDefault === void 0) { isDefault = false; }
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.number(lcid)
.boolean(isDefault);
this._useCaching = false;
return this.invokeMethod("CreateLabel", params)
.then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["extend"])(_this.labels.getByValue(name), r); });
};
/**
* Sets the deprecation flag on a term
*
* @param doDeprecate New value for the deprecation flag
*/
Term.prototype.deprecate = function (doDeprecate) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().boolean(doDeprecate);
return this.invokeNonQuery("Deprecate", params);
};
/**
* Loads the term data
*/
Term.prototype.get = function () {
return this.sendGet(Term);
};
/**
* Gets the appropriate description for a term
*
* @param lcid Language code
*/
Term.prototype.getDescription = function (lcid) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().number(lcid);
return this.invokeMethodAction("GetDescription", params);
};
/**
* Sets the description
*
* @param description Term description
* @param lcid Language code
*/
Term.prototype.setDescription = function (description, lcid) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(description).number(lcid);
return this.invokeNonQuery("SetDescription", params);
};
/**
* Sets a custom property on this term
*
* @param name Property name
* @param value Property value
*/
Term.prototype.setLocalCustomProperty = function (name, value) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(name).string(value);
return this.invokeNonQuery("SetLocalCustomProperty", params);
};
/**
* Updates the specified properties of this term, not all properties can be updated
*
* @param properties Plain object representing the properties and new values to update
*/
Term.prototype.update = function (properties) {
return this.invokeUpdate(properties, Term);
};
return Term;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
var TermSets = /** @class */ (function (_super) {
__extends(TermSets, _super);
function TermSets() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets the termsets in this collection
*/
TermSets.prototype.get = function () {
var _this = this;
return this.sendGetCollection(function (d) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Name)) {
return _this.getByName(d.Name);
}
else if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Id)) {
return _this.getById(d.Id);
}
throw Error("Could not find Value in Labels.get(). You must include at least one of these in your select fields.");
});
};
/**
* Gets a TermSet from this collection by id
*
* @param id TermSet id
*/
TermSets.prototype.getById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(TermSet, "GetById", params);
};
/**
* Gets a TermSet from this collection by name
*
* @param name TermSet name
*/
TermSets.prototype.getByName = function (name) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name);
return this.getChild(TermSet, "GetByName", params);
};
return TermSets;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
var TermSet = /** @class */ (function (_super) {
__extends(TermSet, _super);
function TermSet() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(TermSet.prototype, "group", {
/**
* Gets the group containing this Term set
*/
get: function () {
return this.getChildProperty(TermGroup, "Group");
},
enumerable: true,
configurable: true
});
Object.defineProperty(TermSet.prototype, "terms", {
/**
* Access all the terms in this termset
*/
get: function () {
return this.getChild(Terms, "GetAllTerms", null);
},
enumerable: true,
configurable: true
});
/**
* Adds a stakeholder to the TermSet
*
* @param stakeholderName The login name of the user to be added as a stakeholder
*/
TermSet.prototype.addStakeholder = function (stakeholderName) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(stakeholderName);
return this.invokeNonQuery("DeleteStakeholder", params);
};
/**
* Deletes a stakeholder to the TermSet
*
* @param stakeholderName The login name of the user to be added as a stakeholder
*/
TermSet.prototype.deleteStakeholder = function (stakeholderName) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(stakeholderName);
return this.invokeNonQuery("AddStakeholder", params);
};
/**
* Gets the data for this TermSet
*/
TermSet.prototype.get = function () {
return this.sendGet(TermSet);
};
/**
* Get a term by id
*
* @param id Term id
*/
TermSet.prototype.getTermById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(Term, "GetTerm", params);
};
/**
* Adds a term to this term set
*
* @param name Name for the term
* @param lcid Language code
* @param isAvailableForTagging set tagging availability (default: true)
* @param id GUID id for the term (optional)
*/
TermSet.prototype.addTerm = function (name, lcid, isAvailableForTagging, id) {
var _this = this;
if (isAvailableForTagging === void 0) { isAvailableForTagging = true; }
if (id === void 0) { id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["getGUID"])(); }
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.number(lcid)
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
this._useCaching = false;
return this.invokeMethod("CreateTerm", params, Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["setProperty"])("IsAvailableForTagging", "Boolean", "" + isAvailableForTagging))
.then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["extend"])(_this.getTermById(r.Id), r); });
};
/**
* Copies this term set immediately
*/
TermSet.prototype.copy = function () {
return this.invokeMethod("Copy", null);
};
/**
* Updates the specified properties of this term set, not all properties can be updated
*
* @param properties Plain object representing the properties and new values to update
*/
TermSet.prototype.update = function (properties) {
return this.invokeUpdate(properties, TermSet);
};
return TermSet;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* Term Groups collection in Term Store
*/
var TermGroups = /** @class */ (function (_super) {
__extends(TermGroups, _super);
function TermGroups() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets the groups in this collection
*/
TermGroups.prototype.get = function () {
var _this = this;
return this.sendGetCollection(function (d) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Name)) {
return _this.getByName(d.Name);
}
else if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Id)) {
return _this.getById(d.Id);
}
throw Error("Could not find Name or Id in TermGroups.get(). You must include at least one of these in your select fields.");
});
};
/**
* Gets a TermGroup from this collection by id
*
* @param id TermGroup id
*/
TermGroups.prototype.getById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(TermGroup, "GetById", params);
};
/**
* Gets a TermGroup from this collection by name
*
* @param name TErmGroup name
*/
TermGroups.prototype.getByName = function (name) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name);
return this.getChild(TermGroup, "GetByName", params);
};
return TermGroups;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* Represents a group in the taxonomy heirarchy
*/
var TermGroup = /** @class */ (function (_super) {
__extends(TermGroup, _super);
function TermGroup(parent, _objectPaths) {
if (parent === void 0) { parent = ""; }
var _this = _super.call(this, parent, _objectPaths) || this;
// this should mostly be true
_this.store = parent instanceof TermStore ? parent : null;
return _this;
}
Object.defineProperty(TermGroup.prototype, "termSets", {
/**
* Gets the collection of term sets in this group
*/
get: function () {
return this.getChildProperty(TermSets, "TermSets");
},
enumerable: true,
configurable: true
});
/**
* Adds a contributor to the Group
*
* @param principalName The login name of the user to be added as a contributor
*/
TermGroup.prototype.addContributor = function (principalName) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(principalName);
return this.invokeNonQuery("AddContributor", params);
};
/**
* Adds a group manager to the Group
*
* @param principalName The login name of the user to be added as a group manager
*/
TermGroup.prototype.addGroupManager = function (principalName) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(principalName);
return this.invokeNonQuery("AddGroupManager", params);
};
/**
* Creates a new TermSet in this Group using the provided language and unique identifier
*
* @param name The name of the new TermSet being created
* @param lcid The language that the new TermSet name is in
* @param id The unique identifier of the new TermSet being created (optional)
*/
TermGroup.prototype.createTermSet = function (name, lcid, id) {
var _this = this;
if (id === void 0) { id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["getGUID"])(); }
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id))
.number(lcid);
this._useCaching = false;
return this.invokeMethod("CreateTermSet", params)
.then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["extend"])(_this.store.getTermSetById(r.Id), r); });
};
/**
* Gets this term store's data
*/
TermGroup.prototype.get = function () {
return this.sendGet(TermGroup);
};
/**
* Updates the specified properties of this term set, not all properties can be updated
*
* @param properties Plain object representing the properties and new values to update
*/
TermGroup.prototype.update = function (properties) {
return this.invokeUpdate(properties, TermGroup);
};
return TermGroup;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* Represents the set of available term stores and the collection methods
*/
var TermStores = /** @class */ (function (_super) {
__extends(TermStores, _super);
function TermStores(parent) {
if (parent === void 0) { parent = ""; }
var _this = _super.call(this, parent) || this;
_this._objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["property"])("TermStores",
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()));
return _this;
}
/**
* Gets the term stores
*/
TermStores.prototype.get = function () {
var _this = this;
return this.sendGetCollection(function (d) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Name)) {
return _this.getByName(d.Name);
}
else if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["stringIsNullOrEmpty"])(d.Id)) {
return _this.getById(d.Id);
}
throw Error("Could not find Name or Id in TermStores.get(). You must include at least one of these in your select fields.");
});
};
/**
* Returns the TermStore specified by its index name
*
* @param name The index name of the TermStore to be returned
*/
TermStores.prototype.getByName = function (name) {
return this.getChild(TermStore, "GetByName", _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(name));
};
/**
* Returns the TermStore specified by its GUID index
*
* @param id The GUID index of the TermStore to be returned
*/
TermStores.prototype.getById = function (id) {
return this.getChild(TermStore, "GetById", _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id)));
};
return TermStores;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
var TermStore = /** @class */ (function (_super) {
__extends(TermStore, _super);
function TermStore(parent, _objectPaths) {
if (parent === void 0) { parent = ""; }
if (_objectPaths === void 0) { _objectPaths = null; }
return _super.call(this, parent, _objectPaths) || this;
}
Object.defineProperty(TermStore.prototype, "hashTagsTermSet", {
get: function () {
return this.getChildProperty(TermSet, "HashTagsTermSet");
},
enumerable: true,
configurable: true
});
Object.defineProperty(TermStore.prototype, "keywordsTermSet", {
get: function () {
return this.getChildProperty(TermSet, "KeywordsTermSet");
},
enumerable: true,
configurable: true
});
Object.defineProperty(TermStore.prototype, "orphanedTermsTermSet", {
get: function () {
return this.getChildProperty(TermSet, "OrphanedTermsTermSet");
},
enumerable: true,
configurable: true
});
Object.defineProperty(TermStore.prototype, "systemGroup", {
get: function () {
return this.getChildProperty(TermGroup, "SystemGroup");
},
enumerable: true,
configurable: true
});
Object.defineProperty(TermStore.prototype, "groups", {
get: function () {
return this.getChildProperty(TermGroups, "Groups");
},
enumerable: true,
configurable: true
});
/**
* Gets the term store data
*/
TermStore.prototype.get = function () {
return this.sendGet(TermStore);
};
/**
* Gets term sets
*
* @param name
* @param lcid
*/
TermStore.prototype.getTermSetsByName = function (name, lcid) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.number(lcid);
return this.getChild(TermSets, "GetTermSetsByName", params);
};
/**
* Provides access to an ITermSet by id
*
* @param id
*/
TermStore.prototype.getTermSetById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(TermSet, "GetTermSet", params);
};
/**
* Provides access to an ITermSet by id
*
* @param id
*/
TermStore.prototype.getTermById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(Term, "GetTerm", params);
};
/**
* Provides access to an ITermSet by id
*
* @param id
*/
TermStore.prototype.getTermsById = function () {
var ids = [];
for (var _i = 0; _i < arguments.length; _i++) {
ids[_i] = arguments[_i];
}
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().strArray(ids.map(function (id) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id); }));
return this.getChild(Terms, "GetTermsById", params);
};
/**
* Gets a term from a term set based on the supplied ids
*
* @param termId Term Id
* @param termSetId Termset Id
*/
TermStore.prototype.getTermInTermSet = function (termId, termSetId) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(termId)).string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(termSetId));
return this.getChild(Term, "GetTermInTermSet", params);
};
/**
* This method provides access to a ITermGroup by id
*
* @param id The group id
*/
TermStore.prototype.getTermGroupById = function (id) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
return this.getChild(TermGroup, "GetGroup", params);
};
/**
* Gets the terms by the supplied information (see: https://msdn.microsoft.com/en-us/library/hh626704%28v=office.12%29.aspx)
*
* @param info
*/
TermStore.prototype.getTerms = function (info) {
var objectPaths = this._objectPaths.copy();
// this will be the parent of the GetTerms call, but we need to create the input param first
var parentIndex = objectPaths.lastIndex;
// this is our input object
var input = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objConstructor"].apply(void 0, ["{61a1d689-2744-4ea3-a88b-c95bee9803aa}",
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()].concat(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectProperties"])(info)));
// add the input object path
var inputIndex = objectPaths.add(input);
// this sets up the GetTerms call
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().objectPath(inputIndex);
// call the method
var methodIndex = objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["method"])("GetTerms", params,
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()));
// setup the parent relationship even though they are seperated in the collection
objectPaths.addChildRelationship(parentIndex, methodIndex);
return new Terms(this, objectPaths);
};
/**
* Gets the site collection group associated with the current site
*
* @param createIfMissing If true the group will be created, otherwise null (default: false)
*/
TermStore.prototype.getSiteCollectionGroup = function (createIfMissing) {
if (createIfMissing === void 0) { createIfMissing = false; }
var objectPaths = this._objectPaths.copy();
var methodParent = objectPaths.lastIndex;
var siteIndex = objectPaths.siteIndex;
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().objectPath(siteIndex).boolean(createIfMissing);
var methodIndex = objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["method"])("GetSiteCollectionGroup", params,
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()));
// the parent of this method call is this instance, not the current/site
objectPaths.addChildRelationship(methodParent, methodIndex);
return new TermGroup(this, objectPaths);
};
/**
* Adds a working language to the TermStore
*
* @param lcid The locale identifier of the working language to add
*/
TermStore.prototype.addLanguage = function (lcid) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().number(lcid);
return this.invokeNonQuery("AddLanguage", params);
};
/**
* Creates a new Group in this TermStore
*
* @param name The name of the new Group being created
* @param id The ID (Guid) that the new group should have
*/
TermStore.prototype.addGroup = function (name, id) {
var _this = this;
if (id === void 0) { id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["getGUID"])(); }
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build()
.string(name)
.string(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(id));
this._useCaching = false;
return this.invokeMethod("CreateGroup", params)
.then(function (r) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["extend"])(_this.getTermGroupById(r.Id), r); });
};
/**
* Commits all updates to the database that have occurred since the last commit or rollback
*/
TermStore.prototype.commitAll = function () {
return this.invokeNonQuery("CommitAll");
};
/**
* Delete a working language from the TermStore
*
* @param lcid locale ID for the language to be deleted
*/
TermStore.prototype.deleteLanguage = function (lcid) {
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().number(lcid);
return this.invokeNonQuery("DeleteLanguage", params);
};
/**
* Discards all updates that have occurred since the last commit or rollback
*/
TermStore.prototype.rollbackAll = function () {
return this.invokeNonQuery("RollbackAll");
};
/**
* Updates the cache
*/
TermStore.prototype.updateCache = function () {
return this.invokeNonQuery("UpdateCache");
};
/**
* Updates the specified properties of this term set, not all properties can be updated
*
* @param properties Plain object representing the properties and new values to update
*/
TermStore.prototype.update = function (properties) {
return this.invokeUpdate(properties, TermStore);
};
/**
* This method makes sure that this instance is aware of all child terms that are used in the current site collection
*/
TermStore.prototype.updateUsedTermsOnSite = function () {
var objectPaths = this._objectPaths.copy();
var methodParent = objectPaths.lastIndex;
var siteIndex = objectPaths.siteIndex;
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().objectPath(siteIndex);
var methodIndex = objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["method"])("UpdateUsedTermsOnSite", params));
// the parent of this method call is this instance, not the current context/site
objectPaths.addChildRelationship(methodParent, methodIndex);
return this.send(objectPaths);
};
/**
* Gets a list of changes
*
* @param info Lookup information
*/
TermStore.prototype.getChanges = function (info) {
var objectPaths = this._objectPaths.copy();
var methodParent = objectPaths.lastIndex;
var inputIndex = objectPaths.add(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objConstructor"].apply(void 0, ["{1f849fb0-4fcb-4a54-9b01-9152b9e482d3}",
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()].concat(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectProperties"])(info))));
var params = _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["MethodParams"].build().objectPath(inputIndex);
var methodIndex = objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["method"])("GetChanges", params,
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])(), Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["opQuery"])([], this.getSelects())));
objectPaths.addChildRelationship(methodParent, methodIndex);
return this.send(objectPaths);
};
return TermStore;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
/**
* The root taxonomy object
*/
var Session = /** @class */ (function (_super) {
__extends(Session, _super);
function Session(webUrl) {
if (webUrl === void 0) { webUrl = ""; }
var _this = _super.call(this, webUrl) || this;
// everything starts with the session
_this._objectPaths.add(Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["staticMethod"])("GetTaxonomySession", "{981cbc68-9edc-4f8d-872f-71146fcbb84f}",
// actions
Object(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["objectPath"])()));
return _this;
}
Object.defineProperty(Session.prototype, "termStores", {
/**
* The collection of term stores
*/
get: function () {
return new TermStores(this);
},
enumerable: true,
configurable: true
});
/**
* Provides access to sp.setup from @pnp/sp
*
* @param config Configuration
*/
Session.prototype.setup = function (config) {
_pnp_sp__WEBPACK_IMPORTED_MODULE_2__["sp"].setup(config);
};
/**
* Creates a new batch
*/
Session.prototype.createBatch = function () {
return new _pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ObjectPathBatch"](this.toUrl());
};
/**
* Gets the default keyword termstore for this session
*/
Session.prototype.getDefaultKeywordTermStore = function () {
return this.getChild(TermStore, "GetDefaultKeywordsTermStore", null);
};
/**
* Gets the default site collection termstore for this session
*/
Session.prototype.getDefaultSiteCollectionTermStore = function () {
return this.getChild(TermStore, "GetDefaultSiteCollectionTermStore", null);
};
return Session;
}(_pnp_sp_clientsvc__WEBPACK_IMPORTED_MODULE_0__["ClientSvcQueryable"]));
var StringMatchOption;
(function (StringMatchOption) {
StringMatchOption[StringMatchOption["StartsWith"] = 0] = "StartsWith";
StringMatchOption[StringMatchOption["ExactMatch"] = 1] = "ExactMatch";
})(StringMatchOption || (StringMatchOption = {}));
var ChangedItemType;
(function (ChangedItemType) {
ChangedItemType[ChangedItemType["Unknown"] = 0] = "Unknown";
ChangedItemType[ChangedItemType["Term"] = 1] = "Term";
ChangedItemType[ChangedItemType["TermSet"] = 2] = "TermSet";
ChangedItemType[ChangedItemType["Group"] = 3] = "Group";
ChangedItemType[ChangedItemType["TermStore"] = 4] = "TermStore";
ChangedItemType[ChangedItemType["Site"] = 5] = "Site";
})(ChangedItemType || (ChangedItemType = {}));
var ChangedOperationType;
(function (ChangedOperationType) {
ChangedOperationType[ChangedOperationType["Unknown"] = 0] = "Unknown";
ChangedOperationType[ChangedOperationType["Add"] = 1] = "Add";
ChangedOperationType[ChangedOperationType["Edit"] = 2] = "Edit";
ChangedOperationType[ChangedOperationType["DeleteObject"] = 3] = "DeleteObject";
ChangedOperationType[ChangedOperationType["Move"] = 4] = "Move";
ChangedOperationType[ChangedOperationType["Copy"] = 5] = "Copy";
ChangedOperationType[ChangedOperationType["PathChange"] = 6] = "PathChange";
ChangedOperationType[ChangedOperationType["Merge"] = 7] = "Merge";
ChangedOperationType[ChangedOperationType["ImportObject"] = 8] = "ImportObject";
ChangedOperationType[ChangedOperationType["Restore"] = 9] = "Restore";
})(ChangedOperationType || (ChangedOperationType = {}));
function setItemMetaDataField(item, fieldName, term) {
if (!Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["objectDefinedNotNull"])(term)) {
return Promise.resolve(null);
}
var postData = {};
postData[fieldName] = {
"Label": term.Name,
"TermGuid": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(term.Id),
"WssId": "-1",
"__metadata": { "type": "SP.Taxonomy.TaxonomyFieldValue" },
};
return item.update(postData);
}
function setItemMetaDataMultiField(item, fieldName) {
var terms = [];
for (var _i = 2; _i < arguments.length; _i++) {
terms[_i - 2] = arguments[_i];
}
if (terms.length < 1) {
return Promise.resolve(null);
}
return item.list.fields.getByTitle(fieldName + "_0").select("InternalName").get().then(function (i) {
var postData = {};
postData[i.InternalName] = terms.map(function (term) { return "-1;#" + term.Name + "|" + Object(_pnp_common__WEBPACK_IMPORTED_MODULE_1__["sanitizeGuid"])(term.Id) + ";#"; }).join("");
return item.update(postData);
});
}
// export an existing session instance
var taxonomy = new Session();
//# sourceMappingURL=sp-taxonomy.es5.js.map
/***/ }),
/***/ "./node_modules/@pnp/sp/dist/sp.es5.js":
/*!*********************************************!*\
!*** ./node_modules/@pnp/sp/dist/sp.es5.js ***!
\*********************************************/
/*! exports provided: odataUrlFrom, spODataEntity, spODataEntityArray, SharePointQueryable, SharePointQueryableInstance, SharePointQueryableCollection, SharePointQueryableSecurable, FileFolderShared, SharePointQueryableShareable, SharePointQueryableShareableFile, SharePointQueryableShareableFolder, SharePointQueryableShareableItem, SharePointQueryableShareableWeb, AppCatalog, App, SPBatch, ContentType, ContentTypes, FieldLink, FieldLinks, Field, Fields, CheckinType, WebPartsPersonalizationScope, MoveOperations, TemplateFileType, File, Files, Folder, Folders, SPHttpClient, Item, Items, ItemVersion, ItemVersions, PagedItemCollection, NavigationNodes, NavigationNode, NavigationService, List, Lists, RegionalSettings, InstalledLanguages, TimeZone, TimeZones, sp, SPRest, RoleDefinitionBindings, Search, SearchQueryBuilder, SearchResults, SortDirection, ReorderingRuleMatchType, QueryPropertyValueType, SearchBuiltInSourceId, SearchSuggest, Site, UserProfileQuery, toAbsoluteUrl, extractWebUrl, UtilityMethod, View, Views, ViewFields, WebPartDefinitions, WebPartDefinition, WebPart, Web, SiteScripts, SiteDesigns, HubSite, HubSites, PromotedState, ClientSidePage, CanvasSection, CanvasColumn, ColumnControl, ClientSideText, ClientSideWebpart, Comments, Comment, Replies, SocialQuery, MySocialQuery, SocialActorType, SocialActorTypes, SocialFollowResult, SocialStatusCode, ControlMode, FieldTypes, DateTimeFieldFormatType, DateTimeFieldFriendlyFormatType, AddFieldOptions, CalendarType, UrlFieldFormatType, PermissionKind, PrincipalType, PrincipalSource, RoleType, PageType, SharingLinkKind, SharingRole, SharingOperationStatusCode, SPSharedObjectType, SharingDomainRestrictionMode, RenderListDataOptions, FieldUserSelectionMode, ChoiceFieldFormatType, UrlZone */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* WEBPACK VAR INJECTION */(function(global) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "odataUrlFrom", function() { return odataUrlFrom; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spODataEntity", function() { return spODataEntity; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "spODataEntityArray", function() { return spODataEntityArray; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryable", function() { return SharePointQueryable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableInstance", function() { return SharePointQueryableInstance; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableCollection", function() { return SharePointQueryableCollection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableSecurable", function() { return SharePointQueryableSecurable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FileFolderShared", function() { return FileFolderShared; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableShareable", function() { return SharePointQueryableShareable; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableShareableFile", function() { return SharePointQueryableShareableFile; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableShareableFolder", function() { return SharePointQueryableShareableFolder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableShareableItem", function() { return SharePointQueryableShareableItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharePointQueryableShareableWeb", function() { return SharePointQueryableShareableWeb; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AppCatalog", function() { return AppCatalog; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "App", function() { return App; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPBatch", function() { return SPBatch; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentType", function() { return ContentType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentTypes", function() { return ContentTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldLink", function() { return FieldLink; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldLinks", function() { return FieldLinks; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Field", function() { return Field; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Fields", function() { return Fields; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckinType", function() { return CheckinType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebPartsPersonalizationScope", function() { return WebPartsPersonalizationScope; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MoveOperations", function() { return MoveOperations; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateFileType", function() { return TemplateFileType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "File", function() { return File; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Files", function() { return Files; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Folder", function() { return Folder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Folders", function() { return Folders; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPHttpClient", function() { return SPHttpClient; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Item", function() { return Item; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Items", function() { return Items; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ItemVersion", function() { return ItemVersion; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ItemVersions", function() { return ItemVersions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PagedItemCollection", function() { return PagedItemCollection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationNodes", function() { return NavigationNodes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationNode", function() { return NavigationNode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationService", function() { return NavigationService; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "List", function() { return List; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lists", function() { return Lists; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RegionalSettings", function() { return RegionalSettings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InstalledLanguages", function() { return InstalledLanguages; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeZone", function() { return TimeZone; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeZones", function() { return TimeZones; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sp", function() { return sp; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPRest", function() { return SPRest; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoleDefinitionBindings", function() { return RoleDefinitionBindings; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Search", function() { return Search; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SearchQueryBuilder", function() { return SearchQueryBuilder; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SearchResults", function() { return SearchResults; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SortDirection", function() { return SortDirection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReorderingRuleMatchType", function() { return ReorderingRuleMatchType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueryPropertyValueType", function() { return QueryPropertyValueType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SearchBuiltInSourceId", function() { return SearchBuiltInSourceId; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SearchSuggest", function() { return SearchSuggest; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Site", function() { return Site; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UserProfileQuery", function() { return UserProfileQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toAbsoluteUrl", function() { return toAbsoluteUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "extractWebUrl", function() { return extractWebUrl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UtilityMethod", function() { return UtilityMethod; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "View", function() { return View; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Views", function() { return Views; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewFields", function() { return ViewFields; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebPartDefinitions", function() { return WebPartDefinitions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebPartDefinition", function() { return WebPartDefinition; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WebPart", function() { return WebPart; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Web", function() { return Web; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SiteScripts", function() { return SiteScripts; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SiteDesigns", function() { return SiteDesigns; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubSite", function() { return HubSite; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HubSites", function() { return HubSites; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PromotedState", function() { return PromotedState; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClientSidePage", function() { return ClientSidePage; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CanvasSection", function() { return CanvasSection; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CanvasColumn", function() { return CanvasColumn; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ColumnControl", function() { return ColumnControl; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClientSideText", function() { return ClientSideText; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClientSideWebpart", function() { return ClientSideWebpart; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comments", function() { return Comments; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Replies", function() { return Replies; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SocialQuery", function() { return SocialQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MySocialQuery", function() { return MySocialQuery; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SocialActorType", function() { return SocialActorType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SocialActorTypes", function() { return SocialActorTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SocialFollowResult", function() { return SocialFollowResult; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SocialStatusCode", function() { return SocialStatusCode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControlMode", function() { return ControlMode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldTypes", function() { return FieldTypes; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateTimeFieldFormatType", function() { return DateTimeFieldFormatType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DateTimeFieldFriendlyFormatType", function() { return DateTimeFieldFriendlyFormatType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AddFieldOptions", function() { return AddFieldOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CalendarType", function() { return CalendarType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlFieldFormatType", function() { return UrlFieldFormatType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PermissionKind", function() { return PermissionKind; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrincipalType", function() { return PrincipalType$1; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrincipalSource", function() { return PrincipalSource; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoleType", function() { return RoleType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PageType", function() { return PageType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharingLinkKind", function() { return SharingLinkKind; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharingRole", function() { return SharingRole; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharingOperationStatusCode", function() { return SharingOperationStatusCode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SPSharedObjectType", function() { return SPSharedObjectType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SharingDomainRestrictionMode", function() { return SharingDomainRestrictionMode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderListDataOptions", function() { return RenderListDataOptions; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FieldUserSelectionMode", function() { return FieldUserSelectionMode; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChoiceFieldFormatType", function() { return ChoiceFieldFormatType; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlZone", function() { return UrlZone; });
/* harmony import */ var _pnp_common__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @pnp/common */ "./node_modules/@pnp/common/dist/common.es5.js");
/* harmony import */ var _pnp_logging__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @pnp/logging */ "./node_modules/@pnp/logging/dist/logging.es5.js");
/* harmony import */ var _pnp_odata__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @pnp/odata */ "./node_modules/@pnp/odata/dist/odata.es5.js");
/**
* @license
* v1.3.1
* MIT (https://github.com/pnp/pnpjs/blob/master/LICENSE)
* Copyright (c) 2019 Microsoft
* docs: https://pnp.github.io/pnpjs/
* source: https://github.com/pnp/pnpjs
* bugs: https://github.com/pnp/pnpjs/issues
*/
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
/* global Reflect, Promise */
var extendStatics = function(d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
function __extends(d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
}
function __decorate(decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
}
function __awaiter(thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
}
function __generator(thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
}
function extractWebUrl(candidateUrl) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["stringIsNullOrEmpty"])(candidateUrl)) {
return "";
}
var index = candidateUrl.indexOf("_api/");
if (index < 0) {
index = candidateUrl.indexOf("_vti_bin/");
}
if (index > -1) {
return candidateUrl.substr(0, index);
}
// if all else fails just give them what they gave us back
return candidateUrl;
}
function odataUrlFrom(candidate) {
var parts = [];
var s = ["odata.type", "odata.editLink", "__metadata", "odata.metadata"];
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[0]) && candidate[s[0]] === "SP.Web") {
// webs return an absolute url in the editLink
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[1])) {
parts.push(candidate[s[1]]);
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[2])) {
// we are dealing with verbose, which has an absolute uri
parts.push(candidate.__metadata.uri);
}
}
else {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[3]) && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[1])) {
// we are dealign with minimal metadata (default)
parts.push(extractWebUrl(candidate[s[3]]), "_api", candidate[s[1]]);
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[1])) {
parts.push("_api", candidate[s[1]]);
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(candidate, s[2])) {
// we are dealing with verbose, which has an absolute uri
parts.push(candidate.__metadata.uri);
}
}
if (parts.length < 1) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("No uri information found in ODataEntity parsing, chaining will fail for this object.", 2 /* Warning */);
return "";
}
return _pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"].apply(void 0, parts);
}
var SPODataEntityParserImpl = /** @class */ (function (_super) {
__extends(SPODataEntityParserImpl, _super);
function SPODataEntityParserImpl(factory) {
var _this = _super.call(this) || this;
_this.factory = factory;
_this.hydrate = function (d) {
var o = new _this.factory(odataUrlFrom(d), null);
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(o, d);
};
return _this;
}
SPODataEntityParserImpl.prototype.parse = function (r) {
var _this = this;
return _super.prototype.parse.call(this, r).then(function (d) {
var o = new _this.factory(odataUrlFrom(d), null);
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(o, d);
});
};
return SPODataEntityParserImpl;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataParserBase"]));
var SPODataEntityArrayParserImpl = /** @class */ (function (_super) {
__extends(SPODataEntityArrayParserImpl, _super);
function SPODataEntityArrayParserImpl(factory) {
var _this = _super.call(this) || this;
_this.factory = factory;
_this.hydrate = function (d) {
return d.map(function (v) {
var o = new _this.factory(odataUrlFrom(v), null);
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(o, v);
});
};
return _this;
}
SPODataEntityArrayParserImpl.prototype.parse = function (r) {
var _this = this;
return _super.prototype.parse.call(this, r).then(function (d) {
return d.map(function (v) {
var o = new _this.factory(odataUrlFrom(v), null);
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(o, v);
});
});
};
return SPODataEntityArrayParserImpl;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataParserBase"]));
function spODataEntity(factory) {
return new SPODataEntityParserImpl(factory);
}
function spODataEntityArray(factory) {
return new SPODataEntityArrayParserImpl(factory);
}
function setup(config) {
_pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].extend(config);
}
var SPRuntimeConfigImpl = /** @class */ (function () {
function SPRuntimeConfigImpl() {
}
Object.defineProperty(SPRuntimeConfigImpl.prototype, "headers", {
get: function () {
var spPart = _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].get("sp");
if (spPart !== undefined && spPart.headers !== undefined) {
return spPart.headers;
}
return {};
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRuntimeConfigImpl.prototype, "baseUrl", {
get: function () {
var spPart = _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].get("sp");
if (spPart !== undefined && spPart.baseUrl !== undefined) {
return spPart.baseUrl;
}
if (_pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].spfxContext !== undefined && _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].spfxContext !== null) {
return _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].spfxContext.pageContext.web.absoluteUrl;
}
return null;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRuntimeConfigImpl.prototype, "fetchClientFactory", {
get: function () {
var spPart = _pnp_common__WEBPACK_IMPORTED_MODULE_0__["RuntimeConfig"].get("sp");
if (spPart !== undefined && spPart.fetchClientFactory !== undefined) {
return spPart.fetchClientFactory;
}
else {
return function () { return new _pnp_common__WEBPACK_IMPORTED_MODULE_0__["FetchClient"](); };
}
},
enumerable: true,
configurable: true
});
return SPRuntimeConfigImpl;
}());
var SPRuntimeConfig = new SPRuntimeConfigImpl();
var CachedDigest = /** @class */ (function () {
function CachedDigest() {
}
return CachedDigest;
}());
// allows for the caching of digests across all HttpClient's which each have their own DigestCache wrapper.
var digests = new Map();
var DigestCache = /** @class */ (function () {
function DigestCache(_httpClient, _digests) {
if (_digests === void 0) { _digests = digests; }
this._httpClient = _httpClient;
this._digests = _digests;
}
DigestCache.prototype.getDigest = function (webUrl) {
var _this = this;
var cachedDigest = this._digests.get(webUrl);
if (cachedDigest !== undefined) {
var now = new Date();
if (now < cachedDigest.expiration) {
return Promise.resolve(cachedDigest.value);
}
}
var url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(webUrl, "/_api/contextinfo");
var headers = {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose;charset=utf-8",
};
return this._httpClient.fetchRaw(url, {
cache: "no-cache",
credentials: "same-origin",
headers: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(headers, SPRuntimeConfig.headers, true),
method: "POST",
}).then(function (response) {
var parser = new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataDefaultParser"]();
return parser.parse(response).then(function (d) { return d.GetContextWebInformation; });
}).then(function (data) {
var newCachedDigest = new CachedDigest();
newCachedDigest.value = data.FormDigestValue;
var seconds = data.FormDigestTimeoutSeconds;
var expiration = new Date();
expiration.setTime(expiration.getTime() + 1000 * seconds);
newCachedDigest.expiration = expiration;
_this._digests.set(webUrl, newCachedDigest);
return newCachedDigest.value;
});
};
DigestCache.prototype.clear = function () {
this._digests.clear();
};
return DigestCache;
}());
var SPHttpClient = /** @class */ (function () {
function SPHttpClient(_impl) {
if (_impl === void 0) { _impl = SPRuntimeConfig.fetchClientFactory(); }
this._impl = _impl;
this._digestCache = new DigestCache(this);
}
SPHttpClient.prototype.fetch = function (url, options) {
var _this = this;
if (options === void 0) { options = {}; }
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { cache: "no-cache", credentials: "same-origin" }, true);
var headers = new Headers();
// first we add the global headers so they can be overwritten by any passed in locally to this call
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, SPRuntimeConfig.headers);
// second we add the local options so we can overwrite the globals
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, options.headers);
// lastly we apply any default headers we need that may not exist
if (!headers.has("Accept")) {
headers.append("Accept", "application/json");
}
if (!headers.has("Content-Type")) {
headers.append("Content-Type", "application/json;odata=verbose;charset=utf-8");
}
if (!headers.has("X-ClientService-ClientTag")) {
headers.append("X-ClientService-ClientTag", "PnPCoreJS:@pnp-1.3.1");
}
if (!headers.has("User-Agent")) {
// this marks the requests for understanding by the service
headers.append("User-Agent", "NONISV|SharePointPnP|PnPCoreJS/1.3.1");
}
opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(opts, { headers: headers });
if (opts.method && opts.method.toUpperCase() !== "GET") {
// if we have either a request digest or an authorization header we don't need a digest
if (!headers.has("X-RequestDigest") && !headers.has("Authorization")) {
return this._digestCache.getDigest(extractWebUrl(url))
.then(function (digest) {
headers.append("X-RequestDigest", digest);
return _this.fetchRaw(url, opts);
});
}
}
return this.fetchRaw(url, opts);
};
SPHttpClient.prototype.fetchRaw = function (url, options) {
var _this = this;
if (options === void 0) { options = {}; }
// here we need to normalize the headers
var rawHeaders = new Headers();
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(rawHeaders, options.headers);
options = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { headers: rawHeaders });
var retry = function (ctx) {
// handles setting the proper timeout for a retry
var setRetry = function (response) {
var delay;
if (response.headers.has("Retry-After")) {
// if we have gotten a header, use that value as the delay value
delay = parseInt(response.headers.get("Retry-After"), 10);
}
else {
// grab our current delay
delay = ctx.delay;
// Increment our counters.
ctx.delay *= 2;
}
ctx.attempts++;
// If we have exceeded the retry count, reject.
if (ctx.retryCount <= ctx.attempts) {
ctx.reject(Error("Retry count exceeded (" + ctx.retryCount + ") for request. Response status: [" + response.status + "] " + response.statusText));
}
else {
// Set our retry timeout for {delay} milliseconds.
setTimeout(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getCtxCallback"])(_this, retry, ctx), delay);
}
};
// send the actual request
_this._impl.fetch(url, options).then(function (response) {
if (response.status === 429) {
// we have been throttled
setRetry(response);
}
else {
ctx.resolve(response);
}
}).catch(function (response) {
if (response.status === 503) {
// http status code 503, we can retry this
setRetry(response);
}
else {
ctx.reject(response);
}
});
};
return new Promise(function (resolve, reject) {
var retryContext = {
attempts: 0,
delay: 100,
reject: reject,
resolve: resolve,
retryCount: 7,
};
retry.call(_this, retryContext);
});
};
SPHttpClient.prototype.get = function (url, options) {
if (options === void 0) { options = {}; }
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { method: "GET" });
return this.fetch(url, opts);
};
SPHttpClient.prototype.post = function (url, options) {
if (options === void 0) { options = {}; }
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { method: "POST" });
return this.fetch(url, opts);
};
SPHttpClient.prototype.patch = function (url, options) {
if (options === void 0) { options = {}; }
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { method: "PATCH" });
return this.fetch(url, opts);
};
SPHttpClient.prototype.delete = function (url, options) {
if (options === void 0) { options = {}; }
var opts = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, { method: "DELETE" });
return this.fetch(url, opts);
};
return SPHttpClient;
}());
var global$1 = (typeof global !== "undefined" ? global :
typeof self !== "undefined" ? self :
typeof window !== "undefined" ? window : {});
/**
* Ensures that a given url is absolute for the current web based on context
*
* @param candidateUrl The url to make absolute
*
*/
function toAbsoluteUrl(candidateUrl) {
return new Promise(function (resolve) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isUrlAbsolute"])(candidateUrl)) {
// if we are already absolute, then just return the url
return resolve(candidateUrl);
}
if (SPRuntimeConfig.baseUrl !== null) {
// base url specified either with baseUrl of spfxContext config property
return resolve(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(SPRuntimeConfig.baseUrl, candidateUrl));
}
if (global$1._spPageContextInfo !== undefined) {
// operating in classic pages
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(global$1._spPageContextInfo, "webAbsoluteUrl")) {
return resolve(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(global$1._spPageContextInfo.webAbsoluteUrl, candidateUrl));
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(global$1._spPageContextInfo, "webServerRelativeUrl")) {
return resolve(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(global$1._spPageContextInfo.webServerRelativeUrl, candidateUrl));
}
}
// does window.location exist and have a certain path part in it?
if (global$1.location !== undefined) {
var baseUrl_1 = global$1.location.toString().toLowerCase();
["/_layouts/", "/siteassets/"].forEach(function (s) {
var index = baseUrl_1.indexOf(s);
if (index > 0) {
return resolve(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(baseUrl_1.substr(0, index), candidateUrl));
}
});
}
return resolve(candidateUrl);
});
}
function metadata(type) {
return {
"__metadata": { "type": type },
};
}
/**
* SharePointQueryable Base Class
*
*/
var SharePointQueryable = /** @class */ (function (_super) {
__extends(SharePointQueryable, _super);
/**
* Creates a new instance of the SharePointQueryable class
*
* @constructor
* @param baseUrl A string or SharePointQueryable that should form the base part of the url
*
*/
function SharePointQueryable(baseUrl, path) {
var _this = _super.call(this) || this;
_this._forceCaching = false;
if (typeof baseUrl === "string") {
// we need to do some extra parsing to get the parent url correct if we are
// being created from just a string.
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isUrlAbsolute"])(baseUrl) || baseUrl.lastIndexOf("/") < 0) {
_this._parentUrl = baseUrl;
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(baseUrl, path);
}
else if (baseUrl.lastIndexOf("/") > baseUrl.lastIndexOf("(")) {
// .../items(19)/fields
var index = baseUrl.lastIndexOf("/");
_this._parentUrl = baseUrl.slice(0, index);
path = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(baseUrl.slice(index), path);
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(_this._parentUrl, path);
}
else {
// .../items(19)
var index = baseUrl.lastIndexOf("(");
_this._parentUrl = baseUrl.slice(0, index);
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(baseUrl, path);
}
}
else {
_this.extend(baseUrl, path);
var target = baseUrl.query.get("@target");
if (target !== undefined) {
_this.query.set("@target", target);
}
}
return _this;
}
/**
* Creates a new instance of the supplied factory and extends this into that new instance
*
* @param factory constructor for the new SharePointQueryable
*/
SharePointQueryable.prototype.as = function (factory) {
var o = new factory(this._url, null);
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(o, this, true);
};
/**
* Gets the full url with query information
*
*/
SharePointQueryable.prototype.toUrlAndQuery = function () {
var aliasedParams = new Map(this.query);
var url = this.toUrl().replace(/'!(@.*?)::(.*?)'/ig, function (match, labelName, value) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("Rewriting aliased parameter from match " + match + " to label: " + labelName + " value: " + value, 0 /* Verbose */);
aliasedParams.set(labelName, "'" + value + "'");
return labelName;
});
if (aliasedParams.size > 0) {
var char = url.indexOf("?") > -1 ? "&" : "?";
url += "" + char + Array.from(aliasedParams).map(function (v) { return v[0] + "=" + v[1]; }).join("&");
}
return url;
};
/**
* Choose which fields to return
*
* @param selects One or more fields to return
*/
SharePointQueryable.prototype.select = function () {
var selects = [];
for (var _i = 0; _i < arguments.length; _i++) {
selects[_i] = arguments[_i];
}
if (selects.length > 0) {
this.query.set("$select", selects.join(","));
}
return this;
};
/**
* Expands fields such as lookups to get additional data
*
* @param expands The Fields for which to expand the values
*/
SharePointQueryable.prototype.expand = function () {
var expands = [];
for (var _i = 0; _i < arguments.length; _i++) {
expands[_i] = arguments[_i];
}
if (expands.length > 0) {
this.query.set("$expand", expands.join(","));
}
return this;
};
/**
* Gets a parent for this instance as specified
*
* @param factory The contructor for the class to create
*/
SharePointQueryable.prototype.getParent = function (factory, baseUrl, path, batch) {
if (baseUrl === void 0) { baseUrl = this.parentUrl; }
var parent = new factory(baseUrl, path).configureFrom(this);
var t = "@target";
if (this.query.has(t)) {
parent.query.set(t, this.query.get(t));
}
if (batch !== undefined) {
parent = parent.inBatch(batch);
}
return parent;
};
/**
* Clones this SharePointQueryable into a new SharePointQueryable instance of T
* @param factory Constructor used to create the new instance
* @param additionalPath Any additional path to include in the clone
* @param includeBatch If true this instance's batch will be added to the cloned instance
*/
SharePointQueryable.prototype.clone = function (factory, additionalPath, includeBatch) {
if (includeBatch === void 0) { includeBatch = true; }
var clone = _super.prototype._clone.call(this, new factory(this, additionalPath), { includeBatch: includeBatch });
// handle sp specific clone actions
var t = "@target";
if (this.query.has(t)) {
clone.query.set(t, this.query.get(t));
}
return clone;
};
/**
* Converts the current instance to a request context
*
* @param verb The request verb
* @param options The set of supplied request options
* @param parser The supplied ODataParser instance
* @param pipeline Optional request processing pipeline
*/
SharePointQueryable.prototype.toRequestContext = function (verb, options, parser, pipeline) {
var _this = this;
if (options === void 0) { options = {}; }
var dependencyDispose = this.hasBatch ? this._batchDependency : function () { return; };
return toAbsoluteUrl(this.toUrlAndQuery()).then(function (url) {
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeOptions"])(options, _this._options);
// build our request context
var context = {
batch: _this.batch,
batchDependency: dependencyDispose,
cachingOptions: _this._cachingOptions,
clientFactory: function () { return new SPHttpClient(); },
isBatched: _this.hasBatch,
isCached: _this._forceCaching || (_this._useCaching && /^get$/i.test(verb)),
options: options,
parser: parser,
pipeline: pipeline,
requestAbsoluteUrl: url,
requestId: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])(),
verb: verb,
};
return context;
});
};
return SharePointQueryable;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataQueryable"]));
/**
* Represents a REST collection which can be filtered, paged, and selected
*
*/
var SharePointQueryableCollection = /** @class */ (function (_super) {
__extends(SharePointQueryableCollection, _super);
function SharePointQueryableCollection() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Filters the returned collection (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#bk_supported)
*
* @param filter The string representing the filter query
*/
SharePointQueryableCollection.prototype.filter = function (filter) {
this.query.set("$filter", filter);
return this;
};
/**
* Orders based on the supplied fields
*
* @param orderby The name of the field on which to sort
* @param ascending If false DESC is appended, otherwise ASC (default)
*/
SharePointQueryableCollection.prototype.orderBy = function (orderBy, ascending) {
if (ascending === void 0) { ascending = true; }
var o = "$orderby";
var query = this.query.has(o) ? this.query.get(o).split(",") : [];
query.push(orderBy + " " + (ascending ? "asc" : "desc"));
this.query.set(o, query.join(","));
return this;
};
/**
* Skips the specified number of items
*
* @param skip The number of items to skip
*/
SharePointQueryableCollection.prototype.skip = function (skip) {
this.query.set("$skip", skip.toString());
return this;
};
/**
* Limits the query to only return the specified number of items
*
* @param top The query row limit
*/
SharePointQueryableCollection.prototype.top = function (top) {
this.query.set("$top", top.toString());
return this;
};
return SharePointQueryableCollection;
}(SharePointQueryable));
/**
* Represents an instance that can be selected
*
*/
var SharePointQueryableInstance = /** @class */ (function (_super) {
__extends(SharePointQueryableInstance, _super);
function SharePointQueryableInstance() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Curries the update function into the common pieces
*
* @param type
* @param mapper
*/
SharePointQueryableInstance.prototype._update = function (type, mapper) {
var _this = this;
return function (props) { return _this.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata(type), props)),
headers: {
"X-HTTP-Method": "MERGE",
},
}).then(function (d) { return mapper(d, props); }); };
};
/**
* Deletes this instance
*
*/
SharePointQueryableInstance.prototype._delete = function () {
return this.postCore({
headers: {
"X-HTTP-Method": "DELETE",
},
});
};
/**
* Deletes this instance with an etag value in the headers
*
* @param eTag eTag to delete
*/
SharePointQueryableInstance.prototype._deleteWithETag = function (eTag) {
if (eTag === void 0) { eTag = "*"; }
return this.postCore({
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "DELETE",
},
});
};
return SharePointQueryableInstance;
}(SharePointQueryable));
/**
* Decorator used to specify the default path for SharePointQueryable objects
*
* @param path
*/
function defaultPath(path) {
return function (target) {
return /** @class */ (function (_super) {
__extends(class_1, _super);
function class_1() {
var args = [];
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
return _super.call(this, args[0], args.length > 1 && args[1] !== undefined ? args[1] : path) || this;
}
return class_1;
}(target));
};
}
/**
* Describes a collection of all site collection users
*
*/
var SiteUsers = /** @class */ (function (_super) {
__extends(SiteUsers, _super);
function SiteUsers() {
return _super !== null && _super.apply(this, arguments) || this;
}
SiteUsers_1 = SiteUsers;
/**
* Gets a user from the collection by id
*
* @param id The id of the user to retrieve
*/
SiteUsers.prototype.getById = function (id) {
return new SiteUser(this, "getById(" + id + ")");
};
/**
* Gets a user from the collection by email
*
* @param email The email address of the user to retrieve
*/
SiteUsers.prototype.getByEmail = function (email) {
return new SiteUser(this, "getByEmail('" + email + "')");
};
/**
* Gets a user from the collection by login name
*
* @param loginName The login name of the user to retrieve
*/
SiteUsers.prototype.getByLoginName = function (loginName) {
var su = new SiteUser(this);
su.concat("('!@v::" + encodeURIComponent(loginName) + "')");
return su;
};
/**
* Removes a user from the collection by id
*
* @param id The id of the user to remove
*/
SiteUsers.prototype.removeById = function (id) {
return this.clone(SiteUsers_1, "removeById(" + id + ")").postCore();
};
/**
* Removes a user from the collection by login name
*
* @param loginName The login name of the user to remove
*/
SiteUsers.prototype.removeByLoginName = function (loginName) {
var o = this.clone(SiteUsers_1, "removeByLoginName(@v)");
o.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return o.postCore();
};
/**
* Adds a user to a group
*
* @param loginName The login name of the user to add to the group
*
*/
SiteUsers.prototype.add = function (loginName) {
var _this = this;
return this.clone(SiteUsers_1, null).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.User"), { LoginName: loginName })),
}).then(function () { return _this.getByLoginName(loginName); });
};
var SiteUsers_1;
SiteUsers = SiteUsers_1 = __decorate([
defaultPath("siteusers")
], SiteUsers);
return SiteUsers;
}(SharePointQueryableCollection));
/**
* Base class for a user
*
*/
var UserBase = /** @class */ (function (_super) {
__extends(UserBase, _super);
function UserBase() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(UserBase.prototype, "groups", {
/**
* Gets the groups for this user
*
*/
get: function () {
return new SiteGroups(this, "groups");
},
enumerable: true,
configurable: true
});
return UserBase;
}(SharePointQueryableInstance));
/**
* Describes a single user
*
*/
var SiteUser = /** @class */ (function (_super) {
__extends(SiteUser, _super);
function SiteUser() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Updates this user instance with the supplied properties
*
* @param properties A plain object of property names and values to update for the user
*/
_this.update = _this._update("SP.User", function (data) { return ({ data: data, user: _this }); });
/**
* Delete this user
*
*/
_this.delete = _this._delete;
return _this;
}
return SiteUser;
}(UserBase));
/**
* Represents the current user
*/
var CurrentUser = /** @class */ (function (_super) {
__extends(CurrentUser, _super);
function CurrentUser() {
return _super !== null && _super.apply(this, arguments) || this;
}
CurrentUser = __decorate([
defaultPath("currentuser")
], CurrentUser);
return CurrentUser;
}(UserBase));
/**
* Principal Type enum
*
*/
var PrincipalType;
(function (PrincipalType) {
PrincipalType[PrincipalType["None"] = 0] = "None";
PrincipalType[PrincipalType["User"] = 1] = "User";
PrincipalType[PrincipalType["DistributionList"] = 2] = "DistributionList";
PrincipalType[PrincipalType["SecurityGroup"] = 4] = "SecurityGroup";
PrincipalType[PrincipalType["SharePointGroup"] = 8] = "SharePointGroup";
PrincipalType[PrincipalType["All"] = 15] = "All";
})(PrincipalType || (PrincipalType = {}));
/**
* Describes a collection of site groups
*
*/
var SiteGroups = /** @class */ (function (_super) {
__extends(SiteGroups, _super);
function SiteGroups() {
return _super !== null && _super.apply(this, arguments) || this;
}
SiteGroups_1 = SiteGroups;
/**
* Gets a group from the collection by id
*
* @param id The id of the group to retrieve
*/
SiteGroups.prototype.getById = function (id) {
var sg = new SiteGroup(this);
sg.concat("(" + id + ")");
return sg;
};
/**
* Adds a new group to the site collection
*
* @param props The group properties object of property names and values to be set for the group
*/
SiteGroups.prototype.add = function (properties) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.Group"), properties));
return this.postCore({ body: postBody }).then(function (data) {
return {
data: data,
group: _this.getById(data.Id),
};
});
};
/**
* Gets a group from the collection by name
*
* @param groupName The name of the group to retrieve
*/
SiteGroups.prototype.getByName = function (groupName) {
return new SiteGroup(this, "getByName('" + groupName + "')");
};
/**
* Removes the group with the specified member id from the collection
*
* @param id The id of the group to remove
*/
SiteGroups.prototype.removeById = function (id) {
return this.clone(SiteGroups_1, "removeById('" + id + "')").postCore();
};
/**
* Removes the cross-site group with the specified name from the collection
*
* @param loginName The name of the group to remove
*/
SiteGroups.prototype.removeByLoginName = function (loginName) {
return this.clone(SiteGroups_1, "removeByLoginName('" + loginName + "')").postCore();
};
var SiteGroups_1;
SiteGroups = SiteGroups_1 = __decorate([
defaultPath("sitegroups")
], SiteGroups);
return SiteGroups;
}(SharePointQueryableCollection));
/**
* Describes a single group
*
*/
var SiteGroup = /** @class */ (function (_super) {
__extends(SiteGroup, _super);
function SiteGroup() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.update = _this._update("SP.Group", function (d, p) {
var retGroup = _this;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(p, "Title")) {
/* tslint:disable-next-line no-string-literal */
retGroup = _this.getParent(SiteGroup, _this.parentUrl, "getByName('" + p["Title"] + "')");
}
return {
data: d,
group: retGroup,
};
});
return _this;
}
Object.defineProperty(SiteGroup.prototype, "users", {
/**
* Gets the users for this group
*
*/
get: function () {
return new SiteUsers(this, "users");
},
enumerable: true,
configurable: true
});
return SiteGroup;
}(SharePointQueryableInstance));
/**
* Describes a set of role assignments for the current scope
*
*/
var RoleAssignments = /** @class */ (function (_super) {
__extends(RoleAssignments, _super);
function RoleAssignments() {
return _super !== null && _super.apply(this, arguments) || this;
}
RoleAssignments_1 = RoleAssignments;
/**
* Gets the role assignment associated with the specified principal id from the collection.
*
* @param id The id of the role assignment
*/
RoleAssignments.prototype.getById = function (id) {
var ra = new RoleAssignment(this);
ra.concat("(" + id + ")");
return ra;
};
/**
* Adds a new role assignment with the specified principal and role definitions to the collection
*
* @param principalId The id of the user or group to assign permissions to
* @param roleDefId The id of the role definition that defines the permissions to assign
*
*/
RoleAssignments.prototype.add = function (principalId, roleDefId) {
return this.clone(RoleAssignments_1, "addroleassignment(principalid=" + principalId + ", roledefid=" + roleDefId + ")").postCore();
};
/**
* Removes the role assignment with the specified principal and role definition from the collection
*
* @param principalId The id of the user or group in the role assignment
* @param roleDefId The id of the role definition in the role assignment
*
*/
RoleAssignments.prototype.remove = function (principalId, roleDefId) {
return this.clone(RoleAssignments_1, "removeroleassignment(principalid=" + principalId + ", roledefid=" + roleDefId + ")").postCore();
};
var RoleAssignments_1;
RoleAssignments = RoleAssignments_1 = __decorate([
defaultPath("roleassignments")
], RoleAssignments);
return RoleAssignments;
}(SharePointQueryableCollection));
/**
* Describes a role assignment
*
*/
var RoleAssignment = /** @class */ (function (_super) {
__extends(RoleAssignment, _super);
function RoleAssignment() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Deletes this role assignment
*
*/
_this.delete = _this._delete;
return _this;
}
Object.defineProperty(RoleAssignment.prototype, "groups", {
/**
* Gets the groups that directly belong to the access control list (ACL) for this securable object
*
*/
get: function () {
return new SiteGroups(this, "groups");
},
enumerable: true,
configurable: true
});
Object.defineProperty(RoleAssignment.prototype, "bindings", {
/**
* Gets the role definition bindings for this role assignment
*
*/
get: function () {
return new RoleDefinitionBindings(this);
},
enumerable: true,
configurable: true
});
return RoleAssignment;
}(SharePointQueryableInstance));
/**
* Describes a collection of role definitions
*
*/
var RoleDefinitions = /** @class */ (function (_super) {
__extends(RoleDefinitions, _super);
function RoleDefinitions() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets the role definition with the specified id from the collection
*
* @param id The id of the role definition
*
*/
RoleDefinitions.prototype.getById = function (id) {
return new RoleDefinition(this, "getById(" + id + ")");
};
/**
* Gets the role definition with the specified name
*
* @param name The name of the role definition
*
*/
RoleDefinitions.prototype.getByName = function (name) {
return new RoleDefinition(this, "getbyname('" + name + "')");
};
/**
* Gets the role definition with the specified role type
*
* @param roleTypeKind The roletypekind of the role definition (None=0, Guest=1, Reader=2, Contributor=3, WebDesigner=4, Administrator=5, Editor=6, System=7)
*
*/
RoleDefinitions.prototype.getByType = function (roleTypeKind) {
return new RoleDefinition(this, "getbytype(" + roleTypeKind + ")");
};
/**
* Creates a role definition
*
* @param name The new role definition's name
* @param description The new role definition's description
* @param order The order in which the role definition appears
* @param basePermissions The permissions mask for this role definition
*
*/
RoleDefinitions.prototype.add = function (name, description, order, basePermissions) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
BasePermissions: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ __metadata: { type: "SP.BasePermissions" } }, basePermissions),
Description: description,
Name: name,
Order: order,
__metadata: { "type": "SP.RoleDefinition" },
});
return this.postCore({ body: postBody }).then(function (data) {
return {
data: data,
definition: _this.getById(data.Id),
};
});
};
RoleDefinitions = __decorate([
defaultPath("roledefinitions")
], RoleDefinitions);
return RoleDefinitions;
}(SharePointQueryableCollection));
/**
* Describes a role definition
*
*/
var RoleDefinition = /** @class */ (function (_super) {
__extends(RoleDefinition, _super);
function RoleDefinition() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Deletes this role definition
*
*/
_this.delete = _this._delete;
return _this;
/* tslint:enable */
}
/**
* Updates this role definition with the supplied properties
*
* @param properties A plain object hash of values to update for the role definition
*/
/* tslint:disable no-string-literal */
RoleDefinition.prototype.update = function (properties) {
var _this = this;
var s = ["BasePermissions"];
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(properties, s[0]) !== undefined) {
properties[s[0]] = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ __metadata: { type: "SP." + s[0] } }, properties[s[0]]);
}
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.RoleDefinition"), properties));
return this.postCore({
body: postBody,
headers: {
"X-HTTP-Method": "MERGE",
},
}).then(function (data) {
var retDef = _this;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(properties, "Name")) {
var parent_1 = _this.getParent(RoleDefinitions, _this.parentUrl, "");
retDef = parent_1.getByName(properties["Name"]);
}
return {
data: data,
definition: retDef,
};
});
};
return RoleDefinition;
}(SharePointQueryableInstance));
/**
* Describes the role definitons bound to a role assignment object
*
*/
var RoleDefinitionBindings = /** @class */ (function (_super) {
__extends(RoleDefinitionBindings, _super);
function RoleDefinitionBindings() {
return _super !== null && _super.apply(this, arguments) || this;
}
RoleDefinitionBindings = __decorate([
defaultPath("roledefinitionbindings")
], RoleDefinitionBindings);
return RoleDefinitionBindings;
}(SharePointQueryableCollection));
/**
* Determines the display mode of the given control or view
*/
var ControlMode;
(function (ControlMode) {
ControlMode[ControlMode["Display"] = 1] = "Display";
ControlMode[ControlMode["Edit"] = 2] = "Edit";
ControlMode[ControlMode["New"] = 3] = "New";
})(ControlMode || (ControlMode = {}));
/**
* Specifies the type of the field.
*/
var FieldTypes;
(function (FieldTypes) {
FieldTypes[FieldTypes["Invalid"] = 0] = "Invalid";
FieldTypes[FieldTypes["Integer"] = 1] = "Integer";
FieldTypes[FieldTypes["Text"] = 2] = "Text";
FieldTypes[FieldTypes["Note"] = 3] = "Note";
FieldTypes[FieldTypes["DateTime"] = 4] = "DateTime";
FieldTypes[FieldTypes["Counter"] = 5] = "Counter";
FieldTypes[FieldTypes["Choice"] = 6] = "Choice";
FieldTypes[FieldTypes["Lookup"] = 7] = "Lookup";
FieldTypes[FieldTypes["Boolean"] = 8] = "Boolean";
FieldTypes[FieldTypes["Number"] = 9] = "Number";
FieldTypes[FieldTypes["Currency"] = 10] = "Currency";
FieldTypes[FieldTypes["URL"] = 11] = "URL";
FieldTypes[FieldTypes["Computed"] = 12] = "Computed";
FieldTypes[FieldTypes["Threading"] = 13] = "Threading";
FieldTypes[FieldTypes["Guid"] = 14] = "Guid";
FieldTypes[FieldTypes["MultiChoice"] = 15] = "MultiChoice";
FieldTypes[FieldTypes["GridChoice"] = 16] = "GridChoice";
FieldTypes[FieldTypes["Calculated"] = 17] = "Calculated";
FieldTypes[FieldTypes["File"] = 18] = "File";
FieldTypes[FieldTypes["Attachments"] = 19] = "Attachments";
FieldTypes[FieldTypes["User"] = 20] = "User";
FieldTypes[FieldTypes["Recurrence"] = 21] = "Recurrence";
FieldTypes[FieldTypes["CrossProjectLink"] = 22] = "CrossProjectLink";
FieldTypes[FieldTypes["ModStat"] = 23] = "ModStat";
FieldTypes[FieldTypes["Error"] = 24] = "Error";
FieldTypes[FieldTypes["ContentTypeId"] = 25] = "ContentTypeId";
FieldTypes[FieldTypes["PageSeparator"] = 26] = "PageSeparator";
FieldTypes[FieldTypes["ThreadIndex"] = 27] = "ThreadIndex";
FieldTypes[FieldTypes["WorkflowStatus"] = 28] = "WorkflowStatus";
FieldTypes[FieldTypes["AllDayEvent"] = 29] = "AllDayEvent";
FieldTypes[FieldTypes["WorkflowEventType"] = 30] = "WorkflowEventType";
})(FieldTypes || (FieldTypes = {}));
var DateTimeFieldFormatType;
(function (DateTimeFieldFormatType) {
DateTimeFieldFormatType[DateTimeFieldFormatType["DateOnly"] = 0] = "DateOnly";
DateTimeFieldFormatType[DateTimeFieldFormatType["DateTime"] = 1] = "DateTime";
})(DateTimeFieldFormatType || (DateTimeFieldFormatType = {}));
var DateTimeFieldFriendlyFormatType;
(function (DateTimeFieldFriendlyFormatType) {
DateTimeFieldFriendlyFormatType[DateTimeFieldFriendlyFormatType["Unspecified"] = 0] = "Unspecified";
DateTimeFieldFriendlyFormatType[DateTimeFieldFriendlyFormatType["Disabled"] = 1] = "Disabled";
DateTimeFieldFriendlyFormatType[DateTimeFieldFriendlyFormatType["Relative"] = 2] = "Relative";
})(DateTimeFieldFriendlyFormatType || (DateTimeFieldFriendlyFormatType = {}));
/**
* Specifies the control settings while adding a field.
*/
var AddFieldOptions;
(function (AddFieldOptions) {
/**
* Specify that a new field added to the list must also be added to the default content type in the site collection
*/
AddFieldOptions[AddFieldOptions["DefaultValue"] = 0] = "DefaultValue";
/**
* Specify that a new field added to the list must also be added to the default content type in the site collection.
*/
AddFieldOptions[AddFieldOptions["AddToDefaultContentType"] = 1] = "AddToDefaultContentType";
/**
* Specify that a new field must not be added to any other content type
*/
AddFieldOptions[AddFieldOptions["AddToNoContentType"] = 2] = "AddToNoContentType";
/**
* Specify that a new field that is added to the specified list must also be added to all content types in the site collection
*/
AddFieldOptions[AddFieldOptions["AddToAllContentTypes"] = 4] = "AddToAllContentTypes";
/**
* Specify adding an internal field name hint for the purpose of avoiding possible database locking or field renaming operations
*/
AddFieldOptions[AddFieldOptions["AddFieldInternalNameHint"] = 8] = "AddFieldInternalNameHint";
/**
* Specify that a new field that is added to the specified list must also be added to the default list view
*/
AddFieldOptions[AddFieldOptions["AddFieldToDefaultView"] = 16] = "AddFieldToDefaultView";
/**
* Specify to confirm that no other field has the same display name
*/
AddFieldOptions[AddFieldOptions["AddFieldCheckDisplayName"] = 32] = "AddFieldCheckDisplayName";
})(AddFieldOptions || (AddFieldOptions = {}));
var CalendarType;
(function (CalendarType) {
CalendarType[CalendarType["Gregorian"] = 1] = "Gregorian";
CalendarType[CalendarType["Japan"] = 3] = "Japan";
CalendarType[CalendarType["Taiwan"] = 4] = "Taiwan";
CalendarType[CalendarType["Korea"] = 5] = "Korea";
CalendarType[CalendarType["Hijri"] = 6] = "Hijri";
CalendarType[CalendarType["Thai"] = 7] = "Thai";
CalendarType[CalendarType["Hebrew"] = 8] = "Hebrew";
CalendarType[CalendarType["GregorianMEFrench"] = 9] = "GregorianMEFrench";
CalendarType[CalendarType["GregorianArabic"] = 10] = "GregorianArabic";
CalendarType[CalendarType["GregorianXLITEnglish"] = 11] = "GregorianXLITEnglish";
CalendarType[CalendarType["GregorianXLITFrench"] = 12] = "GregorianXLITFrench";
CalendarType[CalendarType["KoreaJapanLunar"] = 14] = "KoreaJapanLunar";
CalendarType[CalendarType["ChineseLunar"] = 15] = "ChineseLunar";
CalendarType[CalendarType["SakaEra"] = 16] = "SakaEra";
CalendarType[CalendarType["UmAlQura"] = 23] = "UmAlQura";
})(CalendarType || (CalendarType = {}));
var UrlFieldFormatType;
(function (UrlFieldFormatType) {
UrlFieldFormatType[UrlFieldFormatType["Hyperlink"] = 0] = "Hyperlink";
UrlFieldFormatType[UrlFieldFormatType["Image"] = 1] = "Image";
})(UrlFieldFormatType || (UrlFieldFormatType = {}));
var PermissionKind;
(function (PermissionKind) {
/**
* Has no permissions on the Site. Not available through the user interface.
*/
PermissionKind[PermissionKind["EmptyMask"] = 0] = "EmptyMask";
/**
* View items in lists, documents in document libraries, and Web discussion comments.
*/
PermissionKind[PermissionKind["ViewListItems"] = 1] = "ViewListItems";
/**
* Add items to lists, documents to document libraries, and Web discussion comments.
*/
PermissionKind[PermissionKind["AddListItems"] = 2] = "AddListItems";
/**
* Edit items in lists, edit documents in document libraries, edit Web discussion comments
* in documents, and customize Web Part Pages in document libraries.
*/
PermissionKind[PermissionKind["EditListItems"] = 3] = "EditListItems";
/**
* Delete items from a list, documents from a document library, and Web discussion
* comments in documents.
*/
PermissionKind[PermissionKind["DeleteListItems"] = 4] = "DeleteListItems";
/**
* Approve a minor version of a list item or document.
*/
PermissionKind[PermissionKind["ApproveItems"] = 5] = "ApproveItems";
/**
* View the source of documents with server-side file handlers.
*/
PermissionKind[PermissionKind["OpenItems"] = 6] = "OpenItems";
/**
* View past versions of a list item or document.
*/
PermissionKind[PermissionKind["ViewVersions"] = 7] = "ViewVersions";
/**
* Delete past versions of a list item or document.
*/
PermissionKind[PermissionKind["DeleteVersions"] = 8] = "DeleteVersions";
/**
* Discard or check in a document which is checked out to another user.
*/
PermissionKind[PermissionKind["CancelCheckout"] = 9] = "CancelCheckout";
/**
* Create, change, and delete personal views of lists.
*/
PermissionKind[PermissionKind["ManagePersonalViews"] = 10] = "ManagePersonalViews";
/**
* Create and delete lists, add or remove columns in a list, and add or remove public views of a list.
*/
PermissionKind[PermissionKind["ManageLists"] = 12] = "ManageLists";
/**
* View forms, views, and application pages, and enumerate lists.
*/
PermissionKind[PermissionKind["ViewFormPages"] = 13] = "ViewFormPages";
/**
* Make content of a list or document library retrieveable for anonymous users through SharePoint search.
* The list permissions in the site do not change.
*/
PermissionKind[PermissionKind["AnonymousSearchAccessList"] = 14] = "AnonymousSearchAccessList";
/**
* Allow users to open a Site, list, or folder to access items inside that container.
*/
PermissionKind[PermissionKind["Open"] = 17] = "Open";
/**
* View pages in a Site.
*/
PermissionKind[PermissionKind["ViewPages"] = 18] = "ViewPages";
/**
* Add, change, or delete HTML pages or Web Part Pages, and edit the Site using
* a Windows SharePoint Services compatible editor.
*/
PermissionKind[PermissionKind["AddAndCustomizePages"] = 19] = "AddAndCustomizePages";
/**
* Apply a theme or borders to the entire Site.
*/
PermissionKind[PermissionKind["ApplyThemeAndBorder"] = 20] = "ApplyThemeAndBorder";
/**
* Apply a style sheet (.css file) to the Site.
*/
PermissionKind[PermissionKind["ApplyStyleSheets"] = 21] = "ApplyStyleSheets";
/**
* View reports on Site usage.
*/
PermissionKind[PermissionKind["ViewUsageData"] = 22] = "ViewUsageData";
/**
* Create a Site using Self-Service Site Creation.
*/
PermissionKind[PermissionKind["CreateSSCSite"] = 23] = "CreateSSCSite";
/**
* Create subsites such as team sites, Meeting Workspace sites, and Document Workspace sites.
*/
PermissionKind[PermissionKind["ManageSubwebs"] = 24] = "ManageSubwebs";
/**
* Create a group of users that can be used anywhere within the site collection.
*/
PermissionKind[PermissionKind["CreateGroups"] = 25] = "CreateGroups";
/**
* Create and change permission levels on the Site and assign permissions to users
* and groups.
*/
PermissionKind[PermissionKind["ManagePermissions"] = 26] = "ManagePermissions";
/**
* Enumerate files and folders in a Site using Microsoft Office SharePoint Designer
* and WebDAV interfaces.
*/
PermissionKind[PermissionKind["BrowseDirectories"] = 27] = "BrowseDirectories";
/**
* View information about users of the Site.
*/
PermissionKind[PermissionKind["BrowseUserInfo"] = 28] = "BrowseUserInfo";
/**
* Add or remove personal Web Parts on a Web Part Page.
*/
PermissionKind[PermissionKind["AddDelPrivateWebParts"] = 29] = "AddDelPrivateWebParts";
/**
* Update Web Parts to display personalized information.
*/
PermissionKind[PermissionKind["UpdatePersonalWebParts"] = 30] = "UpdatePersonalWebParts";
/**
* Grant the ability to perform all administration tasks for the Site as well as
* manage content, activate, deactivate, or edit properties of Site scoped Features
* through the object model or through the user interface (UI). When granted on the
* root Site of a Site Collection, activate, deactivate, or edit properties of
* site collection scoped Features through the object model. To browse to the Site
* Collection Features page and activate or deactivate Site Collection scoped Features
* through the UI, you must be a Site Collection administrator.
*/
PermissionKind[PermissionKind["ManageWeb"] = 31] = "ManageWeb";
/**
* Content of lists and document libraries in the Web site will be retrieveable for anonymous users through
* SharePoint search if the list or document library has AnonymousSearchAccessList set.
*/
PermissionKind[PermissionKind["AnonymousSearchAccessWebLists"] = 32] = "AnonymousSearchAccessWebLists";
/**
* Use features that launch client applications. Otherwise, users must work on documents
* locally and upload changes.
*/
PermissionKind[PermissionKind["UseClientIntegration"] = 37] = "UseClientIntegration";
/**
* Use SOAP, WebDAV, or Microsoft Office SharePoint Designer interfaces to access the Site.
*/
PermissionKind[PermissionKind["UseRemoteAPIs"] = 38] = "UseRemoteAPIs";
/**
* Manage alerts for all users of the Site.
*/
PermissionKind[PermissionKind["ManageAlerts"] = 39] = "ManageAlerts";
/**
* Create e-mail alerts.
*/
PermissionKind[PermissionKind["CreateAlerts"] = 40] = "CreateAlerts";
/**
* Allows a user to change his or her user information, such as adding a picture.
*/
PermissionKind[PermissionKind["EditMyUserInfo"] = 41] = "EditMyUserInfo";
/**
* Enumerate permissions on Site, list, folder, document, or list item.
*/
PermissionKind[PermissionKind["EnumeratePermissions"] = 63] = "EnumeratePermissions";
/**
* Has all permissions on the Site. Not available through the user interface.
*/
PermissionKind[PermissionKind["FullMask"] = 65] = "FullMask";
})(PermissionKind || (PermissionKind = {}));
/**
* Specifies the type of a principal.
*/
/* tslint:disable:no-bitwise */
var PrincipalType$1;
(function (PrincipalType) {
/**
* Enumeration whose value specifies no principal type.
*/
PrincipalType[PrincipalType["None"] = 0] = "None";
/**
* Enumeration whose value specifies a user as the principal type.
*/
PrincipalType[PrincipalType["User"] = 1] = "User";
/**
* Enumeration whose value specifies a distribution list as the principal type.
*/
PrincipalType[PrincipalType["DistributionList"] = 2] = "DistributionList";
/**
* Enumeration whose value specifies a security group as the principal type.
*/
PrincipalType[PrincipalType["SecurityGroup"] = 4] = "SecurityGroup";
/**
* Enumeration whose value specifies a group as the principal type.
*/
PrincipalType[PrincipalType["SharePointGroup"] = 8] = "SharePointGroup";
/**
* Enumeration whose value specifies all principal types.
*/
PrincipalType[PrincipalType["All"] = 15] = "All";
})(PrincipalType$1 || (PrincipalType$1 = {}));
/* tslint:enable:no-bitwise */
/**
* Specifies the source of a principal.
*/
/* tslint:disable:no-bitwise */
var PrincipalSource;
(function (PrincipalSource) {
/**
* Enumeration whose value specifies no principal source.
*/
PrincipalSource[PrincipalSource["None"] = 0] = "None";
/**
* Enumeration whose value specifies user information list as the principal source.
*/
PrincipalSource[PrincipalSource["UserInfoList"] = 1] = "UserInfoList";
/**
* Enumeration whose value specifies Active Directory as the principal source.
*/
PrincipalSource[PrincipalSource["Windows"] = 2] = "Windows";
/**
* Enumeration whose value specifies the current membership provider as the principal source.
*/
PrincipalSource[PrincipalSource["MembershipProvider"] = 4] = "MembershipProvider";
/**
* Enumeration whose value specifies the current role provider as the principal source.
*/
PrincipalSource[PrincipalSource["RoleProvider"] = 8] = "RoleProvider";
/**
* Enumeration whose value specifies all principal sources.
*/
PrincipalSource[PrincipalSource["All"] = 15] = "All";
})(PrincipalSource || (PrincipalSource = {}));
/* tslint:enable:no-bitwise */
var RoleType;
(function (RoleType) {
RoleType[RoleType["None"] = 0] = "None";
RoleType[RoleType["Guest"] = 1] = "Guest";
RoleType[RoleType["Reader"] = 2] = "Reader";
RoleType[RoleType["Contributor"] = 3] = "Contributor";
RoleType[RoleType["WebDesigner"] = 4] = "WebDesigner";
RoleType[RoleType["Administrator"] = 5] = "Administrator";
})(RoleType || (RoleType = {}));
var PageType;
(function (PageType) {
PageType[PageType["Invalid"] = -1] = "Invalid";
PageType[PageType["DefaultView"] = 0] = "DefaultView";
PageType[PageType["NormalView"] = 1] = "NormalView";
PageType[PageType["DialogView"] = 2] = "DialogView";
PageType[PageType["View"] = 3] = "View";
PageType[PageType["DisplayForm"] = 4] = "DisplayForm";
PageType[PageType["DisplayFormDialog"] = 5] = "DisplayFormDialog";
PageType[PageType["EditForm"] = 6] = "EditForm";
PageType[PageType["EditFormDialog"] = 7] = "EditFormDialog";
PageType[PageType["NewForm"] = 8] = "NewForm";
PageType[PageType["NewFormDialog"] = 9] = "NewFormDialog";
PageType[PageType["SolutionForm"] = 10] = "SolutionForm";
PageType[PageType["PAGE_MAXITEMS"] = 11] = "PAGE_MAXITEMS";
})(PageType || (PageType = {}));
var SharingLinkKind;
(function (SharingLinkKind) {
/**
* Uninitialized link
*/
SharingLinkKind[SharingLinkKind["Uninitialized"] = 0] = "Uninitialized";
/**
* Direct link to the object being shared
*/
SharingLinkKind[SharingLinkKind["Direct"] = 1] = "Direct";
/**
* Organization-shareable link to the object being shared with view permissions
*/
SharingLinkKind[SharingLinkKind["OrganizationView"] = 2] = "OrganizationView";
/**
* Organization-shareable link to the object being shared with edit permissions
*/
SharingLinkKind[SharingLinkKind["OrganizationEdit"] = 3] = "OrganizationEdit";
/**
* View only anonymous link
*/
SharingLinkKind[SharingLinkKind["AnonymousView"] = 4] = "AnonymousView";
/**
* Read/Write anonymous link
*/
SharingLinkKind[SharingLinkKind["AnonymousEdit"] = 5] = "AnonymousEdit";
/**
* Flexible sharing Link where properties can change without affecting link URL
*/
SharingLinkKind[SharingLinkKind["Flexible"] = 6] = "Flexible";
})(SharingLinkKind || (SharingLinkKind = {}));
/**
* Indicates the role of the sharing link
*/
var SharingRole;
(function (SharingRole) {
SharingRole[SharingRole["None"] = 0] = "None";
SharingRole[SharingRole["View"] = 1] = "View";
SharingRole[SharingRole["Edit"] = 2] = "Edit";
SharingRole[SharingRole["Owner"] = 3] = "Owner";
})(SharingRole || (SharingRole = {}));
var SharingOperationStatusCode;
(function (SharingOperationStatusCode) {
/**
* The share operation completed without errors.
*/
SharingOperationStatusCode[SharingOperationStatusCode["CompletedSuccessfully"] = 0] = "CompletedSuccessfully";
/**
* The share operation completed and generated requests for access.
*/
SharingOperationStatusCode[SharingOperationStatusCode["AccessRequestsQueued"] = 1] = "AccessRequestsQueued";
/**
* The share operation failed as there were no resolved users.
*/
SharingOperationStatusCode[SharingOperationStatusCode["NoResolvedUsers"] = -1] = "NoResolvedUsers";
/**
* The share operation failed due to insufficient permissions.
*/
SharingOperationStatusCode[SharingOperationStatusCode["AccessDenied"] = -2] = "AccessDenied";
/**
* The share operation failed when attempting a cross site share, which is not supported.
*/
SharingOperationStatusCode[SharingOperationStatusCode["CrossSiteRequestNotSupported"] = -3] = "CrossSiteRequestNotSupported";
/**
* The sharing operation failed due to an unknown error.
*/
SharingOperationStatusCode[SharingOperationStatusCode["UnknowError"] = -4] = "UnknowError";
/**
* The text you typed is too long. Please shorten it.
*/
SharingOperationStatusCode[SharingOperationStatusCode["EmailBodyTooLong"] = -5] = "EmailBodyTooLong";
/**
* The maximum number of unique scopes in the list has been exceeded.
*/
SharingOperationStatusCode[SharingOperationStatusCode["ListUniqueScopesExceeded"] = -6] = "ListUniqueScopesExceeded";
/**
* The share operation failed because a sharing capability is disabled in the site.
*/
SharingOperationStatusCode[SharingOperationStatusCode["CapabilityDisabled"] = -7] = "CapabilityDisabled";
/**
* The specified object for the share operation is not supported.
*/
SharingOperationStatusCode[SharingOperationStatusCode["ObjectNotSupported"] = -8] = "ObjectNotSupported";
/**
* A SharePoint group cannot contain another SharePoint group.
*/
SharingOperationStatusCode[SharingOperationStatusCode["NestedGroupsNotSupported"] = -9] = "NestedGroupsNotSupported";
})(SharingOperationStatusCode || (SharingOperationStatusCode = {}));
var SPSharedObjectType;
(function (SPSharedObjectType) {
SPSharedObjectType[SPSharedObjectType["Unknown"] = 0] = "Unknown";
SPSharedObjectType[SPSharedObjectType["File"] = 1] = "File";
SPSharedObjectType[SPSharedObjectType["Folder"] = 2] = "Folder";
SPSharedObjectType[SPSharedObjectType["Item"] = 3] = "Item";
SPSharedObjectType[SPSharedObjectType["List"] = 4] = "List";
SPSharedObjectType[SPSharedObjectType["Web"] = 5] = "Web";
SPSharedObjectType[SPSharedObjectType["Max"] = 6] = "Max";
})(SPSharedObjectType || (SPSharedObjectType = {}));
var SharingDomainRestrictionMode;
(function (SharingDomainRestrictionMode) {
SharingDomainRestrictionMode[SharingDomainRestrictionMode["None"] = 0] = "None";
SharingDomainRestrictionMode[SharingDomainRestrictionMode["AllowList"] = 1] = "AllowList";
SharingDomainRestrictionMode[SharingDomainRestrictionMode["BlockList"] = 2] = "BlockList";
})(SharingDomainRestrictionMode || (SharingDomainRestrictionMode = {}));
var RenderListDataOptions;
(function (RenderListDataOptions) {
RenderListDataOptions[RenderListDataOptions["None"] = 0] = "None";
RenderListDataOptions[RenderListDataOptions["ContextInfo"] = 1] = "ContextInfo";
RenderListDataOptions[RenderListDataOptions["ListData"] = 2] = "ListData";
RenderListDataOptions[RenderListDataOptions["ListSchema"] = 4] = "ListSchema";
RenderListDataOptions[RenderListDataOptions["MenuView"] = 8] = "MenuView";
RenderListDataOptions[RenderListDataOptions["ListContentType"] = 16] = "ListContentType";
RenderListDataOptions[RenderListDataOptions["FileSystemItemId"] = 32] = "FileSystemItemId";
RenderListDataOptions[RenderListDataOptions["ClientFormSchema"] = 64] = "ClientFormSchema";
RenderListDataOptions[RenderListDataOptions["QuickLaunch"] = 128] = "QuickLaunch";
RenderListDataOptions[RenderListDataOptions["Spotlight"] = 256] = "Spotlight";
RenderListDataOptions[RenderListDataOptions["Visualization"] = 512] = "Visualization";
RenderListDataOptions[RenderListDataOptions["ViewMetadata"] = 1024] = "ViewMetadata";
RenderListDataOptions[RenderListDataOptions["DisableAutoHyperlink"] = 2048] = "DisableAutoHyperlink";
RenderListDataOptions[RenderListDataOptions["EnableMediaTAUrls"] = 4096] = "EnableMediaTAUrls";
RenderListDataOptions[RenderListDataOptions["ParentInfo"] = 8192] = "ParentInfo";
RenderListDataOptions[RenderListDataOptions["PageContextInfo"] = 16384] = "PageContextInfo";
RenderListDataOptions[RenderListDataOptions["ClientSideComponentManifest"] = 32768] = "ClientSideComponentManifest";
})(RenderListDataOptions || (RenderListDataOptions = {}));
var FieldUserSelectionMode;
(function (FieldUserSelectionMode) {
FieldUserSelectionMode[FieldUserSelectionMode["PeopleAndGroups"] = 1] = "PeopleAndGroups";
FieldUserSelectionMode[FieldUserSelectionMode["PeopleOnly"] = 0] = "PeopleOnly";
})(FieldUserSelectionMode || (FieldUserSelectionMode = {}));
var ChoiceFieldFormatType;
(function (ChoiceFieldFormatType) {
ChoiceFieldFormatType[ChoiceFieldFormatType["Dropdown"] = 0] = "Dropdown";
ChoiceFieldFormatType[ChoiceFieldFormatType["RadioButtons"] = 1] = "RadioButtons";
})(ChoiceFieldFormatType || (ChoiceFieldFormatType = {}));
/**
* Specifies the originating zone of a request received.
*/
var UrlZone;
(function (UrlZone) {
/**
* Specifies the default zone used for requests unless another zone is specified.
*/
UrlZone[UrlZone["DefaultZone"] = 0] = "DefaultZone";
/**
* Specifies an intranet zone.
*/
UrlZone[UrlZone["Intranet"] = 1] = "Intranet";
/**
* Specifies an Internet zone.
*/
UrlZone[UrlZone["Internet"] = 2] = "Internet";
/**
* Specifies a custom zone.
*/
UrlZone[UrlZone["Custom"] = 3] = "Custom";
/**
* Specifies an extranet zone.
*/
UrlZone[UrlZone["Extranet"] = 4] = "Extranet";
})(UrlZone || (UrlZone = {}));
var SharePointQueryableSecurable = /** @class */ (function (_super) {
__extends(SharePointQueryableSecurable, _super);
function SharePointQueryableSecurable() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(SharePointQueryableSecurable.prototype, "roleAssignments", {
/**
* Gets the set of role assignments for this item
*
*/
get: function () {
return new RoleAssignments(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SharePointQueryableSecurable.prototype, "firstUniqueAncestorSecurableObject", {
/**
* Gets the closest securable up the security hierarchy whose permissions are applied to this list item
*
*/
get: function () {
return new SharePointQueryableInstance(this, "FirstUniqueAncestorSecurableObject");
},
enumerable: true,
configurable: true
});
/**
* Gets the effective permissions for the user supplied
*
* @param loginName The claims username for the user (ex: i:0#.f|membership|user@domain.com)
*/
SharePointQueryableSecurable.prototype.getUserEffectivePermissions = function (loginName) {
var q = this.clone(SharePointQueryable, "getUserEffectivePermissions(@user)");
q.query.set("@user", "'" + encodeURIComponent(loginName) + "'");
return q.get().then(function (r) {
// handle verbose mode
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "GetUserEffectivePermissions") ? r.GetUserEffectivePermissions : r;
});
};
/**
* Gets the effective permissions for the current user
*/
SharePointQueryableSecurable.prototype.getCurrentUserEffectivePermissions = function () {
var _this = this;
// remove need to reference Web here, which created a circular build issue
var w = new SharePointQueryableInstance("_api/web", "currentuser");
return w.configureFrom(this).select("LoginName").get().then(function (user) {
return _this.getUserEffectivePermissions(user.LoginName);
});
};
/**
* Breaks the security inheritance at this level optinally copying permissions and clearing subscopes
*
* @param copyRoleAssignments If true the permissions are copied from the current parent scope
* @param clearSubscopes Optional. true to make all child securable objects inherit role assignments from the current object
*/
SharePointQueryableSecurable.prototype.breakRoleInheritance = function (copyRoleAssignments, clearSubscopes) {
if (copyRoleAssignments === void 0) { copyRoleAssignments = false; }
if (clearSubscopes === void 0) { clearSubscopes = false; }
return this.clone(SharePointQueryableSecurable, "breakroleinheritance(copyroleassignments=" + copyRoleAssignments + ", clearsubscopes=" + clearSubscopes + ")").postCore();
};
/**
* Removes the local role assignments so that it re-inherit role assignments from the parent object.
*
*/
SharePointQueryableSecurable.prototype.resetRoleInheritance = function () {
return this.clone(SharePointQueryableSecurable, "resetroleinheritance").postCore();
};
/**
* Determines if a given user has the appropriate permissions
*
* @param loginName The user to check
* @param permission The permission being checked
*/
SharePointQueryableSecurable.prototype.userHasPermissions = function (loginName, permission) {
var _this = this;
return this.getUserEffectivePermissions(loginName).then(function (perms) {
return _this.hasPermissions(perms, permission);
});
};
/**
* Determines if the current user has the requested permissions
*
* @param permission The permission we wish to check
*/
SharePointQueryableSecurable.prototype.currentUserHasPermissions = function (permission) {
var _this = this;
return this.getCurrentUserEffectivePermissions().then(function (perms) {
return _this.hasPermissions(perms, permission);
});
};
/**
* Taken from sp.js, checks the supplied permissions against the mask
*
* @param value The security principal's permissions on the given object
* @param perm The permission checked against the value
*/
/* tslint:disable:no-bitwise */
SharePointQueryableSecurable.prototype.hasPermissions = function (value, perm) {
if (!perm) {
return true;
}
if (perm === PermissionKind.FullMask) {
return (value.High & 32767) === 32767 && value.Low === 65535;
}
perm = perm - 1;
var num = 1;
if (perm >= 0 && perm < 32) {
num = num << perm;
return 0 !== (value.Low & num);
}
else if (perm >= 32 && perm < 64) {
num = num << perm - 32;
return 0 !== (value.High & num);
}
return false;
};
return SharePointQueryableSecurable;
}(SharePointQueryableInstance));
/**
* Internal helper class used to augment classes to include sharing functionality
*/
var SharePointQueryableShareable = /** @class */ (function (_super) {
__extends(SharePointQueryableShareable, _super);
function SharePointQueryableShareable() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a sharing link for the supplied
*
* @param kind The kind of link to share
* @param expiration The optional expiration for this link
*/
SharePointQueryableShareable.prototype.getShareLink = function (kind, expiration) {
if (expiration === void 0) { expiration = null; }
// date needs to be an ISO string or null
var expString = expiration !== null ? expiration.toISOString() : null;
// clone using the factory and send the request
return this.clone(SharePointQueryableShareable, "shareLink").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
request: {
createLink: true,
emailData: null,
settings: {
expiration: expString,
linkKind: kind,
},
},
}),
});
};
/**
* Shares this instance with the supplied users
*
* @param loginNames Resolved login names to share
* @param role The role
* @param requireSignin True to require the user is authenticated, otherwise false
* @param propagateAcl True to apply this share to all children
* @param emailData If supplied an email will be sent with the indicated properties
*/
SharePointQueryableShareable.prototype.shareWith = function (loginNames, role, requireSignin, propagateAcl, emailData) {
var _this = this;
if (requireSignin === void 0) { requireSignin = false; }
if (propagateAcl === void 0) { propagateAcl = false; }
// handle the multiple input types
if (!Array.isArray(loginNames)) {
loginNames = [loginNames];
}
var userStr = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(loginNames.map(function (login) { return { Key: login }; }));
var roleFilter = role === SharingRole.Edit ? RoleType.Contributor : RoleType.Reader;
// start by looking up the role definition id we need to set the roleValue
// remove need to reference Web here, which created a circular build issue
var w = new SharePointQueryableCollection("_api/web", "roledefinitions");
return w.select("Id").filter("RoleTypeKind eq " + roleFilter).get().then(function (def) {
if (!Array.isArray(def) || def.length < 1) {
throw Error("Could not locate a role defintion with RoleTypeKind " + roleFilter);
}
var postBody = {
includeAnonymousLinkInEmail: requireSignin,
peoplePickerInput: userStr,
propagateAcl: propagateAcl,
roleValue: "role:" + def[0].Id,
useSimplifiedRoles: true,
};
if (emailData !== undefined) {
postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(postBody, {
emailBody: emailData.body,
emailSubject: emailData.subject !== undefined ? emailData.subject : "",
sendEmail: true,
});
}
return _this.clone(SharePointQueryableShareable, "shareObject").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(postBody),
});
});
};
/**
* Shares an object based on the supplied options
*
* @param options The set of options to send to the ShareObject method
* @param bypass If true any processing is skipped and the options are sent directly to the ShareObject method
*/
SharePointQueryableShareable.prototype.shareObject = function (options, bypass) {
var _this = this;
if (bypass === void 0) { bypass = false; }
if (bypass) {
// if the bypass flag is set send the supplied parameters directly to the service
return this.sendShareObjectRequest(options);
}
// extend our options with some defaults
options = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(options, {
group: null,
includeAnonymousLinkInEmail: false,
propagateAcl: false,
useSimplifiedRoles: true,
}, true);
return this.getRoleValue(options.role, options.group).then(function (roleValue) {
// handle the multiple input types
if (!Array.isArray(options.loginNames)) {
options.loginNames = [options.loginNames];
}
var userStr = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(options.loginNames.map(function (login) { return { Key: login }; }));
var postBody = {
peoplePickerInput: userStr,
roleValue: roleValue,
url: options.url,
};
if (options.emailData !== undefined && options.emailData !== null) {
postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(postBody, {
emailBody: options.emailData.body,
emailSubject: options.emailData.subject !== undefined ? options.emailData.subject : "Shared with you.",
sendEmail: true,
});
}
return _this.sendShareObjectRequest(postBody);
});
};
/**
* Calls the web's UnshareObject method
*
* @param url The url of the object to unshare
*/
SharePointQueryableShareable.prototype.unshareObjectWeb = function (url) {
return this.clone(SharePointQueryableShareable, "unshareObject").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
url: url,
}),
});
};
/**
* Checks Permissions on the list of Users and returns back role the users have on the Item.
*
* @param recipients The array of Entities for which Permissions need to be checked.
*/
SharePointQueryableShareable.prototype.checkPermissions = function (recipients) {
return this.clone(SharePointQueryableShareable, "checkPermissions").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
recipients: recipients,
}),
});
};
/**
* Get Sharing Information.
*
* @param request The SharingInformationRequest Object.
* @param expands Expand more fields.
*
*/
SharePointQueryableShareable.prototype.getSharingInformation = function (request, expands) {
if (request === void 0) { request = null; }
var q = this.clone(SharePointQueryableShareable, "getSharingInformation");
return q.expand.apply(q, expands).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
request: request,
}),
});
};
/**
* Gets the sharing settings of an item.
*
* @param useSimplifiedRoles Determines whether to use simplified roles.
*/
SharePointQueryableShareable.prototype.getObjectSharingSettings = function (useSimplifiedRoles) {
if (useSimplifiedRoles === void 0) { useSimplifiedRoles = true; }
return this.clone(SharePointQueryableShareable, "getObjectSharingSettings").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
useSimplifiedRoles: useSimplifiedRoles,
}),
});
};
/**
* Unshares this object
*/
SharePointQueryableShareable.prototype.unshareObject = function () {
return this.clone(SharePointQueryableShareable, "unshareObject").postCore();
};
/**
* Deletes a link by type
*
* @param kind Deletes a sharing link by the kind of link
*/
SharePointQueryableShareable.prototype.deleteLinkByKind = function (kind) {
return this.clone(SharePointQueryableShareable, "deleteLinkByKind").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ linkKind: kind }),
});
};
/**
* Removes the specified link to the item.
*
* @param kind The kind of link to be deleted.
* @param shareId
*/
SharePointQueryableShareable.prototype.unshareLink = function (kind, shareId) {
if (shareId === void 0) { shareId = "00000000-0000-0000-0000-000000000000"; }
return this.clone(SharePointQueryableShareable, "unshareLink").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ linkKind: kind, shareId: shareId }),
});
};
/**
* Calculates the roleValue string used in the sharing query
*
* @param role The Sharing Role
* @param group The Group type
*/
SharePointQueryableShareable.prototype.getRoleValue = function (role, group) {
// we will give group precedence, because we had to make a choice
if (group !== undefined && group !== null) {
switch (group) {
case RoleType.Contributor:
// remove need to reference Web here, which created a circular build issue
var memberGroup = new SharePointQueryableInstance("_api/web", "associatedmembergroup");
return memberGroup.select("Id").get().then(function (g) { return "group: " + g.Id; });
case RoleType.Reader:
case RoleType.Guest:
// remove need to reference Web here, which created a circular build issue
var visitorGroup = new SharePointQueryableInstance("_api/web", "associatedvisitorgroup");
return visitorGroup.select("Id").get().then(function (g) { return "group: " + g.Id; });
default:
throw Error("Could not determine role value for supplied value. Contributor, Reader, and Guest are supported");
}
}
else {
var roleFilter = role === SharingRole.Edit ? RoleType.Contributor : RoleType.Reader;
// remove need to reference Web here, which created a circular build issue
var roleDefs = new SharePointQueryableCollection("_api/web", "roledefinitions");
return roleDefs.select("Id").top(1).filter("RoleTypeKind eq " + roleFilter).get().then(function (def) {
if (def.length < 1) {
throw Error("Could not locate associated role definition for supplied role. Edit and View are supported");
}
return "role: " + def[0].Id;
});
}
};
SharePointQueryableShareable.prototype.getShareObjectWeb = function (candidate) {
return Promise.resolve(new SharePointQueryableInstance(extractWebUrl(candidate), "/_api/SP.Web.ShareObject"));
};
SharePointQueryableShareable.prototype.sendShareObjectRequest = function (options) {
return this.getShareObjectWeb(this.toUrl()).then(function (web) {
return web.expand("UsersWithAccessRequests", "GroupsSharedWith").as(SharePointQueryableShareable).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(options),
});
});
};
return SharePointQueryableShareable;
}(SharePointQueryable));
var SharePointQueryableShareableWeb = /** @class */ (function (_super) {
__extends(SharePointQueryableShareableWeb, _super);
function SharePointQueryableShareableWeb() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Shares this web with the supplied users
* @param loginNames The resolved login names to share
* @param role The role to share this web
* @param emailData Optional email data
*/
SharePointQueryableShareableWeb.prototype.shareWith = function (loginNames, role, emailData) {
var _this = this;
if (role === void 0) { role = SharingRole.View; }
var dependency = this.addBatchDependency();
// remove need to reference Web here, which created a circular build issue
var web = new SharePointQueryableInstance(extractWebUrl(this.toUrl()), "/_api/web/url");
return web.get().then(function (url) {
dependency();
return _this.shareObject(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(url, "/_layouts/15/aclinv.aspx?forSharing=1&mbypass=1"), loginNames, role, emailData);
});
};
/**
* Provides direct access to the static web.ShareObject method
*
* @param url The url to share
* @param loginNames Resolved loginnames string[] of a single login name string
* @param roleValue Role value
* @param emailData Optional email data
* @param groupId Optional group id
* @param propagateAcl
* @param includeAnonymousLinkInEmail
* @param useSimplifiedRoles
*/
SharePointQueryableShareableWeb.prototype.shareObject = function (url, loginNames, role, emailData, group, propagateAcl, includeAnonymousLinkInEmail, useSimplifiedRoles) {
if (propagateAcl === void 0) { propagateAcl = false; }
if (includeAnonymousLinkInEmail === void 0) { includeAnonymousLinkInEmail = false; }
if (useSimplifiedRoles === void 0) { useSimplifiedRoles = true; }
return this.clone(SharePointQueryableShareable, null).shareObject({
emailData: emailData,
group: group,
includeAnonymousLinkInEmail: includeAnonymousLinkInEmail,
loginNames: loginNames,
propagateAcl: propagateAcl,
role: role,
url: url,
useSimplifiedRoles: useSimplifiedRoles,
});
};
/**
* Supplies a method to pass any set of arguments to ShareObject
*
* @param options The set of options to send to ShareObject
*/
SharePointQueryableShareableWeb.prototype.shareObjectRaw = function (options) {
return this.clone(SharePointQueryableShareable, null).shareObject(options, true);
};
/**
* Unshares the object
*
* @param url The url of the object to stop sharing
*/
SharePointQueryableShareableWeb.prototype.unshareObject = function (url) {
return this.clone(SharePointQueryableShareable, null).unshareObjectWeb(url);
};
return SharePointQueryableShareableWeb;
}(SharePointQueryableSecurable));
var SharePointQueryableShareableItem = /** @class */ (function (_super) {
__extends(SharePointQueryableShareableItem, _super);
function SharePointQueryableShareableItem() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a link suitable for sharing for this item
*
* @param kind The type of link to share
* @param expiration The optional expiration date
*/
SharePointQueryableShareableItem.prototype.getShareLink = function (kind, expiration) {
if (kind === void 0) { kind = SharingLinkKind.OrganizationView; }
if (expiration === void 0) { expiration = null; }
return this.clone(SharePointQueryableShareable, null).getShareLink(kind, expiration);
};
/**
* Shares this item with one or more users
*
* @param loginNames string or string[] of resolved login names to which this item will be shared
* @param role The role (View | Edit) applied to the share
* @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
*/
SharePointQueryableShareableItem.prototype.shareWith = function (loginNames, role, requireSignin, emailData) {
if (role === void 0) { role = SharingRole.View; }
if (requireSignin === void 0) { requireSignin = false; }
return this.clone(SharePointQueryableShareable, null).shareWith(loginNames, role, requireSignin, false, emailData);
};
/**
* Checks Permissions on the list of Users and returns back role the users have on the Item.
*
* @param recipients The array of Entities for which Permissions need to be checked.
*/
SharePointQueryableShareableItem.prototype.checkSharingPermissions = function (recipients) {
return this.clone(SharePointQueryableShareable, null).checkPermissions(recipients);
};
/**
* Get Sharing Information.
*
* @param request The SharingInformationRequest Object.
* @param expands Expand more fields.
*
*/
SharePointQueryableShareableItem.prototype.getSharingInformation = function (request, expands) {
if (request === void 0) { request = null; }
return this.clone(SharePointQueryableShareable, null).getSharingInformation(request, expands);
};
/**
* Gets the sharing settings of an item.
*
* @param useSimplifiedRoles Determines whether to use simplified roles.
*/
SharePointQueryableShareableItem.prototype.getObjectSharingSettings = function (useSimplifiedRoles) {
if (useSimplifiedRoles === void 0) { useSimplifiedRoles = true; }
return this.clone(SharePointQueryableShareable, null).getObjectSharingSettings(useSimplifiedRoles);
};
/**
* Unshare this item
*/
SharePointQueryableShareableItem.prototype.unshare = function () {
return this.clone(SharePointQueryableShareable, null).unshareObject();
};
/**
* Deletes a sharing link by kind
*
* @param kind Deletes a sharing link by the kind of link
*/
SharePointQueryableShareableItem.prototype.deleteSharingLinkByKind = function (kind) {
return this.clone(SharePointQueryableShareable, null).deleteLinkByKind(kind);
};
/**
* Removes the specified link to the item.
*
* @param kind The kind of link to be deleted.
* @param shareId
*/
SharePointQueryableShareableItem.prototype.unshareLink = function (kind, shareId) {
return this.clone(SharePointQueryableShareable, null).unshareLink(kind, shareId);
};
return SharePointQueryableShareableItem;
}(SharePointQueryableSecurable));
var FileFolderShared = /** @class */ (function (_super) {
__extends(FileFolderShared, _super);
function FileFolderShared() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a link suitable for sharing
*
* @param kind The kind of link to get
* @param expiration Optional, an expiration for this link
*/
FileFolderShared.prototype.getShareLink = function (kind, expiration) {
if (kind === void 0) { kind = SharingLinkKind.OrganizationView; }
if (expiration === void 0) { expiration = null; }
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.getShareLink(kind, expiration);
});
};
/**
* Checks Permissions on the list of Users and returns back role the users have on the Item.
*
* @param recipients The array of Entities for which Permissions need to be checked.
*/
FileFolderShared.prototype.checkSharingPermissions = function (recipients) {
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.checkPermissions(recipients);
});
};
/**
* Get Sharing Information.
*
* @param request The SharingInformationRequest Object.
* @param expands Expand more fields.
*
*/
FileFolderShared.prototype.getSharingInformation = function (request, expands) {
if (request === void 0) { request = null; }
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.getSharingInformation(request, expands);
});
};
/**
* Gets the sharing settings of an item.
*
* @param useSimplifiedRoles Determines whether to use simplified roles.
*/
FileFolderShared.prototype.getObjectSharingSettings = function (useSimplifiedRoles) {
if (useSimplifiedRoles === void 0) { useSimplifiedRoles = true; }
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.getObjectSharingSettings(useSimplifiedRoles);
});
};
/**
* Unshare this item
*/
FileFolderShared.prototype.unshare = function () {
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.unshareObject();
});
};
/**
* Deletes a sharing link by the kind of link
*
* @param kind The kind of link to be deleted.
*/
FileFolderShared.prototype.deleteSharingLinkByKind = function (kind) {
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.deleteLinkByKind(kind);
});
};
/**
* Removes the specified link to the item.
*
* @param kind The kind of link to be deleted.
* @param shareId The share id to delete
*/
FileFolderShared.prototype.unshareLink = function (kind, shareId) {
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.unshareLink(kind, shareId);
});
};
/**
* For files and folders we need to use the associated item end point
*/
FileFolderShared.prototype.getShareable = function () {
var _this = this;
// sharing only works on the item end point, not the file one - so we create a folder instance with the item url internally
return this.clone(SharePointQueryableShareableFile, "listItemAllFields", false).select("odata.id").get().then(function (d) {
var shareable = new SharePointQueryableShareable(odataUrlFrom(d));
// we need to handle batching
if (_this.hasBatch) {
shareable = shareable.inBatch(_this.batch);
}
return shareable;
});
};
return FileFolderShared;
}(SharePointQueryableInstance));
var SharePointQueryableShareableFile = /** @class */ (function (_super) {
__extends(SharePointQueryableShareableFile, _super);
function SharePointQueryableShareableFile() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Shares this item with one or more users
*
* @param loginNames string or string[] of resolved login names to which this item will be shared
* @param role The role (View | Edit) applied to the share
* @param shareEverything Share everything in this folder, even items with unique permissions.
* @param requireSignin If true the user must signin to view link, otherwise anyone with the link can access the resource
* @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
*/
SharePointQueryableShareableFile.prototype.shareWith = function (loginNames, role, requireSignin, emailData) {
if (role === void 0) { role = SharingRole.View; }
if (requireSignin === void 0) { requireSignin = false; }
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.shareWith(loginNames, role, requireSignin, false, emailData);
});
};
return SharePointQueryableShareableFile;
}(FileFolderShared));
var SharePointQueryableShareableFolder = /** @class */ (function (_super) {
__extends(SharePointQueryableShareableFolder, _super);
function SharePointQueryableShareableFolder() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Shares this item with one or more users
*
* @param loginNames string or string[] of resolved login names to which this item will be shared
* @param role The role (View | Edit) applied to the share
* @param shareEverything Share everything in this folder, even items with unique permissions.
* @param requireSignin If true the user must signin to view link, otherwise anyone with the link can access the resource
* @param emailData Optional, if inlucded an email will be sent. Note subject currently has no effect.
*/
SharePointQueryableShareableFolder.prototype.shareWith = function (loginNames, role, requireSignin, shareEverything, emailData) {
if (role === void 0) { role = SharingRole.View; }
if (requireSignin === void 0) { requireSignin = false; }
if (shareEverything === void 0) { shareEverything = false; }
var dependency = this.addBatchDependency();
return this.getShareable().then(function (shareable) {
dependency();
return shareable.shareWith(loginNames, role, requireSignin, shareEverything, emailData);
});
};
return SharePointQueryableShareableFolder;
}(FileFolderShared));
var LimitedWebPartManager = /** @class */ (function (_super) {
__extends(LimitedWebPartManager, _super);
function LimitedWebPartManager() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(LimitedWebPartManager.prototype, "webparts", {
/**
* Gets the set of web part definitions contained by this web part manager
*
*/
get: function () {
return new WebPartDefinitions(this, "webparts");
},
enumerable: true,
configurable: true
});
/**
* Exports a webpart definition
*
* @param id the GUID id of the definition to export
*/
LimitedWebPartManager.prototype.export = function (id) {
return this.clone(LimitedWebPartManager, "ExportWebPart").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ webPartId: id }),
});
};
/**
* Imports a webpart
*
* @param xml webpart definition which must be valid XML in the .dwp or .webpart format
*/
LimitedWebPartManager.prototype.import = function (xml) {
return this.clone(LimitedWebPartManager, "ImportWebPart").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ webPartXml: xml }),
});
};
return LimitedWebPartManager;
}(SharePointQueryable));
var WebPartDefinitions = /** @class */ (function (_super) {
__extends(WebPartDefinitions, _super);
function WebPartDefinitions() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a web part definition from the collection by id
*
* @param id The storage ID of the SPWebPartDefinition to retrieve
*/
WebPartDefinitions.prototype.getById = function (id) {
return new WebPartDefinition(this, "getbyid('" + id + "')");
};
/**
* Gets a web part definition from the collection by storage id
*
* @param id The WebPart.ID of the SPWebPartDefinition to retrieve
*/
WebPartDefinitions.prototype.getByControlId = function (id) {
return new WebPartDefinition(this, "getByControlId('" + id + "')");
};
return WebPartDefinitions;
}(SharePointQueryableCollection));
var WebPartDefinition = /** @class */ (function (_super) {
__extends(WebPartDefinition, _super);
function WebPartDefinition() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(WebPartDefinition.prototype, "webpart", {
/**
* Gets the webpart information associated with this definition
*/
get: function () {
return new WebPart(this);
},
enumerable: true,
configurable: true
});
/**
* Saves changes to the Web Part made using other properties and methods on the SPWebPartDefinition object
*/
WebPartDefinition.prototype.saveChanges = function () {
return this.clone(WebPartDefinition, "SaveWebPartChanges").postCore();
};
/**
* Moves the Web Part to a different location on a Web Part Page
*
* @param zoneId The ID of the Web Part Zone to which to move the Web Part
* @param zoneIndex A Web Part zone index that specifies the position at which the Web Part is to be moved within the destination Web Part zone
*/
WebPartDefinition.prototype.moveTo = function (zoneId, zoneIndex) {
return this.clone(WebPartDefinition, "MoveWebPartTo(zoneID='" + zoneId + "', zoneIndex=" + zoneIndex + ")").postCore();
};
/**
* Closes the Web Part. If the Web Part is already closed, this method does nothing
*/
WebPartDefinition.prototype.close = function () {
return this.clone(WebPartDefinition, "CloseWebPart").postCore();
};
/**
* Opens the Web Part. If the Web Part is already closed, this method does nothing
*/
WebPartDefinition.prototype.open = function () {
return this.clone(WebPartDefinition, "OpenWebPart").postCore();
};
/**
* Removes a webpart from a page, all settings will be lost
*/
WebPartDefinition.prototype.delete = function () {
return this.clone(WebPartDefinition, "DeleteWebPart").postCore();
};
return WebPartDefinition;
}(SharePointQueryableInstance));
var WebPart = /** @class */ (function (_super) {
__extends(WebPart, _super);
function WebPart() {
return _super !== null && _super.apply(this, arguments) || this;
}
WebPart = __decorate([
defaultPath("webpart")
], WebPart);
return WebPart;
}(SharePointQueryableInstance));
/**
* Describes a collection of Folder objects
*
*/
var Folders = /** @class */ (function (_super) {
__extends(Folders, _super);
function Folders() {
return _super !== null && _super.apply(this, arguments) || this;
}
Folders_1 = Folders;
/**
* Gets a folder by folder name
*
*/
Folders.prototype.getByName = function (name) {
var f = new Folder(this);
f.concat("('" + name + "')");
return f;
};
/**
* Adds a new folder to the current folder (relative) or any folder (absolute)
*
* @param url The relative or absolute url where the new folder will be created. Urls starting with a forward slash are absolute.
* @returns The new Folder and the raw response.
*/
Folders.prototype.add = function (url) {
var _this = this;
return this.clone(Folders_1, "add('" + url + "')").postCore().then(function (response) {
return {
data: response,
folder: _this.getByName(url),
};
});
};
var Folders_1;
Folders = Folders_1 = __decorate([
defaultPath("folders")
], Folders);
return Folders;
}(SharePointQueryableCollection));
/**
* Describes a single Folder instance
*
*/
var Folder = /** @class */ (function (_super) {
__extends(Folder, _super);
function Folder() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.update = _this._update("SP.Folder", function (data) { return ({ data: data, folder: _this }); });
return _this;
}
Object.defineProperty(Folder.prototype, "contentTypeOrder", {
/**
* Specifies the sequence in which content types are displayed.
*
*/
get: function () {
return new SharePointQueryableCollection(this, "contentTypeOrder");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "files", {
/**
* Gets this folder's files
*
*/
get: function () {
return new Files(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "folders", {
/**
* Gets this folder's sub folders
*
*/
get: function () {
return new Folders(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "listItemAllFields", {
/**
* Gets this folder's list item field values
*
*/
get: function () {
return new SharePointQueryableInstance(this, "listItemAllFields");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "parentFolder", {
/**
* Gets the parent folder, if available
*
*/
get: function () {
return new Folder(this, "parentFolder");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "properties", {
/**
* Gets this folder's properties
*
*/
get: function () {
return new SharePointQueryableInstance(this, "properties");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "serverRelativeUrl", {
/**
* Gets this folder's server relative url
*
*/
get: function () {
return new SharePointQueryable(this, "serverRelativeUrl");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Folder.prototype, "uniqueContentTypeOrder", {
/**
* Gets a value that specifies the content type order.
*
*/
get: function () {
return new SharePointQueryableCollection(this, "uniqueContentTypeOrder");
},
enumerable: true,
configurable: true
});
/**
* Delete this folder
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
Folder.prototype.delete = function (eTag) {
if (eTag === void 0) { eTag = "*"; }
return this.clone(Folder, null).postCore({
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "DELETE",
},
});
};
/**
* Moves the folder to the Recycle Bin and returns the identifier of the new Recycle Bin item.
*/
Folder.prototype.recycle = function () {
return this.clone(Folder, "recycle").postCore();
};
/**
* Gets the associated list item for this folder, loading the default properties
*/
Folder.prototype.getItem = function () {
var selects = [];
for (var _i = 0; _i < arguments.length; _i++) {
selects[_i] = arguments[_i];
}
var q = this.listItemAllFields;
return q.select.apply(q, selects).get().then(function (d) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(new Item(odataUrlFrom(d)), d);
});
};
/**
* Moves a folder to destination path
*
* @param destUrl Absolute or relative URL of the destination path
*/
Folder.prototype.moveTo = function (destUrl) {
var _this = this;
return this.select("ServerRelativeUrl").get().then(function (_a) {
var srcUrl = _a.ServerRelativeUrl;
var client = new SPHttpClient();
var webBaseUrl = _this.toUrl().split("/_api")[0];
var hostUrl = webBaseUrl.replace("://", "___").split("/")[0].replace("___", "://");
var methodUrl = webBaseUrl + "/_api/SP.MoveCopyUtil.MoveFolder()";
return client.post(methodUrl, {
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
destUrl: destUrl.indexOf("http") === 0 ? destUrl : "" + hostUrl + destUrl,
srcUrl: "" + hostUrl + srcUrl,
}),
}).then(function (r) { return r.json(); });
});
};
return Folder;
}(SharePointQueryableShareableFolder));
/**
* Describes a collection of content types
*
*/
var ContentTypes = /** @class */ (function (_super) {
__extends(ContentTypes, _super);
function ContentTypes() {
return _super !== null && _super.apply(this, arguments) || this;
}
ContentTypes_1 = ContentTypes;
/**
* Adds an existing contenttype to a content type collection
*
* @param contentTypeId in the following format, for example: 0x010102
*/
ContentTypes.prototype.addAvailableContentType = function (contentTypeId) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"contentTypeId": contentTypeId,
});
return this.clone(ContentTypes_1, "addAvailableContentType").postCore({ body: postBody }).then(function (data) {
return {
contentType: _this.getById(data.id),
data: data,
};
});
};
/**
* Gets a ContentType by content type id
*/
ContentTypes.prototype.getById = function (id) {
var ct = new ContentType(this);
ct.concat("('" + id + "')");
return ct;
};
/**
* Adds a new content type to the collection
*
* @param id The desired content type id for the new content type (also determines the parent content type)
* @param name The name of the content type
* @param description The description of the content type
* @param group The group in which to add the content type
* @param additionalSettings Any additional settings to provide when creating the content type
*
*/
ContentTypes.prototype.add = function (id, name, description, group, additionalSettings) {
var _this = this;
if (description === void 0) { description = ""; }
if (group === void 0) { group = "Custom Content Types"; }
if (additionalSettings === void 0) { additionalSettings = {}; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object.assign(metadata("SP.ContentType"), {
"Description": description,
"Group": group,
"Id": { "StringValue": id },
"Name": name,
}, additionalSettings));
return this.postCore({ body: postBody }).then(function (data) {
return { contentType: _this.getById(data.id), data: data };
});
};
var ContentTypes_1;
ContentTypes = ContentTypes_1 = __decorate([
defaultPath("contenttypes")
], ContentTypes);
return ContentTypes;
}(SharePointQueryableCollection));
/**
* Describes a single ContentType instance
*
*/
var ContentType = /** @class */ (function (_super) {
__extends(ContentType, _super);
function ContentType() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Delete this content type
*/
_this.delete = _this._delete;
return _this;
}
Object.defineProperty(ContentType.prototype, "fieldLinks", {
/**
* Gets the column (also known as field) references in the content type.
*/
get: function () {
return new FieldLinks(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(ContentType.prototype, "fields", {
/**
* Gets a value that specifies the collection of fields for the content type.
*/
get: function () {
return new SharePointQueryableCollection(this, "fields");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ContentType.prototype, "parent", {
/**
* Gets the parent content type of the content type.
*/
get: function () {
return new ContentType(this, "parent");
},
enumerable: true,
configurable: true
});
Object.defineProperty(ContentType.prototype, "workflowAssociations", {
/**
* Gets a value that specifies the collection of workflow associations for the content type.
*/
get: function () {
return new SharePointQueryableCollection(this, "workflowAssociations");
},
enumerable: true,
configurable: true
});
return ContentType;
}(SharePointQueryableInstance));
/**
* Represents a collection of field link instances
*/
var FieldLinks = /** @class */ (function (_super) {
__extends(FieldLinks, _super);
function FieldLinks() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a FieldLink by GUID id
*
* @param id The GUID id of the field link
*/
FieldLinks.prototype.getById = function (id) {
var fl = new FieldLink(this);
fl.concat("(guid'" + id + "')");
return fl;
};
FieldLinks = __decorate([
defaultPath("fieldlinks")
], FieldLinks);
return FieldLinks;
}(SharePointQueryableCollection));
/**
* Represents a field link instance
*/
var FieldLink = /** @class */ (function (_super) {
__extends(FieldLink, _super);
function FieldLink() {
return _super !== null && _super.apply(this, arguments) || this;
}
return FieldLink;
}(SharePointQueryableInstance));
/**
* Describes a collection of Item objects
*
*/
var AttachmentFiles = /** @class */ (function (_super) {
__extends(AttachmentFiles, _super);
function AttachmentFiles() {
return _super !== null && _super.apply(this, arguments) || this;
}
AttachmentFiles_1 = AttachmentFiles;
/**
* Gets a Attachment File by filename
*
* @param name The name of the file, including extension.
*/
AttachmentFiles.prototype.getByName = function (name) {
var f = new AttachmentFile(this);
f.concat("('" + name + "')");
return f;
};
/**
* Adds a new attachment to the collection. Not supported for batching.
*
* @param name The name of the file, including extension.
* @param content The Base64 file content.
*/
AttachmentFiles.prototype.add = function (name, content) {
var _this = this;
return this.clone(AttachmentFiles_1, "add(FileName='" + name + "')", false).postCore({
body: content,
}).then(function (response) {
return {
data: response,
file: _this.getByName(name),
};
});
};
/**
* Adds multiple new attachment to the collection. Not supported for batching.
*
* @param files The collection of files to add
*/
AttachmentFiles.prototype.addMultiple = function (files) {
var _this = this;
// add the files in series so we don't get update conflicts
return files.reduce(function (chain, file) { return chain.then(function () { return _this.clone(AttachmentFiles_1, "add(FileName='" + file.name + "')", false).postCore({
body: file.content,
}); }); }, Promise.resolve());
};
/**
* Delete multiple attachments from the collection. Not supported for batching.
*
* @param files The collection of files to delete
*/
AttachmentFiles.prototype.deleteMultiple = function () {
var _this = this;
var files = [];
for (var _i = 0; _i < arguments.length; _i++) {
files[_i] = arguments[_i];
}
return files.reduce(function (chain, file) { return chain.then(function () { return _this.getByName(file).delete(); }); }, Promise.resolve());
};
/**
* Delete multiple attachments from the collection and send to recycle bin. Not supported for batching.
*
* @param files The collection of files to be deleted and sent to recycle bin
*/
AttachmentFiles.prototype.recycleMultiple = function () {
var _this = this;
var files = [];
for (var _i = 0; _i < arguments.length; _i++) {
files[_i] = arguments[_i];
}
return files.reduce(function (chain, file) { return chain.then(function () { return _this.getByName(file).recycle(); }); }, Promise.resolve());
};
var AttachmentFiles_1;
AttachmentFiles = AttachmentFiles_1 = __decorate([
defaultPath("AttachmentFiles")
], AttachmentFiles);
return AttachmentFiles;
}(SharePointQueryableCollection));
/**
* Describes a single attachment file instance
*
*/
var AttachmentFile = /** @class */ (function (_super) {
__extends(AttachmentFile, _super);
function AttachmentFile() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.delete = _this._deleteWithETag;
return _this;
}
/**
* Gets the contents of the file as text
*
*/
AttachmentFile.prototype.getText = function () {
return this.getParsed(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["TextParser"]());
};
/**
* Gets the contents of the file as a blob, does not work in Node.js
*
*/
AttachmentFile.prototype.getBlob = function () {
return this.getParsed(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["BlobParser"]());
};
/**
* Gets the contents of a file as an ArrayBuffer, works in Node.js
*/
AttachmentFile.prototype.getBuffer = function () {
return this.getParsed(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["BufferParser"]());
};
/**
* Gets the contents of a file as an ArrayBuffer, works in Node.js
*/
AttachmentFile.prototype.getJSON = function () {
return this.getParsed(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["JSONParser"]());
};
/**
* Sets the content of a file. Not supported for batching
*
* @param content The value to set for the file contents
*/
AttachmentFile.prototype.setContent = function (content) {
var _this = this;
return this.clone(AttachmentFile, "$value", false).postCore({
body: content,
headers: {
"X-HTTP-Method": "PUT",
},
}).then(function (_) { return new AttachmentFile(_this); });
};
/**
* Delete this attachment file and send it to recycle bin
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
AttachmentFile.prototype.recycle = function (eTag) {
if (eTag === void 0) { eTag = "*"; }
return this.clone(AttachmentFile, "recycleObject").postCore({
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "DELETE",
},
});
};
// /**
// * Delete this attachment file
// *
// * @param eTag Value used in the IF-Match header, by default "*"
// */
// public delete(eTag = "*"): Promise<void> {
// return this.postCore({
// headers: {
// "IF-Match": eTag,
// "X-HTTP-Method": "DELETE",
// },
// });
// }
AttachmentFile.prototype.getParsed = function (parser) {
return this.clone(AttachmentFile, "$value", false).get(parser);
};
return AttachmentFile;
}(SharePointQueryableInstance));
/**
* Describes the views available in the current context
*
*/
var Views = /** @class */ (function (_super) {
__extends(Views, _super);
function Views() {
return _super !== null && _super.apply(this, arguments) || this;
}
Views_1 = Views;
/**
* Gets a view by guid id
*
* @param id The GUID id of the view
*/
Views.prototype.getById = function (id) {
var v = new View(this);
v.concat("('" + id + "')");
return v;
};
/**
* Gets a view by title (case-sensitive)
*
* @param title The case-sensitive title of the view
*/
Views.prototype.getByTitle = function (title) {
return new View(this, "getByTitle('" + title + "')");
};
/**
* Adds a new view to the collection
*
* @param title The new views's title
* @param personalView True if this is a personal view, otherwise false, default = false
* @param additionalSettings Will be passed as part of the view creation body
*/
Views.prototype.add = function (title, personalView, additionalSettings) {
var _this = this;
if (personalView === void 0) { personalView = false; }
if (additionalSettings === void 0) { additionalSettings = {}; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object.assign(metadata("SP.View"), {
"PersonalView": personalView,
"Title": title,
}, additionalSettings));
return this.clone(Views_1, null).postCore({ body: postBody }).then(function (data) {
return {
data: data,
view: _this.getById(data.Id),
};
});
};
var Views_1;
Views = Views_1 = __decorate([
defaultPath("views")
], Views);
return Views;
}(SharePointQueryableCollection));
/**
* Describes a single View instance
*
*/
var View = /** @class */ (function (_super) {
__extends(View, _super);
function View() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Updates this view intance with the supplied properties
*
* @param properties A plain object hash of values to update for the view
*/
_this.update = _this._update("SP.View", function (data) { return ({ data: data, view: _this }); });
/**
* Delete this view
*
*/
_this.delete = _this._delete;
return _this;
}
Object.defineProperty(View.prototype, "fields", {
get: function () {
return new ViewFields(this);
},
enumerable: true,
configurable: true
});
/**
* Returns the list view as HTML.
*
*/
View.prototype.renderAsHtml = function () {
return this.clone(SharePointQueryable, "renderashtml").get();
};
/**
* Sets the view schema
*
* @param viewXml The view XML to set
*/
View.prototype.setViewXml = function (viewXml) {
return this.clone(View, "SetViewXml").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
viewXml: viewXml,
}),
});
};
return View;
}(SharePointQueryableInstance));
var ViewFields = /** @class */ (function (_super) {
__extends(ViewFields, _super);
function ViewFields() {
return _super !== null && _super.apply(this, arguments) || this;
}
ViewFields_1 = ViewFields;
/**
* Gets a value that specifies the XML schema that represents the collection.
*/
ViewFields.prototype.getSchemaXml = function () {
return this.clone(SharePointQueryable, "schemaxml").get();
};
/**
* Adds the field with the specified field internal name or display name to the collection.
*
* @param fieldTitleOrInternalName The case-sensitive internal name or display name of the field to add.
*/
ViewFields.prototype.add = function (fieldTitleOrInternalName) {
return this.clone(ViewFields_1, "addviewfield('" + fieldTitleOrInternalName + "')").postCore();
};
/**
* Moves the field with the specified field internal name to the specified position in the collection.
*
* @param fieldInternalName The case-sensitive internal name of the field to move.
* @param index The zero-based index of the new position for the field.
*/
ViewFields.prototype.move = function (fieldInternalName, index) {
return this.clone(ViewFields_1, "moveviewfieldto").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "field": fieldInternalName, "index": index }),
});
};
/**
* Removes all the fields from the collection.
*/
ViewFields.prototype.removeAll = function () {
return this.clone(ViewFields_1, "removeallviewfields").postCore();
};
/**
* Removes the field with the specified field internal name from the collection.
*
* @param fieldInternalName The case-sensitive internal name of the field to remove from the view.
*/
ViewFields.prototype.remove = function (fieldInternalName) {
return this.clone(ViewFields_1, "removeviewfield('" + fieldInternalName + "')").postCore();
};
var ViewFields_1;
ViewFields = ViewFields_1 = __decorate([
defaultPath("viewfields")
], ViewFields);
return ViewFields;
}(SharePointQueryableCollection));
/**
* Describes a collection of Field objects
*
*/
var Fields = /** @class */ (function (_super) {
__extends(Fields, _super);
function Fields() {
return _super !== null && _super.apply(this, arguments) || this;
}
Fields_1 = Fields;
/**
* Gets a field from the collection by id
*
* @param id The Id of the list
*/
Fields.prototype.getById = function (id) {
var f = new Field(this);
f.concat("('" + id + "')");
return f;
};
/**
* Gets a field from the collection by title
*
* @param title The case-sensitive title of the field
*/
Fields.prototype.getByTitle = function (title) {
return new Field(this, "getByTitle('" + title + "')");
};
/**
* Gets a field from the collection by using internal name or title
*
* @param name The case-sensitive internal name or title of the field
*/
Fields.prototype.getByInternalNameOrTitle = function (name) {
return new Field(this, "getByInternalNameOrTitle('" + name + "')");
};
/**
* Creates a field based on the specified schema
*/
Fields.prototype.createFieldAsXml = function (xml) {
var _this = this;
var info;
if (typeof xml === "string") {
info = { SchemaXml: xml };
}
else {
info = xml;
}
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"parameters": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.XmlSchemaFieldCreationInformation"), info),
});
return this.clone(Fields_1, "createfieldasxml").postCore({ body: postBody }).then(function (data) {
return {
data: data,
field: _this.getById(data.Id),
};
});
};
/**
* Adds a new field to the collection
*
* @param title The new field's title
* @param fieldType The new field's type (ex: SP.FieldText)
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.add = function (title, fieldType, properties) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object.assign(metadata(fieldType), {
"Title": title,
}, properties));
return this.clone(Fields_1, null).postCore({ body: postBody }).then(function (data) {
return {
data: data,
field: _this.getById(data.Id),
};
});
};
/**
* Adds a new SP.FieldText to the collection
*
* @param title The field title
* @param maxLength The maximum number of characters allowed in the value of the field.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addText = function (title, maxLength, properties) {
if (maxLength === void 0) { maxLength = 255; }
var props = {
FieldTypeKind: 2,
MaxLength: maxLength,
};
return this.add(title, "SP.FieldText", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldCalculated to the collection
*
* @param title The field title.
* @param formula The formula for the field.
* @param dateFormat The date and time format that is displayed in the field.
* @param outputType Specifies the output format for the field. Represents a FieldType value.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) {
if (outputType === void 0) { outputType = FieldTypes.Text; }
var props = {
DateFormat: dateFormat,
FieldTypeKind: 17,
Formula: formula,
OutputType: outputType,
};
return this.add(title, "SP.FieldCalculated", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldDateTime to the collection
*
* @param title The field title
* @param displayFormat The format of the date and time that is displayed in the field.
* @param calendarType Specifies the calendar type of the field.
* @param friendlyDisplayFormat The type of friendly display format that is used in the field.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) {
if (displayFormat === void 0) { displayFormat = DateTimeFieldFormatType.DateOnly; }
if (calendarType === void 0) { calendarType = CalendarType.Gregorian; }
if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = DateTimeFieldFriendlyFormatType.Unspecified; }
var props = {
DateTimeCalendarType: calendarType,
DisplayFormat: displayFormat,
FieldTypeKind: 4,
FriendlyDisplayFormat: friendlyDisplayFormat,
};
return this.add(title, "SP.FieldDateTime", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldNumber to the collection
*
* @param title The field title
* @param minValue The field's minimum value
* @param maxValue The field's maximum value
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addNumber = function (title, minValue, maxValue, properties) {
var props = { FieldTypeKind: 9 };
if (minValue !== undefined) {
props = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ MinimumValue: minValue }, props);
}
if (maxValue !== undefined) {
props = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ MaximumValue: maxValue }, props);
}
return this.add(title, "SP.FieldNumber", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldCurrency to the collection
*
* @param title The field title
* @param minValue The field's minimum value
* @param maxValue The field's maximum value
* @param currencyLocalId Specifies the language code identifier (LCID) used to format the value of the field
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) {
if (currencyLocalId === void 0) { currencyLocalId = 1033; }
var props = {
CurrencyLocaleId: currencyLocalId,
FieldTypeKind: 10,
};
if (minValue !== undefined) {
props = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ MinimumValue: minValue }, props);
}
if (maxValue !== undefined) {
props = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ MaximumValue: maxValue }, props);
}
return this.add(title, "SP.FieldCurrency", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldMultiLineText to the collection
*
* @param title The field title
* @param numberOfLines Specifies the number of lines of text to display for the field.
* @param richText Specifies whether the field supports rich formatting.
* @param restrictedMode Specifies whether the field supports a subset of rich formatting.
* @param appendOnly Specifies whether all changes to the value of the field are displayed in list forms.
* @param allowHyperlink Specifies whether a hyperlink is allowed as a value of the field.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*
*/
Fields.prototype.addMultilineText = function (title, numberOfLines, richText, restrictedMode, appendOnly, allowHyperlink, properties) {
if (numberOfLines === void 0) { numberOfLines = 6; }
if (richText === void 0) { richText = true; }
if (restrictedMode === void 0) { restrictedMode = false; }
if (appendOnly === void 0) { appendOnly = false; }
if (allowHyperlink === void 0) { allowHyperlink = true; }
var props = {
AllowHyperlink: allowHyperlink,
AppendOnly: appendOnly,
FieldTypeKind: 3,
NumberOfLines: numberOfLines,
RestrictedMode: restrictedMode,
RichText: richText,
};
return this.add(title, "SP.FieldMultiLineText", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldUrl to the collection
*
* @param title The field title
*/
Fields.prototype.addUrl = function (title, displayFormat, properties) {
if (displayFormat === void 0) { displayFormat = UrlFieldFormatType.Hyperlink; }
var props = {
DisplayFormat: displayFormat,
FieldTypeKind: 11,
};
return this.add(title, "SP.FieldUrl", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/** Adds a user field to the colleciton
*
* @param title The new field's title
* @param selectionMode The selection mode of the field
* @param selectionGroup Value that specifies the identifier of the SharePoint group whose members can be selected as values of the field
* @param properties
*/
Fields.prototype.addUser = function (title, selectionMode, properties) {
var props = {
FieldTypeKind: 20,
SelectionMode: selectionMode,
};
return this.add(title, "SP.FieldUser", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a SP.FieldLookup to the collection
*
* @param title The new field's title
* @param lookupListId The guid id of the list where the source of the lookup is found
* @param lookupFieldName The internal name of the field in the source list
* @param properties Set of additional properties to set on the new field
*/
Fields.prototype.addLookup = function (title, lookupListId, lookupFieldName, properties) {
var _this = this;
var props = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
FieldTypeKind: 7,
LookupFieldName: lookupFieldName,
LookupListId: lookupListId,
Title: title,
}, properties);
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"parameters": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.FieldCreationInformation"), props),
});
return this.clone(Fields_1, "addfield").postCore({ body: postBody }).then(function (data) {
return {
data: data,
field: _this.getById(data.Id),
};
});
};
/**
* Adds a new SP.FieldChoice to the collection
*
* @param title The field title.
* @param choices The choices for the field.
* @param format The display format of the available options for the field.
* @param fillIn Specifies whether the field allows fill-in values.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addChoice = function (title, choices, format, fillIn, properties) {
if (format === void 0) { format = ChoiceFieldFormatType.Dropdown; }
var props = {
Choices: {
results: choices,
},
EditFormat: format,
FieldTypeKind: 6,
FillInChoice: fillIn,
};
return this.add(title, "SP.FieldChoice", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldMultiChoice to the collection
*
* @param title The field title.
* @param choices The choices for the field.
* @param fillIn Specifies whether the field allows fill-in values.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addMultiChoice = function (title, choices, fillIn, properties) {
var props = {
Choices: {
results: choices,
},
FieldTypeKind: 15,
FillInChoice: fillIn,
};
return this.add(title, "SP.FieldMultiChoice", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Adds a new SP.FieldBoolean to the collection
*
* @param title The field title.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addBoolean = function (title, properties) {
var props = {
FieldTypeKind: 8,
};
return this.add(title, "SP.Field", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
/**
* Creates a secondary (dependent) lookup field, based on the Id of the primary lookup field.
*
* @param displayName The display name of the new field.
* @param primaryLookupFieldId The guid of the primary Lookup Field.
* @param showField Which field to show from the lookup list.
*/
Fields.prototype.addDependentLookupField = function (displayName, primaryLookupFieldId, showField) {
var _this = this;
return this.clone(Fields_1, "adddependentlookupfield(displayName='" + displayName + "', primarylookupfieldid='" + primaryLookupFieldId + "', showfield='" + showField + "')")
.postCore()
.then(function (data) {
return {
data: data,
field: _this.getById(data.Id),
};
});
};
/**
* Adds a new SP.FieldLocation to the collection
*
* @param title The field title.
* @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)
*/
Fields.prototype.addLocation = function (title, properties) {
var props = { FieldTypeKind: 33 };
return this.add(title, "SP.FieldLocation", Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(props, properties));
};
var Fields_1;
Fields = Fields_1 = __decorate([
defaultPath("fields")
], Fields);
return Fields;
}(SharePointQueryableCollection));
/**
* Describes a single of Field instance
*
*/
var Field = /** @class */ (function (_super) {
__extends(Field, _super);
function Field() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Delete this fields
*
*/
_this.delete = _this._delete;
return _this;
}
/**
* Updates this field intance with the supplied properties
*
* @param properties A plain object hash of values to update for the list
* @param fieldType The type value, required to update child field type properties
*/
Field.prototype.update = function (properties, fieldType) {
var _this = this;
if (fieldType === void 0) { fieldType = "SP.Field"; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata(fieldType), properties));
return this.postCore({
body: postBody,
headers: {
"X-HTTP-Method": "MERGE",
},
}).then(function (data) {
return {
data: data,
field: _this,
};
});
};
/**
* Sets the value of the ShowInDisplayForm property for this field.
*/
Field.prototype.setShowInDisplayForm = function (show) {
return this.clone(Field, "setshowindisplayform(" + show + ")").postCore();
};
/**
* Sets the value of the ShowInEditForm property for this field.
*/
Field.prototype.setShowInEditForm = function (show) {
return this.clone(Field, "setshowineditform(" + show + ")").postCore();
};
/**
* Sets the value of the ShowInNewForm property for this field.
*/
Field.prototype.setShowInNewForm = function (show) {
return this.clone(Field, "setshowinnewform(" + show + ")").postCore();
};
return Field;
}(SharePointQueryableInstance));
/**
* Describes a collection of Field objects
*
*/
var Forms = /** @class */ (function (_super) {
__extends(Forms, _super);
function Forms() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a form by id
*
* @param id The guid id of the item to retrieve
*/
Forms.prototype.getById = function (id) {
var i = new Form(this);
i.concat("('" + id + "')");
return i;
};
Forms = __decorate([
defaultPath("forms")
], Forms);
return Forms;
}(SharePointQueryableCollection));
/**
* Describes a single of Form instance
*
*/
var Form = /** @class */ (function (_super) {
__extends(Form, _super);
function Form() {
return _super !== null && _super.apply(this, arguments) || this;
}
return Form;
}(SharePointQueryableInstance));
/**
* Describes a collection of webhook subscriptions
*
*/
var Subscriptions = /** @class */ (function (_super) {
__extends(Subscriptions, _super);
function Subscriptions() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Returns all the webhook subscriptions or the specified webhook subscription
*
* @param subscriptionId The id of a specific webhook subscription to retrieve, omit to retrieve all the webhook subscriptions
*/
Subscriptions.prototype.getById = function (subscriptionId) {
var s = new Subscription(this);
s.concat("('" + subscriptionId + "')");
return s;
};
/**
* Creates a new webhook subscription
*
* @param notificationUrl The url to receive the notifications
* @param expirationDate The date and time to expire the subscription in the form YYYY-MM-ddTHH:mm:ss+00:00 (maximum of 6 months)
* @param clientState A client specific string (optional)
*/
Subscriptions.prototype.add = function (notificationUrl, expirationDate, clientState) {
var _this = this;
var postBody = {
"expirationDateTime": expirationDate,
"notificationUrl": notificationUrl,
"resource": this.toUrl(),
};
if (clientState) {
postBody.clientState = clientState;
}
return this.postCore({ body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(postBody), headers: { "Content-Type": "application/json" } }).then(function (result) {
return { data: result, subscription: _this.getById(result.id) };
});
};
Subscriptions = __decorate([
defaultPath("subscriptions")
], Subscriptions);
return Subscriptions;
}(SharePointQueryableCollection));
/**
* Describes a single webhook subscription instance
*
*/
var Subscription = /** @class */ (function (_super) {
__extends(Subscription, _super);
function Subscription() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Renews this webhook subscription
*
* @param expirationDate The date and time to expire the subscription in the form YYYY-MM-ddTHH:mm:ss+00:00 (maximum of 6 months, optional)
* @param notificationUrl The url to receive the notifications (optional)
* @param clientState A client specific string (optional)
*/
Subscription.prototype.update = function (expirationDate, notificationUrl, clientState) {
var _this = this;
var postBody = {};
if (expirationDate) {
postBody.expirationDateTime = expirationDate;
}
if (notificationUrl) {
postBody.notificationUrl = notificationUrl;
}
if (clientState) {
postBody.clientState = clientState;
}
return this.patchCore({ body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(postBody), headers: { "Content-Type": "application/json" } }).then(function (data) {
return { data: data, subscription: _this };
});
};
/**
* Removes this webhook subscription
*
*/
Subscription.prototype.delete = function () {
return _super.prototype.deleteCore.call(this);
};
return Subscription;
}(SharePointQueryableInstance));
/**
* Describes a collection of user custom actions
*
*/
var UserCustomActions = /** @class */ (function (_super) {
__extends(UserCustomActions, _super);
function UserCustomActions() {
return _super !== null && _super.apply(this, arguments) || this;
}
UserCustomActions_1 = UserCustomActions;
/**
* Returns the user custom action with the specified id
*
* @param id The GUID id of the user custom action to retrieve
*/
UserCustomActions.prototype.getById = function (id) {
var uca = new UserCustomAction(this);
uca.concat("('" + id + "')");
return uca;
};
/**
* Creates a user custom action
*
* @param properties The information object of property names and values which define the new user custom action
*
*/
UserCustomActions.prototype.add = function (properties) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ __metadata: { "type": "SP.UserCustomAction" } }, properties));
return this.postCore({ body: postBody }).then(function (data) {
return {
action: _this.getById(data.Id),
data: data,
};
});
};
/**
* Deletes all user custom actions in the collection
*
*/
UserCustomActions.prototype.clear = function () {
return this.clone(UserCustomActions_1, "clear").postCore();
};
var UserCustomActions_1;
UserCustomActions = UserCustomActions_1 = __decorate([
defaultPath("usercustomactions")
], UserCustomActions);
return UserCustomActions;
}(SharePointQueryableCollection));
/**
* Describes a single user custom action
*
*/
var UserCustomAction = /** @class */ (function (_super) {
__extends(UserCustomAction, _super);
function UserCustomAction() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Updates this user custom action with the supplied properties
*
* @param properties An information object of property names and values to update for this user custom action
*/
_this.update = _this._update("SP.UserCustomAction", function (data) { return ({ data: data, action: _this }); });
return _this;
}
/**
* Removes this user custom action
*
*/
UserCustomAction.prototype.delete = function () {
return _super.prototype.deleteCore.call(this);
};
return UserCustomAction;
}(SharePointQueryableInstance));
/**
* Describes a collection of List objects
*
*/
var Lists = /** @class */ (function (_super) {
__extends(Lists, _super);
function Lists() {
return _super !== null && _super.apply(this, arguments) || this;
}
Lists_1 = Lists;
/**
* Gets a list from the collection by guid id
*
* @param id The Id of the list (GUID)
*/
Lists.prototype.getById = function (id) {
var list = new List(this);
list.concat("('" + id + "')");
return list;
};
/**
* Gets a list from the collection by title
*
* @param title The title of the list
*/
Lists.prototype.getByTitle = function (title) {
return new List(this, "getByTitle('" + title + "')");
};
/**
* Adds a new list to the collection
*
* @param title The new list's title
* @param description The new list's description
* @param template The list template value
* @param enableContentTypes If true content types will be allowed and enabled, otherwise they will be disallowed and not enabled
* @param additionalSettings Will be passed as part of the list creation body
*/
Lists.prototype.add = function (title, description, template, enableContentTypes, additionalSettings) {
var _this = this;
if (description === void 0) { description = ""; }
if (template === void 0) { template = 100; }
if (enableContentTypes === void 0) { enableContentTypes = false; }
if (additionalSettings === void 0) { additionalSettings = {}; }
var addSettings = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"AllowContentTypes": enableContentTypes,
"BaseTemplate": template,
"ContentTypesEnabled": enableContentTypes,
"Description": description,
"Title": title,
"__metadata": { "type": "SP.List" },
}, additionalSettings);
return this.postCore({ body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(addSettings) }).then(function (data) {
return { data: data, list: _this.getByTitle(addSettings.Title) };
});
};
/**
* Ensures that the specified list exists in the collection (note: this method not supported for batching)
*
* @param title The new list's title
* @param description The new list's description
* @param template The list template value
* @param enableContentTypes If true content types will be allowed and enabled, otherwise they will be disallowed and not enabled
* @param additionalSettings Will be passed as part of the list creation body or used to update an existing list
*/
Lists.prototype.ensure = function (title, description, template, enableContentTypes, additionalSettings) {
var _this = this;
if (description === void 0) { description = ""; }
if (template === void 0) { template = 100; }
if (enableContentTypes === void 0) { enableContentTypes = false; }
if (additionalSettings === void 0) { additionalSettings = {}; }
if (this.hasBatch) {
throw Error("The ensure list method is not supported for use in a batch.");
}
return new Promise(function (resolve, reject) {
var addOrUpdateSettings = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(additionalSettings, { Title: title, Description: description, ContentTypesEnabled: enableContentTypes }, true);
var list = _this.getByTitle(addOrUpdateSettings.Title);
list.get().then(function (_) {
list.update(addOrUpdateSettings).then(function (d) {
resolve({ created: false, data: d, list: _this.getByTitle(addOrUpdateSettings.Title) });
}).catch(function (e) { return reject(e); });
}).catch(function (_) {
_this.add(title, description, template, enableContentTypes, addOrUpdateSettings).then(function (r) {
resolve({ created: true, data: r.data, list: _this.getByTitle(addOrUpdateSettings.Title) });
}).catch(function (e) { return reject(e); });
});
});
};
/**
* Gets a list that is the default asset location for images or other files, which the users upload to their wiki pages.
*/
Lists.prototype.ensureSiteAssetsLibrary = function () {
return this.clone(Lists_1, "ensuresiteassetslibrary").postCore().then(function (json) {
return new List(odataUrlFrom(json));
});
};
/**
* Gets a list that is the default location for wiki pages.
*/
Lists.prototype.ensureSitePagesLibrary = function () {
return this.clone(Lists_1, "ensuresitepageslibrary").postCore().then(function (json) {
return new List(odataUrlFrom(json));
});
};
var Lists_1;
Lists = Lists_1 = __decorate([
defaultPath("lists")
], Lists);
return Lists;
}(SharePointQueryableCollection));
/**
* Describes a single List instance
*
*/
var List = /** @class */ (function (_super) {
__extends(List, _super);
function List() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(List.prototype, "contentTypes", {
/**
* Gets the content types in this list
*
*/
get: function () {
return new ContentTypes(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "items", {
/**
* Gets the items in this list
*
*/
get: function () {
return new Items(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "views", {
/**
* Gets the views in this list
*
*/
get: function () {
return new Views(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "fields", {
/**
* Gets the fields in this list
*
*/
get: function () {
return new Fields(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "forms", {
/**
* Gets the forms in this list
*
*/
get: function () {
return new Forms(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "defaultView", {
/**
* Gets the default view of this list
*
*/
get: function () {
return new View(this, "DefaultView");
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "userCustomActions", {
/**
* Get all custom actions on a site collection
*
*/
get: function () {
return new UserCustomActions(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "effectiveBasePermissions", {
/**
* Gets the effective base permissions of this list
*
*/
get: function () {
return new SharePointQueryable(this, "EffectiveBasePermissions");
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "eventReceivers", {
/**
* Gets the event receivers attached to this list
*
*/
get: function () {
return new SharePointQueryableCollection(this, "EventReceivers");
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "relatedFields", {
/**
* Gets the related fields of this list
*
*/
get: function () {
return new SharePointQueryable(this, "getRelatedFields");
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "informationRightsManagementSettings", {
/**
* Gets the IRM settings for this list
*
*/
get: function () {
return new SharePointQueryable(this, "InformationRightsManagementSettings");
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "subscriptions", {
/**
* Gets the webhook subscriptions of this list
*
*/
get: function () {
return new Subscriptions(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(List.prototype, "rootFolder", {
/**
* The root folder of the list
*/
get: function () {
return new Folder(this, "rootFolder");
},
enumerable: true,
configurable: true
});
/**
* Gets a view by view guid id
*
*/
List.prototype.getView = function (viewId) {
return new View(this, "getView('" + viewId + "')");
};
/**
* Updates this list intance with the supplied properties
*
* @param properties A plain object hash of values to update for the list
* @param eTag Value used in the IF-Match header, by default "*"
*/
/* tslint:disable no-string-literal */
List.prototype.update = function (properties, eTag) {
var _this = this;
if (eTag === void 0) { eTag = "*"; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"__metadata": { "type": "SP.List" },
}, properties));
return this.postCore({
body: postBody,
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "MERGE",
},
}).then(function (data) {
var retList = _this;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(properties, "Title")) {
retList = _this.getParent(List, _this.parentUrl, "getByTitle('" + properties["Title"] + "')");
}
return {
data: data,
list: retList,
};
});
};
/* tslint:enable */
/**
* Delete this list
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
List.prototype.delete = function (eTag) {
if (eTag === void 0) { eTag = "*"; }
return this.postCore({
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "DELETE",
},
});
};
/**
* Returns the collection of changes from the change log that have occurred within the list, based on the specified query.
*/
List.prototype.getChanges = function (query) {
return this.clone(List, "getchanges").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "query": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.ChangeQuery"), query) }),
});
};
/**
* Returns a collection of items from the list based on the specified query.
*
* @param CamlQuery The Query schema of Collaborative Application Markup
* Language (CAML) is used in various ways within the context of Microsoft SharePoint Foundation
* to define queries against list data.
* see:
*
* https://msdn.microsoft.com/en-us/library/office/ms467521.aspx
*
* @param expands A URI with a $expand System Query Option indicates that Entries associated with
* the Entry or Collection of Entries identified by the Resource Path
* section of the URI must be represented inline (i.e. eagerly loaded).
* see:
*
* https://msdn.microsoft.com/en-us/library/office/fp142385.aspx
*
* http://www.odata.org/documentation/odata-version-2-0/uri-conventions/#ExpandSystemQueryOption
*/
List.prototype.getItemsByCAMLQuery = function (query) {
var expands = [];
for (var _i = 1; _i < arguments.length; _i++) {
expands[_i - 1] = arguments[_i];
}
var q = this.clone(List, "getitems");
return q.expand.apply(q, expands).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "query": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ "__metadata": { "type": "SP.CamlQuery" } }, query) }),
});
};
/**
* See: https://msdn.microsoft.com/en-us/library/office/dn292554.aspx
*/
List.prototype.getListItemChangesSinceToken = function (query) {
return this.clone(List, "getlistitemchangessincetoken").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "query": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ "__metadata": { "type": "SP.ChangeLogItemQuery" } }, query) }),
}, { parse: function (r) { return r.text(); } });
};
/**
* Moves the list to the Recycle Bin and returns the identifier of the new Recycle Bin item.
*/
List.prototype.recycle = function () {
return this.clone(List, "recycle").postCore().then(function (data) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "Recycle")) {
return data.Recycle;
}
else {
return data;
}
});
};
/**
* Renders list data based on the view xml provided
*/
List.prototype.renderListData = function (viewXml) {
var q = this.clone(List, "renderlistdata(@viewXml)");
q.query.set("@viewXml", "'" + viewXml + "'");
return q.postCore().then(function (data) {
// data will be a string, so we parse it again
return JSON.parse(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "RenderListData") ? data.RenderListData : data);
});
};
/**
* Returns the data for the specified query view
*
* @param parameters The parameters to be used to render list data as JSON string.
* @param overrideParameters The parameters that are used to override and extend the regular SPRenderListDataParameters.
*/
List.prototype.renderListDataAsStream = function (parameters, overrideParameters) {
if (overrideParameters === void 0) { overrideParameters = null; }
var postBody = {
overrideParameters: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.RenderListDataOverrideParameters"), overrideParameters),
parameters: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.RenderListDataParameters"), parameters),
};
return this.clone(List, "RenderListDataAsStream", true).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(postBody),
});
};
/**
* Gets the field values and field schema attributes for a list item.
*/
List.prototype.renderListFormData = function (itemId, formId, mode) {
return this.clone(List, "renderlistformdata(itemid=" + itemId + ", formid='" + formId + "', mode='" + mode + "')").postCore().then(function (data) {
// data will be a string, so we parse it again
return JSON.parse(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "RenderListFormData") ? data.RenderListFormData : data);
});
};
/**
* Reserves a list item ID for idempotent list item creation.
*/
List.prototype.reserveListItemId = function () {
return this.clone(List, "reservelistitemid").postCore().then(function (data) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "ReserveListItemId")) {
return data.ReserveListItemId;
}
else {
return data;
}
});
};
/**
* Returns the ListItemEntityTypeFullName for this list, used when adding/updating list items. Does not support batching.
*
*/
List.prototype.getListItemEntityTypeFullName = function () {
return this.clone(List, null, false).select("ListItemEntityTypeFullName").get().then(function (o) { return o.ListItemEntityTypeFullName; });
};
/**
* Creates an item using path (in a folder), validates and sets its field values.
*
* @param formValues The fields to change and their new values.
* @param decodedUrl Path decoded url; folder's server relative path.
* @param bNewDocumentUpdate true if the list item is a document being updated after upload; otherwise false.
* @param checkInComment Optional check in comment.
*/
List.prototype.addValidateUpdateItemUsingPath = function (formValues, decodedUrl, bNewDocumentUpdate, checkInComment) {
if (bNewDocumentUpdate === void 0) { bNewDocumentUpdate = false; }
return this.clone(List, "AddValidateUpdateItemUsingPath()").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
bNewDocumentUpdate: bNewDocumentUpdate,
checkInComment: checkInComment,
formValues: formValues,
listItemCreateInfo: {
FolderPath: {
DecodedUrl: decodedUrl,
__metadata: { type: "SP.ResourcePath" },
},
__metadata: { type: "SP.ListItemCreationInformationUsingPath" },
},
}),
}).then(function (res) {
if (typeof res.AddValidateUpdateItemUsingPath !== "undefined") {
return res.AddValidateUpdateItemUsingPath.results;
}
return res;
});
};
return List;
}(SharePointQueryableSecurable));
/**
* Represents a Collection of comments
*/
var Comments = /** @class */ (function (_super) {
__extends(Comments, _super);
function Comments() {
return _super !== null && _super.apply(this, arguments) || this;
}
Comments_1 = Comments;
/**
* Adds a new comment to this collection
*
* @param info Comment information to add
*/
Comments.prototype.add = function (info) {
var _this = this;
if (typeof info === "string") {
info = { text: info };
}
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("Microsoft.SharePoint.Comments.comment"), info));
return this.clone(Comments_1, null).postCore({ body: postBody }).then(function (d) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(_this.getById(d.id), d);
});
};
/**
* Gets a comment by id
*
* @param id Id of the comment to load
*/
Comments.prototype.getById = function (id) {
var c = new Comment(this);
c.concat("(" + id + ")");
return c;
};
/**
* Deletes all the comments in this collection
*/
Comments.prototype.clear = function () {
return this.clone(Comments_1, "DeleteAll").postCore();
};
var Comments_1;
Comments = Comments_1 = __decorate([
defaultPath("comments")
], Comments);
return Comments;
}(SharePointQueryableCollection));
/**
* Represents a comment
*/
var Comment = /** @class */ (function (_super) {
__extends(Comment, _super);
function Comment() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Comment.prototype, "replies", {
get: function () {
return new Replies(this);
},
enumerable: true,
configurable: true
});
/**
* Likes the comment as the current user
*/
Comment.prototype.like = function () {
return this.clone(Comment, "Like").postCore();
};
/**
* Unlikes the comment as the current user
*/
Comment.prototype.unlike = function () {
return this.clone(Comment, "Unlike").postCore();
};
/**
* Deletes this comment
*/
Comment.prototype.delete = function () {
return this.clone(Comment, "DeleteComment").postCore();
};
return Comment;
}(SharePointQueryableInstance));
/**
* Represents a Collection of comments
*/
var Replies = /** @class */ (function (_super) {
__extends(Replies, _super);
function Replies() {
return _super !== null && _super.apply(this, arguments) || this;
}
Replies_1 = Replies;
/**
* Adds a new reply to this collection
*
* @param info Comment information to add
*/
Replies.prototype.add = function (info) {
if (typeof info === "string") {
info = { text: info };
}
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("Microsoft.SharePoint.Comments.comment"), info));
return this.clone(Replies_1, null).postCore({ body: postBody }).then(function (d) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(new Comment(odataUrlFrom(d)), d);
});
};
var Replies_1;
Replies = Replies_1 = __decorate([
defaultPath("replies")
], Replies);
return Replies;
}(SharePointQueryableCollection));
/**
* Describes a collection of Item objects
*
*/
var Items = /** @class */ (function (_super) {
__extends(Items, _super);
function Items() {
return _super !== null && _super.apply(this, arguments) || this;
}
Items_1 = Items;
/**
* Gets an Item by id
*
* @param id The integer id of the item to retrieve
*/
Items.prototype.getById = function (id) {
var i = new Item(this);
i.concat("(" + id + ")");
return i;
};
/**
* Gets BCS Item by string id
*
* @param stringId The string id of the BCS item to retrieve
*/
Items.prototype.getItemByStringId = function (stringId) {
// creates an item with the parent list path and append out method call
return new Item(this.parentUrl, "getItemByStringId('" + stringId + "')");
};
/**
* Skips the specified number of items (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#sectionSection6)
*
* @param skip The starting id where the page should start, use with top to specify pages
* @param reverse It true the PagedPrev=true parameter is added allowing backwards navigation in the collection
*/
Items.prototype.skip = function (skip, reverse) {
if (reverse === void 0) { reverse = false; }
if (reverse) {
this.query.set("$skiptoken", encodeURIComponent("Paged=TRUE&PagedPrev=TRUE&p_ID=" + skip));
}
else {
this.query.set("$skiptoken", encodeURIComponent("Paged=TRUE&p_ID=" + skip));
}
return this;
};
/**
* Gets a collection designed to aid in paging through data
*
*/
Items.prototype.getPaged = function () {
return this.get(new PagedItemCollectionParser(this));
};
/**
* Gets all the items in a list, regardless of count. Does not support batching or caching
*
* @param requestSize Number of items to return in each request (Default: 2000)
* @param acceptHeader Allows for setting the value of the Accept header for SP 2013 support
*/
Items.prototype.getAll = function (requestSize, acceptHeader) {
if (requestSize === void 0) { requestSize = 2000; }
if (acceptHeader === void 0) { acceptHeader = "application/json;odata=nometadata"; }
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("Calling items.getAll should be done sparingly. Ensure this is the correct choice. If you are unsure, it is not.", 2 /* Warning */);
// this will be used for the actual query
// and we set no metadata here to try and reduce traffic
var items = new Items_1(this, "").top(requestSize).configure({
headers: {
"Accept": acceptHeader,
},
});
// let's copy over the odata query params that can be applied
// $top - allow setting the page size this way (override what we did above)
// $select - allow picking the return fields (good behavior)
// $filter - allow setting a filter, though this may fail due for large lists
this.query.forEach(function (v, k) {
if (/^\$select|filter|top|expand$/i.test(k)) {
items.query.set(k, v);
}
});
// give back the promise
return new Promise(function (resolve, reject) {
// this will eventually hold the items we return
var itemsCollector = [];
// action that will gather up our results recursively
var gatherer = function (last) {
// collect that set of results
[].push.apply(itemsCollector, last.results);
// if we have more, repeat - otherwise resolve with the collected items
if (last.hasNext) {
last.getNext().then(gatherer).catch(reject);
}
else {
resolve(itemsCollector);
}
};
// start the cycle
items.getPaged().then(gatherer).catch(reject);
});
};
/**
* Adds a new item to the collection
*
* @param properties The new items's properties
* @param listItemEntityTypeFullName The type name of the list's entities
*/
Items.prototype.add = function (properties, listItemEntityTypeFullName) {
var _this = this;
if (properties === void 0) { properties = {}; }
if (listItemEntityTypeFullName === void 0) { listItemEntityTypeFullName = null; }
var removeDependency = this.addBatchDependency();
return this.ensureListItemEntityTypeName(listItemEntityTypeFullName).then(function (listItemEntityType) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata(listItemEntityType), properties));
// we need to create a compound dependency clearing function to clear both the batch dependency assigned to this object
// and the one created during the clone. See https://github.com/pnp/pnpjs/issues/468 for details.
var clonedReq = _this.clone(Items_1, "");
if (clonedReq.hasBatch) {
var r_1 = clonedReq._batchDependency;
var compoundDep = function () {
_this._batchDependency();
r_1();
};
clonedReq._batchDependency = compoundDep;
}
var promise = clonedReq.postCore({ body: postBody }).then(function (data) {
return {
data: data,
item: _this.getById(data.Id),
};
});
removeDependency();
return promise;
});
};
/**
* Ensures we have the proper list item entity type name, either from the value provided or from the list
*
* @param candidatelistItemEntityTypeFullName The potential type name
*/
Items.prototype.ensureListItemEntityTypeName = function (candidatelistItemEntityTypeFullName) {
return candidatelistItemEntityTypeFullName ?
Promise.resolve(candidatelistItemEntityTypeFullName) :
this.getParent(List).getListItemEntityTypeFullName();
};
var Items_1;
Items = Items_1 = __decorate([
defaultPath("items")
], Items);
return Items;
}(SharePointQueryableCollection));
/**
* Descrines a single Item instance
*
*/
var Item = /** @class */ (function (_super) {
__extends(Item, _super);
function Item() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Delete this item
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
_this.delete = _this._deleteWithETag;
return _this;
}
Object.defineProperty(Item.prototype, "attachmentFiles", {
/**
* Gets the set of attachments for this item
*
*/
get: function () {
return new AttachmentFiles(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "contentType", {
/**
* Gets the content type for this item
*
*/
get: function () {
return new ContentType(this, "ContentType");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "comments", {
/**
* Gets the collection of comments associated with this list item
*/
get: function () {
return new Comments(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "effectiveBasePermissions", {
/**
* Gets the effective base permissions for the item
*
*/
get: function () {
return new SharePointQueryable(this, "EffectiveBasePermissions");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "effectiveBasePermissionsForUI", {
/**
* Gets the effective base permissions for the item in a UI context
*
*/
get: function () {
return new SharePointQueryable(this, "EffectiveBasePermissionsForUI");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "fieldValuesAsHTML", {
/**
* Gets the field values for this list item in their HTML representation
*
*/
get: function () {
return new SharePointQueryableInstance(this, "FieldValuesAsHTML");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "fieldValuesAsText", {
/**
* Gets the field values for this list item in their text representation
*
*/
get: function () {
return new SharePointQueryableInstance(this, "FieldValuesAsText");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "fieldValuesForEdit", {
/**
* Gets the field values for this list item for use in editing controls
*
*/
get: function () {
return new SharePointQueryableInstance(this, "FieldValuesForEdit");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "folder", {
/**
* Gets the folder associated with this list item (if this item represents a folder)
*
*/
get: function () {
return new Folder(this, "folder");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "file", {
/**
* Gets the folder associated with this list item (if this item represents a folder)
*
*/
get: function () {
return new File(this, "file");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "versions", {
/**
* Gets the collection of versions associated with this item
*/
get: function () {
return new ItemVersions(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Item.prototype, "list", {
get: function () {
return this.getParent(List, this.parentUrl.substr(0, this.parentUrl.lastIndexOf("/")));
},
enumerable: true,
configurable: true
});
/**
* Updates this list intance with the supplied properties
*
* @param properties A plain object hash of values to update for the list
* @param eTag Value used in the IF-Match header, by default "*"
* @param listItemEntityTypeFullName The type name of the list's entities
*/
Item.prototype.update = function (properties, eTag, listItemEntityTypeFullName) {
var _this = this;
if (eTag === void 0) { eTag = "*"; }
if (listItemEntityTypeFullName === void 0) { listItemEntityTypeFullName = null; }
return new Promise(function (resolve, reject) {
var removeDependency = _this.addBatchDependency();
return _this.ensureListItemEntityTypeName(listItemEntityTypeFullName).then(function (listItemEntityType) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata(listItemEntityType), properties));
removeDependency();
return _this.postCore({
body: postBody,
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "MERGE",
},
}, new ItemUpdatedParser()).then(function (data) {
resolve({
data: data,
item: _this,
});
});
}).catch(function (e) { return reject(e); });
});
};
/**
* Gets the collection of people who have liked this item
*/
Item.prototype.getLikedBy = function () {
return this.clone(Item, "likedBy").postCore();
};
/**
* Likes this item as the current user
*/
Item.prototype.like = function () {
return this.clone(Item, "like").postCore();
};
/**
* Unlikes this item as the current user
*/
Item.prototype.unlike = function () {
return this.clone(Item, "unlike").postCore();
};
/**
* Moves the list item to the Recycle Bin and returns the identifier of the new Recycle Bin item.
*/
Item.prototype.recycle = function () {
return this.clone(Item, "recycle").postCore();
};
/**
* Gets a string representation of the full URL to the WOPI frame.
* If there is no associated WOPI application, or no associated action, an empty string is returned.
*
* @param action Display mode: 0: view, 1: edit, 2: mobileView, 3: interactivePreview
*/
Item.prototype.getWopiFrameUrl = function (action) {
if (action === void 0) { action = 0; }
var i = this.clone(Item, "getWOPIFrameUrl(@action)");
i.query.set("@action", action);
return i.postCore().then(function (data) {
// handle verbose mode
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "GetWOPIFrameUrl")) {
return data.GetWOPIFrameUrl;
}
return data;
});
};
/**
* Validates and sets the values of the specified collection of fields for the list item.
*
* @param formValues The fields to change and their new values.
* @param newDocumentUpdate true if the list item is a document being updated after upload; otherwise false.
*/
Item.prototype.validateUpdateListItem = function (formValues, newDocumentUpdate) {
if (newDocumentUpdate === void 0) { newDocumentUpdate = false; }
return this.clone(Item, "validateupdatelistitem").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "formValues": formValues, bNewDocumentUpdate: newDocumentUpdate }),
});
};
/**
* Get the like by information for a modern site page
*/
Item.prototype.getLikedByInformation = function () {
return this.clone(Item, "likedByInformation").expand("likedby").getCore();
};
/**
* Ensures we have the proper list item entity type name, either from the value provided or from the list
*
* @param candidatelistItemEntityTypeFullName The potential type name
*/
Item.prototype.ensureListItemEntityTypeName = function (candidatelistItemEntityTypeFullName) {
return candidatelistItemEntityTypeFullName ?
Promise.resolve(candidatelistItemEntityTypeFullName) :
this.list.getListItemEntityTypeFullName();
};
return Item;
}(SharePointQueryableShareableItem));
/**
* Describes a collection of Version objects
*
*/
var ItemVersions = /** @class */ (function (_super) {
__extends(ItemVersions, _super);
function ItemVersions() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a version by id
*
* @param versionId The id of the version to retrieve
*/
ItemVersions.prototype.getById = function (versionId) {
var v = new ItemVersion(this);
v.concat("(" + versionId + ")");
return v;
};
ItemVersions = __decorate([
defaultPath("versions")
], ItemVersions);
return ItemVersions;
}(SharePointQueryableCollection));
/**
* Describes a single Version instance
*
*/
var ItemVersion = /** @class */ (function (_super) {
__extends(ItemVersion, _super);
function ItemVersion() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Delete a specific version of a file.
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
_this.delete = _this._deleteWithETag;
return _this;
}
return ItemVersion;
}(SharePointQueryableInstance));
/**
* Provides paging functionality for list items
*/
var PagedItemCollection = /** @class */ (function () {
function PagedItemCollection(parent, nextUrl, results) {
this.parent = parent;
this.nextUrl = nextUrl;
this.results = results;
}
Object.defineProperty(PagedItemCollection.prototype, "hasNext", {
/**
* If true there are more results available in the set, otherwise there are not
*/
get: function () {
return typeof this.nextUrl === "string" && this.nextUrl.length > 0;
},
enumerable: true,
configurable: true
});
/**
* Gets the next set of results, or resolves to null if no results are available
*/
PagedItemCollection.prototype.getNext = function () {
if (this.hasNext) {
var items = new Items(this.nextUrl, null).configureFrom(this.parent);
return items.getPaged();
}
return new Promise(function (r) { return r(null); });
};
return PagedItemCollection;
}());
var PagedItemCollectionParser = /** @class */ (function (_super) {
__extends(PagedItemCollectionParser, _super);
function PagedItemCollectionParser(_parent) {
var _this = _super.call(this) || this;
_this._parent = _parent;
return _this;
}
PagedItemCollectionParser.prototype.parse = function (r) {
var _this = this;
return new Promise(function (resolve, reject) {
if (_this.handleError(r, reject)) {
r.json().then(function (json) {
var nextUrl = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(json, "d") && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(json.d, "__next") ? json.d.__next : json["odata.nextLink"];
resolve(new PagedItemCollection(_this._parent, nextUrl, _this.parseODataJSON(json)));
});
}
});
};
return PagedItemCollectionParser;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataParserBase"]));
var ItemUpdatedParser = /** @class */ (function (_super) {
__extends(ItemUpdatedParser, _super);
function ItemUpdatedParser() {
return _super !== null && _super.apply(this, arguments) || this;
}
ItemUpdatedParser.prototype.parse = function (r) {
return __awaiter(this, void 0, void 0, function () {
var _this = this;
return __generator(this, function (_a) {
return [2 /*return*/, new Promise(function (resolve, reject) {
if (_this.handleError(r, reject)) {
resolve({
"odata.etag": r.headers.get("etag"),
});
}
})];
});
});
};
return ItemUpdatedParser;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataParserBase"]));
/**
* Describes a collection of File objects
*
*/
var Files = /** @class */ (function (_super) {
__extends(Files, _super);
function Files() {
return _super !== null && _super.apply(this, arguments) || this;
}
Files_1 = Files;
/**
* Gets a File by filename
*
* @param name The name of the file, including extension.
*/
Files.prototype.getByName = function (name) {
var f = new File(this);
f.concat("('" + name + "')");
return f;
};
/**
* Uploads a file. Not supported for batching
*
* @param url The folder-relative url of the file.
* @param content The file contents blob.
* @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
* @returns The new File and the raw response.
*/
Files.prototype.add = function (url, content, shouldOverWrite) {
var _this = this;
if (shouldOverWrite === void 0) { shouldOverWrite = true; }
return new Files_1(this, "add(overwrite=" + shouldOverWrite + ",url='" + url + "')")
.postCore({
body: content,
}).then(function (response) {
return {
data: response,
file: _this.getByName(url),
};
});
};
/**
* Uploads a file. Not supported for batching
*
* @param url The folder-relative url of the file.
* @param content The Blob file content to add
* @param progress A callback function which can be used to track the progress of the upload
* @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
* @param chunkSize The size of each file slice, in bytes (default: 10485760)
* @returns The new File and the raw response.
*/
Files.prototype.addChunked = function (url, content, progress, shouldOverWrite, chunkSize) {
var _this = this;
if (shouldOverWrite === void 0) { shouldOverWrite = true; }
if (chunkSize === void 0) { chunkSize = 10485760; }
var adder = this.clone(Files_1, "add(overwrite=" + shouldOverWrite + ",url='" + url + "')", false);
return adder.postCore()
.then(function () { return _this.getByName(url); })
.then(function (file) { return file.setContentChunked(content, progress, chunkSize); });
};
/**
* Adds a ghosted file to an existing list or document library. Not supported for batching.
*
* @param fileUrl The server-relative url where you want to save the file.
* @param templateFileType The type of use to create the file.
* @returns The template file that was added and the raw response.
*/
Files.prototype.addTemplateFile = function (fileUrl, templateFileType) {
var _this = this;
return this.clone(Files_1, "addTemplateFile(urloffile='" + fileUrl + "',templatefiletype=" + templateFileType + ")", false)
.postCore().then(function (response) {
return {
data: response,
file: _this.getByName(fileUrl),
};
});
};
var Files_1;
Files = Files_1 = __decorate([
defaultPath("files")
], Files);
return Files;
}(SharePointQueryableCollection));
/**
* Describes a single File instance
*
*/
var File = /** @class */ (function (_super) {
__extends(File, _super);
function File() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(File.prototype, "listItemAllFields", {
/**
* Gets a value that specifies the list item field values for the list item corresponding to the file.
*
*/
get: function () {
return new SharePointQueryableInstance(this, "listItemAllFields");
},
enumerable: true,
configurable: true
});
Object.defineProperty(File.prototype, "versions", {
/**
* Gets a collection of versions
*
*/
get: function () {
return new Versions(this);
},
enumerable: true,
configurable: true
});
/**
* Approves the file submitted for content approval with the specified comment.
* Only documents in lists that are enabled for content approval can be approved.
*
* @param comment The comment for the approval.
*/
File.prototype.approve = function (comment) {
if (comment === void 0) { comment = ""; }
return this.clone(File, "approve(comment='" + comment + "')").postCore();
};
/**
* Stops the chunk upload session without saving the uploaded data. Does not support batching.
* If the file doesn’t already exist in the library, the partially uploaded file will be deleted.
* Use this in response to user action (as in a request to cancel an upload) or an error or exception.
* Use the uploadId value that was passed to the StartUpload method that started the upload session.
* This method is currently available only on Office 365.
*
* @param uploadId The unique identifier of the upload session.
*/
File.prototype.cancelUpload = function (uploadId) {
return this.clone(File, "cancelUpload(uploadId=guid'" + uploadId + "')", false).postCore();
};
/**
* Checks the file in to a document library based on the check-in type.
*
* @param comment A comment for the check-in. Its length must be <= 1023.
* @param checkinType The check-in type for the file.
*/
File.prototype.checkin = function (comment, checkinType) {
if (comment === void 0) { comment = ""; }
if (checkinType === void 0) { checkinType = CheckinType.Major; }
if (comment.length > 1023) {
throw Error("The maximum comment length is 1023 characters.");
}
return this.clone(File, "checkin(comment='" + comment + "',checkintype=" + checkinType + ")").postCore();
};
/**
* Checks out the file from a document library.
*/
File.prototype.checkout = function () {
return this.clone(File, "checkout").postCore();
};
/**
* Copies the file to the destination url.
*
* @param url The absolute url or server relative url of the destination file path to copy to.
* @param shouldOverWrite Should a file with the same name in the same location be overwritten?
*/
File.prototype.copyTo = function (url, shouldOverWrite) {
if (shouldOverWrite === void 0) { shouldOverWrite = true; }
return this.clone(File, "copyTo(strnewurl='" + url + "',boverwrite=" + shouldOverWrite + ")").postCore();
};
/**
* Delete this file.
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
File.prototype.delete = function (eTag) {
if (eTag === void 0) { eTag = "*"; }
return this.clone(File, null).postCore({
headers: {
"IF-Match": eTag,
"X-HTTP-Method": "DELETE",
},
});
};
/**
* Denies approval for a file that was submitted for content approval.
* Only documents in lists that are enabled for content approval can be denied.
*
* @param comment The comment for the denial.
*/
File.prototype.deny = function (comment) {
if (comment === void 0) { comment = ""; }
if (comment.length > 1023) {
throw Error("The maximum comment length is 1023 characters.");
}
return this.clone(File, "deny(comment='" + comment + "')").postCore();
};
/**
* Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view.
* An exception is thrown if the file is not an ASPX page.
*
* @param scope The WebPartsPersonalizationScope view on the Web Parts page.
*/
File.prototype.getLimitedWebPartManager = function (scope) {
if (scope === void 0) { scope = WebPartsPersonalizationScope.Shared; }
return new LimitedWebPartManager(this, "getLimitedWebPartManager(scope=" + scope + ")");
};
/**
* Moves the file to the specified destination url.
*
* @param url The absolute url or server relative url of the destination file path to move to.
* @param moveOperations The bitwise MoveOperations value for how to move the file.
*/
File.prototype.moveTo = function (url, moveOperations) {
if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; }
return this.clone(File, "moveTo(newurl='" + url + "',flags=" + moveOperations + ")").postCore();
};
/**
* Submits the file for content approval with the specified comment.
*
* @param comment The comment for the published file. Its length must be <= 1023.
*/
File.prototype.publish = function (comment) {
if (comment === void 0) { comment = ""; }
if (comment.length > 1023) {
throw Error("The maximum comment length is 1023 characters.");
}
return this.clone(File, "publish(comment='" + comment + "')").postCore();
};
/**
* Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.
*
* @returns The GUID of the recycled file.
*/
File.prototype.recycle = function () {
return this.clone(File, "recycle").postCore();
};
/**
* Reverts an existing checkout for the file.
*
*/
File.prototype.undoCheckout = function () {
return this.clone(File, "undoCheckout").postCore();
};
/**
* Removes the file from content approval or unpublish a major version.
*
* @param comment The comment for the unpublish operation. Its length must be <= 1023.
*/
File.prototype.unpublish = function (comment) {
if (comment === void 0) { comment = ""; }
if (comment.length > 1023) {
throw Error("The maximum comment length is 1023 characters.");
}
return this.clone(File, "unpublish(comment='" + comment + "')").postCore();
};
/**
* Gets the contents of the file as text. Not supported in batching.
*
*/
File.prototype.getText = function () {
return this.clone(File, "$value", false).get(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["TextParser"](), { headers: { "binaryStringResponseBody": "true" } });
};
/**
* Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching.
*
*/
File.prototype.getBlob = function () {
return this.clone(File, "$value", false).get(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["BlobParser"](), { headers: { "binaryStringResponseBody": "true" } });
};
/**
* Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
*/
File.prototype.getBuffer = function () {
return this.clone(File, "$value", false).get(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["BufferParser"](), { headers: { "binaryStringResponseBody": "true" } });
};
/**
* Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.
*/
File.prototype.getJSON = function () {
return this.clone(File, "$value", false).get(new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["JSONParser"](), { headers: { "binaryStringResponseBody": "true" } });
};
/**
* Sets the content of a file, for large files use setContentChunked. Not supported in batching.
*
* @param content The file content
*
*/
File.prototype.setContent = function (content) {
var _this = this;
return this.clone(File, "$value", false).postCore({
body: content,
headers: {
"X-HTTP-Method": "PUT",
},
}).then(function (_) { return new File(_this); });
};
/**
* Gets the associated list item for this folder, loading the default properties
*/
File.prototype.getItem = function () {
var _this = this;
var selects = [];
for (var _i = 0; _i < arguments.length; _i++) {
selects[_i] = arguments[_i];
}
var q = this.listItemAllFields;
return q.select.apply(q, selects).get().then(function (d) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])((new Item(odataUrlFrom(d))).configureFrom(_this), d);
});
};
/**
* Sets the contents of a file using a chunked upload approach. Not supported in batching.
*
* @param file The file to upload
* @param progress A callback function which can be used to track the progress of the upload
* @param chunkSize The size of each file slice, in bytes (default: 10485760)
*/
File.prototype.setContentChunked = function (file, progress, chunkSize) {
var _this = this;
if (chunkSize === void 0) { chunkSize = 10485760; }
if (progress === undefined) {
progress = function () { return null; };
}
var fileSize = file.size;
var blockCount = parseInt((file.size / chunkSize).toString(), 10) + ((file.size % chunkSize === 0) ? 1 : 0);
var uploadId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
// start the chain with the first fragment
progress({ uploadId: uploadId, blockNumber: 1, chunkSize: chunkSize, currentPointer: 0, fileSize: fileSize, stage: "starting", totalBlocks: blockCount });
var chain = this.startUpload(uploadId, file.slice(0, chunkSize));
var _loop_1 = function (i) {
chain = chain.then(function (pointer) {
progress({ uploadId: uploadId, blockNumber: i, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: "continue", totalBlocks: blockCount });
return _this.continueUpload(uploadId, pointer, file.slice(pointer, pointer + chunkSize));
});
};
// skip the first and last blocks
for (var i = 2; i < blockCount; i++) {
_loop_1(i);
}
return chain.then(function (pointer) {
progress({ uploadId: uploadId, blockNumber: blockCount, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: "finishing", totalBlocks: blockCount });
return _this.finishUpload(uploadId, pointer, file.slice(pointer));
});
};
/**
* Starts a new chunk upload session and uploads the first fragment.
* The current file content is not changed when this method completes.
* The method is idempotent (and therefore does not change the result) as long as you use the same values for uploadId and stream.
* The upload session ends either when you use the CancelUpload method or when you successfully
* complete the upload session by passing the rest of the file contents through the ContinueUpload and FinishUpload methods.
* The StartUpload and ContinueUpload methods return the size of the running total of uploaded data in bytes,
* so you can pass those return values to subsequent uses of ContinueUpload and FinishUpload.
* This method is currently available only on Office 365.
*
* @param uploadId The unique identifier of the upload session.
* @param fragment The file contents.
* @returns The size of the total uploaded data in bytes.
*/
File.prototype.startUpload = function (uploadId, fragment) {
return this.clone(File, "startUpload(uploadId=guid'" + uploadId + "')", false)
.postCore({ body: fragment })
.then(function (n) {
// When OData=verbose the payload has the following shape:
// { StartUpload: "10485760" }
if (typeof n === "object") {
n = n.StartUpload;
}
return parseFloat(n);
});
};
/**
* Continues the chunk upload session with an additional fragment.
* The current file content is not changed.
* Use the uploadId value that was passed to the StartUpload method that started the upload session.
* This method is currently available only on Office 365.
*
* @param uploadId The unique identifier of the upload session.
* @param fileOffset The size of the offset into the file where the fragment starts.
* @param fragment The file contents.
* @returns The size of the total uploaded data in bytes.
*/
File.prototype.continueUpload = function (uploadId, fileOffset, fragment) {
return this.clone(File, "continueUpload(uploadId=guid'" + uploadId + "',fileOffset=" + fileOffset + ")", false)
.postCore({ body: fragment })
.then(function (n) {
// When OData=verbose the payload has the following shape:
// { ContinueUpload: "20971520" }
if (typeof n === "object") {
n = n.ContinueUpload;
}
return parseFloat(n);
});
};
/**
* Uploads the last file fragment and commits the file. The current file content is changed when this method completes.
* Use the uploadId value that was passed to the StartUpload method that started the upload session.
* This method is currently available only on Office 365.
*
* @param uploadId The unique identifier of the upload session.
* @param fileOffset The size of the offset into the file where the fragment starts.
* @param fragment The file contents.
* @returns The newly uploaded file.
*/
File.prototype.finishUpload = function (uploadId, fileOffset, fragment) {
return this.clone(File, "finishUpload(uploadId=guid'" + uploadId + "',fileOffset=" + fileOffset + ")", false)
.postCore({ body: fragment })
.then(function (response) {
return {
data: response,
file: new File(odataUrlFrom(response)),
};
});
};
return File;
}(SharePointQueryableShareableFile));
/**
* Describes a collection of Version objects
*
*/
var Versions = /** @class */ (function (_super) {
__extends(Versions, _super);
function Versions() {
return _super !== null && _super.apply(this, arguments) || this;
}
Versions_1 = Versions;
/**
* Gets a version by id
*
* @param versionId The id of the version to retrieve
*/
Versions.prototype.getById = function (versionId) {
var v = new Version(this);
v.concat("(" + versionId + ")");
return v;
};
/**
* Deletes all the file version objects in the collection.
*
*/
Versions.prototype.deleteAll = function () {
return new Versions_1(this, "deleteAll").postCore();
};
/**
* Deletes the specified version of the file.
*
* @param versionId The ID of the file version to delete.
*/
Versions.prototype.deleteById = function (versionId) {
return this.clone(Versions_1, "deleteById(vid=" + versionId + ")").postCore();
};
/**
* Recycles the specified version of the file.
*
* @param versionId The ID of the file version to delete.
*/
Versions.prototype.recycleByID = function (versionId) {
return this.clone(Versions_1, "recycleByID(vid=" + versionId + ")").postCore();
};
/**
* Deletes the file version object with the specified version label.
*
* @param label The version label of the file version to delete, for example: 1.2
*/
Versions.prototype.deleteByLabel = function (label) {
return this.clone(Versions_1, "deleteByLabel(versionlabel='" + label + "')").postCore();
};
/**
* Recycles the file version object with the specified version label.
*
* @param label The version label of the file version to delete, for example: 1.2
*/
Versions.prototype.recycleByLabel = function (label) {
return this.clone(Versions_1, "recycleByLabel(versionlabel='" + label + "')").postCore();
};
/**
* Creates a new file version from the file specified by the version label.
*
* @param label The version label of the file version to restore, for example: 1.2
*/
Versions.prototype.restoreByLabel = function (label) {
return this.clone(Versions_1, "restoreByLabel(versionlabel='" + label + "')").postCore();
};
var Versions_1;
Versions = Versions_1 = __decorate([
defaultPath("versions")
], Versions);
return Versions;
}(SharePointQueryableCollection));
/**
* Describes a single Version instance
*
*/
var Version = /** @class */ (function (_super) {
__extends(Version, _super);
function Version() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Delete a specific version of a file.
*
* @param eTag Value used in the IF-Match header, by default "*"
*/
_this.delete = _this._deleteWithETag;
return _this;
// /**
// * Delete a specific version of a file.
// *
// * @param eTag Value used in the IF-Match header, by default "*"
// */
// public delete(eTag = "*"): Promise<void> {
// return this.postCore({
// headers: {
// "IF-Match": eTag,
// "X-HTTP-Method": "DELETE",
// },
// });
// }
}
return Version;
}(SharePointQueryableInstance));
var CheckinType;
(function (CheckinType) {
CheckinType[CheckinType["Minor"] = 0] = "Minor";
CheckinType[CheckinType["Major"] = 1] = "Major";
CheckinType[CheckinType["Overwrite"] = 2] = "Overwrite";
})(CheckinType || (CheckinType = {}));
var WebPartsPersonalizationScope;
(function (WebPartsPersonalizationScope) {
WebPartsPersonalizationScope[WebPartsPersonalizationScope["User"] = 0] = "User";
WebPartsPersonalizationScope[WebPartsPersonalizationScope["Shared"] = 1] = "Shared";
})(WebPartsPersonalizationScope || (WebPartsPersonalizationScope = {}));
var MoveOperations;
(function (MoveOperations) {
MoveOperations[MoveOperations["Overwrite"] = 1] = "Overwrite";
MoveOperations[MoveOperations["AllowBrokenThickets"] = 8] = "AllowBrokenThickets";
})(MoveOperations || (MoveOperations = {}));
var TemplateFileType;
(function (TemplateFileType) {
TemplateFileType[TemplateFileType["StandardPage"] = 0] = "StandardPage";
TemplateFileType[TemplateFileType["WikiPage"] = 1] = "WikiPage";
TemplateFileType[TemplateFileType["FormPage"] = 2] = "FormPage";
TemplateFileType[TemplateFileType["ClientSidePage"] = 3] = "ClientSidePage";
})(TemplateFileType || (TemplateFileType = {}));
/**
* Represents an app catalog
*/
var AppCatalog = /** @class */ (function (_super) {
__extends(AppCatalog, _super);
function AppCatalog(baseUrl, path) {
if (path === void 0) { path = "_api/web/tenantappcatalog/AvailableApps"; }
return _super.call(this, extractWebUrl(typeof baseUrl === "string" ? baseUrl : baseUrl.toUrl()), path) || this;
}
/**
* Get details of specific app from the app catalog
* @param id - Specify the guid of the app
*/
AppCatalog.prototype.getAppById = function (id) {
return new App(this, "getById('" + id + "')");
};
/**
* Uploads an app package. Not supported for batching
*
* @param filename Filename to create.
* @param content app package data (eg: the .app or .sppkg file).
* @param shouldOverWrite Should an app with the same name in the same location be overwritten? (default: true)
* @returns Promise<AppAddResult>
*/
AppCatalog.prototype.add = function (filename, content, shouldOverWrite) {
if (shouldOverWrite === void 0) { shouldOverWrite = true; }
var catalog = this.toUrl().indexOf("tenantappcatalog") > 0 ? "tenantappcatalog" : "sitecollectionappcatalog";
// you don't add to the availableapps collection
var adder = new AppCatalog(extractWebUrl(this.toUrl()), "_api/web/" + catalog + "/add(overwrite=" + shouldOverWrite + ",url='" + filename + "')");
return adder.postCore({
body: content,
}).then(function (r) {
return {
data: r,
file: new File(odataUrlFrom(r)),
};
});
};
return AppCatalog;
}(SharePointQueryableCollection));
/**
* Represents the actions you can preform on a given app within the catalog
*/
var App = /** @class */ (function (_super) {
__extends(App, _super);
function App() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* This method deploys an app on the app catalog. It must be called in the context
* of the tenant app catalog web or it will fail.
*
* @param skipFeatureDeployment Deploy the app to the entire tenant
*/
App.prototype.deploy = function (skipFeatureDeployment) {
if (skipFeatureDeployment === void 0) { skipFeatureDeployment = false; }
return this.clone(App, "Deploy(" + skipFeatureDeployment + ")").postCore();
};
/**
* This method retracts a deployed app on the app catalog. It must be called in the context
* of the tenant app catalog web or it will fail.
*/
App.prototype.retract = function () {
return this.clone(App, "Retract").postCore();
};
/**
* This method allows an app which is already deployed to be installed on a web
*/
App.prototype.install = function () {
return this.clone(App, "Install").postCore();
};
/**
* This method allows an app which is already insatlled to be uninstalled on a web
*/
App.prototype.uninstall = function () {
return this.clone(App, "Uninstall").postCore();
};
/**
* This method allows an app which is already insatlled to be upgraded on a web
*/
App.prototype.upgrade = function () {
return this.clone(App, "Upgrade").postCore();
};
/**
* This method removes an app from the app catalog. It must be called in the context
* of the tenant app catalog web or it will fail.
*/
App.prototype.remove = function () {
return this.clone(App, "Remove").postCore();
};
return App;
}(SharePointQueryableInstance));
/**
* Manages a batch of OData operations
*/
var SPBatch = /** @class */ (function (_super) {
__extends(SPBatch, _super);
function SPBatch(baseUrl) {
var _this = _super.call(this) || this;
_this.baseUrl = baseUrl;
return _this;
}
/**
* Parses the response from a batch request into an array of Response instances
*
* @param body Text body of the response from the batch request
*/
SPBatch.ParseResponse = function (body) {
return new Promise(function (resolve, reject) {
var responses = [];
var header = "--batchresponse_";
// Ex. "HTTP/1.1 500 Internal Server Error"
var statusRegExp = new RegExp("^HTTP/[0-9.]+ +([0-9]+) +(.*)", "i");
var lines = body.split("\n");
var state = "batch";
var status;
var statusText;
for (var i = 0; i < lines.length; ++i) {
var line = lines[i];
switch (state) {
case "batch":
if (line.substr(0, header.length) === header) {
state = "batchHeaders";
}
else {
if (line.trim() !== "") {
throw Error("Invalid response, line " + i);
}
}
break;
case "batchHeaders":
if (line.trim() === "") {
state = "status";
}
break;
case "status":
var parts = statusRegExp.exec(line);
if (parts.length !== 3) {
throw Error("Invalid status, line " + i);
}
status = parseInt(parts[1], 10);
statusText = parts[2];
state = "statusHeaders";
break;
case "statusHeaders":
if (line.trim() === "") {
state = "body";
}
break;
case "body":
responses.push((status === 204) ? new Response() : new Response(line, { status: status, statusText: statusText }));
state = "batch";
break;
}
}
if (state !== "status") {
reject(Error("Unexpected end of input"));
}
resolve(responses);
});
};
SPBatch.prototype.executeImpl = function () {
var _this = this;
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + this.batchId + "] (" + (new Date()).getTime() + ") Executing batch with " + this.requests.length + " requests.", 1 /* Info */);
// if we don't have any requests, don't bother sending anything
// this could be due to caching further upstream, or just an empty batch
if (this.requests.length < 1) {
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("Resolving empty batch.", 1 /* Info */);
return Promise.resolve();
}
// creating the client here allows the url to be populated for nodejs client as well as potentially
// any other hacks needed for other types of clients. Essentially allows the absoluteRequestUrl
// below to be correct
var client = new SPHttpClient();
// due to timing we need to get the absolute url here so we can use it for all the individual requests
// and for sending the entire batch
return toAbsoluteUrl(this.baseUrl).then(function (absoluteRequestUrl) {
// build all the requests, send them, pipe results in order to parsers
var batchBody = [];
var currentChangeSetId = "";
for (var i = 0; i < _this.requests.length; i++) {
var reqInfo = _this.requests[i];
if (reqInfo.method === "GET") {
if (currentChangeSetId.length > 0) {
// end an existing change set
batchBody.push("--changeset_" + currentChangeSetId + "--\n\n");
currentChangeSetId = "";
}
batchBody.push("--batch_" + _this.batchId + "\n");
}
else {
if (currentChangeSetId.length < 1) {
// start new change set
currentChangeSetId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
batchBody.push("--batch_" + _this.batchId + "\n");
batchBody.push("Content-Type: multipart/mixed; boundary=\"changeset_" + currentChangeSetId + "\"\n\n");
}
batchBody.push("--changeset_" + currentChangeSetId + "\n");
}
// common batch part prefix
batchBody.push("Content-Type: application/http\n");
batchBody.push("Content-Transfer-Encoding: binary\n\n");
var headers = new Headers();
// this is the url of the individual request within the batch
var url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isUrlAbsolute"])(reqInfo.url) ? reqInfo.url : Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(absoluteRequestUrl, reqInfo.url);
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + _this.batchId + "] (" + (new Date()).getTime() + ") Adding request " + reqInfo.method + " " + url + " to batch.", 0 /* Verbose */);
if (reqInfo.method !== "GET") {
var method = reqInfo.method;
var castHeaders = reqInfo.options.headers;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(reqInfo, "options") && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(reqInfo.options, "headers") && castHeaders["X-HTTP-Method"] !== undefined) {
method = castHeaders["X-HTTP-Method"];
delete castHeaders["X-HTTP-Method"];
}
batchBody.push(method + " " + url + " HTTP/1.1\n");
headers.set("Content-Type", "application/json;odata=verbose;charset=utf-8");
}
else {
batchBody.push(reqInfo.method + " " + url + " HTTP/1.1\n");
}
// merge global config headers
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, SPRuntimeConfig.headers);
// merge per-request headers
if (reqInfo.options) {
Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["mergeHeaders"])(headers, reqInfo.options.headers);
}
// lastly we apply any default headers we need that may not exist
if (!headers.has("Accept")) {
headers.append("Accept", "application/json");
}
if (!headers.has("Content-Type")) {
headers.append("Content-Type", "application/json;odata=verbose;charset=utf-8");
}
if (!headers.has("X-ClientService-ClientTag")) {
headers.append("X-ClientService-ClientTag", "PnPCoreJS:@pnp-1.3.1");
}
// write headers into batch body
headers.forEach(function (value, name) {
batchBody.push(name + ": " + value + "\n");
});
batchBody.push("\n");
if (reqInfo.options.body) {
batchBody.push(reqInfo.options.body + "\n\n");
}
}
if (currentChangeSetId.length > 0) {
// Close the changeset
batchBody.push("--changeset_" + currentChangeSetId + "--\n\n");
currentChangeSetId = "";
}
batchBody.push("--batch_" + _this.batchId + "--\n");
var batchOptions = {
"body": batchBody.join(""),
"headers": {
"Content-Type": "multipart/mixed; boundary=batch_" + _this.batchId,
},
"method": "POST",
};
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + _this.batchId + "] (" + (new Date()).getTime() + ") Sending batch request.", 1 /* Info */);
return client.fetch(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(absoluteRequestUrl, "/_api/$batch"), batchOptions)
.then(function (r) { return r.text(); })
.then(SPBatch.ParseResponse)
.then(function (responses) {
if (responses.length !== _this.requests.length) {
throw Error("Could not properly parse responses to match requests in batch.");
}
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + _this.batchId + "] (" + (new Date()).getTime() + ") Resolving batched requests.", 1 /* Info */);
return responses.reduce(function (chain, response, index) {
var request = _this.requests[index];
_pnp_logging__WEBPACK_IMPORTED_MODULE_1__["Logger"].write("[" + request.id + "] (" + (new Date()).getTime() + ") Resolving request in batch " + _this.batchId + ".", 1 /* Info */);
return chain.then(function (_) { return request.parser.parse(response).then(request.resolve).catch(request.reject); });
}, Promise.resolve());
});
});
};
return SPBatch;
}(_pnp_odata__WEBPACK_IMPORTED_MODULE_2__["ODataBatch"]));
/**
* Page promotion state
*/
var PromotedState;
(function (PromotedState) {
/**
* Regular client side page
*/
PromotedState[PromotedState["NotPromoted"] = 0] = "NotPromoted";
/**
* Page that will be promoted as news article after publishing
*/
PromotedState[PromotedState["PromoteOnPublish"] = 1] = "PromoteOnPublish";
/**
* Page that is promoted as news article
*/
PromotedState[PromotedState["Promoted"] = 2] = "Promoted";
})(PromotedState || (PromotedState = {}));
/**
* Gets the next order value 1 based for the provided collection
*
* @param collection Collection of orderable things
*/
function getNextOrder(collection) {
if (collection.length < 1) {
return 1;
}
return Math.max.apply(null, collection.map(function (i) { return i.order; })) + 1;
}
/**
* Normalizes the order value for all the sections, columns, and controls to be 1 based and stepped (1, 2, 3...)
*
* @param collection The collection to normalize
*/
function reindex(collection) {
for (var i = 0; i < collection.length; i++) {
collection[i].order = i + 1;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(collection[i], "columns")) {
reindex(collection[i].columns);
}
else if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(collection[i], "controls")) {
reindex(collection[i].controls);
}
}
}
/**
* Represents the data and methods associated with client side "modern" pages
*/
var ClientSidePage = /** @class */ (function (_super) {
__extends(ClientSidePage, _super);
/**
* PLEASE DON'T USE THIS CONSTRUCTOR DIRECTLY
*
*/
function ClientSidePage(baseUrl, path, json, noInit, sections, commentsDisabled) {
if (noInit === void 0) { noInit = false; }
if (sections === void 0) { sections = []; }
if (commentsDisabled === void 0) { commentsDisabled = false; }
var _this = _super.call(this, baseUrl, path) || this;
_this.json = json;
_this.sections = sections;
_this.commentsDisabled = commentsDisabled;
// ensure we have a good url to build on for the pages api
if (typeof baseUrl === "string") {
_this._parentUrl = "";
_this._url = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["combine"])(extractWebUrl(baseUrl), path);
}
else {
_this.extend(ClientSidePage.initFrom(baseUrl, null), path);
}
// set a default page settings slice
_this._pageSettings = { controlType: 0, pageSettingsSlice: { isDefaultDescription: true, isDefaultThumbnail: true } };
// set a default layout part
_this._layoutPart = ClientSidePage.getDefaultLayoutPart();
if (typeof json !== "undefined" && !noInit) {
_this.fromJSON(json);
}
return _this;
}
/**
* Creates a new blank page within the supplied library [does not work with batching]
*
* @param web Parent web in which we will create the page (we allow list here too matching the old api)
* @param pageName Filename of the page, such as "page"
* @param title The display title of the page
* @param pageLayoutType Layout type of the page to use
*/
ClientSidePage.create = function (web, pageName, title, pageLayoutType) {
if (pageLayoutType === void 0) { pageLayoutType = "Article"; }
return __awaiter(this, void 0, void 0, function () {
var pageInitData, newPage;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// patched because previously we used the full page name with the .aspx at the end
// this allows folk's existing code to work after the re-write to the new API
pageName = pageName.replace(/\.aspx$/i, "");
return [4 /*yield*/, ClientSidePage.initFrom(web, "_api/sitepages/pages").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object.assign(metadata("SP.Publishing.SitePage"), {
PageLayoutType: pageLayoutType,
})),
})];
case 1:
pageInitData = _a.sent();
newPage = new ClientSidePage(web, "", pageInitData);
// newPage.authors = [currentUserLogin.UserPrincipalName];
newPage.title = pageName;
return [4 /*yield*/, newPage.save(false)];
case 2:
_a.sent();
newPage.title = title;
return [2 /*return*/, newPage];
}
});
});
};
/**
* Creates a new ClientSidePage instance from the provided html content string
*
* @param html HTML markup representing the page
*/
ClientSidePage.fromFile = function (file) {
return file.getItem().then(function (i) {
var page = new ClientSidePage(extractWebUrl(file.toUrl()), "", { Id: i.Id }, true);
return page.configureFrom(file).load();
});
};
ClientSidePage.getDefaultLayoutPart = function () {
var layoutId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
return {
dataVersion: "1.4",
description: "Title Region Description",
id: layoutId,
instanceId: layoutId,
properties: {
authorByline: [],
authors: [],
layoutType: "FullWidthImage",
showPublishDate: false,
showTopicHeader: false,
textAlignment: "Left",
title: "",
topicHeader: "",
},
serverProcessedContent: { htmlStrings: {}, searchablePlainTexts: {}, imageSources: {}, links: {} },
title: "Title area",
};
};
ClientSidePage.initFrom = function (o, url) {
return (new ClientSidePage(extractWebUrl(o.toUrl()), url)).configureFrom(o);
};
Object.defineProperty(ClientSidePage.prototype, "pageLayout", {
get: function () {
return this.json.PageLayoutType;
},
set: function (value) {
this.json.PageLayoutType = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "bannerImageUrl", {
get: function () {
return this.json.BannerImageUrl;
},
set: function (value) {
delete this._layoutPart.serverProcessedContent.customMetadata.imageSource;
delete this._layoutPart.properties.webId;
delete this._layoutPart.properties.siteId;
delete this._layoutPart.properties.listId;
delete this._layoutPart.properties.uniqueId;
this._layoutPart.serverProcessedContent.imageSources = { imageSource: value };
this.json.BannerImageUrl = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "bannerImageSourceType", {
get: function () {
return this._layoutPart.properties.imageSourceType;
},
set: function (value) {
this._layoutPart.properties.imageSourceType = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "topicHeader", {
get: function () {
return this.json.TopicHeader;
},
set: function (value) {
this.json.TopicHeader = value;
this._layoutPart.properties.topicHeader = value;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["stringIsNullOrEmpty"])(value)) {
this.showTopicHeader = false;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "title", {
// public get authors(): string[] {
// return this._layoutPart.properties.authorByline;
// }
// public set authors(value: string[]) {
// this.json.AuthorByline = value;
// this._layoutPart.properties.authorByline = value;
// this._layoutPart.properties.authors = null;
// }
get: function () {
return this._layoutPart.properties.title;
},
set: function (value) {
this.json.Title = value;
this._layoutPart.properties.title = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "layoutType", {
get: function () {
return this._layoutPart.properties.layoutType;
},
set: function (value) {
this._layoutPart.properties.layoutType = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "headerTextAlignment", {
get: function () {
return this._layoutPart.properties.textAlignment;
},
set: function (value) {
this._layoutPart.properties.textAlignment = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "showTopicHeader", {
get: function () {
return this._layoutPart.properties.showTopicHeader;
},
set: function (value) {
this._layoutPart.properties.showTopicHeader = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSidePage.prototype, "showPublishDate", {
get: function () {
return this._layoutPart.properties.showPublishDate;
},
set: function (value) {
this._layoutPart.properties.showPublishDate = value;
},
enumerable: true,
configurable: true
});
/**
* Add a section to this page
*/
ClientSidePage.prototype.addSection = function () {
var section = new CanvasSection(this, getNextOrder(this.sections));
this.sections.push(section);
return section;
};
ClientSidePage.prototype.fromJSON = function (pageData) {
this.json = pageData;
var canvasControls = JSON.parse(pageData.CanvasContent1);
var layouts = JSON.parse(pageData.LayoutWebpartsContent);
if (layouts && layouts.length > 0) {
this._layoutPart = layouts[0];
}
this.setControls(canvasControls);
return this;
};
/**
* Loads this page's content from the server
*/
ClientSidePage.prototype.load = function () {
var _this = this;
// load item id, then load page data from new pages api
return this.getItem("Id", "CommentsDisabled").then(function (item) {
return (new SharePointQueryable(_this, "_api/sitepages/pages(" + item.Id + ")")).get().then(function (pageData) {
_this.commentsDisabled = item.CommentsDisabled;
return _this.fromJSON(pageData);
});
});
};
/**
* Persists the content changes (sections, columns, and controls) [does not work with batching]
*
* @param publish If true the page is published, if false the changes are persisted to SharePoint but not published
*/
ClientSidePage.prototype.save = function (publish) {
var _this = this;
if (publish === void 0) { publish = true; }
if (this.json.Id === null) {
throw Error("The id for this page is null. If you want to create a new page, please use ClientSidePage.Create");
}
// we will chain our work on this promise
var promise = Promise.resolve({});
// we need to update our authors if they have changed
// if (this._layoutPart.properties.authors === null && this._layoutPart.properties.authorByline.length > 0) {
// promise = promise.then(_ => new Promise(resolve => {
// const collector: any[] = [];
// const userResolver = ClientSidePage.getPoster("/_api/SP.UI.ApplicationPages.ClientPeoplePickerWebServiceInterface.ClientPeoplePickerResolveUser");
// this._layoutPart.properties.authorByline.forEach(async author => {
// const userData = await userResolver.postCore({
// body: jsS({
// queryParams: {
// AllowEmailAddresses: false,
// MaximumEntitySuggestions: 1,
// PrincipalSource: 15,
// PrincipalType: 1,
// QueryString: author,
// SharePointGroupID: 0,
// },
// }),
// });
// collector.push({
// email: userData.EntityData.Email,
// id: userData.Key,
// name: userData.DisplayName,
// role: "",
// upn: userData.EntityData.Email,
// });
// });
// this._layoutPart.properties.authors = collector;
// resolve();
// }));
// }
// we try and check out the page for the user
if (!this.json.IsPageCheckedOutToCurrentUser) {
promise = promise.then(function (_) { return (ClientSidePage.initFrom(_this, "_api/sitepages/pages(" + _this.json.Id + ")/checkoutpage")).postCore(); });
}
promise = promise.then(function (_) { return (ClientSidePage.initFrom(_this, "_api/sitepages/pages(" + _this.json.Id + ")/savepage")).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object.assign(metadata("SP.Publishing.SitePage"), {
AuthorByline: _this.json.AuthorByline,
BannerImageUrl: _this.json.BannerImageUrl,
CanvasContent1: _this.getCanvasContent1(),
LayoutWebpartsContent: _this.getLayoutWebpartsContent(),
Title: _this.title,
TopicHeader: _this.topicHeader,
})),
}); });
if (publish) {
promise = promise.then(function (_) { return (ClientSidePage.initFrom(_this, "_api/sitepages/pages(" + _this.json.Id + ")/publish")).postCore(); }).then(function (r) {
if (r) {
_this.json.IsPageCheckedOutToCurrentUser = false;
}
});
}
return promise;
};
ClientSidePage.prototype.discardPageCheckout = function () {
var _this = this;
if (this.json.Id === null) {
throw Error("The id for this page is null. If you want to create a new page, please use ClientSidePage.Create");
}
return ClientSidePage.initFrom(this, "_api/sitepages/pages(" + this.json.Id + ")/discardPage").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(metadata("SP.Publishing.SitePage")),
}).then(function (d) {
_this.fromJSON(d);
});
};
/**
* Enables comments on this page
*/
ClientSidePage.prototype.enableComments = function () {
var _this = this;
return this.setCommentsOn(true).then(function (r) {
_this.commentsDisabled = false;
return r;
});
};
/**
* Disables comments on this page
*/
ClientSidePage.prototype.disableComments = function () {
var _this = this;
return this.setCommentsOn(false).then(function (r) {
_this.commentsDisabled = true;
return r;
});
};
/**
* Finds a control by the specified instance id
*
* @param id Instance id of the control to find
*/
ClientSidePage.prototype.findControlById = function (id) {
return this.findControl(function (c) { return c.id === id; });
};
/**
* Finds a control within this page's control tree using the supplied predicate
*
* @param predicate Takes a control and returns true or false, if true that control is returned by findControl
*/
ClientSidePage.prototype.findControl = function (predicate) {
// check all sections
for (var i = 0; i < this.sections.length; i++) {
// check all columns
for (var j = 0; j < this.sections[i].columns.length; j++) {
// check all controls
for (var k = 0; k < this.sections[i].columns[j].controls.length; k++) {
// check to see if the predicate likes this control
if (predicate(this.sections[i].columns[j].controls[k])) {
return this.sections[i].columns[j].controls[k];
}
}
}
}
// we found nothing so give nothing back
return null;
};
/**
* Like the modern site page
*/
ClientSidePage.prototype.like = function () {
return this.getItem().then(function (i) {
return i.like();
});
};
/**
* Unlike the modern site page
*/
ClientSidePage.prototype.unlike = function () {
return this.getItem().then(function (i) {
return i.unlike();
});
};
/**
* Get the liked by information for a modern site page
*/
ClientSidePage.prototype.getLikedByInformation = function () {
return this.getItem().then(function (i) {
return i.getLikedByInformation();
});
};
/**
* Creates a copy of this page
*
* @param web The web where we will create the copy
* @param pageName The file name of the new page
* @param title The title of the new page
* @param publish If true the page will be published
*/
ClientSidePage.prototype.copyPage = function (web, pageName, title, publish) {
if (publish === void 0) { publish = true; }
return __awaiter(this, void 0, void 0, function () {
var page;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, ClientSidePage.create(web, pageName, title, this.pageLayout)];
case 1:
page = _a.sent();
page.setControls(this.getControls());
return [4 /*yield*/, page.save(publish)];
case 2:
_a.sent();
return [2 /*return*/, page];
}
});
});
};
/**
* Sets the modern page banner image
*
* @param url Url of the image to display
* @param altText Alt text to describe the image
* @param bannerProps Additional properties to control display of the banner
*/
ClientSidePage.prototype.setBannerImage = function (url, props) {
this.bannerImageUrl = url;
this.bannerImageSourceType = 2; // this seems to always be true, so default?
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(props)) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(props, "translateX")) {
this._layoutPart.properties.translateX = props.translateX;
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(props, "translateY")) {
this._layoutPart.properties.translateY = props.translateY;
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(props, "imageSourceType")) {
this.bannerImageSourceType = props.imageSourceType;
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(props, "altText")) {
this._layoutPart.properties.altText = props.altText;
}
}
};
ClientSidePage.prototype.getCanvasContent1 = function () {
return JSON.stringify(this.getControls());
};
ClientSidePage.prototype.getLayoutWebpartsContent = function () {
if (this._layoutPart) {
return JSON.stringify([this._layoutPart]);
}
else {
return JSON.stringify(null);
}
};
ClientSidePage.prototype.setControls = function (controls) {
if (controls && controls.length) {
for (var i = 0; i < controls.length; i++) {
// if no control type is present this is a column which we give type 0 to let us process it
var controlType = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(controls[i], "controlType") ? controls[i].controlType : 0;
switch (controlType) {
case 0:
// empty canvas column or page settings
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(controls[i], "pageSettingsSlice")) {
this._pageSettings = controls[i];
}
else {
// we have an empty column
this.mergeColumnToTree(new CanvasColumn(controls[i]));
}
break;
case 3:
var part = new ClientSideWebpart(controls[i]);
this.mergePartToTree(part, part.data.position);
break;
case 4:
var textData = controls[i];
var text = new ClientSideText(textData.innerHTML, textData);
this.mergePartToTree(text, text.data.position);
break;
}
}
reindex(this.sections);
}
};
ClientSidePage.prototype.getControls = function () {
var _this = this;
// reindex things
reindex(this.sections);
// rollup the control changes
var canvasData = [];
this.sections.forEach(function (section) {
section.columns.forEach(function (column) {
if (column.controls.length < 1) {
// empty column
canvasData.push({
displayMode: column.data.displayMode,
emphasis: _this.getEmphasisObj(section.emphasis),
position: column.data.position,
});
}
else {
column.controls.forEach(function (control) {
control.data.emphasis = _this.getEmphasisObj(section.emphasis);
canvasData.push(control.data);
});
}
});
});
canvasData.push(this._pageSettings);
return canvasData;
};
ClientSidePage.prototype.getEmphasisObj = function (value) {
if (value < 1 || value > 3) {
return {};
}
return { zoneEmphasis: value };
};
/**
* Sets the comments flag for a page
*
* @param on If true comments are enabled, false they are disabled
*/
ClientSidePage.prototype.setCommentsOn = function (on) {
return this.getItem().then(function (i) {
var updater = new Item(i, "SetCommentsDisabled(" + !on + ")");
return updater.update({});
});
};
/**
* Merges the control into the tree of sections and columns for this page
*
* @param control The control to merge
*/
ClientSidePage.prototype.mergePartToTree = function (control, positionData) {
var section = null;
var column = null;
var sectionFactor = 12;
var sectionIndex = 0;
var zoneIndex = 0;
// handle case where we don't have position data (shouldn't happen?)
if (positionData) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(positionData, "zoneIndex")) {
zoneIndex = positionData.zoneIndex;
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(positionData, "sectionIndex")) {
sectionIndex = positionData.sectionIndex;
}
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(positionData, "sectionFactor")) {
sectionFactor = positionData.sectionFactor;
}
}
var sections = this.sections.filter(function (s) { return s.order === zoneIndex; });
if (sections.length < 1) {
section = new CanvasSection(this, zoneIndex);
this.sections.push(section);
}
else {
section = sections[0];
}
section.emphasis = control.data.emphasis.zoneEmphasis || 0;
var columns = section.columns.filter(function (c) { return c.order === sectionIndex; });
if (columns.length < 1) {
column = section.addColumn(sectionFactor);
}
else {
column = columns[0];
}
control.column = column;
column.addControl(control);
};
/**
* Merges the supplied column into the tree
*
* @param column Column to merge
* @param position The position data for the column
*/
ClientSidePage.prototype.mergeColumnToTree = function (column) {
var order = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(column.data, "position") && Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(column.data.position, "zoneIndex") ? column.data.position.zoneIndex : 0;
var section = null;
var sections = this.sections.filter(function (s) { return s.order === order; });
if (sections.length < 1) {
section = new CanvasSection(this, order);
section.emphasis = column.data.emphasis.zoneEmphasis || 0;
this.sections.push(section);
}
else {
section = sections[0];
}
column.section = section;
section.columns.push(column);
};
ClientSidePage.prototype.getItem = function () {
var _this = this;
var selects = [];
for (var _i = 0; _i < arguments.length; _i++) {
selects[_i] = arguments[_i];
}
var initer = ClientSidePage.initFrom(this, "/_api/lists/EnsureClientRenderedSitePagesLibrary").select("EnableModeration", "EnableMinorVersions", "Id");
return initer.postCore().then(function (listData) {
var item = (new List(listData["odata.id"])).configureFrom(_this).items.getById(_this.json.Id);
return item.select.apply(item, selects).get().then(function (d) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])((new Item(odataUrlFrom(d))).configureFrom(_this), d);
});
});
};
return ClientSidePage;
}(SharePointQueryable));
var CanvasSection = /** @class */ (function () {
function CanvasSection(page, order, columns, _emphasis) {
if (columns === void 0) { columns = []; }
if (_emphasis === void 0) { _emphasis = 0; }
this.page = page;
this.columns = columns;
this._emphasis = _emphasis;
this._memId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
this._order = order;
}
Object.defineProperty(CanvasSection.prototype, "order", {
get: function () {
return this._order;
},
set: function (value) {
this._order = value;
for (var i = 0; i < this.columns.length; i++) {
this.columns[i].data.position.zoneIndex = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(CanvasSection.prototype, "defaultColumn", {
/**
* Default column (this.columns[0]) for this section
*/
get: function () {
if (this.columns.length < 1) {
this.addColumn(12);
}
return this.columns[0];
},
enumerable: true,
configurable: true
});
/**
* Adds a new column to this section
*/
CanvasSection.prototype.addColumn = function (factor) {
var column = new CanvasColumn();
column.section = this;
column.data.position.zoneIndex = this.order;
column.data.position.sectionFactor = factor;
column.order = getNextOrder(this.columns);
this.columns.push(column);
return column;
};
/**
* Adds a control to the default column for this section
*
* @param control Control to add to the default column
*/
CanvasSection.prototype.addControl = function (control) {
this.defaultColumn.addControl(control);
return this;
};
Object.defineProperty(CanvasSection.prototype, "emphasis", {
get: function () {
return this._emphasis;
},
set: function (value) {
this._emphasis = value;
},
enumerable: true,
configurable: true
});
/**
* Removes this section and all contained columns and controls from the collection
*/
CanvasSection.prototype.remove = function () {
var _this = this;
this.page.sections = this.page.sections.filter(function (section) { return section._memId !== _this._memId; });
reindex(this.page.sections);
};
return CanvasSection;
}());
var CanvasColumn = /** @class */ (function () {
function CanvasColumn(json, controls) {
if (json === void 0) { json = JSON.parse(JSON.stringify(CanvasColumn.Default)); }
if (controls === void 0) { controls = []; }
this.json = json;
this.controls = controls;
this._section = null;
this._memId = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
}
Object.defineProperty(CanvasColumn.prototype, "data", {
get: function () {
return this.json;
},
enumerable: true,
configurable: true
});
Object.defineProperty(CanvasColumn.prototype, "section", {
get: function () {
return this._section;
},
set: function (section) {
this._section = section;
},
enumerable: true,
configurable: true
});
Object.defineProperty(CanvasColumn.prototype, "order", {
get: function () {
return this.data.position.sectionIndex;
},
set: function (value) {
this.data.position.sectionIndex = value;
for (var i = 0; i < this.controls.length; i++) {
this.controls[i].data.position.zoneIndex = this.data.position.zoneIndex;
this.controls[i].data.position.sectionIndex = value;
}
},
enumerable: true,
configurable: true
});
Object.defineProperty(CanvasColumn.prototype, "factor", {
get: function () {
return this.data.position.sectionFactor;
},
set: function (value) {
this.data.position.sectionFactor = value;
},
enumerable: true,
configurable: true
});
CanvasColumn.prototype.addControl = function (control) {
control.column = this;
this.controls.push(control);
return this;
};
CanvasColumn.prototype.getControl = function (index) {
return this.controls[index];
};
CanvasColumn.prototype.remove = function () {
var _this = this;
this.section.columns = this.section.columns.filter(function (column) { return column._memId !== _this._memId; });
reindex(this.section.columns);
};
CanvasColumn.Default = {
controlType: 0,
displayMode: 2,
emphasis: {},
position: {
layoutIndex: 1,
sectionFactor: 12,
sectionIndex: 1,
zoneIndex: 1,
},
};
return CanvasColumn;
}());
var ColumnControl = /** @class */ (function () {
function ColumnControl(json) {
this.json = json;
}
Object.defineProperty(ColumnControl.prototype, "id", {
get: function () {
return this.json.id;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ColumnControl.prototype, "data", {
get: function () {
return this.json;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ColumnControl.prototype, "column", {
get: function () {
return this._column;
},
set: function (value) {
this._column = value;
this.onColumnChange(this._column);
},
enumerable: true,
configurable: true
});
ColumnControl.prototype.remove = function () {
var _this = this;
this.column.controls = this.column.controls.filter(function (control) { return control.id !== _this.id; });
reindex(this.column.controls);
};
ColumnControl.prototype.setData = function (data) {
this.json = data;
};
return ColumnControl;
}());
var ClientSideText = /** @class */ (function (_super) {
__extends(ClientSideText, _super);
function ClientSideText(text, json) {
if (json === void 0) { json = JSON.parse(JSON.stringify(ClientSideText.Default)); }
var _this = this;
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["stringIsNullOrEmpty"])(json.id)) {
json.id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
json.anchorComponentId = json.id;
}
_this = _super.call(this, json) || this;
_this.text = text;
return _this;
}
Object.defineProperty(ClientSideText.prototype, "text", {
get: function () {
return this.data.innerHTML;
},
set: function (value) {
if (!value.startsWith("<p>")) {
value = "<p>" + value + "</p>";
}
this.data.innerHTML = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideText.prototype, "order", {
get: function () {
return this.data.position.controlIndex;
},
set: function (value) {
this.data.position.controlIndex = value;
},
enumerable: true,
configurable: true
});
ClientSideText.prototype.onColumnChange = function (col) {
this.data.position.sectionFactor = col.factor;
this.data.position.controlIndex = getNextOrder(col.controls);
this.data.position.zoneIndex = col.data.position.zoneIndex;
this.data.position.sectionIndex = col.order;
};
ClientSideText.Default = {
addedFromPersistedData: false,
anchorComponentId: "",
controlType: 4,
displayMode: 2,
editorType: "CKEditor",
emphasis: {},
id: "",
innerHTML: "",
position: {
controlIndex: 1,
layoutIndex: 1,
sectionFactor: 12,
sectionIndex: 1,
zoneIndex: 1,
},
};
return ClientSideText;
}(ColumnControl));
var ClientSideWebpart = /** @class */ (function (_super) {
__extends(ClientSideWebpart, _super);
function ClientSideWebpart(json) {
if (json === void 0) { json = JSON.parse(JSON.stringify(ClientSideWebpart.Default)); }
return _super.call(this, json) || this;
}
ClientSideWebpart.fromComponentDef = function (definition) {
var part = new ClientSideWebpart();
part.import(definition);
return part;
};
Object.defineProperty(ClientSideWebpart.prototype, "title", {
get: function () {
return this.data.webPartData.title;
},
set: function (value) {
this.data.webPartData.title = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideWebpart.prototype, "description", {
get: function () {
return this.data.webPartData.description;
},
set: function (value) {
this.data.webPartData.description = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideWebpart.prototype, "order", {
get: function () {
return this.data.position.controlIndex;
},
set: function (value) {
this.data.position.controlIndex = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideWebpart.prototype, "height", {
get: function () {
return this.data.reservedHeight;
},
set: function (value) {
this.data.reservedHeight = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideWebpart.prototype, "width", {
get: function () {
return this.data.reservedWidth;
},
set: function (value) {
this.data.reservedWidth = value;
},
enumerable: true,
configurable: true
});
Object.defineProperty(ClientSideWebpart.prototype, "dataVersion", {
get: function () {
return this.data.webPartData.dataVersion;
},
set: function (value) {
this.data.webPartData.dataVersion = value;
},
enumerable: true,
configurable: true
});
ClientSideWebpart.prototype.setProperties = function (properties) {
this.data.webPartData.properties = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(this.data.webPartData.properties, properties);
return this;
};
ClientSideWebpart.prototype.getProperties = function () {
return this.data.webPartData.properties;
};
ClientSideWebpart.prototype.onColumnChange = function (col) {
this.data.position.sectionFactor = col.factor;
this.data.position.controlIndex = getNextOrder(col.controls);
this.data.position.zoneIndex = col.data.position.zoneIndex;
this.data.position.sectionIndex = col.data.position.sectionIndex;
};
ClientSideWebpart.prototype.import = function (component) {
var id = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getGUID"])();
var componendId = component.Id.replace(/^\{|\}$/g, "").toLowerCase();
var manifest = JSON.parse(component.Manifest);
var preconfiguredEntries = manifest.preconfiguredEntries[0];
this.setData(Object.assign({}, this.data, {
id: id,
webPartData: {
dataVersion: "1.0",
description: preconfiguredEntries.description.default,
id: componendId,
instanceId: id,
properties: preconfiguredEntries.properties,
title: preconfiguredEntries.title.default,
},
webPartId: componendId,
}));
};
ClientSideWebpart.Default = {
addedFromPersistedData: false,
controlType: 3,
displayMode: 2,
emphasis: {},
id: null,
position: {
controlIndex: 1,
sectionFactor: 12,
sectionIndex: 1,
zoneIndex: 1,
},
reservedHeight: 500,
reservedWidth: 500,
webPartData: null,
webPartId: null,
};
return ClientSideWebpart;
}(ColumnControl));
/**
* Represents a collection of navigation nodes
*
*/
var NavigationNodes = /** @class */ (function (_super) {
__extends(NavigationNodes, _super);
function NavigationNodes() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a navigation node by id
*
* @param id The id of the node
*/
NavigationNodes.prototype.getById = function (id) {
var node = new NavigationNode(this);
node.concat("(" + id + ")");
return node;
};
/**
* Adds a new node to the collection
*
* @param title Display name of the node
* @param url The url of the node
* @param visible If true the node is visible, otherwise it is hidden (default: true)
*/
NavigationNodes.prototype.add = function (title, url, visible) {
var _this = this;
if (visible === void 0) { visible = true; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.NavigationNode"), {
IsVisible: visible,
Title: title,
Url: url,
}));
return this.clone(NavigationNodes, null).postCore({ body: postBody }).then(function (data) {
return {
data: data,
node: _this.getById(data.Id),
};
});
};
/**
* Moves a node to be after another node in the navigation
*
* @param nodeId Id of the node to move
* @param previousNodeId Id of the node after which we move the node specified by nodeId
*/
NavigationNodes.prototype.moveAfter = function (nodeId, previousNodeId) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
nodeId: nodeId,
previousNodeId: previousNodeId,
});
return this.clone(NavigationNodes, "MoveAfter").postCore({ body: postBody });
};
return NavigationNodes;
}(SharePointQueryableCollection));
/**
* Represents an instance of a navigation node
*
*/
var NavigationNode = /** @class */ (function (_super) {
__extends(NavigationNode, _super);
function NavigationNode() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(NavigationNode.prototype, "children", {
/**
* Represents the child nodes of this node
*/
get: function () {
return new NavigationNodes(this, "Children");
},
enumerable: true,
configurable: true
});
/**
* Deletes this node and any child nodes
*/
NavigationNode.prototype.delete = function () {
return _super.prototype.deleteCore.call(this);
};
/**
* Updates this node
*
* @param properties Properties used to update this node
*/
NavigationNode.prototype.update = function (properties) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"__metadata": { "type": "SP.NavigationNode" },
}, properties));
return this.postCore({
body: postBody,
headers: {
"X-HTTP-Method": "MERGE",
},
}).then(function (data) {
return {
data: data,
node: _this,
};
});
};
return NavigationNode;
}(SharePointQueryableInstance));
/**
* Exposes the navigation components
*
*/
var Navigation = /** @class */ (function (_super) {
__extends(Navigation, _super);
function Navigation() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(Navigation.prototype, "quicklaunch", {
/**
* Gets the quicklaunch navigation nodes for the current context
*
*/
get: function () {
return new NavigationNodes(this, "quicklaunch");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Navigation.prototype, "topNavigationBar", {
/**
* Gets the top bar navigation nodes for the current context
*
*/
get: function () {
return new NavigationNodes(this, "topnavigationbar");
},
enumerable: true,
configurable: true
});
Navigation = __decorate([
defaultPath("navigation")
], Navigation);
return Navigation;
}(SharePointQueryable));
/**
* Represents the top level navigation service
*/
var NavigationService = /** @class */ (function (_super) {
__extends(NavigationService, _super);
function NavigationService(baseUrl, path) {
if (path === void 0) { path = null; }
return _super.call(this, baseUrl, path) || this;
}
/**
* The MenuState service operation returns a Menu-State (dump) of a SiteMapProvider on a site.
*
* @param menuNodeKey MenuNode.Key of the start node within the SiteMapProvider If no key is provided the SiteMapProvider.RootNode will be the root of the menu state.
* @param depth Depth of the dump. If no value is provided a dump with the depth of 10 is returned
* @param mapProviderName The name identifying the SiteMapProvider to be used
* @param customProperties comma seperated list of custom properties to be returned.
*/
NavigationService.prototype.getMenuState = function (menuNodeKey, depth, mapProviderName, customProperties) {
if (menuNodeKey === void 0) { menuNodeKey = null; }
if (depth === void 0) { depth = 10; }
if (mapProviderName === void 0) { mapProviderName = null; }
if (customProperties === void 0) { customProperties = null; }
return (new NavigationService(this, "_api/navigation/MenuState")).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
customProperties: customProperties,
depth: depth,
mapProviderName: mapProviderName,
menuNodeKey: menuNodeKey,
}),
});
};
/**
* Tries to get a SiteMapNode.Key for a given URL within a site collection.
*
* @param currentUrl A url representing the SiteMapNode
* @param mapProviderName The name identifying the SiteMapProvider to be used
*/
NavigationService.prototype.getMenuNodeKey = function (currentUrl, mapProviderName) {
if (mapProviderName === void 0) { mapProviderName = null; }
return (new NavigationService(this, "_api/navigation/MenuNodeKey")).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
currentUrl: currentUrl,
mapProviderName: mapProviderName,
}),
});
};
return NavigationService;
}(SharePointQueryable));
/**
* Describes regional settings ODada object
*/
var RegionalSettings = /** @class */ (function (_super) {
__extends(RegionalSettings, _super);
function RegionalSettings() {
return _super !== null && _super.apply(this, arguments) || this;
}
Object.defineProperty(RegionalSettings.prototype, "installedLanguages", {
/**
* Gets the collection of languages used in a server farm.
*/
get: function () {
return new InstalledLanguages(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RegionalSettings.prototype, "globalInstalledLanguages", {
/**
* Gets the collection of language packs that are installed on the server.
*/
get: function () {
return new InstalledLanguages(this, "globalinstalledlanguages");
},
enumerable: true,
configurable: true
});
Object.defineProperty(RegionalSettings.prototype, "timeZone", {
/**
* Gets time zone
*/
get: function () {
return new TimeZone(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(RegionalSettings.prototype, "timeZones", {
/**
* Gets time zones
*/
get: function () {
return new TimeZones(this);
},
enumerable: true,
configurable: true
});
RegionalSettings = __decorate([
defaultPath("regionalsettings")
], RegionalSettings);
return RegionalSettings;
}(SharePointQueryableInstance));
/**
* Describes installed languages ODada queriable collection
*/
var InstalledLanguages = /** @class */ (function (_super) {
__extends(InstalledLanguages, _super);
function InstalledLanguages() {
return _super !== null && _super.apply(this, arguments) || this;
}
InstalledLanguages = __decorate([
defaultPath("installedlanguages")
], InstalledLanguages);
return InstalledLanguages;
}(SharePointQueryableCollection));
/**
* Describes TimeZone ODada object
*/
var TimeZone = /** @class */ (function (_super) {
__extends(TimeZone, _super);
function TimeZone() {
return _super !== null && _super.apply(this, arguments) || this;
}
TimeZone_1 = TimeZone;
/**
* Gets an Local Time by UTC Time
*
* @param utcTime UTC Time as Date or ISO String
*/
TimeZone.prototype.utcToLocalTime = function (utcTime) {
var dateIsoString;
if (typeof utcTime === "string") {
dateIsoString = utcTime;
}
else {
dateIsoString = utcTime.toISOString();
}
return this.clone(TimeZone_1, "utctolocaltime('" + dateIsoString + "')")
.postCore()
.then(function (res) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(res, "UTCToLocalTime") ? res.UTCToLocalTime : res; });
};
/**
* Gets an UTC Time by Local Time
*
* @param localTime Local Time as Date or ISO String
*/
TimeZone.prototype.localTimeToUTC = function (localTime) {
var dateIsoString;
if (typeof localTime === "string") {
dateIsoString = localTime;
}
else {
dateIsoString = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["dateAdd"])(localTime, "minute", localTime.getTimezoneOffset() * -1).toISOString();
}
return this.clone(TimeZone_1, "localtimetoutc('" + dateIsoString + "')")
.postCore()
.then(function (res) { return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(res, "LocalTimeToUTC") ? res.LocalTimeToUTC : res; });
};
var TimeZone_1;
TimeZone = TimeZone_1 = __decorate([
defaultPath("timezone")
], TimeZone);
return TimeZone;
}(SharePointQueryableInstance));
/**
* Describes time zones queriable collection
*/
var TimeZones = /** @class */ (function (_super) {
__extends(TimeZones, _super);
function TimeZones() {
return _super !== null && _super.apply(this, arguments) || this;
}
TimeZones_1 = TimeZones;
// https://msdn.microsoft.com/en-us/library/office/jj247008.aspx - timezones ids
/**
* Gets an TimeZone by id
*
* @param id The integer id of the timezone to retrieve
*/
TimeZones.prototype.getById = function (id) {
// do the post and merge the result into a TimeZone instance so the data and methods are available
return this.clone(TimeZones_1, "GetById(" + id + ")").postCore({}, spODataEntity(TimeZone));
};
var TimeZones_1;
TimeZones = TimeZones_1 = __decorate([
defaultPath("timezones")
], TimeZones);
return TimeZones;
}(SharePointQueryableCollection));
var funcs = new Map([
["text", "Querytext"],
["template", "QueryTemplate"],
["sourceId", "SourceId"],
["trimDuplicatesIncludeId", ""],
["startRow", ""],
["rowLimit", ""],
["rankingModelId", ""],
["rowsPerPage", ""],
["selectProperties", ""],
["culture", ""],
["timeZoneId", ""],
["refinementFilters", ""],
["refiners", ""],
["hiddenConstraints", ""],
["sortList", ""],
["timeout", ""],
["hithighlightedProperties", ""],
["clientType", ""],
["personalizationData", ""],
["resultsURL", ""],
["queryTag", ""],
["properties", ""],
["queryTemplatePropertiesUrl", ""],
["reorderingRules", ""],
["hitHighlightedMultivaluePropertyLimit", ""],
["collapseSpecification", ""],
["uiLanguage", ""],
["desiredSnippetLength", ""],
["maxSnippetLength", ""],
["summaryLength", ""],
]);
var props = new Map([]);
function toPropCase(str) {
return str.replace(/^(.)/, function ($1) { return $1.toUpperCase(); });
}
/**
* Creates a new instance of the SearchQueryBuilder
*
* @param queryText Initial query text
* @param _query Any initial query configuration
*/
function SearchQueryBuilder(queryText, _query) {
if (queryText === void 0) { queryText = ""; }
if (_query === void 0) { _query = {}; }
return new Proxy({
query: Object.assign({
Querytext: queryText,
}, _query),
}, {
get: function (self, propertyKey, proxy) {
var pk = propertyKey.toString();
if (pk === "toSearchQuery") {
return function () { return self.query; };
}
if (funcs.has(pk)) {
return function () {
var value = [];
for (var _i = 0; _i < arguments.length; _i++) {
value[_i] = arguments[_i];
}
var mappedPk = funcs.get(pk);
self.query[mappedPk.length > 0 ? mappedPk : toPropCase(pk)] = value.length > 1 ? value : value[0];
return proxy;
};
}
var propKey = props.has(pk) ? props.get(pk) : toPropCase(pk);
self.query[propKey] = true;
return proxy;
},
});
}
/**
* Describes the search API
*
*/
var Search = /** @class */ (function (_super) {
__extends(Search, _super);
function Search() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* @returns Promise
*/
Search.prototype.execute = function (queryInit) {
var _this = this;
var query = this.parseQuery(queryInit);
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
request: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("Microsoft.Office.Server.Search.REST.SearchRequest"), Object.assign({}, query, {
HitHighlightedProperties: this.fixArrProp(query.HitHighlightedProperties),
Properties: this.fixArrProp(query.Properties),
RefinementFilters: this.fixArrProp(query.RefinementFilters),
ReorderingRules: this.fixArrProp(query.ReorderingRules),
SelectProperties: this.fixArrProp(query.SelectProperties),
SortList: this.fixArrProp(query.SortList),
})),
});
// if we are using caching with this search request, then we need to handle some work upfront to enable that
if (this._useCaching) {
// force use of the cache for this request if .usingCaching was called
this._forceCaching = true;
// because all the requests use the same url they would collide in the cache we use a special key
var cacheKey = "PnPjs.SearchWithCaching(" + Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["getHashCode"])(postBody) + ")";
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["objectDefinedNotNull"])(this._cachingOptions)) {
// if our key ends in the postquery url we overwrite it
if (/\/_api\/search\/postquery$/i.test(this._cachingOptions.key)) {
this._cachingOptions.key = cacheKey;
}
}
else {
this._cachingOptions = new _pnp_odata__WEBPACK_IMPORTED_MODULE_2__["CachingOptions"](cacheKey);
}
}
return this.postCore({ body: postBody }).then(function (data) { return new SearchResults(data, _this.toUrl(), query); });
};
/**
* Fix array property
*
* @param prop property to fix for container struct
*/
Search.prototype.fixArrProp = function (prop) {
if (typeof prop === "undefined") {
return ({ results: [] });
}
prop = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["isArray"])(prop) ? prop : [prop];
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(prop, "results") ? prop : { results: prop };
};
/**
* Translates one of the query initializers into a SearchQuery instance
*
* @param query
*/
Search.prototype.parseQuery = function (query) {
var finalQuery;
if (typeof query === "string") {
finalQuery = { Querytext: query };
}
else if (query.toSearchQuery) {
finalQuery = query.toSearchQuery();
}
else {
finalQuery = query;
}
return finalQuery;
};
Search = __decorate([
defaultPath("_api/search/postquery")
], Search);
return Search;
}(SharePointQueryableInstance));
/**
* Describes the SearchResults class, which returns the formatted and raw version of the query response
*/
var SearchResults = /** @class */ (function () {
/**
* Creates a new instance of the SearchResult class
*
*/
function SearchResults(rawResponse, _url, _query, _raw, _primary) {
if (_raw === void 0) { _raw = null; }
if (_primary === void 0) { _primary = null; }
this._url = _url;
this._query = _query;
this._raw = _raw;
this._primary = _primary;
this._raw = rawResponse.postquery ? rawResponse.postquery : rawResponse;
}
Object.defineProperty(SearchResults.prototype, "ElapsedTime", {
get: function () {
return this.RawSearchResults.ElapsedTime;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SearchResults.prototype, "RowCount", {
get: function () {
return this.RawSearchResults.PrimaryQueryResult.RelevantResults.RowCount;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SearchResults.prototype, "TotalRows", {
get: function () {
return this.RawSearchResults.PrimaryQueryResult.RelevantResults.TotalRows;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SearchResults.prototype, "TotalRowsIncludingDuplicates", {
get: function () {
return this.RawSearchResults.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SearchResults.prototype, "RawSearchResults", {
get: function () {
return this._raw;
},
enumerable: true,
configurable: true
});
Object.defineProperty(SearchResults.prototype, "PrimarySearchResults", {
get: function () {
if (this._primary === null) {
this._primary = this.formatSearchResults(this._raw.PrimaryQueryResult.RelevantResults.Table.Rows);
}
return this._primary;
},
enumerable: true,
configurable: true
});
/**
* Gets a page of results
*
* @param pageNumber Index of the page to return. Used to determine StartRow
* @param pageSize Optional, items per page (default = 10)
*/
SearchResults.prototype.getPage = function (pageNumber, pageSize) {
// if we got all the available rows we don't have another page
if (this.TotalRows < this.RowCount) {
return Promise.resolve(null);
}
// if pageSize is supplied, then we use that regardless of any previous values
// otherwise get the previous RowLimit or default to 10
var rows = pageSize !== undefined ? pageSize : Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(this._query, "RowLimit") ? this._query.RowLimit : 10;
var query = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(this._query, {
RowLimit: rows,
StartRow: rows * (pageNumber - 1),
});
// we have reached the end
if (query.StartRow > this.TotalRows) {
return Promise.resolve(null);
}
var search = new Search(this._url, null);
return search.execute(query);
};
/**
* Formats a search results array
*
* @param rawResults The array to process
*/
SearchResults.prototype.formatSearchResults = function (rawResults) {
var results = new Array();
var tempResults = rawResults.results ? rawResults.results : rawResults;
for (var _i = 0, tempResults_1 = tempResults; _i < tempResults_1.length; _i++) {
var tempResult = tempResults_1[_i];
var cells = tempResult.Cells.results ? tempResult.Cells.results : tempResult.Cells;
results.push(cells.reduce(function (res, cell) {
Object.defineProperty(res, cell.Key, {
configurable: false,
enumerable: true,
value: cell.Value,
writable: false,
});
return res;
}, {}));
}
return results;
};
return SearchResults;
}());
/**
* defines the SortDirection enum
*/
var SortDirection;
(function (SortDirection) {
SortDirection[SortDirection["Ascending"] = 0] = "Ascending";
SortDirection[SortDirection["Descending"] = 1] = "Descending";
SortDirection[SortDirection["FQLFormula"] = 2] = "FQLFormula";
})(SortDirection || (SortDirection = {}));
/**
* defines the ReorderingRuleMatchType enum
*/
var ReorderingRuleMatchType;
(function (ReorderingRuleMatchType) {
ReorderingRuleMatchType[ReorderingRuleMatchType["ResultContainsKeyword"] = 0] = "ResultContainsKeyword";
ReorderingRuleMatchType[ReorderingRuleMatchType["TitleContainsKeyword"] = 1] = "TitleContainsKeyword";
ReorderingRuleMatchType[ReorderingRuleMatchType["TitleMatchesKeyword"] = 2] = "TitleMatchesKeyword";
ReorderingRuleMatchType[ReorderingRuleMatchType["UrlStartsWith"] = 3] = "UrlStartsWith";
ReorderingRuleMatchType[ReorderingRuleMatchType["UrlExactlyMatches"] = 4] = "UrlExactlyMatches";
ReorderingRuleMatchType[ReorderingRuleMatchType["ContentTypeIs"] = 5] = "ContentTypeIs";
ReorderingRuleMatchType[ReorderingRuleMatchType["FileExtensionMatches"] = 6] = "FileExtensionMatches";
ReorderingRuleMatchType[ReorderingRuleMatchType["ResultHasTag"] = 7] = "ResultHasTag";
ReorderingRuleMatchType[ReorderingRuleMatchType["ManualCondition"] = 8] = "ManualCondition";
})(ReorderingRuleMatchType || (ReorderingRuleMatchType = {}));
/**
* Specifies the type value for the property
*/
var QueryPropertyValueType;
(function (QueryPropertyValueType) {
QueryPropertyValueType[QueryPropertyValueType["None"] = 0] = "None";
QueryPropertyValueType[QueryPropertyValueType["StringType"] = 1] = "StringType";
QueryPropertyValueType[QueryPropertyValueType["Int32Type"] = 2] = "Int32Type";
QueryPropertyValueType[QueryPropertyValueType["BooleanType"] = 3] = "BooleanType";
QueryPropertyValueType[QueryPropertyValueType["StringArrayType"] = 4] = "StringArrayType";
QueryPropertyValueType[QueryPropertyValueType["UnSupportedType"] = 5] = "UnSupportedType";
})(QueryPropertyValueType || (QueryPropertyValueType = {}));
var SearchBuiltInSourceId = /** @class */ (function () {
function SearchBuiltInSourceId() {
}
SearchBuiltInSourceId.Documents = "e7ec8cee-ded8-43c9-beb5-436b54b31e84";
SearchBuiltInSourceId.ItemsMatchingContentType = "5dc9f503-801e-4ced-8a2c-5d1237132419";
SearchBuiltInSourceId.ItemsMatchingTag = "e1327b9c-2b8c-4b23-99c9-3730cb29c3f7";
SearchBuiltInSourceId.ItemsRelatedToCurrentUser = "48fec42e-4a92-48ce-8363-c2703a40e67d";
SearchBuiltInSourceId.ItemsWithSameKeywordAsThisItem = "5c069288-1d17-454a-8ac6-9c642a065f48";
SearchBuiltInSourceId.LocalPeopleResults = "b09a7990-05ea-4af9-81ef-edfab16c4e31";
SearchBuiltInSourceId.LocalReportsAndDataResults = "203fba36-2763-4060-9931-911ac8c0583b";
SearchBuiltInSourceId.LocalSharePointResults = "8413cd39-2156-4e00-b54d-11efd9abdb89";
SearchBuiltInSourceId.LocalVideoResults = "78b793ce-7956-4669-aa3b-451fc5defebf";
SearchBuiltInSourceId.Pages = "5e34578e-4d08-4edc-8bf3-002acf3cdbcc";
SearchBuiltInSourceId.Pictures = "38403c8c-3975-41a8-826e-717f2d41568a";
SearchBuiltInSourceId.Popular = "97c71db1-58ce-4891-8b64-585bc2326c12";
SearchBuiltInSourceId.RecentlyChangedItems = "ba63bbae-fa9c-42c0-b027-9a878f16557c";
SearchBuiltInSourceId.RecommendedItems = "ec675252-14fa-4fbe-84dd-8d098ed74181";
SearchBuiltInSourceId.Wiki = "9479bf85-e257-4318-b5a8-81a180f5faa1";
return SearchBuiltInSourceId;
}());
var SearchSuggest = /** @class */ (function (_super) {
__extends(SearchSuggest, _super);
function SearchSuggest() {
return _super !== null && _super.apply(this, arguments) || this;
}
SearchSuggest.prototype.execute = function (query) {
this.mapQueryToQueryString(query);
return this.get().then(function (response) {
var mapper = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(response, "suggest") ? function (s) { return response.suggest[s].results; } : function (s) { return response[s]; };
return {
PeopleNames: mapper("PeopleNames"),
PersonalResults: mapper("PersonalResults"),
Queries: mapper("Queries"),
};
});
};
SearchSuggest.prototype.mapQueryToQueryString = function (query) {
var _this = this;
var setProp = function (q) { return function (checkProp) { return function (sp) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(q, checkProp)) {
_this.query.set(sp, q[checkProp].toString());
}
}; }; };
this.query.set("querytext", "'" + query.querytext + "'");
var querySetter = setProp(query);
querySetter("count")("inumberofquerysuggestions");
querySetter("personalCount")("inumberofresultsuggestions");
querySetter("preQuery")("fprequerysuggestions");
querySetter("hitHighlighting")("fhithighlighting");
querySetter("capitalize")("fcapitalizefirstletters");
querySetter("culture")("culture");
querySetter("stemming")("enablestemming");
querySetter("includePeople")("showpeoplenamesuggestions");
querySetter("queryRules")("enablequeryrules");
querySetter("prefixMatch")("fprefixmatchallterms");
};
SearchSuggest = __decorate([
defaultPath("_api/search/suggest")
], SearchSuggest);
return SearchSuggest;
}(SharePointQueryableInstance));
/**
* Describes a collection of List objects
*
*/
var Features = /** @class */ (function (_super) {
__extends(Features, _super);
function Features() {
return _super !== null && _super.apply(this, arguments) || this;
}
Features_1 = Features;
/**
* Adds a new list to the collection
*
* @param id The Id of the feature (GUID)
* @param force If true the feature activation will be forced
*/
Features.prototype.add = function (id, force) {
var _this = this;
if (force === void 0) { force = false; }
return this.clone(Features_1, "add").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
featdefScope: 0,
featureId: id,
force: force,
}),
}).then(function (data) {
return {
data: data,
feature: _this.getById(id),
};
});
};
/**
* Gets a list from the collection by guid id
*
* @param id The Id of the feature (GUID)
*/
Features.prototype.getById = function (id) {
var feature = new Feature(this);
feature.concat("('" + id + "')");
return feature;
};
/**
* Removes (deactivates) a feature from the collection
*
* @param id The Id of the feature (GUID)
* @param force If true the feature deactivation will be forced
*/
Features.prototype.remove = function (id, force) {
if (force === void 0) { force = false; }
return this.clone(Features_1, "remove").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
featureId: id,
force: force,
}),
});
};
var Features_1;
Features = Features_1 = __decorate([
defaultPath("features")
], Features);
return Features;
}(SharePointQueryableCollection));
var Feature = /** @class */ (function (_super) {
__extends(Feature, _super);
function Feature() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Removes (deactivates) a feature from the collection
*
* @param force If true the feature deactivation will be forced
*/
Feature.prototype.deactivate = function (force) {
var _this = this;
if (force === void 0) { force = false; }
var removeDependency = this.addBatchDependency();
var idGet = new Feature(this).select("DefinitionId");
return idGet.get().then(function (feature) {
var promise = _this.getParent(Features, _this.parentUrl, "", _this.batch).remove(feature.DefinitionId, force);
removeDependency();
return promise;
});
};
return Feature;
}(SharePointQueryableInstance));
var RelatedItemManagerImpl = /** @class */ (function (_super) {
__extends(RelatedItemManagerImpl, _super);
function RelatedItemManagerImpl() {
return _super !== null && _super.apply(this, arguments) || this;
}
RelatedItemManagerImpl_1 = RelatedItemManagerImpl;
RelatedItemManagerImpl.FromUrl = function (url) {
if (url === null) {
return new RelatedItemManagerImpl_1("");
}
var index = url.indexOf("_api/");
if (index > -1) {
return new RelatedItemManagerImpl_1(url.substr(0, index));
}
return new RelatedItemManagerImpl_1(url);
};
RelatedItemManagerImpl.prototype.getRelatedItems = function (sourceListName, sourceItemId) {
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".GetRelatedItems");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
}),
});
};
RelatedItemManagerImpl.prototype.getPageOneRelatedItems = function (sourceListName, sourceItemId) {
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".GetPageOneRelatedItems");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
}),
});
};
RelatedItemManagerImpl.prototype.addSingleLink = function (sourceListName, sourceItemId, sourceWebUrl, targetListName, targetItemID, targetWebUrl, tryAddReverseLink) {
if (tryAddReverseLink === void 0) { tryAddReverseLink = false; }
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".AddSingleLink");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
SourceWebUrl: sourceWebUrl,
TargetItemID: targetItemID,
TargetListName: targetListName,
TargetWebUrl: targetWebUrl,
TryAddReverseLink: tryAddReverseLink,
}),
});
};
/**
* Adds a related item link from an item specified by list name and item id, to an item specified by url
*
* @param sourceListName The source list name or list id
* @param sourceItemId The source item id
* @param targetItemUrl The target item url
* @param tryAddReverseLink If set to true try to add the reverse link (will not return error if it fails)
*/
RelatedItemManagerImpl.prototype.addSingleLinkToUrl = function (sourceListName, sourceItemId, targetItemUrl, tryAddReverseLink) {
if (tryAddReverseLink === void 0) { tryAddReverseLink = false; }
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".AddSingleLinkToUrl");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
TargetItemUrl: targetItemUrl,
TryAddReverseLink: tryAddReverseLink,
}),
});
};
/**
* Adds a related item link from an item specified by url, to an item specified by list name and item id
*
* @param sourceItemUrl The source item url
* @param targetListName The target list name or list id
* @param targetItemId The target item id
* @param tryAddReverseLink If set to true try to add the reverse link (will not return error if it fails)
*/
RelatedItemManagerImpl.prototype.addSingleLinkFromUrl = function (sourceItemUrl, targetListName, targetItemId, tryAddReverseLink) {
if (tryAddReverseLink === void 0) { tryAddReverseLink = false; }
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".AddSingleLinkFromUrl");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemUrl: sourceItemUrl,
TargetItemID: targetItemId,
TargetListName: targetListName,
TryAddReverseLink: tryAddReverseLink,
}),
});
};
RelatedItemManagerImpl.prototype.deleteSingleLink = function (sourceListName, sourceItemId, sourceWebUrl, targetListName, targetItemId, targetWebUrl, tryDeleteReverseLink) {
if (tryDeleteReverseLink === void 0) { tryDeleteReverseLink = false; }
var query = this.clone(RelatedItemManagerImpl_1, null);
query.concat(".DeleteSingleLink");
return query.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
SourceWebUrl: sourceWebUrl,
TargetItemID: targetItemId,
TargetListName: targetListName,
TargetWebUrl: targetWebUrl,
TryDeleteReverseLink: tryDeleteReverseLink,
}),
});
};
var RelatedItemManagerImpl_1;
RelatedItemManagerImpl = RelatedItemManagerImpl_1 = __decorate([
defaultPath("_api/SP.RelatedItemManager")
], RelatedItemManagerImpl);
return RelatedItemManagerImpl;
}(SharePointQueryable));
/**
* Describes a collection of webs
*
*/
var Webs = /** @class */ (function (_super) {
__extends(Webs, _super);
function Webs() {
return _super !== null && _super.apply(this, arguments) || this;
}
Webs_1 = Webs;
/**
* Adds a new web to the collection
*
* @param title The new web's title
* @param url The new web's relative url
* @param description The new web's description
* @param template The new web's template internal name (default = STS)
* @param language The locale id that specifies the new web's language (default = 1033 [English, US])
* @param inheritPermissions When true, permissions will be inherited from the new web's parent (default = true)
*/
Webs.prototype.add = function (title, url, description, template, language, inheritPermissions) {
if (description === void 0) { description = ""; }
if (template === void 0) { template = "STS"; }
if (language === void 0) { language = 1033; }
if (inheritPermissions === void 0) { inheritPermissions = true; }
var props = {
Description: description,
Language: language,
Title: title,
Url: url,
UseSamePermissionsAsParentSite: inheritPermissions,
WebTemplate: template,
};
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"parameters": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"__metadata": { "type": "SP.WebCreationInformation" },
}, props),
});
return this.clone(Webs_1, "add").postCore({ body: postBody }).then(function (data) {
return {
data: data,
web: new Web(odataUrlFrom(data).replace(/_api\/web\/?/i, "")),
};
});
};
var Webs_1;
Webs = Webs_1 = __decorate([
defaultPath("webs")
], Webs);
return Webs;
}(SharePointQueryableCollection));
/**
* Describes a collection of web infos
*
*/
var WebInfos = /** @class */ (function (_super) {
__extends(WebInfos, _super);
function WebInfos() {
return _super !== null && _super.apply(this, arguments) || this;
}
WebInfos = __decorate([
defaultPath("webinfos")
], WebInfos);
return WebInfos;
}(SharePointQueryableCollection));
/**
* Describes a web
*
*/
var Web = /** @class */ (function (_super) {
__extends(Web, _super);
function Web() {
return _super !== null && _super.apply(this, arguments) || this;
}
Web_1 = Web;
/**
* Creates a new web instance from the given url by indexing the location of the /_api/
* segment. If this is not found the method creates a new web with the entire string as
* supplied.
*
* @param url
*/
Web.fromUrl = function (url, path) {
return new Web_1(extractWebUrl(url), path);
};
Object.defineProperty(Web.prototype, "webs", {
/**
* Gets this web's subwebs
*
*/
get: function () {
return new Webs(this);
},
enumerable: true,
configurable: true
});
/**
* Gets this web's parent web and data
*
*/
Web.prototype.getParentWeb = function () {
var _this = this;
return this.select("ParentWeb/Id").expand("ParentWeb").get()
.then(function (_a) {
var ParentWeb = _a.ParentWeb;
return ParentWeb ? new Site(_this.parentUrl).openWebById(ParentWeb.Id) : null;
});
};
/**
* Returns a collection of objects that contain metadata about subsites of the current site in which the current user is a member.
*
* @param nWebTemplateFilter Specifies the site definition (default = -1)
* @param nConfigurationFilter A 16-bit integer that specifies the identifier of a configuration (default = -1)
*/
Web.prototype.getSubwebsFilteredForCurrentUser = function (nWebTemplateFilter, nConfigurationFilter) {
if (nWebTemplateFilter === void 0) { nWebTemplateFilter = -1; }
if (nConfigurationFilter === void 0) { nConfigurationFilter = -1; }
return this.clone(Webs, "getSubwebsFilteredForCurrentUser(nWebTemplateFilter=" + nWebTemplateFilter + ",nConfigurationFilter=" + nConfigurationFilter + ")");
};
Object.defineProperty(Web.prototype, "allProperties", {
/**
* Allows access to the web's all properties collection
*/
get: function () {
return this.clone(SharePointQueryableInstance, "allproperties");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "webinfos", {
/**
* Gets a collection of WebInfos for this web's subwebs
*
*/
get: function () {
return new WebInfos(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "contentTypes", {
/**
* Gets the content types available in this web
*
*/
get: function () {
return new ContentTypes(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "lists", {
/**
* Gets the lists in this web
*
*/
get: function () {
return new Lists(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "fields", {
/**
* Gets the fields in this web
*
*/
get: function () {
return new Fields(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "features", {
/**
* Gets the active features for this web
*
*/
get: function () {
return new Features(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "availablefields", {
/**
* Gets the available fields in this web
*
*/
get: function () {
return new Fields(this, "availablefields");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "navigation", {
/**
* Gets the navigation options in this web
*
*/
get: function () {
return new Navigation(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "siteUsers", {
/**
* Gets the site users
*
*/
get: function () {
return new SiteUsers(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "siteGroups", {
/**
* Gets the site groups
*
*/
get: function () {
return new SiteGroups(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "siteUserInfoList", {
/**
* Gets site user info list
*
*/
get: function () {
return new List(this, "siteuserinfolist");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "regionalSettings", {
/**
* Gets regional settings
*
*/
get: function () {
return new RegionalSettings(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "currentUser", {
/**
* Gets the current user
*/
get: function () {
return new CurrentUser(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "folders", {
/**
* Gets the top-level folders in this web
*
*/
get: function () {
return new Folders(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "userCustomActions", {
/**
* Gets all user custom actions for this web
*
*/
get: function () {
return new UserCustomActions(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "roleDefinitions", {
/**
* Gets the collection of RoleDefinition resources
*
*/
get: function () {
return new RoleDefinitions(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "relatedItems", {
/**
* Provides an interface to manage related items
*
*/
get: function () {
return RelatedItemManagerImpl.FromUrl(this.toUrl());
},
enumerable: true,
configurable: true
});
/**
* Creates a new batch for requests within the context of this web
*
*/
Web.prototype.createBatch = function () {
return new SPBatch(this.parentUrl);
};
Object.defineProperty(Web.prototype, "rootFolder", {
/**
* Gets the root folder of this web
*
*/
get: function () {
return new Folder(this, "rootFolder");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "associatedOwnerGroup", {
/**
* Gets the associated owner group for this web
*
*/
get: function () {
return new SiteGroup(this, "associatedownergroup");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "associatedMemberGroup", {
/**
* Gets the associated member group for this web
*
*/
get: function () {
return new SiteGroup(this, "associatedmembergroup");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "associatedVisitorGroup", {
/**
* Gets the associated visitor group for this web
*
*/
get: function () {
return new SiteGroup(this, "associatedvisitorgroup");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Web.prototype, "defaultDocumentLibrary", {
/**
* Gets the default document library for this web
*
*/
get: function () {
return new List(this, "DefaultDocumentLibrary");
},
enumerable: true,
configurable: true
});
/**
* Gets a folder by id
*
* @param uniqueId The uniqueId of the folder
*/
Web.prototype.getFolderById = function (uniqueId) {
return new Folder(this, "getFolderById('" + uniqueId + "')");
};
/**
* Gets a folder by server relative url
*
* @param folderRelativeUrl The server relative path to the folder (including /sites/ if applicable)
*/
Web.prototype.getFolderByServerRelativeUrl = function (folderRelativeUrl) {
return new Folder(this, "getFolderByServerRelativeUrl('" + folderRelativeUrl + "')");
};
/**
* Gets a folder by server relative relative path if your folder name contains # and % characters
* you need to first encode the file name using encodeURIComponent() and then pass the url
* let url = "/sites/test/Shared Documents/" + encodeURIComponent("%123");
* This works only in SharePoint online.
*
* @param folderRelativeUrl The server relative path to the folder (including /sites/ if applicable)
*/
Web.prototype.getFolderByServerRelativePath = function (folderRelativeUrl) {
return new Folder(this, "getFolderByServerRelativePath(decodedUrl='" + folderRelativeUrl + "')");
};
/**
* Gets a file by id
*
* @param uniqueId The uniqueId of the file
*/
Web.prototype.getFileById = function (uniqueId) {
return new File(this, "getFileById('" + uniqueId + "')");
};
/**
* Gets a file by server relative url
*
* @param fileRelativeUrl The server relative path to the file (including /sites/ if applicable)
*/
Web.prototype.getFileByServerRelativeUrl = function (fileRelativeUrl) {
return new File(this, "getFileByServerRelativeUrl('" + fileRelativeUrl + "')");
};
/**
* Gets a file by server relative url if your file name contains # and % characters
* you need to first encode the file name using encodeURIComponent() and then pass the url
* let url = "/sites/test/Shared Documents/" + encodeURIComponent("%123.docx");
*
* @param fileRelativeUrl The server relative path to the file (including /sites/ if applicable)
*/
Web.prototype.getFileByServerRelativePath = function (fileRelativeUrl) {
return new File(this, "getFileByServerRelativePath(decodedUrl='" + fileRelativeUrl + "')");
};
/**
* Gets a list by server relative url (list's root folder)
*
* @param listRelativeUrl The server relative path to the list's root folder (including /sites/ if applicable)
*/
Web.prototype.getList = function (listRelativeUrl) {
return new List(this, "getList('" + listRelativeUrl + "')");
};
/**
* Updates this web instance with the supplied properties
*
* @param properties A plain object hash of values to update for the web
*/
Web.prototype.update = function (properties) {
var _this = this;
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"__metadata": { "type": "SP.Web" },
}, properties));
return this.postCore({
body: postBody,
headers: {
"X-HTTP-Method": "MERGE",
},
}).then(function (data) {
return {
data: data,
web: _this,
};
});
};
/**
* Deletes this web
*
*/
Web.prototype.delete = function () {
return _super.prototype.deleteCore.call(this);
};
/**
* Applies the theme specified by the contents of each of the files specified in the arguments to the site
*
* @param colorPaletteUrl The server-relative URL of the color palette file
* @param fontSchemeUrl The server-relative URL of the font scheme
* @param backgroundImageUrl The server-relative URL of the background image
* @param shareGenerated When true, the generated theme files are stored in the root site. When false, they are stored in this web
*/
Web.prototype.applyTheme = function (colorPaletteUrl, fontSchemeUrl, backgroundImageUrl, shareGenerated) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
backgroundImageUrl: backgroundImageUrl,
colorPaletteUrl: colorPaletteUrl,
fontSchemeUrl: fontSchemeUrl,
shareGenerated: shareGenerated,
});
return this.clone(Web_1, "applytheme").postCore({ body: postBody });
};
/**
* Applies the specified site definition or site template to the Web site that has no template applied to it
*
* @param template Name of the site definition or the name of the site template
*/
Web.prototype.applyWebTemplate = function (template) {
var q = this.clone(Web_1, "applywebtemplate");
q.concat("(@t)");
q.query.set("@t", template);
return q.postCore();
};
/**
* Checks whether the specified login name belongs to a valid user in the web. If the user doesn't exist, adds the user to the web.
*
* @param loginName The login name of the user (ex: i:0#.f|membership|user@domain.onmicrosoft.com)
*/
Web.prototype.ensureUser = function (loginName) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
logonName: loginName,
});
return this.clone(Web_1, "ensureuser").postCore({ body: postBody }).then(function (data) {
return {
data: data,
user: new SiteUser(odataUrlFrom(data)),
};
});
};
/**
* Returns a collection of site templates available for the site
*
* @param language The locale id of the site templates to retrieve (default = 1033 [English, US])
* @param includeCrossLanguage When true, includes language-neutral site templates; otherwise false (default = true)
*/
Web.prototype.availableWebTemplates = function (language, includeCrossLanugage) {
if (language === void 0) { language = 1033; }
if (includeCrossLanugage === void 0) { includeCrossLanugage = true; }
return new SharePointQueryableCollection(this, "getavailablewebtemplates(lcid=" + language + ", doincludecrosslanguage=" + includeCrossLanugage + ")");
};
/**
* Returns the list gallery on the site
*
* @param type The gallery type - WebTemplateCatalog = 111, WebPartCatalog = 113 ListTemplateCatalog = 114,
* MasterPageCatalog = 116, SolutionCatalog = 121, ThemeCatalog = 123, DesignCatalog = 124, AppDataCatalog = 125
*/
Web.prototype.getCatalog = function (type) {
return this.clone(Web_1, "getcatalog(" + type + ")").select("Id").get().then(function (data) {
return new List(odataUrlFrom(data));
});
};
/**
* Returns the collection of changes from the change log that have occurred within the list, based on the specified query
*
* @param query The change query
*/
Web.prototype.getChanges = function (query) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "query": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({ "__metadata": { "type": "SP.ChangeQuery" } }, query) });
return this.clone(Web_1, "getchanges").postCore({ body: postBody });
};
Object.defineProperty(Web.prototype, "customListTemplate", {
/**
* Gets the custom list templates for the site
*
*/
get: function () {
return new SharePointQueryableCollection(this, "getcustomlisttemplates");
},
enumerable: true,
configurable: true
});
/**
* Returns the user corresponding to the specified member identifier for the current site
*
* @param id The id of the user
*/
Web.prototype.getUserById = function (id) {
return new SiteUser(this, "getUserById(" + id + ")");
};
/**
* Returns the name of the image file for the icon that is used to represent the specified file
*
* @param filename The file name. If this parameter is empty, the server returns an empty string
* @param size The size of the icon: 16x16 pixels = 0, 32x32 pixels = 1 (default = 0)
* @param progId The ProgID of the application that was used to create the file, in the form OLEServerName.ObjectName
*/
Web.prototype.mapToIcon = function (filename, size, progId) {
if (size === void 0) { size = 0; }
if (progId === void 0) { progId = ""; }
return this.clone(Web_1, "maptoicon(filename='" + filename + "', progid='" + progId + "', size=" + size + ")").get();
};
/**
* Returns the tenant property corresponding to the specified key in the app catalog site
*
* @param key Id of storage entity to be set
*/
Web.prototype.getStorageEntity = function (key) {
return this.clone(Web_1, "getStorageEntity('" + key + "')").get();
};
/**
* This will set the storage entity identified by the given key (MUST be called in the context of the app catalog)
*
* @param key Id of storage entity to be set
* @param value Value of storage entity to be set
* @param description Description of storage entity to be set
* @param comments Comments of storage entity to be set
*/
Web.prototype.setStorageEntity = function (key, value, description, comments) {
if (description === void 0) { description = ""; }
if (comments === void 0) { comments = ""; }
return this.clone(Web_1, "setStorageEntity").postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
comments: comments,
description: description,
key: key,
value: value,
}),
});
};
/**
* This will remove the storage entity identified by the given key
*
* @param key Id of storage entity to be removed
*/
Web.prototype.removeStorageEntity = function (key) {
return this.clone(Web_1, "removeStorageEntity('" + key + "')").postCore();
};
/**
* Gets the tenant app catalog for this web
*
* @param url Optional url or web containing the app catalog (default: current web)
*/
Web.prototype.getAppCatalog = function (url) {
return new AppCatalog(url || this);
};
/**
* Gets the site collection app catalog for this web
*
* @param url Optional url or web containing the app catalog (default: current web)
*/
Web.prototype.getSiteCollectionAppCatalog = function (url) {
return new AppCatalog(url || this, "_api/web/sitecollectionappcatalog/AvailableApps");
};
/**
* Gets the collection of available client side web parts for this web instance
*/
Web.prototype.getClientSideWebParts = function () {
return this.clone(SharePointQueryableCollection, "GetClientSideWebParts").get();
};
/**
* Creates a new client side page
*
* @param pageName Name of the new page
* @param title Display title of the new page
* @param libraryTitle Title of the library in which to create the new page. Default: "Site Pages"
*/
Web.prototype.addClientSidePage = function (pageName, title) {
if (title === void 0) { title = pageName.replace(/\.[^/.]+$/, ""); }
return ClientSidePage.create(this, pageName, title);
};
/**
* Creates a new client side page using the library path
*
* @param pageName Name of the new page
* @param listRelativePath The server relative path to the list's root folder (including /sites/ if applicable)
* @param title Display title of the new page
*/
Web.prototype.addClientSidePageByPath = function (pageName, title) {
if (title === void 0) { title = pageName.replace(/\.[^/.]+$/, ""); }
return ClientSidePage.create(this, pageName, title);
};
/**
* Creates the default associated groups (Members, Owners, Visitors) and gives them the default permissions on the site.
* The target site must have unique permissions and no associated members / owners / visitors groups
*
* @param siteOwner The user login name to be added to the site Owners group. Default is the current user
* @param siteOwner2 The second user login name to be added to the site Owners group. Default is empty
* @param groupNameSeed The base group name. E.g. 'TestSite' would produce 'TestSite Members' etc.
*/
Web.prototype.createDefaultAssociatedGroups = function (siteOwner, siteOwner2, groupNameSeed) {
var q = this.clone(Web_1, "createDefaultAssociatedGroups(userLogin=@u,userLogin2=@v,groupNameSeed=@s)");
q.query.set("@u", "'" + encodeURIComponent(siteOwner || "") + "'");
q.query.set("@v", "'" + encodeURIComponent(siteOwner2 || "") + "'");
q.query.set("@s", "'" + encodeURIComponent(groupNameSeed || "") + "'");
return q.postCore();
};
/**
* Gets hub site data for the current web.
*
* @param forceRefresh Default value is false. When false, the data is returned from the server's cache.
* When true, the cache is refreshed with the latest updates and then returned.
* Use this if you just made changes and need to see those changes right away.
*/
Web.prototype.hubSiteData = function (forceRefresh) {
if (forceRefresh === void 0) { forceRefresh = false; }
return this.clone(Web_1, "hubSiteData(" + forceRefresh + ")").get();
};
/**
* Applies theme updates from the parent hub site collection.
*/
Web.prototype.syncHubSiteTheme = function () {
return this.clone(Web_1, "syncHubSiteTheme").postCore();
};
var Web_1;
Web = Web_1 = __decorate([
defaultPath("_api/web")
], Web);
return Web;
}(SharePointQueryableShareableWeb));
/**
* Describes a site collection
*
*/
var Site = /** @class */ (function (_super) {
__extends(Site, _super);
function Site() {
return _super !== null && _super.apply(this, arguments) || this;
}
Site_1 = Site;
Object.defineProperty(Site.prototype, "rootWeb", {
/**
* Gets the root web of the site collection
*
*/
get: function () {
return new Web(this, "rootweb");
},
enumerable: true,
configurable: true
});
Object.defineProperty(Site.prototype, "features", {
/**
* Gets the active features for this site collection
*
*/
get: function () {
return new Features(this);
},
enumerable: true,
configurable: true
});
Object.defineProperty(Site.prototype, "userCustomActions", {
/**
* Gets all custom actions for this site collection
*
*/
get: function () {
return new UserCustomActions(this);
},
enumerable: true,
configurable: true
});
/**
* Gets a Web instance representing the root web of the site collection
* correctly setup for chaining within the library
*/
Site.prototype.getRootWeb = function () {
return this.rootWeb.select("Url").get().then(function (web) { return new Web(web.Url); });
};
/**
* Gets the context information for this site collection
*/
Site.prototype.getContextInfo = function () {
var q = new Site_1(this.parentUrl, "_api/contextinfo");
return q.postCore().then(function (data) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "GetContextWebInformation")) {
var info = data.GetContextWebInformation;
info.SupportedSchemaVersions = info.SupportedSchemaVersions.results;
return info;
}
else {
return data;
}
});
};
/**
* Gets the document libraries on a site. Static method. (SharePoint Online only)
*
* @param absoluteWebUrl The absolute url of the web whose document libraries should be returned
*/
Site.prototype.getDocumentLibraries = function (absoluteWebUrl) {
var q = new SharePointQueryable("", "_api/sp.web.getdocumentlibraries(@v)");
q.query.set("@v", "'" + absoluteWebUrl + "'");
return q.get().then(function (data) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "GetDocumentLibraries")) {
return data.GetDocumentLibraries;
}
else {
return data;
}
});
};
/**
* Gets the site url from a page url
*
* @param absolutePageUrl The absolute url of the page
*/
Site.prototype.getWebUrlFromPageUrl = function (absolutePageUrl) {
var q = new SharePointQueryable("", "_api/sp.web.getweburlfrompageurl(@v)");
q.query.set("@v", "'" + absolutePageUrl + "'");
return q.get().then(function (data) {
if (Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(data, "GetWebUrlFromPageUrl")) {
return data.GetWebUrlFromPageUrl;
}
else {
return data;
}
});
};
/**
* Creates a new batch for requests within the context of this site collection
*
*/
Site.prototype.createBatch = function () {
return new SPBatch(this.parentUrl);
};
/**
* Opens a web by id (using POST)
*
* @param webId The GUID id of the web to open
*/
Site.prototype.openWebById = function (webId) {
return this.clone(Site_1, "openWebById('" + webId + "')").postCore().then(function (d) { return ({
data: d,
web: Web.fromUrl(d["odata.id"] || d.__metadata.uri),
}); });
};
/**
* Associates a site collection to a hub site.
*
* @param siteId Id of the hub site collection you want to join.
* If you want to disassociate the site collection from hub site, then
* pass the siteId as 00000000-0000-0000-0000-000000000000
*/
Site.prototype.joinHubSite = function (siteId) {
return this.clone(Site_1, "joinHubSite('" + siteId + "')").postCore();
};
/**
* Registers the current site collection as hub site collection
*/
Site.prototype.registerHubSite = function () {
return this.clone(Site_1, "registerHubSite").postCore();
};
/**
* Unregisters the current site collection as hub site collection.
*/
Site.prototype.unRegisterHubSite = function () {
return this.clone(Site_1, "unRegisterHubSite").postCore();
};
/**
* Creates a Modern communication site.
*
* @param title The title of the site to create
* @param lcid The language to use for the site. If not specified will default to 1033 (English).
* @param shareByEmailEnabled If set to true, it will enable sharing files via Email. By default it is set to false
* @param url The fully qualified URL (e.g. https://yourtenant.sharepoint.com/sites/mysitecollection) of the site.
* @param description The description of the communication site.
* @param classification The Site classification to use. For instance 'Contoso Classified'. See https://www.youtube.com/watch?v=E-8Z2ggHcS0 for more information
* @param siteDesignId The Guid of the site design to be used.
* You can use the below default OOTB GUIDs:
* Topic: 00000000-0000-0000-0000-000000000000
* Showcase: 6142d2a0-63a5-4ba0-aede-d9fefca2c767
* Blank: f6cc5403-0d63-442e-96c0-285923709ffc
*/
Site.prototype.createCommunicationSite = function (title, lcid, shareByEmailEnabled, url, description, classification, siteDesignId, hubSiteId) {
var _this = this;
if (lcid === void 0) { lcid = 1033; }
if (shareByEmailEnabled === void 0) { shareByEmailEnabled = false; }
if (description === void 0) { description = ""; }
if (classification === void 0) { classification = ""; }
if (siteDesignId === void 0) { siteDesignId = "00000000-0000-0000-0000-000000000000"; }
if (hubSiteId === void 0) { hubSiteId = "00000000-0000-0000-0000-000000000000"; }
var props = {
Classification: classification,
Description: description,
HubSiteId: hubSiteId,
Lcid: lcid,
ShareByEmailEnabled: shareByEmailEnabled,
SiteDesignId: siteDesignId,
Title: title,
Url: url,
WebTemplate: "SITEPAGEPUBLISHING#0",
WebTemplateExtensionId: "00000000-0000-0000-0000-000000000000",
};
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"request": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])({
"__metadata": { "type": "Microsoft.SharePoint.Portal.SPSiteCreationRequest" },
}, props),
});
return this.getRootWeb().then(function (d) { return __awaiter(_this, void 0, void 0, function () {
var client, methodUrl;
return __generator(this, function (_a) {
client = new SPHttpClient();
methodUrl = d.parentUrl + "/_api/SPSiteManager/Create";
return [2 /*return*/, client.post(methodUrl, {
body: postBody,
headers: {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose;charset=utf-8",
},
}).then(function (r) { return r.json(); })];
});
}); });
};
/**
* Creates a Modern team site backed by Office 365 group. For use in SP Online only. This will not work with App-only tokens
*
* @param displayName The title or display name of the Modern team site to be created
* @param alias Alias of the underlying Office 365 Group
* @param isPublic Defines whether the Office 365 Group will be public (default), or private.
* @param lcid The language to use for the site. If not specified will default to English (1033).
* @param description The description of the site to be created.
* @param classification The Site classification to use. For instance 'Contoso Classified'. See https://www.youtube.com/watch?v=E-8Z2ggHcS0 for more information
* @param owners The Owners of the site to be created
*/
Site.prototype.createModernTeamSite = function (displayName, alias, isPublic, lcid, description, classification, owners, hubSiteId) {
var _this = this;
if (isPublic === void 0) { isPublic = true; }
if (lcid === void 0) { lcid = 1033; }
if (description === void 0) { description = ""; }
if (classification === void 0) { classification = ""; }
if (hubSiteId === void 0) { hubSiteId = "00000000-0000-0000-0000-000000000000"; }
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
alias: alias,
displayName: displayName,
isPublic: isPublic,
optionalParams: {
Classification: classification,
CreationOptions: {
"results": ["SPSiteLanguage:" + lcid, "HubSiteId:" + hubSiteId],
},
Description: description,
Owners: {
"results": owners ? owners : [],
},
},
});
return this.getRootWeb().then(function (d) { return __awaiter(_this, void 0, void 0, function () {
var client, methodUrl;
return __generator(this, function (_a) {
client = new SPHttpClient();
methodUrl = d.parentUrl + "/_api/GroupSiteManager/CreateGroupEx";
return [2 /*return*/, client.post(methodUrl, {
body: postBody,
headers: {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose;charset=utf-8",
},
}).then(function (r) { return r.json(); })];
});
}); });
};
var Site_1;
Site = Site_1 = __decorate([
defaultPath("_api/site")
], Site);
return Site;
}(SharePointQueryableInstance));
var UserProfileQuery = /** @class */ (function (_super) {
__extends(UserProfileQuery, _super);
/**
* Creates a new instance of the UserProfileQuery class
*
* @param baseUrl The url or SharePointQueryable which forms the parent of this user profile query
*/
function UserProfileQuery(baseUrl, path) {
if (path === void 0) { path = "_api/sp.userprofiles.peoplemanager"; }
var _this = _super.call(this, baseUrl, path) || this;
_this.clientPeoplePickerQuery = (new ClientPeoplePickerQuery(baseUrl)).configureFrom(_this);
_this.profileLoader = (new ProfileLoader(baseUrl)).configureFrom(_this);
return _this;
}
Object.defineProperty(UserProfileQuery.prototype, "editProfileLink", {
/**
* The url of the edit profile page for the current user
*/
get: function () {
return this.clone(UserProfileQuery, "EditProfileLink").get();
},
enumerable: true,
configurable: true
});
Object.defineProperty(UserProfileQuery.prototype, "isMyPeopleListPublic", {
/**
* A boolean value that indicates whether the current user's "People I'm Following" list is public
*/
get: function () {
return this.clone(UserProfileQuery, "IsMyPeopleListPublic").get();
},
enumerable: true,
configurable: true
});
/**
* A boolean value that indicates whether the current user is being followed by the specified user
*
* @param loginName The account name of the user
*/
UserProfileQuery.prototype.amIFollowedBy = function (loginName) {
var q = this.clone(UserProfileQuery, "amifollowedby(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
/**
* A boolean value that indicates whether the current user is following the specified user
*
* @param loginName The account name of the user
*/
UserProfileQuery.prototype.amIFollowing = function (loginName) {
var q = this.clone(UserProfileQuery, "amifollowing(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
/**
* Gets tags that the current user is following
*
* @param maxCount The maximum number of tags to retrieve (default is 20)
*/
UserProfileQuery.prototype.getFollowedTags = function (maxCount) {
if (maxCount === void 0) { maxCount = 20; }
return this.clone(UserProfileQuery, "getfollowedtags(" + maxCount + ")").get();
};
/**
* Gets the people who are following the specified user
*
* @param loginName The account name of the user
*/
UserProfileQuery.prototype.getFollowersFor = function (loginName) {
var q = this.clone(UserProfileQuery, "getfollowersfor(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
Object.defineProperty(UserProfileQuery.prototype, "myFollowers", {
/**
* Gets the people who are following the current user
*
*/
get: function () {
return new SharePointQueryableCollection(this, "getmyfollowers");
},
enumerable: true,
configurable: true
});
Object.defineProperty(UserProfileQuery.prototype, "myProperties", {
/**
* Gets user properties for the current user
*
*/
get: function () {
return new UserProfileQuery(this, "getmyproperties");
},
enumerable: true,
configurable: true
});
/**
* Gets the people who the specified user is following
*
* @param loginName The account name of the user.
*/
UserProfileQuery.prototype.getPeopleFollowedBy = function (loginName) {
var q = this.clone(UserProfileQuery, "getpeoplefollowedby(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
/**
* Gets user properties for the specified user.
*
* @param loginName The account name of the user.
*/
UserProfileQuery.prototype.getPropertiesFor = function (loginName) {
var q = this.clone(UserProfileQuery, "getpropertiesfor(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
Object.defineProperty(UserProfileQuery.prototype, "trendingTags", {
/**
* Gets the 20 most popular hash tags over the past week, sorted so that the most popular tag appears first
*
*/
get: function () {
var q = this.clone(UserProfileQuery, null);
q.concat(".gettrendingtags");
return q.get();
},
enumerable: true,
configurable: true
});
/**
* Gets the specified user profile property for the specified user
*
* @param loginName The account name of the user
* @param propertyName The case-sensitive name of the property to get
*/
UserProfileQuery.prototype.getUserProfilePropertyFor = function (loginName, propertyName) {
var q = this.clone(UserProfileQuery, "getuserprofilepropertyfor(accountname=@v, propertyname='" + propertyName + "')");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.get();
};
/**
* Removes the specified user from the user's list of suggested people to follow
*
* @param loginName The account name of the user
*/
UserProfileQuery.prototype.hideSuggestion = function (loginName) {
var q = this.clone(UserProfileQuery, "hidesuggestion(@v)");
q.query.set("@v", "'" + encodeURIComponent(loginName) + "'");
return q.postCore();
};
/**
* A boolean values that indicates whether the first user is following the second user
*
* @param follower The account name of the user who might be following the followee
* @param followee The account name of the user who might be followed by the follower
*/
UserProfileQuery.prototype.isFollowing = function (follower, followee) {
var q = this.clone(UserProfileQuery, null);
q.concat(".isfollowing(possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)");
q.query.set("@v", "'" + encodeURIComponent(follower) + "'");
q.query.set("@y", "'" + encodeURIComponent(followee) + "'");
return q.get();
};
/**
* Uploads and sets the user profile picture (Users can upload a picture to their own profile only). Not supported for batching.
*
* @param profilePicSource Blob data representing the user's picture in BMP, JPEG, or PNG format of up to 4.76MB
*/
UserProfileQuery.prototype.setMyProfilePic = function (profilePicSource) {
var _this = this;
return new Promise(function (resolve, reject) {
var buffer = null;
var reader = new FileReader();
reader.onload = function (e) { return buffer = e.target.result; };
reader.readAsArrayBuffer(profilePicSource);
var request = new UserProfileQuery(_this, "setmyprofilepicture");
request.postCore({
body: String.fromCharCode.apply(null, new Uint16Array(buffer)),
}).then(function (_) { return resolve(); }).catch(function (e) { return reject(e); });
});
};
/**
* Sets single value User Profile property
*
* @param accountName The account name of the user
* @param propertyName Property name
* @param propertyValue Property value
*/
UserProfileQuery.prototype.setSingleValueProfileProperty = function (accountName, propertyName, propertyValue) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
accountName: accountName,
propertyName: propertyName,
propertyValue: propertyValue,
});
return this.clone(UserProfileQuery, "SetSingleValueProfileProperty")
.postCore({ body: postBody });
};
/**
* Sets multi valued User Profile property
*
* @param accountName The account name of the user
* @param propertyName Property name
* @param propertyValues Property values
*/
UserProfileQuery.prototype.setMultiValuedProfileProperty = function (accountName, propertyName, propertyValues) {
var postBody = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
accountName: accountName,
propertyName: propertyName,
propertyValues: propertyValues,
});
return this.clone(UserProfileQuery, "SetMultiValuedProfileProperty")
.postCore({ body: postBody });
};
/**
* Provisions one or more users' personal sites. (My Site administrator on SharePoint Online only)
*
* @param emails The email addresses of the users to provision sites for
*/
UserProfileQuery.prototype.createPersonalSiteEnqueueBulk = function () {
var emails = [];
for (var _i = 0; _i < arguments.length; _i++) {
emails[_i] = arguments[_i];
}
return this.profileLoader.createPersonalSiteEnqueueBulk(emails);
};
Object.defineProperty(UserProfileQuery.prototype, "ownerUserProfile", {
/**
* Gets the user profile of the site owner
*
*/
get: function () {
return this.profileLoader.ownerUserProfile;
},
enumerable: true,
configurable: true
});
Object.defineProperty(UserProfileQuery.prototype, "userProfile", {
/**
* Gets the user profile for the current user
*/
get: function () {
return this.profileLoader.userProfile;
},
enumerable: true,
configurable: true
});
/**
* Enqueues creating a personal site for this user, which can be used to share documents, web pages, and other files
*
* @param interactiveRequest true if interactively (web) initiated request, or false (default) if non-interactively (client) initiated request
*/
UserProfileQuery.prototype.createPersonalSite = function (interactiveRequest) {
if (interactiveRequest === void 0) { interactiveRequest = false; }
return this.profileLoader.createPersonalSite(interactiveRequest);
};
/**
* Sets the privacy settings for this profile
*
* @param share true to make all social data public; false to make all social data private
*/
UserProfileQuery.prototype.shareAllSocialData = function (share) {
return this.profileLoader.shareAllSocialData(share);
};
/**
* Resolves user or group using specified query parameters
*
* @param queryParams The query parameters used to perform resolve
*/
UserProfileQuery.prototype.clientPeoplePickerResolveUser = function (queryParams) {
return this.clientPeoplePickerQuery.clientPeoplePickerResolveUser(queryParams);
};
/**
* Searches for users or groups using specified query parameters
*
* @param queryParams The query parameters used to perform search
*/
UserProfileQuery.prototype.clientPeoplePickerSearchUser = function (queryParams) {
return this.clientPeoplePickerQuery.clientPeoplePickerSearchUser(queryParams);
};
return UserProfileQuery;
}(SharePointQueryableInstance));
var ProfileLoader = /** @class */ (function (_super) {
__extends(ProfileLoader, _super);
function ProfileLoader() {
return _super !== null && _super.apply(this, arguments) || this;
}
ProfileLoader_1 = ProfileLoader;
/**
* Provisions one or more users' personal sites. (My Site administrator on SharePoint Online only) Doesn't support batching
*
* @param emails The email addresses of the users to provision sites for
*/
ProfileLoader.prototype.createPersonalSiteEnqueueBulk = function (emails) {
return this.clone(ProfileLoader_1, "createpersonalsiteenqueuebulk", false).postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({ "emailIDs": emails }),
});
};
Object.defineProperty(ProfileLoader.prototype, "ownerUserProfile", {
/**
* Gets the user profile of the site owner.
*
*/
get: function () {
var q = this.getParent(ProfileLoader_1, this.parentUrl, "_api/sp.userprofiles.profileloader.getowneruserprofile");
if (this.hasBatch) {
q = q.inBatch(this.batch);
}
return q.postCore();
},
enumerable: true,
configurable: true
});
Object.defineProperty(ProfileLoader.prototype, "userProfile", {
/**
* Gets the user profile of the current user.
*
*/
get: function () {
return this.clone(ProfileLoader_1, "getuserprofile").postCore();
},
enumerable: true,
configurable: true
});
/**
* Enqueues creating a personal site for this user, which can be used to share documents, web pages, and other files.
*
* @param interactiveRequest true if interactively (web) initiated request, or false (default) if non-interactively (client) initiated request
*/
ProfileLoader.prototype.createPersonalSite = function (interactiveRequest) {
if (interactiveRequest === void 0) { interactiveRequest = false; }
return this.clone(ProfileLoader_1, "getuserprofile/createpersonalsiteenque(" + interactiveRequest + ")").postCore();
};
/**
* Sets the privacy settings for this profile
*
* @param share true to make all social data public; false to make all social data private.
*/
ProfileLoader.prototype.shareAllSocialData = function (share) {
return this.clone(ProfileLoader_1, "getuserprofile/shareallsocialdata(" + share + ")").postCore();
};
var ProfileLoader_1;
ProfileLoader = ProfileLoader_1 = __decorate([
defaultPath("_api/sp.userprofiles.profileloader.getprofileloader")
], ProfileLoader);
return ProfileLoader;
}(SharePointQueryable));
var ClientPeoplePickerQuery = /** @class */ (function (_super) {
__extends(ClientPeoplePickerQuery, _super);
function ClientPeoplePickerQuery() {
return _super !== null && _super.apply(this, arguments) || this;
}
ClientPeoplePickerQuery_1 = ClientPeoplePickerQuery;
/**
* Resolves user or group using specified query parameters
*
* @param queryParams The query parameters used to perform resolve
*/
ClientPeoplePickerQuery.prototype.clientPeoplePickerResolveUser = function (queryParams) {
var q = this.clone(ClientPeoplePickerQuery_1, null);
q.concat(".clientpeoplepickerresolveuser");
return q.postCore({
body: this.createClientPeoplePickerQueryParametersRequestBody(queryParams),
})
.then(function (res) {
if (typeof res === "object") {
return res.ClientPeoplePickerResolveUser;
}
return res;
})
.then(JSON.parse);
};
/**
* Searches for users or groups using specified query parameters
*
* @param queryParams The query parameters used to perform search
*/
ClientPeoplePickerQuery.prototype.clientPeoplePickerSearchUser = function (queryParams) {
var q = this.clone(ClientPeoplePickerQuery_1, null);
q.concat(".clientpeoplepickersearchuser");
return q.postCore({
body: this.createClientPeoplePickerQueryParametersRequestBody(queryParams),
})
.then(function (res) {
if (typeof res === "object") {
return res.ClientPeoplePickerSearchUser;
}
return res;
})
.then(JSON.parse);
};
/**
* Creates ClientPeoplePickerQueryParameters request body
*
* @param queryParams The query parameters to create request body
*/
ClientPeoplePickerQuery.prototype.createClientPeoplePickerQueryParametersRequestBody = function (queryParams) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"queryParams": Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.UI.ApplicationPages.ClientPeoplePickerQueryParameters"), queryParams),
});
};
var ClientPeoplePickerQuery_1;
ClientPeoplePickerQuery = ClientPeoplePickerQuery_1 = __decorate([
defaultPath("_api/sp.ui.applicationpages.clientpeoplepickerwebserviceinterface")
], ClientPeoplePickerQuery);
return ClientPeoplePickerQuery;
}(SharePointQueryable));
/**
* Exposes social following methods
*/
var SocialQuery = /** @class */ (function (_super) {
__extends(SocialQuery, _super);
function SocialQuery() {
return _super !== null && _super.apply(this, arguments) || this;
}
SocialQuery_1 = SocialQuery;
Object.defineProperty(SocialQuery.prototype, "my", {
get: function () {
return new MySocialQuery(this);
},
enumerable: true,
configurable: true
});
/**
* Gets a URI to a site that lists the current user's followed sites.
*/
SocialQuery.prototype.getFollowedSitesUri = function () {
return this.clone(SocialQuery_1, "FollowedSitesUri").get().then(function (r) {
return r.FollowedSitesUri || r;
});
};
/**
* Gets a URI to a site that lists the current user's followed documents.
*/
SocialQuery.prototype.getFollowedDocumentsUri = function () {
return this.clone(SocialQuery_1, "FollowedDocumentsUri").get().then(function (r) {
return r.FollowedDocumentsUri || r;
});
};
/**
* Makes the current user start following a user, document, site, or tag
*
* @param actorInfo The actor to start following
*/
SocialQuery.prototype.follow = function (actorInfo) {
return this.clone(SocialQuery_1, "follow").postCore({ body: this.createSocialActorInfoRequestBody(actorInfo) });
};
/**
* Indicates whether the current user is following a specified user, document, site, or tag
*
* @param actorInfo The actor to find the following status for
*/
SocialQuery.prototype.isFollowed = function (actorInfo) {
return this.clone(SocialQuery_1, "isfollowed").postCore({ body: this.createSocialActorInfoRequestBody(actorInfo) });
};
/**
* Makes the current user stop following a user, document, site, or tag
*
* @param actorInfo The actor to stop following
*/
SocialQuery.prototype.stopFollowing = function (actorInfo) {
return this.clone(SocialQuery_1, "stopfollowing").postCore({ body: this.createSocialActorInfoRequestBody(actorInfo) });
};
/**
* Creates SocialActorInfo request body
*
* @param actorInfo The actor to create request body
*/
SocialQuery.prototype.createSocialActorInfoRequestBody = function (actorInfo) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])({
"actor": Object.assign(metadata("SP.Social.SocialActorInfo"), {
Id: null,
}, actorInfo),
});
};
var SocialQuery_1;
SocialQuery = SocialQuery_1 = __decorate([
defaultPath("_api/social.following")
], SocialQuery);
return SocialQuery;
}(SharePointQueryableInstance));
var MySocialQuery = /** @class */ (function (_super) {
__extends(MySocialQuery, _super);
function MySocialQuery() {
return _super !== null && _super.apply(this, arguments) || this;
}
MySocialQuery_1 = MySocialQuery;
/**
* Gets users, documents, sites, and tags that the current user is following.
*
* @param types Bitwise set of SocialActorTypes to retrieve
*/
MySocialQuery.prototype.followed = function (types) {
return this.clone(MySocialQuery_1, "followed(types=" + types + ")").get().then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "Followed") ? r.Followed.results : r;
});
};
/**
* Gets the count of users, documents, sites, and tags that the current user is following.
*
* @param types Bitwise set of SocialActorTypes to retrieve
*/
MySocialQuery.prototype.followedCount = function (types) {
return this.clone(MySocialQuery_1, "followedcount(types=" + types + ")").get().then(function (r) {
return r.FollowedCount || r;
});
};
/**
* Gets the users who are following the current user.
*/
MySocialQuery.prototype.followers = function () {
return this.clone(MySocialQuery_1, "followers").get().then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "Followers") ? r.Followers.results : r;
});
};
/**
* Gets users who the current user might want to follow.
*/
MySocialQuery.prototype.suggestions = function () {
return this.clone(MySocialQuery_1, "suggestions").get().then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "Suggestions") ? r.Suggestions.results : r;
});
};
var MySocialQuery_1;
MySocialQuery = MySocialQuery_1 = __decorate([
defaultPath("my")
], MySocialQuery);
return MySocialQuery;
}(SharePointQueryableInstance));
/**
* Social actor type
*
*/
var SocialActorType;
(function (SocialActorType) {
SocialActorType[SocialActorType["User"] = 0] = "User";
SocialActorType[SocialActorType["Document"] = 1] = "Document";
SocialActorType[SocialActorType["Site"] = 2] = "Site";
SocialActorType[SocialActorType["Tag"] = 3] = "Tag";
})(SocialActorType || (SocialActorType = {}));
/**
* Social actor type
*
*/
/* tslint:disable:no-bitwise */
var SocialActorTypes;
(function (SocialActorTypes) {
SocialActorTypes[SocialActorTypes["None"] = 0] = "None";
SocialActorTypes[SocialActorTypes["User"] = 1] = "User";
SocialActorTypes[SocialActorTypes["Document"] = 2] = "Document";
SocialActorTypes[SocialActorTypes["Site"] = 4] = "Site";
SocialActorTypes[SocialActorTypes["Tag"] = 8] = "Tag";
/**
* The set excludes documents and sites that do not have feeds.
*/
SocialActorTypes[SocialActorTypes["ExcludeContentWithoutFeeds"] = 268435456] = "ExcludeContentWithoutFeeds";
/**
* The set includes group sites
*/
SocialActorTypes[SocialActorTypes["IncludeGroupsSites"] = 536870912] = "IncludeGroupsSites";
/**
* The set includes only items created within the last 24 hours
*/
SocialActorTypes[SocialActorTypes["WithinLast24Hours"] = 1073741824] = "WithinLast24Hours";
})(SocialActorTypes || (SocialActorTypes = {}));
/* tslint:enable */
/**
* Result from following
*
*/
var SocialFollowResult;
(function (SocialFollowResult) {
SocialFollowResult[SocialFollowResult["Ok"] = 0] = "Ok";
SocialFollowResult[SocialFollowResult["AlreadyFollowing"] = 1] = "AlreadyFollowing";
SocialFollowResult[SocialFollowResult["LimitReached"] = 2] = "LimitReached";
SocialFollowResult[SocialFollowResult["InternalError"] = 3] = "InternalError";
})(SocialFollowResult || (SocialFollowResult = {}));
/**
* Specifies an exception or status code.
*/
var SocialStatusCode;
(function (SocialStatusCode) {
/**
* The operation completed successfully
*/
SocialStatusCode[SocialStatusCode["OK"] = 0] = "OK";
/**
* The request is invalid.
*/
SocialStatusCode[SocialStatusCode["InvalidRequest"] = 1] = "InvalidRequest";
/**
* The current user is not authorized to perform the operation.
*/
SocialStatusCode[SocialStatusCode["AccessDenied"] = 2] = "AccessDenied";
/**
* The target of the operation was not found.
*/
SocialStatusCode[SocialStatusCode["ItemNotFound"] = 3] = "ItemNotFound";
/**
* The operation is invalid for the target's current state.
*/
SocialStatusCode[SocialStatusCode["InvalidOperation"] = 4] = "InvalidOperation";
/**
* The operation completed without modifying the target.
*/
SocialStatusCode[SocialStatusCode["ItemNotModified"] = 5] = "ItemNotModified";
/**
* The operation failed because an internal error occurred.
*/
SocialStatusCode[SocialStatusCode["InternalError"] = 6] = "InternalError";
/**
* The operation failed because the server could not access the distributed cache.
*/
SocialStatusCode[SocialStatusCode["CacheReadError"] = 7] = "CacheReadError";
/**
* The operation succeeded but the server could not update the distributed cache.
*/
SocialStatusCode[SocialStatusCode["CacheUpdateError"] = 8] = "CacheUpdateError";
/**
* No personal site exists for the current user, and no further information is available.
*/
SocialStatusCode[SocialStatusCode["PersonalSiteNotFound"] = 9] = "PersonalSiteNotFound";
/**
* No personal site exists for the current user, and a previous attempt to create one failed.
*/
SocialStatusCode[SocialStatusCode["FailedToCreatePersonalSite"] = 10] = "FailedToCreatePersonalSite";
/**
* No personal site exists for the current user, and a previous attempt to create one was not authorized.
*/
SocialStatusCode[SocialStatusCode["NotAuthorizedToCreatePersonalSite"] = 11] = "NotAuthorizedToCreatePersonalSite";
/**
* No personal site exists for the current user, and no attempt should be made to create one.
*/
SocialStatusCode[SocialStatusCode["CannotCreatePersonalSite"] = 12] = "CannotCreatePersonalSite";
/**
* The operation was rejected because an internal limit had been reached.
*/
SocialStatusCode[SocialStatusCode["LimitReached"] = 13] = "LimitReached";
/**
* The operation failed because an error occurred during the processing of the specified attachment.
*/
SocialStatusCode[SocialStatusCode["AttachmentError"] = 14] = "AttachmentError";
/**
* The operation succeeded with recoverable errors; the returned data is incomplete.
*/
SocialStatusCode[SocialStatusCode["PartialData"] = 15] = "PartialData";
/**
* A required SharePoint feature is not enabled.
*/
SocialStatusCode[SocialStatusCode["FeatureDisabled"] = 16] = "FeatureDisabled";
/**
* The site's storage quota has been exceeded.
*/
SocialStatusCode[SocialStatusCode["StorageQuotaExceeded"] = 17] = "StorageQuotaExceeded";
/**
* The operation failed because the server could not access the database.
*/
SocialStatusCode[SocialStatusCode["DatabaseError"] = 18] = "DatabaseError";
})(SocialStatusCode || (SocialStatusCode = {}));
/**
* Implements the site script API REST methods
*
*/
var SiteScripts = /** @class */ (function (_super) {
__extends(SiteScripts, _super);
/**
* Creates a new instance of the SiteScripts method class
*
* @param baseUrl The parent url provider
* @param methodName The static method name to call on the utility class
*/
function SiteScripts(baseUrl, methodName) {
return _super.call(this, SiteScripts.getBaseUrl(baseUrl), "_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility." + methodName) || this;
}
SiteScripts.getBaseUrl = function (candidate) {
if (typeof candidate === "string") {
return candidate;
}
var c = candidate;
var url = c.toUrl();
var index = url.indexOf("_api/");
if (index < 0) {
return url;
}
return url.substr(0, index);
};
SiteScripts.prototype.execute = function (props) {
return this.postCore({
body: JSON.stringify(props),
});
};
/**
* Gets a list of information on all existing site scripts.
*/
SiteScripts.prototype.getSiteScripts = function () {
return this.clone(SiteScripts, "GetSiteScripts", true).execute({});
};
/**
* Creates a new site script.
*
* @param title The display name of the site design.
* @param content JSON value that describes the script. For more information, see JSON reference.
*/
SiteScripts.prototype.createSiteScript = function (title, description, content) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteScripts, "CreateSiteScript(Title=@title,Description=@desc)?@title='" + encodeURIComponent(title) + "'&@desc='" + encodeURIComponent(description) + "'")
.execute(content)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Gets information about a specific site script. It also returns the JSON of the script.
*
* @param id The ID of the site script to get information about.
*/
SiteScripts.prototype.getSiteScriptMetadata = function (id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteScripts, "GetSiteScriptMetadata").execute({ id: id })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Deletes a site script.
*
* @param id The ID of the site script to delete.
*/
SiteScripts.prototype.deleteSiteScript = function (id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteScripts, "DeleteSiteScript").execute({ id: id })];
case 1:
_a.sent();
return [2 /*return*/];
}
});
});
};
/**
* Updates a site script with new values. In the REST call, all parameters are optional except the site script Id.
*
* @param siteScriptUpdateInfo Object that contains the information to update a site script.
* Make sure you stringify the content object or pass it in the second 'content' parameter
* @param content (Optional) A new JSON script defining the script actions. For more information, see Site design JSON schema.
*/
SiteScripts.prototype.updateSiteScript = function (siteScriptUpdateInfo, content) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (content) {
siteScriptUpdateInfo.Content = JSON.stringify(content);
}
return [4 /*yield*/, this.clone(SiteScripts, "UpdateSiteScript").execute({ updateInfo: siteScriptUpdateInfo })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
return SiteScripts;
}(SharePointQueryable));
/**
* Implements the site designs API REST methods
*
*/
var SiteDesigns = /** @class */ (function (_super) {
__extends(SiteDesigns, _super);
/**
* Creates a new instance of the SiteDesigns method class
*
* @param baseUrl The parent url provider
* @param methodName The static method name to call on the utility class
*/
function SiteDesigns(baseUrl, methodName) {
return _super.call(this, SiteDesigns.getBaseUrl(baseUrl), "_api/Microsoft.Sharepoint.Utilities.WebTemplateExtensions.SiteScriptUtility." + methodName) || this;
}
SiteDesigns.getBaseUrl = function (candidate) {
if (typeof candidate === "string") {
return candidate;
}
var c = candidate;
var url = c.toUrl();
var index = url.indexOf("_api/");
if (index < 0) {
return url;
}
return url.substr(0, index);
};
SiteDesigns.prototype.execute = function (props) {
return this.postCore({
body: JSON.stringify(props),
headers: {
"Content-Type": "application/json;charset=utf-8",
},
});
};
/**
* Creates a new site design available to users when they create a new site from the SharePoint home page.
*
* @param creationInfo A sitedesign creation information object
*/
SiteDesigns.prototype.createSiteDesign = function (creationInfo) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "CreateSiteDesign").execute({ info: creationInfo })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Applies a site design to an existing site collection.
*
* @param siteDesignId The ID of the site design to apply.
* @param webUrl The URL of the site collection where you want to apply the site design.
*/
SiteDesigns.prototype.applySiteDesign = function (siteDesignId, webUrl) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "ApplySiteDesign").execute({ siteDesignId: siteDesignId, "webUrl": webUrl })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Gets a list of information about existing site designs.
*/
SiteDesigns.prototype.getSiteDesigns = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "GetSiteDesigns").execute({})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Gets information about a specific site design.
* @param id The ID of the site design to get information about.
*/
SiteDesigns.prototype.getSiteDesignMetadata = function (id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "GetSiteDesignMetadata").execute({ id: id })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Updates a site design with new values. In the REST call, all parameters are optional except the site script Id.
* If you had previously set the IsDefault parameter to TRUE and wish it to remain true, you must pass in this parameter again (otherwise it will be reset to FALSE).
* @param updateInfo A sitedesign update information object
*/
SiteDesigns.prototype.updateSiteDesign = function (updateInfo) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "UpdateSiteDesign").execute({ updateInfo: updateInfo })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Deletes a site design.
* @param id The ID of the site design to delete.
*/
SiteDesigns.prototype.deleteSiteDesign = function (id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "DeleteSiteDesign").execute({ id: id })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Gets a list of principals that have access to a site design.
* @param id The ID of the site design to get rights information from.
*/
SiteDesigns.prototype.getSiteDesignRights = function (id) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "GetSiteDesignRights").execute({ id: id })];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Grants access to a site design for one or more principals.
* @param id The ID of the site design to grant rights on.
* @param principalNames An array of one or more principals to grant view rights.
* Principals can be users or mail-enabled security groups in the form of "alias" or "alias@<domain name>.com"
* @param grantedRights Always set to 1. This represents the View right.
*/
SiteDesigns.prototype.grantSiteDesignRights = function (id, principalNames, grantedRights) {
if (grantedRights === void 0) { grantedRights = 1; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "GrantSiteDesignRights")
.execute({
"grantedRights": grantedRights.toString(),
"id": id,
"principalNames": principalNames,
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
/**
* Revokes access from a site design for one or more principals.
* @param id The ID of the site design to revoke rights from.
* @param principalNames An array of one or more principals to revoke view rights from.
* If all principals have rights revoked on the site design, the site design becomes viewable to everyone.
*/
SiteDesigns.prototype.revokeSiteDesignRights = function (id, principalNames) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.clone(SiteDesigns, "RevokeSiteDesignRights")
.execute({
"id": id,
"principalNames": principalNames,
})];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
return SiteDesigns;
}(SharePointQueryable));
/**
* Allows for calling of the static SP.Utilities.Utility methods by supplying the method name
*/
var UtilityMethod = /** @class */ (function (_super) {
__extends(UtilityMethod, _super);
/**
* Creates a new instance of the Utility method class
*
* @param baseUrl The parent url provider
* @param methodName The static method name to call on the utility class
*/
function UtilityMethod(baseUrl, methodName) {
return _super.call(this, UtilityMethod.getBaseUrl(baseUrl), "_api/SP.Utilities.Utility." + methodName) || this;
}
UtilityMethod.getBaseUrl = function (candidate) {
if (typeof candidate === "string") {
return candidate;
}
var c = candidate;
var url = c.toUrl();
var index = url.indexOf("_api/");
if (index < 0) {
return url;
}
return url.substr(0, index);
};
UtilityMethod.prototype.excute = function (props) {
return this.postCore({
body: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["jsS"])(props),
});
};
/**
* Sends an email based on the supplied properties
*
* @param props The properties of the email to send
*/
UtilityMethod.prototype.sendEmail = function (props) {
var params = {
properties: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(metadata("SP.Utilities.EmailProperties"), {
Body: props.Body,
From: props.From,
Subject: props.Subject,
}),
};
if (props.To && props.To.length > 0) {
params.properties = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(params.properties, {
To: { results: props.To },
});
}
if (props.CC && props.CC.length > 0) {
params.properties = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(params.properties, {
CC: { results: props.CC },
});
}
if (props.BCC && props.BCC.length > 0) {
params.properties = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(params.properties, {
BCC: { results: props.BCC },
});
}
if (props.AdditionalHeaders) {
params.properties = Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["extend"])(params.properties, {
AdditionalHeaders: props.AdditionalHeaders,
});
}
return this.clone(UtilityMethod, "SendEmail", true).excute(params);
};
UtilityMethod.prototype.getCurrentUserEmailAddresses = function () {
return this.clone(UtilityMethod, "GetCurrentUserEmailAddresses", true).excute({}).then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "GetCurrentUserEmailAddresses") ? r.GetCurrentUserEmailAddresses : r;
});
};
UtilityMethod.prototype.resolvePrincipal = function (input, scopes, sources, inputIsEmailOnly, addToUserInfoList, matchUserInfoList) {
if (matchUserInfoList === void 0) { matchUserInfoList = false; }
var params = {
addToUserInfoList: addToUserInfoList,
input: input,
inputIsEmailOnly: inputIsEmailOnly,
matchUserInfoList: matchUserInfoList,
scopes: scopes,
sources: sources,
};
return this.clone(UtilityMethod, "ResolvePrincipalInCurrentContext", true).excute(params).then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "ResolvePrincipalInCurrentContext") ? r.ResolvePrincipalInCurrentContext : r;
});
};
UtilityMethod.prototype.searchPrincipals = function (input, scopes, sources, groupName, maxCount) {
var params = {
groupName: groupName,
input: input,
maxCount: maxCount,
scopes: scopes,
sources: sources,
};
return this.clone(UtilityMethod, "SearchPrincipalsUsingContextWeb", true).excute(params).then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "SearchPrincipalsUsingContextWeb") ? r.SearchPrincipalsUsingContextWeb : r;
});
};
UtilityMethod.prototype.createEmailBodyForInvitation = function (pageAddress) {
var params = {
pageAddress: pageAddress,
};
return this.clone(UtilityMethod, "CreateEmailBodyForInvitation", true).excute(params).then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "CreateEmailBodyForInvitation") ? r.CreateEmailBodyForInvitation : r;
});
};
UtilityMethod.prototype.expandGroupsToPrincipals = function (inputs, maxCount) {
if (maxCount === void 0) { maxCount = 30; }
var params = {
inputs: inputs,
maxCount: maxCount,
};
return this.clone(UtilityMethod, "ExpandGroupsToPrincipals", true).excute(params).then(function (r) {
return Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "ExpandGroupsToPrincipals") ? r.ExpandGroupsToPrincipals : r;
});
};
UtilityMethod.prototype.createWikiPage = function (info) {
return this.clone(UtilityMethod, "CreateWikiPageInContextWeb", true).excute({
parameters: info,
}).then(function (r) {
return {
data: Object(_pnp_common__WEBPACK_IMPORTED_MODULE_0__["hOP"])(r, "CreateWikiPageInContextWeb") ? r.CreateWikiPageInContextWeb : r,
file: new File(odataUrlFrom(r)),
};
});
};
/**
* Checks if file or folder name contains invalid characters
*
* @param input File or folder name to check
* @param onPremise Set to true for SharePoint On-Premise
* @returns True if contains invalid chars, false otherwise
*/
UtilityMethod.prototype.containsInvalidFileFolderChars = function (input, onPremise) {
if (onPremise === void 0) { onPremise = false; }
if (onPremise) {
return UtilityMethod.InvalidFileFolderNameCharsOnPremiseRegex.test(input);
}
else {
return UtilityMethod.InvalidFileFolderNameCharsOnlineRegex.test(input);
}
};
/**
* Removes invalid characters from file or folder name
*
* @param input File or folder name
* @param replacer Value that will replace invalid characters
* @param onPremise Set to true for SharePoint On-Premise
* @returns File or folder name with replaced invalid characters
*/
UtilityMethod.prototype.stripInvalidFileFolderChars = function (input, replacer, onPremise) {
if (replacer === void 0) { replacer = ""; }
if (onPremise === void 0) { onPremise = false; }
if (onPremise) {
return input.replace(UtilityMethod.InvalidFileFolderNameCharsOnPremiseRegex, replacer);
}
else {
return input.replace(UtilityMethod.InvalidFileFolderNameCharsOnlineRegex, replacer);
}
};
UtilityMethod.InvalidFileFolderNameCharsOnlineRegex = /["*:<>?/\\|\x00-\x1f\x7f-\x9f]/g;
UtilityMethod.InvalidFileFolderNameCharsOnPremiseRegex = /["#%*:<>?/\\|\x00-\x1f\x7f-\x9f]/g;
return UtilityMethod;
}(SharePointQueryable));
/**
* Describes a collection of Hub Sites
*
*/
var HubSites = /** @class */ (function (_super) {
__extends(HubSites, _super);
function HubSites() {
return _super !== null && _super.apply(this, arguments) || this;
}
/**
* Gets a Hub Site from the collection by id
*
* @param id The Id of the Hub Site
*/
HubSites.prototype.getById = function (id) {
return new HubSite(this, "GetById?hubSiteId='" + id + "'");
};
HubSites = __decorate([
defaultPath("_api/hubsites")
], HubSites);
return HubSites;
}(SharePointQueryableCollection));
var HubSite = /** @class */ (function (_super) {
__extends(HubSite, _super);
function HubSite() {
return _super !== null && _super.apply(this, arguments) || this;
}
return HubSite;
}(SharePointQueryableInstance));
/**
* Root of the SharePoint REST module
*/
var SPRest = /** @class */ (function () {
/**
* Creates a new instance of the SPRest class
*
* @param options Additional options
* @param baseUrl A string that should form the base part of the url
*/
function SPRest(_options, _baseUrl) {
if (_options === void 0) { _options = {}; }
if (_baseUrl === void 0) { _baseUrl = ""; }
this._options = _options;
this._baseUrl = _baseUrl;
}
/**
* Configures instance with additional options and baseUrl.
* Provided configuration used by other objects in a chain
*
* @param options Additional options
* @param baseUrl A string that should form the base part of the url
*/
SPRest.prototype.configure = function (options, baseUrl) {
if (baseUrl === void 0) { baseUrl = ""; }
return new SPRest(options, baseUrl);
};
/**
* Global SharePoint configuration options
*
* @param config The SharePoint configuration to apply
*/
SPRest.prototype.setup = function (config) {
setup(config);
};
/**
* Executes a search against this web context
*
* @param query The SearchQuery definition
*/
SPRest.prototype.searchSuggest = function (query) {
var finalQuery;
if (typeof query === "string") {
finalQuery = { querytext: query };
}
else {
finalQuery = query;
}
return this.create(SearchSuggest).execute(finalQuery);
};
/**
* Executes a search against this web context
*
* @param query The SearchQuery definition
*/
SPRest.prototype.search = function (query) {
return this.create(Search).execute(query);
};
/**
* Executes the provided search query, caching the results
*
* @param query The SearchQuery definition
* @param options The set of caching options used to store the results
*/
SPRest.prototype.searchWithCaching = function (query, options) {
return this.create(Search).usingCaching(options).execute(query);
};
Object.defineProperty(SPRest.prototype, "site", {
/**
* Begins a site collection scoped REST request
*
*/
get: function () {
return this.create(Site);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "web", {
/**
* Begins a web scoped REST request
*
*/
get: function () {
return this.create(Web);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "profiles", {
/**
* Access to user profile methods
*
*/
get: function () {
return this.create(UserProfileQuery);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "social", {
/**
* Access to social methods
*/
get: function () {
return this.create(SocialQuery);
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "navigation", {
/**
* Access to the site collection level navigation service
*/
get: function () {
return this.create(NavigationService);
},
enumerable: true,
configurable: true
});
/**
* Creates a new batch object for use with the SharePointQueryable.addToBatch method
*
*/
SPRest.prototype.createBatch = function () {
return this.web.createBatch();
};
Object.defineProperty(SPRest.prototype, "utility", {
/**
* Static utilities methods from SP.Utilities.Utility
*/
get: function () {
return this.create(UtilityMethod, "");
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "siteScripts", {
/**
* Access to sitescripts methods
*/
get: function () {
return this.create(SiteScripts, "");
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "siteDesigns", {
/**
* Access to sitedesigns methods
*/
get: function () {
return this.create(SiteDesigns, "");
},
enumerable: true,
configurable: true
});
Object.defineProperty(SPRest.prototype, "hubSites", {
/**
* Access to Hub Site methods
*/
get: function () {
return this.create(HubSites);
},
enumerable: true,
configurable: true
});
/**
* Handles creating and configuring the objects returned from this class
*
* @param fm The factory method used to create the instance
* @param path Optional additional path information to pass to the factory method
*/
SPRest.prototype.create = function (fm, path) {
return new fm(this._baseUrl, path).configure(this._options);
};
return SPRest;
}());
var sp = new SPRest();
//# sourceMappingURL=sp.es5.js.map
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/adal-angular/dist/adal.min.js":
/*!****************************************************!*\
!*** ./node_modules/adal-angular/dist/adal.min.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/*! adal-angular v1.0.17 2018-02-27 */
var AuthenticationContext=function(){"use strict";return AuthenticationContext=function(a){if(this.REQUEST_TYPE={LOGIN:"LOGIN",RENEW_TOKEN:"RENEW_TOKEN",UNKNOWN:"UNKNOWN"},this.RESPONSE_TYPE={ID_TOKEN_TOKEN:"id_token token",TOKEN:"token"},this.CONSTANTS={ACCESS_TOKEN:"access_token",EXPIRES_IN:"expires_in",ID_TOKEN:"id_token",ERROR_DESCRIPTION:"error_description",SESSION_STATE:"session_state",ERROR:"error",STORAGE:{TOKEN_KEYS:"adal.token.keys",ACCESS_TOKEN_KEY:"adal.access.token.key",EXPIRATION_KEY:"adal.expiration.key",STATE_LOGIN:"adal.state.login",STATE_RENEW:"adal.state.renew",NONCE_IDTOKEN:"adal.nonce.idtoken",SESSION_STATE:"adal.session.state",USERNAME:"adal.username",IDTOKEN:"adal.idtoken",ERROR:"adal.error",ERROR_DESCRIPTION:"adal.error.description",LOGIN_REQUEST:"adal.login.request",LOGIN_ERROR:"adal.login.error",RENEW_STATUS:"adal.token.renew.status",ANGULAR_LOGIN_REQUEST:"adal.angular.login.request"},RESOURCE_DELIMETER:"|",CACHE_DELIMETER:"||",LOADFRAME_TIMEOUT:6e3,TOKEN_RENEW_STATUS_CANCELED:"Canceled",TOKEN_RENEW_STATUS_COMPLETED:"Completed",TOKEN_RENEW_STATUS_IN_PROGRESS:"In Progress",LOGGING_LEVEL:{ERROR:0,WARN:1,INFO:2,VERBOSE:3},LEVEL_STRING_MAP:{0:"ERROR:",1:"WARNING:",2:"INFO:",3:"VERBOSE:"},POPUP_WIDTH:483,POPUP_HEIGHT:600},AuthenticationContext.prototype._singletonInstance)return AuthenticationContext.prototype._singletonInstance;if(AuthenticationContext.prototype._singletonInstance=this,this.instance="https://login.microsoftonline.com/",this.config={},this.callback=null,this.popUp=!1,this.isAngular=!1,this._user=null,this._activeRenewals={},this._loginInProgress=!1,this._acquireTokenInProgress=!1,this._renewStates=[],this._callBackMappedToRenewStates={},this._callBacksMappedToRenewStates={},this._openedWindows=[],this._requestType=this.REQUEST_TYPE.LOGIN,window._adalInstance=this,a.displayCall&&"function"!=typeof a.displayCall)throw new Error("displayCall is not a function");if(!a.clientId)throw new Error("clientId is required");this.config=this._cloneConfig(a),void 0===this.config.navigateToLoginRequestUrl&&(this.config.navigateToLoginRequestUrl=!0),this.config.popUp&&(this.popUp=!0),this.config.callback&&"function"==typeof this.config.callback&&(this.callback=this.config.callback),this.config.instance&&(this.instance=this.config.instance),this.config.loginResource||(this.config.loginResource=this.config.clientId),this.config.redirectUri||(this.config.redirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.postLogoutRedirectUri||(this.config.postLogoutRedirectUri=window.location.href.split("?")[0].split("#")[0]),this.config.anonymousEndpoints||(this.config.anonymousEndpoints=[]),this.config.isAngular&&(this.isAngular=this.config.isAngular),this.config.loadFrameTimeout&&(this.CONSTANTS.LOADFRAME_TIMEOUT=this.config.loadFrameTimeout)},"undefined"!=typeof window&&(window.Logging={piiLoggingEnabled:!1,level:0,log:function(a){}}),AuthenticationContext.prototype.login=function(){if(this._loginInProgress)return void this.info("Login in progress");this._loginInProgress=!0;var a=this._guid();this.config.state=a,this._idTokenNonce=this._guid();var b=this._getItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST);b&&""!==b?this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""):b=window.location.href,this.verbose("Expected state: "+a+" startPage:"+b),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,b),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,a,!0),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var c=this._getNavigateUrl("id_token",null)+"&nonce="+encodeURIComponent(this._idTokenNonce);this.config.displayCall?this.config.displayCall(c):this.popUp?(this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._renewStates.push(a),this.registerCallback(a,this.config.clientId,this.callback),this._loginPopup(c)):this.promptUser(c)},AuthenticationContext.prototype._openPopup=function(a,b,c,d){try{var e=window.screenLeft?window.screenLeft:window.screenX,f=window.screenTop?window.screenTop:window.screenY,g=window.innerWidth||document.documentElement.clientWidth||document.body.clientWidth,h=window.innerHeight||document.documentElement.clientHeight||document.body.clientHeight,i=g/2-c/2+e,j=h/2-d/2+f,k=window.open(a,b,"width="+c+", height="+d+", top="+j+", left="+i);return k.focus&&k.focus(),k}catch(a){return this.warn("Error opening popup, "+a.message),this._loginInProgress=!1,this._acquireTokenInProgress=!1,null}},AuthenticationContext.prototype._handlePopupError=function(a,b,c,d,e){this.warn(d),this._saveItem(this.CONSTANTS.STORAGE.ERROR,c),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,d),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,e),b&&this._activeRenewals[b]&&(this._activeRenewals[b]=null),this._loginInProgress=!1,this._acquireTokenInProgress=!1,a&&a(d,null,c)},AuthenticationContext.prototype._loginPopup=function(a,b,c){var d=this._openPopup(a,"login",this.CONSTANTS.POPUP_WIDTH,this.CONSTANTS.POPUP_HEIGHT),e=c||this.callback;if(null==d){var f="Popup Window is null. This can happen if you are using IE";return void this._handlePopupError(e,b,"Error opening popup",f,f)}if(this._openedWindows.push(d),-1!=this.config.redirectUri.indexOf("#"))var g=this.config.redirectUri.split("#")[0];else var g=this.config.redirectUri;var h=this,i=window.setInterval(function(){if(!d||d.closed||void 0===d.closed){var a="Popup Window closed",c="Popup Window closed by UI action/ Popup Window handle destroyed due to cross zone navigation in IE/Edge";return h.isAngular&&h._broadcast("adal:popUpClosed",c+h.CONSTANTS.RESOURCE_DELIMETER+a),h._handlePopupError(e,b,a,c,c),void window.clearInterval(i)}try{var f=d.location;if(-1!=encodeURI(f.href).indexOf(encodeURI(g)))return h.isAngular?h._broadcast("adal:popUpHashChanged",f.hash):h.handleWindowCallback(f.hash),window.clearInterval(i),h._loginInProgress=!1,h._acquireTokenInProgress=!1,h.info("Closing popup window"),h._openedWindows=[],void d.close()}catch(a){}},1)},AuthenticationContext.prototype._broadcast=function(a,b){!function(){function a(a,b){b=b||{bubbles:!1,cancelable:!1,detail:void 0};var c=document.createEvent("CustomEvent");return c.initCustomEvent(a,b.bubbles,b.cancelable,b.detail),c}if("function"==typeof window.CustomEvent)return!1;a.prototype=window.Event.prototype,window.CustomEvent=a}();var c=new CustomEvent(a,{detail:b});window.dispatchEvent(c)},AuthenticationContext.prototype.loginInProgress=function(){return this._loginInProgress},AuthenticationContext.prototype._hasResource=function(a){var b=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);return b&&!this._isEmpty(b)&&b.indexOf(a+this.CONSTANTS.RESOURCE_DELIMETER)>-1},AuthenticationContext.prototype.getCachedToken=function(a){if(!this._hasResource(a))return null;var b=this._getItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+a),c=this._getItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+a),d=this.config.expireOffsetSeconds||300;return c&&c>this._now()+d?b:(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+a,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+a,0),null)},AuthenticationContext.prototype.getCachedUser=function(){if(this._user)return this._user;var a=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);return this._user=this._createUser(a),this._user},AuthenticationContext.prototype.registerCallback=function(a,b,c){this._activeRenewals[b]=a,this._callBacksMappedToRenewStates[a]||(this._callBacksMappedToRenewStates[a]=[]);var d=this;this._callBacksMappedToRenewStates[a].push(c),this._callBackMappedToRenewStates[a]||(this._callBackMappedToRenewStates[a]=function(c,e,f,g){d._activeRenewals[b]=null;for(var h=0;h<d._callBacksMappedToRenewStates[a].length;++h)try{d._callBacksMappedToRenewStates[a][h](c,e,f,g)}catch(f){d.warn(f)}d._callBacksMappedToRenewStates[a]=null,d._callBackMappedToRenewStates[a]=null})},AuthenticationContext.prototype._renewToken=function(a,b,c){this.info("renewToken is called for resource:"+a);var d=this._addAdalFrame("adalRenewFrame"+a),e=this._guid()+"|"+a;this.config.state=e,this._renewStates.push(e),this.verbose("Renew token Expected state: "+e),c=c||"token";var f=this._urlRemoveQueryStringParameter(this._getNavigateUrl(c,a),"prompt");c===this.RESPONSE_TYPE.ID_TOKEN_TOKEN&&(this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),f+="&nonce="+encodeURIComponent(this._idTokenNonce)),f+="&prompt=none",f=this._addHintParameters(f),this.registerCallback(e,a,b),this.verbosePii("Navigate to:"+f),d.src="about:blank",this._loadFrameTimeout(f,"adalRenewFrame"+a,a)},AuthenticationContext.prototype._renewIdToken=function(a,b){this.info("renewIdToken is called");var c=this._addAdalFrame("adalIdTokenFrame"),d=this._guid()+"|"+this.config.clientId;this._idTokenNonce=this._guid(),this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,this._idTokenNonce,!0),this.config.state=d,this._renewStates.push(d),this.verbose("Renew Idtoken Expected state: "+d);var e=null===b||void 0===b?null:this.config.clientId,b=b||"id_token",f=this._urlRemoveQueryStringParameter(this._getNavigateUrl(b,e),"prompt");f+="&prompt=none",f=this._addHintParameters(f),f+="&nonce="+encodeURIComponent(this._idTokenNonce),this.registerCallback(d,this.config.clientId,a),this.verbosePii("Navigate to:"+f),c.src="about:blank",this._loadFrameTimeout(f,"adalIdTokenFrame",this.config.clientId)},AuthenticationContext.prototype._urlContainsQueryStringParameter=function(a,b){return new RegExp("[\\?&]"+a+"=").test(b)},AuthenticationContext.prototype._urlRemoveQueryStringParameter=function(a,b){var c=new RegExp("(\\&"+b+"=)[^&]+");return a=a.replace(c,""),c=new RegExp("("+b+"=)[^&]+&"),a=a.replace(c,""),c=new RegExp("("+b+"=)[^&]+"),a=a.replace(c,"")},AuthenticationContext.prototype._loadFrameTimeout=function(a,b,c){this.verbose("Set loading state to pending for: "+c),this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+c,this.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS),this._loadFrame(a,b);var d=this;setTimeout(function(){if(d._getItem(d.CONSTANTS.STORAGE.RENEW_STATUS+c)===d.CONSTANTS.TOKEN_RENEW_STATUS_IN_PROGRESS){d.verbose("Loading frame has timed out after: "+d.CONSTANTS.LOADFRAME_TIMEOUT/1e3+" seconds for resource "+c);var a=d._activeRenewals[c];a&&d._callBackMappedToRenewStates[a]&&d._callBackMappedToRenewStates[a]("Token renewal operation failed due to timeout",null,"Token Renewal Failed"),d._saveItem(d.CONSTANTS.STORAGE.RENEW_STATUS+c,d.CONSTANTS.TOKEN_RENEW_STATUS_CANCELED)}},d.CONSTANTS.LOADFRAME_TIMEOUT)},AuthenticationContext.prototype._loadFrame=function(a,b){var c=this;c.info("LoadFrame: "+b);var d=b;setTimeout(function(){var b=c._addAdalFrame(d);""!==b.src&&"about:blank"!==b.src||(b.src=a,c._loadFrame(a,d))},500)},AuthenticationContext.prototype.acquireToken=function(a,b){if(this._isEmpty(a))return this.warn("resource is required"),void b("resource is required",null,"resource is required");var c=this.getCachedToken(a);return c?(this.info("Token is already in cache for resource:"+a),void b(null,c,null)):this._user||this.config.extraQueryParameter&&-1!==this.config.extraQueryParameter.indexOf("login_hint")?void(this._activeRenewals[a]?this.registerCallback(this._activeRenewals[a],a,b):(this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,a===this.config.clientId?this._user?(this.verbose("renewing idtoken"),this._renewIdToken(b)):(this.verbose("renewing idtoken and access_token"),this._renewIdToken(b,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)):this._user?(this.verbose("renewing access_token"),this._renewToken(a,b)):(this.verbose("renewing idtoken and access_token"),this._renewToken(a,b,this.RESPONSE_TYPE.ID_TOKEN_TOKEN)))):(this.warn("User login is required"),void b("User login is required",null,"login required"))},AuthenticationContext.prototype.acquireTokenPopup=function(a,b,c,d){if(this._isEmpty(a))return this.warn("resource is required"),void d("resource is required",null,"resource is required");if(!this._user)return this.warn("User login is required"),void d("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void d("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var e=this._guid()+"|"+a;this.config.state=e,this._renewStates.push(e),this._requestType=this.REQUEST_TYPE.RENEW_TOKEN,this.verbose("Renew token Expected state: "+e);var f=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",a),"prompt");if(f+="&prompt=select_account",b&&(f+=b),c&&-1===f.indexOf("&claims"))f+="&claims="+encodeURIComponent(c);else if(c&&-1!==f.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");f=this._addHintParameters(f),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+a),this.registerCallback(e,a,d),this._loginPopup(f,a,d)},AuthenticationContext.prototype.acquireTokenRedirect=function(a,b,c){if(this._isEmpty(a))return this.warn("resource is required"),void d("resource is required",null,"resource is required");var d=this.callback;if(!this._user)return this.warn("User login is required"),void d("User login is required",null,"login required");if(this._acquireTokenInProgress)return this.warn("Acquire token interactive is already in progress"),void d("Acquire token interactive is already in progress",null,"Acquire token interactive is already in progress");var e=this._guid()+"|"+a;this.config.state=e,this.verbose("Renew token Expected state: "+e);var f=this._urlRemoveQueryStringParameter(this._getNavigateUrl("token",a),"prompt");if(f+="&prompt=select_account",b&&(f+=b),c&&-1===f.indexOf("&claims"))f+="&claims="+encodeURIComponent(c);else if(c&&-1!==f.indexOf("&claims"))throw new Error("Claims cannot be passed as an extraQueryParameter");f=this._addHintParameters(f),this._acquireTokenInProgress=!0,this.info("acquireToken interactive is called for the resource "+a),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,window.location.href),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,e,!0),this.promptUser(f)},AuthenticationContext.prototype.promptUser=function(a){a?(this.infoPii("Navigate to:"+a),window.location.replace(a)):this.info("Navigate url is empty")},AuthenticationContext.prototype.clearCache=function(){this._saveItem(this.CONSTANTS.STORAGE.LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.ANGULAR_LOGIN_REQUEST,""),this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_LOGIN,""),this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._renewStates=[],this._saveItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"");var a=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS);if(!this._isEmpty(a)){a=a.split(this.CONSTANTS.RESOURCE_DELIMETER);for(var b=0;b<a.length&&""!==a[b];b++)this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+a[b],""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+a[b],0)}this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,"")},AuthenticationContext.prototype.clearCacheForResource=function(a){this._saveItem(this.CONSTANTS.STORAGE.STATE_RENEW,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,""),this._hasResource(a)&&(this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+a,""),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+a,0))},AuthenticationContext.prototype.logOut=function(){this.clearCache(),this._user=null;var a;if(this.config.logOutUri)a=this.config.logOutUri;else{var b="common",c="";this.config.tenant&&(b=this.config.tenant),this.config.postLogoutRedirectUri&&(c="post_logout_redirect_uri="+encodeURIComponent(this.config.postLogoutRedirectUri)),a=this.instance+b+"/oauth2/logout?"+c}this.infoPii("Logout navigate to: "+a),this.promptUser(a)},AuthenticationContext.prototype._isEmpty=function(a){return void 0===a||!a||0===a.length},AuthenticationContext.prototype.getUser=function(a){if("function"!=typeof a)throw new Error("callback is not a function");if(this._user)return void a(null,this._user);var b=this._getItem(this.CONSTANTS.STORAGE.IDTOKEN);this._isEmpty(b)?(this.warn("User information is not available"),a("User information is not available",null)):(this.info("User exists in cache: "),this._user=this._createUser(b),a(null,this._user))},AuthenticationContext.prototype._addHintParameters=function(a){if(this._user&&this._user.profile)if(this._user.profile.sid&&-1!==a.indexOf("&prompt=none"))this._urlContainsQueryStringParameter("sid",a)||(a+="&sid="+encodeURIComponent(this._user.profile.sid));else if(this._user.profile.upn&&(this._urlContainsQueryStringParameter("login_hint",a)||(a+="&login_hint="+encodeURIComponent(this._user.profile.upn)),!this._urlContainsQueryStringParameter("domain_hint",a)&&this._user.profile.upn.indexOf("@")>-1)){var b=this._user.profile.upn.split("@");a+="&domain_hint="+encodeURIComponent(b[b.length-1])}return a},AuthenticationContext.prototype._createUser=function(a){var b=null,c=this._extractIdToken(a);return c&&c.hasOwnProperty("aud")&&(c.aud.toLowerCase()===this.config.clientId.toLowerCase()?(b={userName:"",profile:c},c.hasOwnProperty("upn")?b.userName=c.upn:c.hasOwnProperty("email")&&(b.userName=c.email)):this.warn("IdToken has invalid aud field")),b},AuthenticationContext.prototype._getHash=function(a){return a.indexOf("#/")>-1?a=a.substring(a.indexOf("#/")+2):a.indexOf("#")>-1&&(a=a.substring(1)),a},AuthenticationContext.prototype.isCallback=function(a){a=this._getHash(a);var b=this._deserialize(a);return b.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||b.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||b.hasOwnProperty(this.CONSTANTS.ID_TOKEN)},AuthenticationContext.prototype.getLoginError=function(){return this._getItem(this.CONSTANTS.STORAGE.LOGIN_ERROR)},AuthenticationContext.prototype.getRequestInfo=function(a){a=this._getHash(a);var b=this._deserialize(a),c={valid:!1,parameters:{},stateMatch:!1,stateResponse:"",requestType:this.REQUEST_TYPE.UNKNOWN};if(b&&(c.parameters=b,b.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION)||b.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)||b.hasOwnProperty(this.CONSTANTS.ID_TOKEN))){c.valid=!0;var d="";if(!b.hasOwnProperty("state"))return this.warn("No state returned"),c;if(this.verbose("State: "+b.state),d=b.state,c.stateResponse=d,this._matchState(c))return c;if(!c.stateMatch&&window.parent){c.requestType=this._requestType;for(var e=this._renewStates,f=0;f<e.length;f++)if(e[f]===c.stateResponse){c.stateMatch=!0;break}}}return c},AuthenticationContext.prototype._matchNonce=function(a){var b=this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN);if(b){b=b.split(this.CONSTANTS.CACHE_DELIMETER);for(var c=0;c<b.length;c++)if(b[c]===a.profile.nonce)return!0}return!1},AuthenticationContext.prototype._matchState=function(a){var b=this._getItem(this.CONSTANTS.STORAGE.STATE_LOGIN);if(b){b=b.split(this.CONSTANTS.CACHE_DELIMETER);for(var c=0;c<b.length;c++)if(b[c]===a.stateResponse)return a.requestType=this.REQUEST_TYPE.LOGIN,a.stateMatch=!0,!0}var d=this._getItem(this.CONSTANTS.STORAGE.STATE_RENEW);if(d){d=d.split(this.CONSTANTS.CACHE_DELIMETER);for(var c=0;c<d.length;c++)if(d[c]===a.stateResponse)return a.requestType=this.REQUEST_TYPE.RENEW_TOKEN,a.stateMatch=!0,!0}return!1},AuthenticationContext.prototype._getResourceFromState=function(a){if(a){var b=a.indexOf("|");if(b>-1&&b+1<a.length)return a.substring(b+1)}return""},AuthenticationContext.prototype.saveTokenFromHash=function(a){this.info("State status:"+a.stateMatch+"; Request type:"+a.requestType),this._saveItem(this.CONSTANTS.STORAGE.ERROR,""),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"");var b=this._getResourceFromState(a.stateResponse);if(a.parameters.hasOwnProperty(this.CONSTANTS.ERROR_DESCRIPTION))this.infoPii("Error :"+a.parameters.error+"; Error description:"+a.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),this._saveItem(this.CONSTANTS.STORAGE.ERROR,a.parameters.error),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,a.parameters[this.CONSTANTS.ERROR_DESCRIPTION]),a.requestType===this.REQUEST_TYPE.LOGIN&&(this._loginInProgress=!1,this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,a.parameters.error_description));else if(a.stateMatch){this.info("State is right"),a.parameters.hasOwnProperty(this.CONSTANTS.SESSION_STATE)&&this._saveItem(this.CONSTANTS.STORAGE.SESSION_STATE,a.parameters[this.CONSTANTS.SESSION_STATE]);var c;a.parameters.hasOwnProperty(this.CONSTANTS.ACCESS_TOKEN)&&(this.info("Fragment has access token"),this._hasResource(b)||(c=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,c+b+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+b,a.parameters[this.CONSTANTS.ACCESS_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+b,this._expiresIn(a.parameters[this.CONSTANTS.EXPIRES_IN]))),a.parameters.hasOwnProperty(this.CONSTANTS.ID_TOKEN)&&(this.info("Fragment has id token"),this._loginInProgress=!1,this._user=this._createUser(a.parameters[this.CONSTANTS.ID_TOKEN]),this._user&&this._user.profile?this._matchNonce(this._user)?(this._saveItem(this.CONSTANTS.STORAGE.IDTOKEN,a.parameters[this.CONSTANTS.ID_TOKEN]),b=this.config.loginResource?this.config.loginResource:this.config.clientId,this._hasResource(b)||(c=this._getItem(this.CONSTANTS.STORAGE.TOKEN_KEYS)||"",this._saveItem(this.CONSTANTS.STORAGE.TOKEN_KEYS,c+b+this.CONSTANTS.RESOURCE_DELIMETER)),this._saveItem(this.CONSTANTS.STORAGE.ACCESS_TOKEN_KEY+b,a.parameters[this.CONSTANTS.ID_TOKEN]),this._saveItem(this.CONSTANTS.STORAGE.EXPIRATION_KEY+b,this._user.profile.exp)):(this._saveItem(this.CONSTANTS.STORAGE.LOGIN_ERROR,"Nonce received: "+this._user.profile.nonce+" is not same as requested: "+this._getItem(this.CONSTANTS.STORAGE.NONCE_IDTOKEN)),this._user=null):(a.parameters.error="invalid id_token",a.parameters.error_description="Invalid id_token. id_token: "+a.parameters[this.CONSTANTS.ID_TOKEN],this._saveItem(this.CONSTANTS.STORAGE.ERROR,"invalid id_token"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid id_token. id_token: "+a.parameters[this.CONSTANTS.ID_TOKEN])))}else a.parameters.error="Invalid_state",a.parameters.error_description="Invalid_state. state: "+a.stateResponse,this._saveItem(this.CONSTANTS.STORAGE.ERROR,"Invalid_state"),this._saveItem(this.CONSTANTS.STORAGE.ERROR_DESCRIPTION,"Invalid_state. state: "+a.stateResponse);this._saveItem(this.CONSTANTS.STORAGE.RENEW_STATUS+b,this.CONSTANTS.TOKEN_RENEW_STATUS_COMPLETED)},AuthenticationContext.prototype.getResourceForEndpoint=function(a){if(this.config&&this.config.anonymousEndpoints)for(var b=0;b<this.config.anonymousEndpoints.length;b++)if(a.indexOf(this.config.anonymousEndpoints[b])>-1)return null;if(this.config&&this.config.endpoints)for(var c in this.config.endpoints)if(a.indexOf(c)>-1)return this.config.endpoints[c];return a.indexOf("http://")>-1||a.indexOf("https://")>-1?this._getHostFromUri(a)===this._getHostFromUri(this.config.redirectUri)?this.config.loginResource:null:this.config.loginResource},AuthenticationContext.prototype._getHostFromUri=function(a){var b=String(a).replace(/^(https?:)\/\//,"");return b=b.split("/")[0]},AuthenticationContext.prototype.handleWindowCallback=function(a){if(null==a&&(a=window.location.hash),this.isCallback(a)){var b=null,c=!1;this._openedWindows.length>0&&this._openedWindows[this._openedWindows.length-1].opener&&this._openedWindows[this._openedWindows.length-1].opener._adalInstance?(b=this._openedWindows[this._openedWindows.length-1].opener._adalInstance,c=!0):window.parent&&window.parent._adalInstance&&(b=window.parent._adalInstance);var d,e,f=b.getRequestInfo(a),g=null;e=c||window.parent!==window?b._callBackMappedToRenewStates[f.stateResponse]:b.callback,b.info("Returned from redirect url"),b.saveTokenFromHash(f),f.requestType===this.REQUEST_TYPE.RENEW_TOKEN&&window.parent?(window.parent!==window?b.verbose("Window is in iframe, acquiring token silently"):b.verbose("acquiring token interactive in progress"),d=f.parameters[b.CONSTANTS.ACCESS_TOKEN]||f.parameters[b.CONSTANTS.ID_TOKEN],g=b.CONSTANTS.ACCESS_TOKEN):f.requestType===this.REQUEST_TYPE.LOGIN&&(d=f.parameters[b.CONSTANTS.ID_TOKEN],g=b.CONSTANTS.ID_TOKEN);var h=f.parameters[b.CONSTANTS.ERROR_DESCRIPTION],i=f.parameters[b.CONSTANTS.ERROR];try{e&&e(h,d,i,g)}catch(a){b.error("Error occurred in user defined callback function: "+a)}window.parent!==window||c||(b.config.navigateToLoginRequestUrl?window.location.href=b._getItem(b.CONSTANTS.STORAGE.LOGIN_REQUEST):window.location.hash="")}},AuthenticationContext.prototype._getNavigateUrl=function(a,b){var c="common";this.config.tenant&&(c=this.config.tenant);var d=this.instance+c+"/oauth2/authorize"+this._serialize(a,this.config,b)+this._addLibMetadata();return this.info("Navigate url:"+d),d},AuthenticationContext.prototype._extractIdToken=function(a){var b=this._decodeJwt(a);if(!b)return null;try{var c=b.JWSPayload,d=this._base64DecodeStringUrlSafe(c);return d?JSON.parse(d):(this.info("The returned id_token could not be base64 url safe decoded."),null)}catch(a){this.error("The returned id_token could not be decoded",a)}return null},AuthenticationContext.prototype._base64DecodeStringUrlSafe=function(a){return a=a.replace(/-/g,"+").replace(/_/g,"/"),window.atob?decodeURIComponent(escape(window.atob(a))):decodeURIComponent(escape(this._decode(a)))},AuthenticationContext.prototype._decode=function(a){var b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";a=String(a).replace(/=+$/,"");var c=a.length;if(c%4==1)throw new Error("The token to be decoded is not correctly encoded.");for(var d,e,f,g,h,i,j,k,l="",m=0;m<c;m+=4){if(d=b.indexOf(a.charAt(m)),e=b.indexOf(a.charAt(m+1)),f=b.indexOf(a.charAt(m+2)),g=b.indexOf(a.charAt(m+3)),m+2===c-1){h=d<<18|e<<12|f<<6,i=h>>16&255,j=h>>8&255,l+=String.fromCharCode(i,j);break}if(m+1===c-1){h=d<<18|e<<12,i=h>>16&255,l+=String.fromCharCode(i);break}h=d<<18|e<<12|f<<6|g,i=h>>16&255,j=h>>8&255,k=255&h,l+=String.fromCharCode(i,j,k)}return l},AuthenticationContext.prototype._decodeJwt=function(a){if(this._isEmpty(a))return null;var b=/^([^\.\s]*)\.([^\.\s]+)\.([^\.\s]*)$/,c=b.exec(a);return!c||c.length<4?(this.warn("The returned id_token is not parseable."),null):{header:c[1],JWSPayload:c[2],JWSSig:c[3]}},AuthenticationContext.prototype._convertUrlSafeToRegularBase64EncodedString=function(a){return a.replace("-","+").replace("_","/")},AuthenticationContext.prototype._serialize=function(a,b,c){var d=[];if(null!==b){d.push("?response_type="+a),d.push("client_id="+encodeURIComponent(b.clientId)),c&&d.push("resource="+encodeURIComponent(c)),d.push("redirect_uri="+encodeURIComponent(b.redirectUri)),d.push("state="+encodeURIComponent(b.state)),b.hasOwnProperty("slice")&&d.push("slice="+encodeURIComponent(b.slice)),b.hasOwnProperty("extraQueryParameter")&&d.push(b.extraQueryParameter);var e=b.correlationId?b.correlationId:this._guid();d.push("client-request-id="+encodeURIComponent(e))}return d.join("&")},AuthenticationContext.prototype._deserialize=function(a){var b,c=/\+/g,d=/([^&=]+)=([^&]*)/g,e=function(a){return decodeURIComponent(a.replace(c," "))},f={};for(b=d.exec(a);b;)f[e(b[1])]=e(b[2]),b=d.exec(a);return f},AuthenticationContext.prototype._decimalToHex=function(a){for(var b=a.toString(16);b.length<2;)b="0"+b;return b},AuthenticationContext.prototype._guid=function(){var a=window.crypto||window.msCrypto;if(a&&a.getRandomValues){var b=new Uint8Array(16);return a.getRandomValues(b),b[6]|=64,b[6]&=79,b[8]|=128,b[8]&=191,this._decimalToHex(b[0])+this._decimalToHex(b[1])+this._decimalToHex(b[2])+this._decimalToHex(b[3])+"-"+this._decimalToHex(b[4])+this._decimalToHex(b[5])+"-"+this._decimalToHex(b[6])+this._decimalToHex(b[7])+"-"+this._decimalToHex(b[8])+this._decimalToHex(b[9])+"-"+this._decimalToHex(b[10])+this._decimalToHex(b[11])+this._decimalToHex(b[12])+this._decimalToHex(b[13])+this._decimalToHex(b[14])+this._decimalToHex(b[15])}for(var c="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx",d="0123456789abcdef",e=0,f="",g=0;g<36;g++)"-"!==c[g]&&"4"!==c[g]&&(e=16*Math.random()|0),"x"===c[g]?f+=d[e]:"y"===c[g]?(e&=3,e|=8,f+=d[e]):f+=c[g];return f},AuthenticationContext.prototype._expiresIn=function(a){return a||(a=3599),this._now()+parseInt(a,10)},AuthenticationContext.prototype._now=function(){return Math.round((new Date).getTime()/1e3)},AuthenticationContext.prototype._addAdalFrame=function(a){if(void 0!==a){this.info("Add adal frame to document:"+a);var b=document.getElementById(a);if(!b){if(document.createElement&&document.documentElement&&(window.opera||-1===window.navigator.userAgent.indexOf("MSIE 5.0"))){var c=document.createElement("iframe");c.setAttribute("id",a),c.setAttribute("aria-hidden","true"),c.style.visibility="hidden",c.style.position="absolute",c.style.width=c.style.height=c.borderWidth="0px",b=document.getElementsByTagName("body")[0].appendChild(c)}else document.body&&document.body.insertAdjacentHTML&&document.body.insertAdjacentHTML("beforeEnd",'<iframe name="'+a+'" id="'+a+'" style="display:none"></iframe>');window.frames&&window.frames[a]&&(b=window.frames[a])}return b}},AuthenticationContext.prototype._saveItem=function(a,b,c){if(this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation){if(!this._supportsLocalStorage())return this.info("Local storage is not supported"),!1;if(c){var d=this._getItem(a)||"";localStorage.setItem(a,d+b+this.CONSTANTS.CACHE_DELIMETER)}else localStorage.setItem(a,b);return!0}return this._supportsSessionStorage()?(sessionStorage.setItem(a,b),!0):(this.info("Session storage is not supported"),!1)},AuthenticationContext.prototype._getItem=function(a){return this.config&&this.config.cacheLocation&&"localStorage"===this.config.cacheLocation?this._supportsLocalStorage()?localStorage.getItem(a):(this.info("Local storage is not supported"),null):this._supportsSessionStorage()?sessionStorage.getItem(a):(this.info("Session storage is not supported"),null)},AuthenticationContext.prototype._supportsLocalStorage=function(){try{return!!window.localStorage&&(window.localStorage.setItem("storageTest","A"),"A"==window.localStorage.getItem("storageTest")&&(window.localStorage.removeItem("storageTest"),!window.localStorage.getItem("storageTest")))}catch(a){return!1}},AuthenticationContext.prototype._supportsSessionStorage=function(){try{return!!window.sessionStorage&&(window.sessionStorage.setItem("storageTest","A"),"A"==window.sessionStorage.getItem("storageTest")&&(window.sessionStorage.removeItem("storageTest"),!window.sessionStorage.getItem("storageTest")))}catch(a){return!1}},AuthenticationContext.prototype._cloneConfig=function(a){if(null===a||"object"!=typeof a)return a;var b={};for(var c in a)a.hasOwnProperty(c)&&(b[c]=a[c]);return b},AuthenticationContext.prototype._addLibMetadata=function(){return"&x-client-SKU=Js&x-client-Ver="+this._libVersion()},AuthenticationContext.prototype.log=function(a,b,c,d){if(a<=Logging.level){if(!Logging.piiLoggingEnabled&&d)return;var e=(new Date).toUTCString(),f="";f=this.config.correlationId?e+":"+this.config.correlationId+"-"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[a]+" "+b:e+":"+this._libVersion()+"-"+this.CONSTANTS.LEVEL_STRING_MAP[a]+" "+b,c&&(f+="\nstack:\n"+c.stack),Logging.log(f)}},AuthenticationContext.prototype.error=function(a,b){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,a,b)},AuthenticationContext.prototype.warn=function(a){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,a,null)},AuthenticationContext.prototype.info=function(a){
this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,a,null)},AuthenticationContext.prototype.verbose=function(a){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,a,null)},AuthenticationContext.prototype.errorPii=function(a,b){this.log(this.CONSTANTS.LOGGING_LEVEL.ERROR,a,b,!0)},AuthenticationContext.prototype.warnPii=function(a){this.log(this.CONSTANTS.LOGGING_LEVEL.WARN,a,null,!0)},AuthenticationContext.prototype.infoPii=function(a){this.log(this.CONSTANTS.LOGGING_LEVEL.INFO,a,null,!0)},AuthenticationContext.prototype.verbosePii=function(a){this.log(this.CONSTANTS.LOGGING_LEVEL.VERBOSE,a,null,!0)},AuthenticationContext.prototype._libVersion=function(){return"1.0.17"}, true&&module.exports&&(module.exports=AuthenticationContext,module.exports.inject=function(a){return new AuthenticationContext(a)}),AuthenticationContext}();
/***/ }),
/***/ "./node_modules/ansi-html/index.js":
/*!*****************************************!*\
!*** ./node_modules/ansi-html/index.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = ansiHTML
// Reference to https://github.com/sindresorhus/ansi-regex
var _regANSI = /(?:(?:\u001b\[)|\u009b)(?:(?:[0-9]{1,3})?(?:(?:;[0-9]{0,3})*)?[A-M|f-m])|\u001b[A-M]/
var _defColors = {
reset: ['fff', '000'], // [FOREGROUD_COLOR, BACKGROUND_COLOR]
black: '000',
red: 'ff0000',
green: '209805',
yellow: 'e8bf03',
blue: '0000ff',
magenta: 'ff00ff',
cyan: '00ffee',
lightgrey: 'f0f0f0',
darkgrey: '888'
}
var _styles = {
30: 'black',
31: 'red',
32: 'green',
33: 'yellow',
34: 'blue',
35: 'magenta',
36: 'cyan',
37: 'lightgrey'
}
var _openTags = {
'1': 'font-weight:bold', // bold
'2': 'opacity:0.5', // dim
'3': '<i>', // italic
'4': '<u>', // underscore
'8': 'display:none', // hidden
'9': '<del>' // delete
}
var _closeTags = {
'23': '</i>', // reset italic
'24': '</u>', // reset underscore
'29': '</del>' // reset delete
}
;[0, 21, 22, 27, 28, 39, 49].forEach(function (n) {
_closeTags[n] = '</span>'
})
/**
* Converts text with ANSI color codes to HTML markup.
* @param {String} text
* @returns {*}
*/
function ansiHTML (text) {
// Returns the text if the string has no ANSI escape code.
if (!_regANSI.test(text)) {
return text
}
// Cache opened sequence.
var ansiCodes = []
// Replace with markup.
var ret = text.replace(/\033\[(\d+)*m/g, function (match, seq) {
var ot = _openTags[seq]
if (ot) {
// If current sequence has been opened, close it.
if (!!~ansiCodes.indexOf(seq)) { // eslint-disable-line no-extra-boolean-cast
ansiCodes.pop()
return '</span>'
}
// Open tag.
ansiCodes.push(seq)
return ot[0] === '<' ? ot : '<span style="' + ot + ';">'
}
var ct = _closeTags[seq]
if (ct) {
// Pop sequence
ansiCodes.pop()
return ct
}
return ''
})
// Make sure tags are closed.
var l = ansiCodes.length
;(l > 0) && (ret += Array(l + 1).join('</span>'))
return ret
}
/**
* Customize colors.
* @param {Object} colors reference to _defColors
*/
ansiHTML.setColors = function (colors) {
if (typeof colors !== 'object') {
throw new Error('`colors` parameter must be an Object.')
}
var _finalColors = {}
for (var key in _defColors) {
var hex = colors.hasOwnProperty(key) ? colors[key] : null
if (!hex) {
_finalColors[key] = _defColors[key]
continue
}
if ('reset' === key) {
if (typeof hex === 'string') {
hex = [hex]
}
if (!Array.isArray(hex) || hex.length === 0 || hex.some(function (h) {
return typeof h !== 'string'
})) {
throw new Error('The value of `' + key + '` property must be an Array and each item could only be a hex string, e.g.: FF0000')
}
var defHexColor = _defColors[key]
if (!hex[0]) {
hex[0] = defHexColor[0]
}
if (hex.length === 1 || !hex[1]) {
hex = [hex[0]]
hex.push(defHexColor[1])
}
hex = hex.slice(0, 2)
} else if (typeof hex !== 'string') {
throw new Error('The value of `' + key + '` property must be a hex string, e.g.: FF0000')
}
_finalColors[key] = hex
}
_setTags(_finalColors)
}
/**
* Reset colors.
*/
ansiHTML.reset = function () {
_setTags(_defColors)
}
/**
* Expose tags, including open and close.
* @type {Object}
*/
ansiHTML.tags = {}
if (Object.defineProperty) {
Object.defineProperty(ansiHTML.tags, 'open', {
get: function () { return _openTags }
})
Object.defineProperty(ansiHTML.tags, 'close', {
get: function () { return _closeTags }
})
} else {
ansiHTML.tags.open = _openTags
ansiHTML.tags.close = _closeTags
}
function _setTags (colors) {
// reset all
_openTags['0'] = 'font-weight:normal;opacity:1;color:#' + colors.reset[0] + ';background:#' + colors.reset[1]
// inverse
_openTags['7'] = 'color:#' + colors.reset[1] + ';background:#' + colors.reset[0]
// dark grey
_openTags['90'] = 'color:#' + colors.darkgrey
for (var code in _styles) {
var color = _styles[code]
var oriColor = colors[color] || '000'
_openTags[code] = 'color:#' + oriColor
code = parseInt(code)
_openTags[(code + 10).toString()] = 'background:#' + oriColor
}
}
ansiHTML.reset()
/***/ }),
/***/ "./node_modules/core-js/modules/_a-function.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_a-function.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
if (typeof it != 'function') throw TypeError(it + ' is not a function!');
return it;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_add-to-unscopables.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/modules/_add-to-unscopables.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 22.1.3.31 Array.prototype[@@unscopables]
var UNSCOPABLES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('unscopables');
var ArrayProto = Array.prototype;
if (ArrayProto[UNSCOPABLES] == undefined) __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")(ArrayProto, UNSCOPABLES, {});
module.exports = function (key) {
ArrayProto[UNSCOPABLES][key] = true;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_an-instance.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_an-instance.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it, Constructor, name, forbiddenField) {
if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {
throw TypeError(name + ': incorrect invocation!');
} return it;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_an-object.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_an-object.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
module.exports = function (it) {
if (!isObject(it)) throw TypeError(it + ' is not an object!');
return it;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_array-includes.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/modules/_array-includes.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// false -> Array#indexOf
// true -> Array#includes
var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");
var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");
var toAbsoluteIndex = __webpack_require__(/*! ./_to-absolute-index */ "./node_modules/core-js/modules/_to-absolute-index.js");
module.exports = function (IS_INCLUDES) {
return function ($this, el, fromIndex) {
var O = toIObject($this);
var length = toLength(O.length);
var index = toAbsoluteIndex(fromIndex, length);
var value;
// Array#includes uses SameValueZero equality algorithm
// eslint-disable-next-line no-self-compare
if (IS_INCLUDES && el != el) while (length > index) {
value = O[index++];
// eslint-disable-next-line no-self-compare
if (value != value) return true;
// Array#indexOf ignores holes, Array#includes - not
} else for (;length > index; index++) if (IS_INCLUDES || index in O) {
if (O[index] === el) return IS_INCLUDES || index || 0;
} return !IS_INCLUDES && -1;
};
};
/***/ }),
/***/ "./node_modules/core-js/modules/_classof.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_classof.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// getting tag from 19.1.3.6 Object.prototype.toString()
var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js");
var TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag');
// ES3 wrong here
var ARG = cof(function () { return arguments; }()) == 'Arguments';
// fallback for IE11 Script Access Denied error
var tryGet = function (it, key) {
try {
return it[key];
} catch (e) { /* empty */ }
};
module.exports = function (it) {
var O, T, B;
return it === undefined ? 'Undefined' : it === null ? 'Null'
// @@toStringTag case
: typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T
// builtinTag case
: ARG ? cof(O)
// ES3 arguments fallback
: (B = cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_cof.js":
/*!**********************************************!*\
!*** ./node_modules/core-js/modules/_cof.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var toString = {}.toString;
module.exports = function (it) {
return toString.call(it).slice(8, -1);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_core.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/modules/_core.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var core = module.exports = { version: '2.5.7' };
if (typeof __e == 'number') __e = core; // eslint-disable-line no-undef
/***/ }),
/***/ "./node_modules/core-js/modules/_ctx.js":
/*!**********************************************!*\
!*** ./node_modules/core-js/modules/_ctx.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// optional / simple context binding
var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");
module.exports = function (fn, that, length) {
aFunction(fn);
if (that === undefined) return fn;
switch (length) {
case 1: return function (a) {
return fn.call(that, a);
};
case 2: return function (a, b) {
return fn.call(that, a, b);
};
case 3: return function (a, b, c) {
return fn.call(that, a, b, c);
};
}
return function (/* ...args */) {
return fn.apply(that, arguments);
};
};
/***/ }),
/***/ "./node_modules/core-js/modules/_defined.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_defined.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// 7.2.1 RequireObjectCoercible(argument)
module.exports = function (it) {
if (it == undefined) throw TypeError("Can't call method on " + it);
return it;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_descriptors.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_descriptors.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// Thank's IE8 for his funny defineProperty
module.exports = !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () {
return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/modules/_dom-create.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_dom-create.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var document = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document;
// typeof document.createElement is 'object' in old IE
var is = isObject(document) && isObject(document.createElement);
module.exports = function (it) {
return is ? document.createElement(it) : {};
};
/***/ }),
/***/ "./node_modules/core-js/modules/_enum-bug-keys.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/modules/_enum-bug-keys.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// IE 8- don't enum bug keys
module.exports = (
'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'
).split(',');
/***/ }),
/***/ "./node_modules/core-js/modules/_enum-keys.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_enum-keys.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// all enumerable object keys, includes symbols
var getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");
var gOPS = __webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js");
var pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js");
module.exports = function (it) {
var result = getKeys(it);
var getSymbols = gOPS.f;
if (getSymbols) {
var symbols = getSymbols(it);
var isEnum = pIE.f;
var i = 0;
var key;
while (symbols.length > i) if (isEnum.call(it, key = symbols[i++])) result.push(key);
} return result;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_export.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/modules/_export.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");
var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js");
var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");
var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");
var PROTOTYPE = 'prototype';
var $export = function (type, name, source) {
var IS_FORCED = type & $export.F;
var IS_GLOBAL = type & $export.G;
var IS_STATIC = type & $export.S;
var IS_PROTO = type & $export.P;
var IS_BIND = type & $export.B;
var target = IS_GLOBAL ? global : IS_STATIC ? global[name] || (global[name] = {}) : (global[name] || {})[PROTOTYPE];
var exports = IS_GLOBAL ? core : core[name] || (core[name] = {});
var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});
var key, own, out, exp;
if (IS_GLOBAL) source = name;
for (key in source) {
// contains in native
own = !IS_FORCED && target && target[key] !== undefined;
// export native or passed
out = (own ? target : source)[key];
// bind timers to global for call from export context
exp = IS_BIND && own ? ctx(out, global) : IS_PROTO && typeof out == 'function' ? ctx(Function.call, out) : out;
// extend global
if (target) redefine(target, key, out, type & $export.U);
// export
if (exports[key] != out) hide(exports, key, exp);
if (IS_PROTO && expProto[key] != out) expProto[key] = out;
}
};
global.core = core;
// type bitmap
$export.F = 1; // forced
$export.G = 2; // global
$export.S = 4; // static
$export.P = 8; // proto
$export.B = 16; // bind
$export.W = 32; // wrap
$export.U = 64; // safe
$export.R = 128; // real proto method for `library`
module.exports = $export;
/***/ }),
/***/ "./node_modules/core-js/modules/_fails-is-regexp.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/modules/_fails-is-regexp.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var MATCH = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('match');
module.exports = function (KEY) {
var re = /./;
try {
'/./'[KEY](re);
} catch (e) {
try {
re[MATCH] = false;
return !'/./'[KEY](re);
} catch (f) { /* empty */ }
} return true;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_fails.js":
/*!************************************************!*\
!*** ./node_modules/core-js/modules/_fails.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return !!exec();
} catch (e) {
return true;
}
};
/***/ }),
/***/ "./node_modules/core-js/modules/_for-of.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/modules/_for-of.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");
var call = __webpack_require__(/*! ./_iter-call */ "./node_modules/core-js/modules/_iter-call.js");
var isArrayIter = __webpack_require__(/*! ./_is-array-iter */ "./node_modules/core-js/modules/_is-array-iter.js");
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var toLength = __webpack_require__(/*! ./_to-length */ "./node_modules/core-js/modules/_to-length.js");
var getIterFn = __webpack_require__(/*! ./core.get-iterator-method */ "./node_modules/core-js/modules/core.get-iterator-method.js");
var BREAK = {};
var RETURN = {};
var exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {
var iterFn = ITERATOR ? function () { return iterable; } : getIterFn(iterable);
var f = ctx(fn, that, entries ? 2 : 1);
var index = 0;
var length, step, iterator, result;
if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');
// fast case for arrays with default iterator
if (isArrayIter(iterFn)) for (length = toLength(iterable.length); length > index; index++) {
result = entries ? f(anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);
if (result === BREAK || result === RETURN) return result;
} else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {
result = call(iterator, f, step.value, entries);
if (result === BREAK || result === RETURN) return result;
}
};
exports.BREAK = BREAK;
exports.RETURN = RETURN;
/***/ }),
/***/ "./node_modules/core-js/modules/_global.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/modules/_global.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
var global = module.exports = typeof window != 'undefined' && window.Math == Math
? window : typeof self != 'undefined' && self.Math == Math ? self
// eslint-disable-next-line no-new-func
: Function('return this')();
if (typeof __g == 'number') __g = global; // eslint-disable-line no-undef
/***/ }),
/***/ "./node_modules/core-js/modules/_has.js":
/*!**********************************************!*\
!*** ./node_modules/core-js/modules/_has.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var hasOwnProperty = {}.hasOwnProperty;
module.exports = function (it, key) {
return hasOwnProperty.call(it, key);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_hide.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/modules/_hide.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");
var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");
module.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? function (object, key, value) {
return dP.f(object, key, createDesc(1, value));
} : function (object, key, value) {
object[key] = value;
return object;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_html.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/modules/_html.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var document = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").document;
module.exports = document && document.documentElement;
/***/ }),
/***/ "./node_modules/core-js/modules/_ie8-dom-define.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/modules/_ie8-dom-define.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = !__webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") && !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () {
return Object.defineProperty(__webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")('div'), 'a', { get: function () { return 7; } }).a != 7;
});
/***/ }),
/***/ "./node_modules/core-js/modules/_invoke.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/modules/_invoke.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// fast apply, http://jsperf.lnkit.com/fast-apply/5
module.exports = function (fn, args, that) {
var un = that === undefined;
switch (args.length) {
case 0: return un ? fn()
: fn.call(that);
case 1: return un ? fn(args[0])
: fn.call(that, args[0]);
case 2: return un ? fn(args[0], args[1])
: fn.call(that, args[0], args[1]);
case 3: return un ? fn(args[0], args[1], args[2])
: fn.call(that, args[0], args[1], args[2]);
case 4: return un ? fn(args[0], args[1], args[2], args[3])
: fn.call(that, args[0], args[1], args[2], args[3]);
} return fn.apply(that, args);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_iobject.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_iobject.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// fallback for non-array-like ES3 and non-enumerable old V8 strings
var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js");
// eslint-disable-next-line no-prototype-builtins
module.exports = Object('z').propertyIsEnumerable(0) ? Object : function (it) {
return cof(it) == 'String' ? it.split('') : Object(it);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_is-array-iter.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/modules/_is-array-iter.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// check on default Array iterator
var Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js");
var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator');
var ArrayProto = Array.prototype;
module.exports = function (it) {
return it !== undefined && (Iterators.Array === it || ArrayProto[ITERATOR] === it);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_is-array.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/modules/_is-array.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 7.2.2 IsArray(argument)
var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js");
module.exports = Array.isArray || function isArray(arg) {
return cof(arg) == 'Array';
};
/***/ }),
/***/ "./node_modules/core-js/modules/_is-object.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_is-object.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (it) {
return typeof it === 'object' ? it !== null : typeof it === 'function';
};
/***/ }),
/***/ "./node_modules/core-js/modules/_is-regexp.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_is-regexp.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 7.2.8 IsRegExp(argument)
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var cof = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js");
var MATCH = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('match');
module.exports = function (it) {
var isRegExp;
return isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : cof(it) == 'RegExp');
};
/***/ }),
/***/ "./node_modules/core-js/modules/_iter-call.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_iter-call.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// call something on iterator step with safe closing on error
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
module.exports = function (iterator, fn, value, entries) {
try {
return entries ? fn(anObject(value)[0], value[1]) : fn(value);
// 7.4.6 IteratorClose(iterator, completion)
} catch (e) {
var ret = iterator['return'];
if (ret !== undefined) anObject(ret.call(iterator));
throw e;
}
};
/***/ }),
/***/ "./node_modules/core-js/modules/_iter-detect.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_iter-detect.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator');
var SAFE_CLOSING = false;
try {
var riter = [7][ITERATOR]();
riter['return'] = function () { SAFE_CLOSING = true; };
// eslint-disable-next-line no-throw-literal
Array.from(riter, function () { throw 2; });
} catch (e) { /* empty */ }
module.exports = function (exec, skipClosing) {
if (!skipClosing && !SAFE_CLOSING) return false;
var safe = false;
try {
var arr = [7];
var iter = arr[ITERATOR]();
iter.next = function () { return { done: safe = true }; };
arr[ITERATOR] = function () { return iter; };
exec(arr);
} catch (e) { /* empty */ }
return safe;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_iterators.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_iterators.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = {};
/***/ }),
/***/ "./node_modules/core-js/modules/_library.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_library.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = false;
/***/ }),
/***/ "./node_modules/core-js/modules/_meta.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/modules/_meta.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var META = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js")('meta');
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var setDesc = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f;
var id = 0;
var isExtensible = Object.isExtensible || function () {
return true;
};
var FREEZE = !__webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js")(function () {
return isExtensible(Object.preventExtensions({}));
});
var setMeta = function (it) {
setDesc(it, META, { value: {
i: 'O' + ++id, // object ID
w: {} // weak collections IDs
} });
};
var fastKey = function (it, create) {
// return primitive with prefix
if (!isObject(it)) return typeof it == 'symbol' ? it : (typeof it == 'string' ? 'S' : 'P') + it;
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return 'F';
// not necessary to add metadata
if (!create) return 'E';
// add missing metadata
setMeta(it);
// return object ID
} return it[META].i;
};
var getWeak = function (it, create) {
if (!has(it, META)) {
// can't set metadata to uncaught frozen object
if (!isExtensible(it)) return true;
// not necessary to add metadata
if (!create) return false;
// add missing metadata
setMeta(it);
// return hash weak collections IDs
} return it[META].w;
};
// add metadata on freeze-family methods calling
var onFreeze = function (it) {
if (FREEZE && meta.NEED && isExtensible(it) && !has(it, META)) setMeta(it);
return it;
};
var meta = module.exports = {
KEY: META,
NEED: false,
fastKey: fastKey,
getWeak: getWeak,
onFreeze: onFreeze
};
/***/ }),
/***/ "./node_modules/core-js/modules/_microtask.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_microtask.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var macrotask = __webpack_require__(/*! ./_task */ "./node_modules/core-js/modules/_task.js").set;
var Observer = global.MutationObserver || global.WebKitMutationObserver;
var process = global.process;
var Promise = global.Promise;
var isNode = __webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js")(process) == 'process';
module.exports = function () {
var head, last, notify;
var flush = function () {
var parent, fn;
if (isNode && (parent = process.domain)) parent.exit();
while (head) {
fn = head.fn;
head = head.next;
try {
fn();
} catch (e) {
if (head) notify();
else last = undefined;
throw e;
}
} last = undefined;
if (parent) parent.enter();
};
// Node.js
if (isNode) {
notify = function () {
process.nextTick(flush);
};
// browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339
} else if (Observer && !(global.navigator && global.navigator.standalone)) {
var toggle = true;
var node = document.createTextNode('');
new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new
notify = function () {
node.data = toggle = !toggle;
};
// environments with maybe non-completely correct, but existent Promise
} else if (Promise && Promise.resolve) {
// Promise.resolve without an argument throws an error in LG WebOS 2
var promise = Promise.resolve(undefined);
notify = function () {
promise.then(flush);
};
// for other environments - macrotask based on:
// - setImmediate
// - MessageChannel
// - window.postMessag
// - onreadystatechange
// - setTimeout
} else {
notify = function () {
// strange IE + webpack dev server bug - use .call(global)
macrotask.call(global, flush);
};
}
return function (fn) {
var task = { fn: fn, next: undefined };
if (last) last.next = task;
if (!head) {
head = task;
notify();
} last = task;
};
};
/***/ }),
/***/ "./node_modules/core-js/modules/_new-promise-capability.js":
/*!*****************************************************************!*\
!*** ./node_modules/core-js/modules/_new-promise-capability.js ***!
\*****************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 25.4.1.5 NewPromiseCapability(C)
var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");
function PromiseCapability(C) {
var resolve, reject;
this.promise = new C(function ($$resolve, $$reject) {
if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');
resolve = $$resolve;
reject = $$reject;
});
this.resolve = aFunction(resolve);
this.reject = aFunction(reject);
}
module.exports.f = function (C) {
return new PromiseCapability(C);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-create.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/modules/_object-create.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.2 / 15.2.3.5 Object.create(O [, Properties])
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var dPs = __webpack_require__(/*! ./_object-dps */ "./node_modules/core-js/modules/_object-dps.js");
var enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js");
var IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")('IE_PROTO');
var Empty = function () { /* empty */ };
var PROTOTYPE = 'prototype';
// Create object with fake `null` prototype: use iframe Object with cleared prototype
var createDict = function () {
// Thrash, waste and sodomy: IE GC bug
var iframe = __webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js")('iframe');
var i = enumBugKeys.length;
var lt = '<';
var gt = '>';
var iframeDocument;
iframe.style.display = 'none';
__webpack_require__(/*! ./_html */ "./node_modules/core-js/modules/_html.js").appendChild(iframe);
iframe.src = 'javascript:'; // eslint-disable-line no-script-url
// createDict = iframe.contentWindow.Object;
// html.removeChild(iframe);
iframeDocument = iframe.contentWindow.document;
iframeDocument.open();
iframeDocument.write(lt + 'script' + gt + 'document.F=Object' + lt + '/script' + gt);
iframeDocument.close();
createDict = iframeDocument.F;
while (i--) delete createDict[PROTOTYPE][enumBugKeys[i]];
return createDict();
};
module.exports = Object.create || function create(O, Properties) {
var result;
if (O !== null) {
Empty[PROTOTYPE] = anObject(O);
result = new Empty();
Empty[PROTOTYPE] = null;
// add "__proto__" for Object.getPrototypeOf polyfill
result[IE_PROTO] = O;
} else result = createDict();
return Properties === undefined ? result : dPs(result, Properties);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-dp.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_object-dp.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js");
var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js");
var dP = Object.defineProperty;
exports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperty : function defineProperty(O, P, Attributes) {
anObject(O);
P = toPrimitive(P, true);
anObject(Attributes);
if (IE8_DOM_DEFINE) try {
return dP(O, P, Attributes);
} catch (e) { /* empty */ }
if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');
if ('value' in Attributes) O[P] = Attributes.value;
return O;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-dps.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_object-dps.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var getKeys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");
module.exports = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? Object.defineProperties : function defineProperties(O, Properties) {
anObject(O);
var keys = getKeys(Properties);
var length = keys.length;
var i = 0;
var P;
while (length > i) dP.f(O, P = keys[i++], Properties[P]);
return O;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-gopd.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_object-gopd.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var pIE = __webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js");
var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");
var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");
var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js");
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var IE8_DOM_DEFINE = __webpack_require__(/*! ./_ie8-dom-define */ "./node_modules/core-js/modules/_ie8-dom-define.js");
var gOPD = Object.getOwnPropertyDescriptor;
exports.f = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js") ? gOPD : function getOwnPropertyDescriptor(O, P) {
O = toIObject(O);
P = toPrimitive(P, true);
if (IE8_DOM_DEFINE) try {
return gOPD(O, P);
} catch (e) { /* empty */ }
if (has(O, P)) return createDesc(!pIE.f.call(O, P), O[P]);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-gopn-ext.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/modules/_object-gopn-ext.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// fallback for IE11 buggy Object.getOwnPropertyNames with iframe and window
var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");
var gOPN = __webpack_require__(/*! ./_object-gopn */ "./node_modules/core-js/modules/_object-gopn.js").f;
var toString = {}.toString;
var windowNames = typeof window == 'object' && window && Object.getOwnPropertyNames
? Object.getOwnPropertyNames(window) : [];
var getWindowNames = function (it) {
try {
return gOPN(it);
} catch (e) {
return windowNames.slice();
}
};
module.exports.f = function getOwnPropertyNames(it) {
return windowNames && toString.call(it) == '[object Window]' ? getWindowNames(it) : gOPN(toIObject(it));
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-gopn.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_object-gopn.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.7 / 15.2.3.4 Object.getOwnPropertyNames(O)
var $keys = __webpack_require__(/*! ./_object-keys-internal */ "./node_modules/core-js/modules/_object-keys-internal.js");
var hiddenKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js").concat('length', 'prototype');
exports.f = Object.getOwnPropertyNames || function getOwnPropertyNames(O) {
return $keys(O, hiddenKeys);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-gops.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_object-gops.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
exports.f = Object.getOwnPropertySymbols;
/***/ }),
/***/ "./node_modules/core-js/modules/_object-keys-internal.js":
/*!***************************************************************!*\
!*** ./node_modules/core-js/modules/_object-keys-internal.js ***!
\***************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");
var arrayIndexOf = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(false);
var IE_PROTO = __webpack_require__(/*! ./_shared-key */ "./node_modules/core-js/modules/_shared-key.js")('IE_PROTO');
module.exports = function (object, names) {
var O = toIObject(object);
var i = 0;
var result = [];
var key;
for (key in O) if (key != IE_PROTO) has(O, key) && result.push(key);
// Don't enum bug & hidden keys
while (names.length > i) if (has(O, key = names[i++])) {
~arrayIndexOf(result, key) || result.push(key);
}
return result;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-keys.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_object-keys.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.2.14 / 15.2.3.14 Object.keys(O)
var $keys = __webpack_require__(/*! ./_object-keys-internal */ "./node_modules/core-js/modules/_object-keys-internal.js");
var enumBugKeys = __webpack_require__(/*! ./_enum-bug-keys */ "./node_modules/core-js/modules/_enum-bug-keys.js");
module.exports = Object.keys || function keys(O) {
return $keys(O, enumBugKeys);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_object-pie.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_object-pie.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
exports.f = {}.propertyIsEnumerable;
/***/ }),
/***/ "./node_modules/core-js/modules/_perform.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_perform.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (exec) {
try {
return { e: false, v: exec() };
} catch (e) {
return { e: true, v: e };
}
};
/***/ }),
/***/ "./node_modules/core-js/modules/_promise-resolve.js":
/*!**********************************************************!*\
!*** ./node_modules/core-js/modules/_promise-resolve.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var newPromiseCapability = __webpack_require__(/*! ./_new-promise-capability */ "./node_modules/core-js/modules/_new-promise-capability.js");
module.exports = function (C, x) {
anObject(C);
if (isObject(x) && x.constructor === C) return x;
var promiseCapability = newPromiseCapability.f(C);
var resolve = promiseCapability.resolve;
resolve(x);
return promiseCapability.promise;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_property-desc.js":
/*!********************************************************!*\
!*** ./node_modules/core-js/modules/_property-desc.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
module.exports = function (bitmap, value) {
return {
enumerable: !(bitmap & 1),
configurable: !(bitmap & 2),
writable: !(bitmap & 4),
value: value
};
};
/***/ }),
/***/ "./node_modules/core-js/modules/_redefine-all.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/modules/_redefine-all.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");
module.exports = function (target, src, safe) {
for (var key in src) redefine(target, key, src[key], safe);
return target;
};
/***/ }),
/***/ "./node_modules/core-js/modules/_redefine.js":
/*!***************************************************!*\
!*** ./node_modules/core-js/modules/_redefine.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var hide = __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js");
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var SRC = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js")('src');
var TO_STRING = 'toString';
var $toString = Function[TO_STRING];
var TPL = ('' + $toString).split(TO_STRING);
__webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").inspectSource = function (it) {
return $toString.call(it);
};
(module.exports = function (O, key, val, safe) {
var isFunction = typeof val == 'function';
if (isFunction) has(val, 'name') || hide(val, 'name', key);
if (O[key] === val) return;
if (isFunction) has(val, SRC) || hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));
if (O === global) {
O[key] = val;
} else if (!safe) {
delete O[key];
hide(O, key, val);
} else if (O[key]) {
O[key] = val;
} else {
hide(O, key, val);
}
// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative
})(Function.prototype, TO_STRING, function toString() {
return typeof this == 'function' && this[SRC] || $toString.call(this);
});
/***/ }),
/***/ "./node_modules/core-js/modules/_set-proto.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_set-proto.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// Works with __proto__ only. Old v8 can't work with null proto objects.
/* eslint-disable no-proto */
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var check = function (O, proto) {
anObject(O);
if (!isObject(proto) && proto !== null) throw TypeError(proto + ": can't set as prototype!");
};
module.exports = {
set: Object.setPrototypeOf || ('__proto__' in {} ? // eslint-disable-line
function (test, buggy, set) {
try {
set = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js")(Function.call, __webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js").f(Object.prototype, '__proto__').set, 2);
set(test, []);
buggy = !(test instanceof Array);
} catch (e) { buggy = true; }
return function setPrototypeOf(O, proto) {
check(O, proto);
if (buggy) O.__proto__ = proto;
else set(O, proto);
return O;
};
}({}, false) : undefined),
check: check
};
/***/ }),
/***/ "./node_modules/core-js/modules/_set-species.js":
/*!******************************************************!*\
!*** ./node_modules/core-js/modules/_set-species.js ***!
\******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var dP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");
var DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js");
var SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('species');
module.exports = function (KEY) {
var C = global[KEY];
if (DESCRIPTORS && C && !C[SPECIES]) dP.f(C, SPECIES, {
configurable: true,
get: function () { return this; }
});
};
/***/ }),
/***/ "./node_modules/core-js/modules/_set-to-string-tag.js":
/*!************************************************************!*\
!*** ./node_modules/core-js/modules/_set-to-string-tag.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var def = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f;
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var TAG = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag');
module.exports = function (it, tag, stat) {
if (it && !has(it = stat ? it : it.prototype, TAG)) def(it, TAG, { configurable: true, value: tag });
};
/***/ }),
/***/ "./node_modules/core-js/modules/_shared-key.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_shared-key.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('keys');
var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js");
module.exports = function (key) {
return shared[key] || (shared[key] = uid(key));
};
/***/ }),
/***/ "./node_modules/core-js/modules/_shared.js":
/*!*************************************************!*\
!*** ./node_modules/core-js/modules/_shared.js ***!
\*************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var SHARED = '__core-js_shared__';
var store = global[SHARED] || (global[SHARED] = {});
(module.exports = function (key, value) {
return store[key] || (store[key] = value !== undefined ? value : {});
})('versions', []).push({
version: core.version,
mode: __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js") ? 'pure' : 'global',
copyright: '© 2018 Denis Pushkarev (zloirock.ru)'
});
/***/ }),
/***/ "./node_modules/core-js/modules/_species-constructor.js":
/*!**************************************************************!*\
!*** ./node_modules/core-js/modules/_species-constructor.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 7.3.20 SpeciesConstructor(O, defaultConstructor)
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");
var SPECIES = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('species');
module.exports = function (O, D) {
var C = anObject(O).constructor;
var S;
return C === undefined || (S = anObject(C)[SPECIES]) == undefined ? D : aFunction(S);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_string-context.js":
/*!*********************************************************!*\
!*** ./node_modules/core-js/modules/_string-context.js ***!
\*********************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// helper for String#{startsWith, endsWith, includes}
var isRegExp = __webpack_require__(/*! ./_is-regexp */ "./node_modules/core-js/modules/_is-regexp.js");
var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js");
module.exports = function (that, searchString, NAME) {
if (isRegExp(searchString)) throw TypeError('String#' + NAME + " doesn't accept regex!");
return String(defined(that));
};
/***/ }),
/***/ "./node_modules/core-js/modules/_task.js":
/*!***********************************************!*\
!*** ./node_modules/core-js/modules/_task.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");
var invoke = __webpack_require__(/*! ./_invoke */ "./node_modules/core-js/modules/_invoke.js");
var html = __webpack_require__(/*! ./_html */ "./node_modules/core-js/modules/_html.js");
var cel = __webpack_require__(/*! ./_dom-create */ "./node_modules/core-js/modules/_dom-create.js");
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var process = global.process;
var setTask = global.setImmediate;
var clearTask = global.clearImmediate;
var MessageChannel = global.MessageChannel;
var Dispatch = global.Dispatch;
var counter = 0;
var queue = {};
var ONREADYSTATECHANGE = 'onreadystatechange';
var defer, channel, port;
var run = function () {
var id = +this;
// eslint-disable-next-line no-prototype-builtins
if (queue.hasOwnProperty(id)) {
var fn = queue[id];
delete queue[id];
fn();
}
};
var listener = function (event) {
run.call(event.data);
};
// Node.js 0.9+ & IE10+ has setImmediate, otherwise:
if (!setTask || !clearTask) {
setTask = function setImmediate(fn) {
var args = [];
var i = 1;
while (arguments.length > i) args.push(arguments[i++]);
queue[++counter] = function () {
// eslint-disable-next-line no-new-func
invoke(typeof fn == 'function' ? fn : Function(fn), args);
};
defer(counter);
return counter;
};
clearTask = function clearImmediate(id) {
delete queue[id];
};
// Node.js 0.8-
if (__webpack_require__(/*! ./_cof */ "./node_modules/core-js/modules/_cof.js")(process) == 'process') {
defer = function (id) {
process.nextTick(ctx(run, id, 1));
};
// Sphere (JS game engine) Dispatch API
} else if (Dispatch && Dispatch.now) {
defer = function (id) {
Dispatch.now(ctx(run, id, 1));
};
// Browsers with MessageChannel, includes WebWorkers
} else if (MessageChannel) {
channel = new MessageChannel();
port = channel.port2;
channel.port1.onmessage = listener;
defer = ctx(port.postMessage, port, 1);
// Browsers with postMessage, skip WebWorkers
// IE8 has postMessage, but it's sync & typeof its postMessage is 'object'
} else if (global.addEventListener && typeof postMessage == 'function' && !global.importScripts) {
defer = function (id) {
global.postMessage(id + '', '*');
};
global.addEventListener('message', listener, false);
// IE8-
} else if (ONREADYSTATECHANGE in cel('script')) {
defer = function (id) {
html.appendChild(cel('script'))[ONREADYSTATECHANGE] = function () {
html.removeChild(this);
run.call(id);
};
};
// Rest old browsers
} else {
defer = function (id) {
setTimeout(ctx(run, id, 1), 0);
};
}
}
module.exports = {
set: setTask,
clear: clearTask
};
/***/ }),
/***/ "./node_modules/core-js/modules/_to-absolute-index.js":
/*!************************************************************!*\
!*** ./node_modules/core-js/modules/_to-absolute-index.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js");
var max = Math.max;
var min = Math.min;
module.exports = function (index, length) {
index = toInteger(index);
return index < 0 ? max(index + length, 0) : min(index, length);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_to-integer.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_to-integer.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// 7.1.4 ToInteger
var ceil = Math.ceil;
var floor = Math.floor;
module.exports = function (it) {
return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);
};
/***/ }),
/***/ "./node_modules/core-js/modules/_to-iobject.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_to-iobject.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// to indexed object, toObject with fallback for non-array-like ES3 strings
var IObject = __webpack_require__(/*! ./_iobject */ "./node_modules/core-js/modules/_iobject.js");
var defined = __webpack_require__(/*! ./_defined */ "./node_modules/core-js/modules/_defined.js");
module.exports = function (it) {
return IObject(defined(it));
};
/***/ }),
/***/ "./node_modules/core-js/modules/_to-length.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/_to-length.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.15 ToLength
var toInteger = __webpack_require__(/*! ./_to-integer */ "./node_modules/core-js/modules/_to-integer.js");
var min = Math.min;
module.exports = function (it) {
return it > 0 ? min(toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991
};
/***/ }),
/***/ "./node_modules/core-js/modules/_to-primitive.js":
/*!*******************************************************!*\
!*** ./node_modules/core-js/modules/_to-primitive.js ***!
\*******************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 7.1.1 ToPrimitive(input [, PreferredType])
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
// instead of the ES6 spec version, we didn't implement @@toPrimitive case
// and the second argument - flag - preferred type is a string
module.exports = function (it, S) {
if (!isObject(it)) return it;
var fn, val;
if (S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
if (typeof (fn = it.valueOf) == 'function' && !isObject(val = fn.call(it))) return val;
if (!S && typeof (fn = it.toString) == 'function' && !isObject(val = fn.call(it))) return val;
throw TypeError("Can't convert object to primitive value");
};
/***/ }),
/***/ "./node_modules/core-js/modules/_uid.js":
/*!**********************************************!*\
!*** ./node_modules/core-js/modules/_uid.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var id = 0;
var px = Math.random();
module.exports = function (key) {
return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));
};
/***/ }),
/***/ "./node_modules/core-js/modules/_user-agent.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_user-agent.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var navigator = global.navigator;
module.exports = navigator && navigator.userAgent || '';
/***/ }),
/***/ "./node_modules/core-js/modules/_wks-define.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/_wks-define.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var core = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js");
var LIBRARY = __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js");
var wksExt = __webpack_require__(/*! ./_wks-ext */ "./node_modules/core-js/modules/_wks-ext.js");
var defineProperty = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js").f;
module.exports = function (name) {
var $Symbol = core.Symbol || (core.Symbol = LIBRARY ? {} : global.Symbol || {});
if (name.charAt(0) != '_' && !(name in $Symbol)) defineProperty($Symbol, name, { value: wksExt.f(name) });
};
/***/ }),
/***/ "./node_modules/core-js/modules/_wks-ext.js":
/*!**************************************************!*\
!*** ./node_modules/core-js/modules/_wks-ext.js ***!
\**************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
exports.f = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js");
/***/ }),
/***/ "./node_modules/core-js/modules/_wks.js":
/*!**********************************************!*\
!*** ./node_modules/core-js/modules/_wks.js ***!
\**********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var store = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js")('wks');
var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js");
var Symbol = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js").Symbol;
var USE_SYMBOL = typeof Symbol == 'function';
var $exports = module.exports = function (name) {
return store[name] || (store[name] =
USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : uid)('Symbol.' + name));
};
$exports.store = store;
/***/ }),
/***/ "./node_modules/core-js/modules/core.get-iterator-method.js":
/*!******************************************************************!*\
!*** ./node_modules/core-js/modules/core.get-iterator-method.js ***!
\******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var classof = __webpack_require__(/*! ./_classof */ "./node_modules/core-js/modules/_classof.js");
var ITERATOR = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('iterator');
var Iterators = __webpack_require__(/*! ./_iterators */ "./node_modules/core-js/modules/_iterators.js");
module.exports = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js").getIteratorMethod = function (it) {
if (it != undefined) return it[ITERATOR]
|| it['@@iterator']
|| Iterators[classof(it)];
};
/***/ }),
/***/ "./node_modules/core-js/modules/es6.object.set-prototype-of.js":
/*!*********************************************************************!*\
!*** ./node_modules/core-js/modules/es6.object.set-prototype-of.js ***!
\*********************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
// 19.1.3.19 Object.setPrototypeOf(O, proto)
var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");
$export($export.S, 'Object', { setPrototypeOf: __webpack_require__(/*! ./_set-proto */ "./node_modules/core-js/modules/_set-proto.js").set });
/***/ }),
/***/ "./node_modules/core-js/modules/es6.object.to-string.js":
/*!**************************************************************!*\
!*** ./node_modules/core-js/modules/es6.object.to-string.js ***!
\**************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 19.1.3.6 Object.prototype.toString()
var classof = __webpack_require__(/*! ./_classof */ "./node_modules/core-js/modules/_classof.js");
var test = {};
test[__webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('toStringTag')] = 'z';
if (test + '' != '[object z]') {
__webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js")(Object.prototype, 'toString', function toString() {
return '[object ' + classof(this) + ']';
}, true);
}
/***/ }),
/***/ "./node_modules/core-js/modules/es6.promise.js":
/*!*****************************************************!*\
!*** ./node_modules/core-js/modules/es6.promise.js ***!
\*****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var LIBRARY = __webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js");
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var ctx = __webpack_require__(/*! ./_ctx */ "./node_modules/core-js/modules/_ctx.js");
var classof = __webpack_require__(/*! ./_classof */ "./node_modules/core-js/modules/_classof.js");
var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var aFunction = __webpack_require__(/*! ./_a-function */ "./node_modules/core-js/modules/_a-function.js");
var anInstance = __webpack_require__(/*! ./_an-instance */ "./node_modules/core-js/modules/_an-instance.js");
var forOf = __webpack_require__(/*! ./_for-of */ "./node_modules/core-js/modules/_for-of.js");
var speciesConstructor = __webpack_require__(/*! ./_species-constructor */ "./node_modules/core-js/modules/_species-constructor.js");
var task = __webpack_require__(/*! ./_task */ "./node_modules/core-js/modules/_task.js").set;
var microtask = __webpack_require__(/*! ./_microtask */ "./node_modules/core-js/modules/_microtask.js")();
var newPromiseCapabilityModule = __webpack_require__(/*! ./_new-promise-capability */ "./node_modules/core-js/modules/_new-promise-capability.js");
var perform = __webpack_require__(/*! ./_perform */ "./node_modules/core-js/modules/_perform.js");
var userAgent = __webpack_require__(/*! ./_user-agent */ "./node_modules/core-js/modules/_user-agent.js");
var promiseResolve = __webpack_require__(/*! ./_promise-resolve */ "./node_modules/core-js/modules/_promise-resolve.js");
var PROMISE = 'Promise';
var TypeError = global.TypeError;
var process = global.process;
var versions = process && process.versions;
var v8 = versions && versions.v8 || '';
var $Promise = global[PROMISE];
var isNode = classof(process) == 'process';
var empty = function () { /* empty */ };
var Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;
var newPromiseCapability = newGenericPromiseCapability = newPromiseCapabilityModule.f;
var USE_NATIVE = !!function () {
try {
// correct subclassing with @@species support
var promise = $Promise.resolve(1);
var FakePromise = (promise.constructor = {})[__webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js")('species')] = function (exec) {
exec(empty, empty);
};
// unhandled rejections tracking support, NodeJS Promise without it fails @@species test
return (isNode || typeof PromiseRejectionEvent == 'function')
&& promise.then(empty) instanceof FakePromise
// v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables
// https://bugs.chromium.org/p/chromium/issues/detail?id=830565
// we can't detect it synchronously, so just check versions
&& v8.indexOf('6.6') !== 0
&& userAgent.indexOf('Chrome/66') === -1;
} catch (e) { /* empty */ }
}();
// helpers
var isThenable = function (it) {
var then;
return isObject(it) && typeof (then = it.then) == 'function' ? then : false;
};
var notify = function (promise, isReject) {
if (promise._n) return;
promise._n = true;
var chain = promise._c;
microtask(function () {
var value = promise._v;
var ok = promise._s == 1;
var i = 0;
var run = function (reaction) {
var handler = ok ? reaction.ok : reaction.fail;
var resolve = reaction.resolve;
var reject = reaction.reject;
var domain = reaction.domain;
var result, then, exited;
try {
if (handler) {
if (!ok) {
if (promise._h == 2) onHandleUnhandled(promise);
promise._h = 1;
}
if (handler === true) result = value;
else {
if (domain) domain.enter();
result = handler(value); // may throw
if (domain) {
domain.exit();
exited = true;
}
}
if (result === reaction.promise) {
reject(TypeError('Promise-chain cycle'));
} else if (then = isThenable(result)) {
then.call(result, resolve, reject);
} else resolve(result);
} else reject(value);
} catch (e) {
if (domain && !exited) domain.exit();
reject(e);
}
};
while (chain.length > i) run(chain[i++]); // variable length - can't use forEach
promise._c = [];
promise._n = false;
if (isReject && !promise._h) onUnhandled(promise);
});
};
var onUnhandled = function (promise) {
task.call(global, function () {
var value = promise._v;
var unhandled = isUnhandled(promise);
var result, handler, console;
if (unhandled) {
result = perform(function () {
if (isNode) {
process.emit('unhandledRejection', value, promise);
} else if (handler = global.onunhandledrejection) {
handler({ promise: promise, reason: value });
} else if ((console = global.console) && console.error) {
console.error('Unhandled promise rejection', value);
}
});
// Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should
promise._h = isNode || isUnhandled(promise) ? 2 : 1;
} promise._a = undefined;
if (unhandled && result.e) throw result.v;
});
};
var isUnhandled = function (promise) {
return promise._h !== 1 && (promise._a || promise._c).length === 0;
};
var onHandleUnhandled = function (promise) {
task.call(global, function () {
var handler;
if (isNode) {
process.emit('rejectionHandled', promise);
} else if (handler = global.onrejectionhandled) {
handler({ promise: promise, reason: promise._v });
}
});
};
var $reject = function (value) {
var promise = this;
if (promise._d) return;
promise._d = true;
promise = promise._w || promise; // unwrap
promise._v = value;
promise._s = 2;
if (!promise._a) promise._a = promise._c.slice();
notify(promise, true);
};
var $resolve = function (value) {
var promise = this;
var then;
if (promise._d) return;
promise._d = true;
promise = promise._w || promise; // unwrap
try {
if (promise === value) throw TypeError("Promise can't be resolved itself");
if (then = isThenable(value)) {
microtask(function () {
var wrapper = { _w: promise, _d: false }; // wrap
try {
then.call(value, ctx($resolve, wrapper, 1), ctx($reject, wrapper, 1));
} catch (e) {
$reject.call(wrapper, e);
}
});
} else {
promise._v = value;
promise._s = 1;
notify(promise, false);
}
} catch (e) {
$reject.call({ _w: promise, _d: false }, e); // wrap
}
};
// constructor polyfill
if (!USE_NATIVE) {
// 25.4.3.1 Promise(executor)
$Promise = function Promise(executor) {
anInstance(this, $Promise, PROMISE, '_h');
aFunction(executor);
Internal.call(this);
try {
executor(ctx($resolve, this, 1), ctx($reject, this, 1));
} catch (err) {
$reject.call(this, err);
}
};
// eslint-disable-next-line no-unused-vars
Internal = function Promise(executor) {
this._c = []; // <- awaiting reactions
this._a = undefined; // <- checked in isUnhandled reactions
this._s = 0; // <- state
this._d = false; // <- done
this._v = undefined; // <- value
this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled
this._n = false; // <- notify
};
Internal.prototype = __webpack_require__(/*! ./_redefine-all */ "./node_modules/core-js/modules/_redefine-all.js")($Promise.prototype, {
// 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)
then: function then(onFulfilled, onRejected) {
var reaction = newPromiseCapability(speciesConstructor(this, $Promise));
reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;
reaction.fail = typeof onRejected == 'function' && onRejected;
reaction.domain = isNode ? process.domain : undefined;
this._c.push(reaction);
if (this._a) this._a.push(reaction);
if (this._s) notify(this, false);
return reaction.promise;
},
// 25.4.5.1 Promise.prototype.catch(onRejected)
'catch': function (onRejected) {
return this.then(undefined, onRejected);
}
});
OwnPromiseCapability = function () {
var promise = new Internal();
this.promise = promise;
this.resolve = ctx($resolve, promise, 1);
this.reject = ctx($reject, promise, 1);
};
newPromiseCapabilityModule.f = newPromiseCapability = function (C) {
return C === $Promise || C === Wrapper
? new OwnPromiseCapability(C)
: newGenericPromiseCapability(C);
};
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, { Promise: $Promise });
__webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js")($Promise, PROMISE);
__webpack_require__(/*! ./_set-species */ "./node_modules/core-js/modules/_set-species.js")(PROMISE);
Wrapper = __webpack_require__(/*! ./_core */ "./node_modules/core-js/modules/_core.js")[PROMISE];
// statics
$export($export.S + $export.F * !USE_NATIVE, PROMISE, {
// 25.4.4.5 Promise.reject(r)
reject: function reject(r) {
var capability = newPromiseCapability(this);
var $$reject = capability.reject;
$$reject(r);
return capability.promise;
}
});
$export($export.S + $export.F * (LIBRARY || !USE_NATIVE), PROMISE, {
// 25.4.4.6 Promise.resolve(x)
resolve: function resolve(x) {
return promiseResolve(LIBRARY && this === Wrapper ? $Promise : this, x);
}
});
$export($export.S + $export.F * !(USE_NATIVE && __webpack_require__(/*! ./_iter-detect */ "./node_modules/core-js/modules/_iter-detect.js")(function (iter) {
$Promise.all(iter)['catch'](empty);
})), PROMISE, {
// 25.4.4.1 Promise.all(iterable)
all: function all(iterable) {
var C = this;
var capability = newPromiseCapability(C);
var resolve = capability.resolve;
var reject = capability.reject;
var result = perform(function () {
var values = [];
var index = 0;
var remaining = 1;
forOf(iterable, false, function (promise) {
var $index = index++;
var alreadyCalled = false;
values.push(undefined);
remaining++;
C.resolve(promise).then(function (value) {
if (alreadyCalled) return;
alreadyCalled = true;
values[$index] = value;
--remaining || resolve(values);
}, reject);
});
--remaining || resolve(values);
});
if (result.e) reject(result.v);
return capability.promise;
},
// 25.4.4.4 Promise.race(iterable)
race: function race(iterable) {
var C = this;
var capability = newPromiseCapability(C);
var reject = capability.reject;
var result = perform(function () {
forOf(iterable, false, function (promise) {
C.resolve(promise).then(capability.resolve, reject);
});
});
if (result.e) reject(result.v);
return capability.promise;
}
});
/***/ }),
/***/ "./node_modules/core-js/modules/es6.string.includes.js":
/*!*************************************************************!*\
!*** ./node_modules/core-js/modules/es6.string.includes.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// 21.1.3.7 String.prototype.includes(searchString, position = 0)
var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");
var context = __webpack_require__(/*! ./_string-context */ "./node_modules/core-js/modules/_string-context.js");
var INCLUDES = 'includes';
$export($export.P + $export.F * __webpack_require__(/*! ./_fails-is-regexp */ "./node_modules/core-js/modules/_fails-is-regexp.js")(INCLUDES), 'String', {
includes: function includes(searchString /* , position = 0 */) {
return !!~context(this, searchString, INCLUDES)
.indexOf(searchString, arguments.length > 1 ? arguments[1] : undefined);
}
});
/***/ }),
/***/ "./node_modules/core-js/modules/es6.symbol.js":
/*!****************************************************!*\
!*** ./node_modules/core-js/modules/es6.symbol.js ***!
\****************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// ECMAScript 6 symbols shim
var global = __webpack_require__(/*! ./_global */ "./node_modules/core-js/modules/_global.js");
var has = __webpack_require__(/*! ./_has */ "./node_modules/core-js/modules/_has.js");
var DESCRIPTORS = __webpack_require__(/*! ./_descriptors */ "./node_modules/core-js/modules/_descriptors.js");
var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");
var redefine = __webpack_require__(/*! ./_redefine */ "./node_modules/core-js/modules/_redefine.js");
var META = __webpack_require__(/*! ./_meta */ "./node_modules/core-js/modules/_meta.js").KEY;
var $fails = __webpack_require__(/*! ./_fails */ "./node_modules/core-js/modules/_fails.js");
var shared = __webpack_require__(/*! ./_shared */ "./node_modules/core-js/modules/_shared.js");
var setToStringTag = __webpack_require__(/*! ./_set-to-string-tag */ "./node_modules/core-js/modules/_set-to-string-tag.js");
var uid = __webpack_require__(/*! ./_uid */ "./node_modules/core-js/modules/_uid.js");
var wks = __webpack_require__(/*! ./_wks */ "./node_modules/core-js/modules/_wks.js");
var wksExt = __webpack_require__(/*! ./_wks-ext */ "./node_modules/core-js/modules/_wks-ext.js");
var wksDefine = __webpack_require__(/*! ./_wks-define */ "./node_modules/core-js/modules/_wks-define.js");
var enumKeys = __webpack_require__(/*! ./_enum-keys */ "./node_modules/core-js/modules/_enum-keys.js");
var isArray = __webpack_require__(/*! ./_is-array */ "./node_modules/core-js/modules/_is-array.js");
var anObject = __webpack_require__(/*! ./_an-object */ "./node_modules/core-js/modules/_an-object.js");
var isObject = __webpack_require__(/*! ./_is-object */ "./node_modules/core-js/modules/_is-object.js");
var toIObject = __webpack_require__(/*! ./_to-iobject */ "./node_modules/core-js/modules/_to-iobject.js");
var toPrimitive = __webpack_require__(/*! ./_to-primitive */ "./node_modules/core-js/modules/_to-primitive.js");
var createDesc = __webpack_require__(/*! ./_property-desc */ "./node_modules/core-js/modules/_property-desc.js");
var _create = __webpack_require__(/*! ./_object-create */ "./node_modules/core-js/modules/_object-create.js");
var gOPNExt = __webpack_require__(/*! ./_object-gopn-ext */ "./node_modules/core-js/modules/_object-gopn-ext.js");
var $GOPD = __webpack_require__(/*! ./_object-gopd */ "./node_modules/core-js/modules/_object-gopd.js");
var $DP = __webpack_require__(/*! ./_object-dp */ "./node_modules/core-js/modules/_object-dp.js");
var $keys = __webpack_require__(/*! ./_object-keys */ "./node_modules/core-js/modules/_object-keys.js");
var gOPD = $GOPD.f;
var dP = $DP.f;
var gOPN = gOPNExt.f;
var $Symbol = global.Symbol;
var $JSON = global.JSON;
var _stringify = $JSON && $JSON.stringify;
var PROTOTYPE = 'prototype';
var HIDDEN = wks('_hidden');
var TO_PRIMITIVE = wks('toPrimitive');
var isEnum = {}.propertyIsEnumerable;
var SymbolRegistry = shared('symbol-registry');
var AllSymbols = shared('symbols');
var OPSymbols = shared('op-symbols');
var ObjectProto = Object[PROTOTYPE];
var USE_NATIVE = typeof $Symbol == 'function';
var QObject = global.QObject;
// Don't use setters in Qt Script, https://github.com/zloirock/core-js/issues/173
var setter = !QObject || !QObject[PROTOTYPE] || !QObject[PROTOTYPE].findChild;
// fallback for old Android, https://code.google.com/p/v8/issues/detail?id=687
var setSymbolDesc = DESCRIPTORS && $fails(function () {
return _create(dP({}, 'a', {
get: function () { return dP(this, 'a', { value: 7 }).a; }
})).a != 7;
}) ? function (it, key, D) {
var protoDesc = gOPD(ObjectProto, key);
if (protoDesc) delete ObjectProto[key];
dP(it, key, D);
if (protoDesc && it !== ObjectProto) dP(ObjectProto, key, protoDesc);
} : dP;
var wrap = function (tag) {
var sym = AllSymbols[tag] = _create($Symbol[PROTOTYPE]);
sym._k = tag;
return sym;
};
var isSymbol = USE_NATIVE && typeof $Symbol.iterator == 'symbol' ? function (it) {
return typeof it == 'symbol';
} : function (it) {
return it instanceof $Symbol;
};
var $defineProperty = function defineProperty(it, key, D) {
if (it === ObjectProto) $defineProperty(OPSymbols, key, D);
anObject(it);
key = toPrimitive(key, true);
anObject(D);
if (has(AllSymbols, key)) {
if (!D.enumerable) {
if (!has(it, HIDDEN)) dP(it, HIDDEN, createDesc(1, {}));
it[HIDDEN][key] = true;
} else {
if (has(it, HIDDEN) && it[HIDDEN][key]) it[HIDDEN][key] = false;
D = _create(D, { enumerable: createDesc(0, false) });
} return setSymbolDesc(it, key, D);
} return dP(it, key, D);
};
var $defineProperties = function defineProperties(it, P) {
anObject(it);
var keys = enumKeys(P = toIObject(P));
var i = 0;
var l = keys.length;
var key;
while (l > i) $defineProperty(it, key = keys[i++], P[key]);
return it;
};
var $create = function create(it, P) {
return P === undefined ? _create(it) : $defineProperties(_create(it), P);
};
var $propertyIsEnumerable = function propertyIsEnumerable(key) {
var E = isEnum.call(this, key = toPrimitive(key, true));
if (this === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return false;
return E || !has(this, key) || !has(AllSymbols, key) || has(this, HIDDEN) && this[HIDDEN][key] ? E : true;
};
var $getOwnPropertyDescriptor = function getOwnPropertyDescriptor(it, key) {
it = toIObject(it);
key = toPrimitive(key, true);
if (it === ObjectProto && has(AllSymbols, key) && !has(OPSymbols, key)) return;
var D = gOPD(it, key);
if (D && has(AllSymbols, key) && !(has(it, HIDDEN) && it[HIDDEN][key])) D.enumerable = true;
return D;
};
var $getOwnPropertyNames = function getOwnPropertyNames(it) {
var names = gOPN(toIObject(it));
var result = [];
var i = 0;
var key;
while (names.length > i) {
if (!has(AllSymbols, key = names[i++]) && key != HIDDEN && key != META) result.push(key);
} return result;
};
var $getOwnPropertySymbols = function getOwnPropertySymbols(it) {
var IS_OP = it === ObjectProto;
var names = gOPN(IS_OP ? OPSymbols : toIObject(it));
var result = [];
var i = 0;
var key;
while (names.length > i) {
if (has(AllSymbols, key = names[i++]) && (IS_OP ? has(ObjectProto, key) : true)) result.push(AllSymbols[key]);
} return result;
};
// 19.4.1.1 Symbol([description])
if (!USE_NATIVE) {
$Symbol = function Symbol() {
if (this instanceof $Symbol) throw TypeError('Symbol is not a constructor!');
var tag = uid(arguments.length > 0 ? arguments[0] : undefined);
var $set = function (value) {
if (this === ObjectProto) $set.call(OPSymbols, value);
if (has(this, HIDDEN) && has(this[HIDDEN], tag)) this[HIDDEN][tag] = false;
setSymbolDesc(this, tag, createDesc(1, value));
};
if (DESCRIPTORS && setter) setSymbolDesc(ObjectProto, tag, { configurable: true, set: $set });
return wrap(tag);
};
redefine($Symbol[PROTOTYPE], 'toString', function toString() {
return this._k;
});
$GOPD.f = $getOwnPropertyDescriptor;
$DP.f = $defineProperty;
__webpack_require__(/*! ./_object-gopn */ "./node_modules/core-js/modules/_object-gopn.js").f = gOPNExt.f = $getOwnPropertyNames;
__webpack_require__(/*! ./_object-pie */ "./node_modules/core-js/modules/_object-pie.js").f = $propertyIsEnumerable;
__webpack_require__(/*! ./_object-gops */ "./node_modules/core-js/modules/_object-gops.js").f = $getOwnPropertySymbols;
if (DESCRIPTORS && !__webpack_require__(/*! ./_library */ "./node_modules/core-js/modules/_library.js")) {
redefine(ObjectProto, 'propertyIsEnumerable', $propertyIsEnumerable, true);
}
wksExt.f = function (name) {
return wrap(wks(name));
};
}
$export($export.G + $export.W + $export.F * !USE_NATIVE, { Symbol: $Symbol });
for (var es6Symbols = (
// 19.4.2.2, 19.4.2.3, 19.4.2.4, 19.4.2.6, 19.4.2.8, 19.4.2.9, 19.4.2.10, 19.4.2.11, 19.4.2.12, 19.4.2.13, 19.4.2.14
'hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables'
).split(','), j = 0; es6Symbols.length > j;)wks(es6Symbols[j++]);
for (var wellKnownSymbols = $keys(wks.store), k = 0; wellKnownSymbols.length > k;) wksDefine(wellKnownSymbols[k++]);
$export($export.S + $export.F * !USE_NATIVE, 'Symbol', {
// 19.4.2.1 Symbol.for(key)
'for': function (key) {
return has(SymbolRegistry, key += '')
? SymbolRegistry[key]
: SymbolRegistry[key] = $Symbol(key);
},
// 19.4.2.5 Symbol.keyFor(sym)
keyFor: function keyFor(sym) {
if (!isSymbol(sym)) throw TypeError(sym + ' is not a symbol!');
for (var key in SymbolRegistry) if (SymbolRegistry[key] === sym) return key;
},
useSetter: function () { setter = true; },
useSimple: function () { setter = false; }
});
$export($export.S + $export.F * !USE_NATIVE, 'Object', {
// 19.1.2.2 Object.create(O [, Properties])
create: $create,
// 19.1.2.4 Object.defineProperty(O, P, Attributes)
defineProperty: $defineProperty,
// 19.1.2.3 Object.defineProperties(O, Properties)
defineProperties: $defineProperties,
// 19.1.2.6 Object.getOwnPropertyDescriptor(O, P)
getOwnPropertyDescriptor: $getOwnPropertyDescriptor,
// 19.1.2.7 Object.getOwnPropertyNames(O)
getOwnPropertyNames: $getOwnPropertyNames,
// 19.1.2.8 Object.getOwnPropertySymbols(O)
getOwnPropertySymbols: $getOwnPropertySymbols
});
// 24.3.2 JSON.stringify(value [, replacer [, space]])
$JSON && $export($export.S + $export.F * (!USE_NATIVE || $fails(function () {
var S = $Symbol();
// MS Edge converts symbol values to JSON as {}
// WebKit converts symbol values to JSON as null
// V8 throws on boxed symbols
return _stringify([S]) != '[null]' || _stringify({ a: S }) != '{}' || _stringify(Object(S)) != '{}';
})), 'JSON', {
stringify: function stringify(it) {
var args = [it];
var i = 1;
var replacer, $replacer;
while (arguments.length > i) args.push(arguments[i++]);
$replacer = replacer = args[1];
if (!isObject(replacer) && it === undefined || isSymbol(it)) return; // IE8 returns string on undefined
if (!isArray(replacer)) replacer = function (key, value) {
if (typeof $replacer == 'function') value = $replacer.call(this, key, value);
if (!isSymbol(value)) return value;
};
args[1] = replacer;
return _stringify.apply($JSON, args);
}
});
// 19.4.3.4 Symbol.prototype[@@toPrimitive](hint)
$Symbol[PROTOTYPE][TO_PRIMITIVE] || __webpack_require__(/*! ./_hide */ "./node_modules/core-js/modules/_hide.js")($Symbol[PROTOTYPE], TO_PRIMITIVE, $Symbol[PROTOTYPE].valueOf);
// 19.4.3.5 Symbol.prototype[@@toStringTag]
setToStringTag($Symbol, 'Symbol');
// 20.2.1.9 Math[@@toStringTag]
setToStringTag(Math, 'Math', true);
// 24.3.3 JSON[@@toStringTag]
setToStringTag(global.JSON, 'JSON', true);
/***/ }),
/***/ "./node_modules/core-js/modules/es7.array.includes.js":
/*!************************************************************!*\
!*** ./node_modules/core-js/modules/es7.array.includes.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// https://github.com/tc39/Array.prototype.includes
var $export = __webpack_require__(/*! ./_export */ "./node_modules/core-js/modules/_export.js");
var $includes = __webpack_require__(/*! ./_array-includes */ "./node_modules/core-js/modules/_array-includes.js")(true);
$export($export.P, 'Array', {
includes: function includes(el /* , fromIndex = 0 */) {
return $includes(this, el, arguments.length > 1 ? arguments[1] : undefined);
}
});
__webpack_require__(/*! ./_add-to-unscopables */ "./node_modules/core-js/modules/_add-to-unscopables.js")('includes');
/***/ }),
/***/ "./node_modules/core-js/modules/es7.symbol.async-iterator.js":
/*!*******************************************************************!*\
!*** ./node_modules/core-js/modules/es7.symbol.async-iterator.js ***!
\*******************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
__webpack_require__(/*! ./_wks-define */ "./node_modules/core-js/modules/_wks-define.js")('asyncIterator');
/***/ }),
/***/ "./node_modules/css-hot-loader/hotModuleReplacement.js":
/*!*************************************************************!*\
!*** ./node_modules/css-hot-loader/hotModuleReplacement.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var normalizeUrl = __webpack_require__(/*! normalize-url */ "./node_modules/css-hot-loader/node_modules/normalize-url/index.js");
var srcByModuleId = Object.create(null);
var debounce = __webpack_require__(/*! lodash/debounce */ "./node_modules/lodash/debounce.js");
var noDocument = typeof document === 'undefined';
var forEach = Array.prototype.forEach;
var noop = function () {};
var getCurrentScriptUrl = function(moduleId) {
var src = srcByModuleId[moduleId];
if (!src) {
if (document.currentScript) {
src = document.currentScript.src;
} else {
var scripts = document.getElementsByTagName('script');
var lastScriptTag = scripts[scripts.length - 1];
if (lastScriptTag) {
src = lastScriptTag.src;
}
}
srcByModuleId[moduleId] = src;
}
return function(fileMap) {
var splitResult = /([^\\/]+)\.js$/.exec(src);
var filename = splitResult && splitResult[1];
if (!filename) {
return [src.replace('.js', '.css')];
}
return fileMap.split(',').map(function(mapRule) {
var reg = new RegExp(filename + '\\.js$', 'g')
return normalizeUrl(src.replace(reg, mapRule.replace(/{fileName}/g, filename) + '.css'), { stripWWW: false });
});
};
};
function updateCss(el, url) {
if (!url) {
url = el.href.split('?')[0];
}
if (el.isLoaded === false) {
// We seem to be about to replace a css link that hasn't loaded yet.
// We're probably changing the same file more than once.
return;
}
if (!url || !(url.indexOf('.css') > -1)) return;
el.visited = true;
var newEl = el.cloneNode();
newEl.isLoaded = false;
newEl.addEventListener('load', function () {
newEl.isLoaded = true;
newEl.parentNode.removeChild(el);
});
newEl.addEventListener('error', function () {
newEl.isLoaded = true;
if (newEl.parentNode.contains(el)) {
newEl.parentNode.removeChild(el);
}
});
newEl.href = url + '?' + Date.now();
// insert new <link /> right to the old one's position
el.parentNode.insertBefore(newEl, el.nextSibling);
}
function reloadStyle(src) {
var elements = document.querySelectorAll('link');
var loaded = false;
forEach.call(elements, function(el) {
if (el.visited === true) return;
var url = getReloadUrl(el.href, src);
if (url) {
updateCss(el, url);
loaded = true;
}
});
return loaded;
}
function getReloadUrl(href, src) {
href = normalizeUrl(href, { stripWWW: false });
var ret;
src.some(function(url) {
if (href.indexOf(src) > -1) {
ret = url;
}
});
return ret;
}
function reloadAll() {
var elements = document.querySelectorAll('link');
forEach.call(elements, function(el) {
if (el.visited === true) return;
updateCss(el);
});
}
module.exports = function(moduleId, options) {
var getScriptSrc;
if (noDocument) {
return noop;
}
getScriptSrc = getCurrentScriptUrl(moduleId);
function update() {
var src = getScriptSrc(options.fileMap);
var reloaded = reloadStyle(src);
if (reloaded && !options.reloadAll) {
console.log('[HMR] css reload %s', src.join(' '));
} else {
console.log('[HMR] Reload all css');
reloadAll();
}
}
return debounce(update, 10);
};
/***/ }),
/***/ "./node_modules/css-hot-loader/node_modules/normalize-url/index.js":
/*!*************************************************************************!*\
!*** ./node_modules/css-hot-loader/node_modules/normalize-url/index.js ***!
\*************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var url = __webpack_require__(/*! url */ "./node_modules/url/url.js");
var punycode = __webpack_require__(/*! punycode */ "./node_modules/node-libs-browser/node_modules/punycode/punycode.js");
var queryString = __webpack_require__(/*! query-string */ "./node_modules/query-string/index.js");
var prependHttp = __webpack_require__(/*! prepend-http */ "./node_modules/prepend-http/index.js");
var sortKeys = __webpack_require__(/*! sort-keys */ "./node_modules/sort-keys/index.js");
var objectAssign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
var DEFAULT_PORTS = {
'http:': 80,
'https:': 443,
'ftp:': 21
};
// protocols that always contain a `//`` bit
var slashedProtocol = {
'http': true,
'https': true,
'ftp': true,
'gopher': true,
'file': true,
'http:': true,
'https:': true,
'ftp:': true,
'gopher:': true,
'file:': true
};
function testParameter(name, filters) {
return filters.some(function (filter) {
return filter instanceof RegExp ? filter.test(name) : filter === name;
});
}
module.exports = function (str, opts) {
opts = objectAssign({
normalizeProtocol: true,
normalizeHttps: false,
stripFragment: true,
stripWWW: true,
removeQueryParameters: [/^utm_\w+/i],
removeTrailingSlash: true,
removeDirectoryIndex: false
}, opts);
if (typeof str !== 'string') {
throw new TypeError('Expected a string');
}
var hasRelativeProtocol = str.indexOf('//') === 0;
// prepend protocol
str = prependHttp(str.trim()).replace(/^\/\//, 'http://');
var urlObj = url.parse(str);
if (opts.normalizeHttps && urlObj.protocol === 'https:') {
urlObj.protocol = 'http:';
}
if (!urlObj.hostname && !urlObj.pathname) {
throw new Error('Invalid URL');
}
// prevent these from being used by `url.format`
delete urlObj.host;
delete urlObj.query;
// remove fragment
if (opts.stripFragment) {
delete urlObj.hash;
}
// remove default port
var port = DEFAULT_PORTS[urlObj.protocol];
if (Number(urlObj.port) === port) {
delete urlObj.port;
}
// remove duplicate slashes
if (urlObj.pathname) {
urlObj.pathname = urlObj.pathname.replace(/\/{2,}/g, '/');
}
// decode URI octets
if (urlObj.pathname) {
urlObj.pathname = decodeURI(urlObj.pathname);
}
// remove directory index
if (opts.removeDirectoryIndex === true) {
opts.removeDirectoryIndex = [/^index\.[a-z]+$/];
}
if (Array.isArray(opts.removeDirectoryIndex) && opts.removeDirectoryIndex.length) {
var pathComponents = urlObj.pathname.split('/');
var lastComponent = pathComponents[pathComponents.length - 1];
if (testParameter(lastComponent, opts.removeDirectoryIndex)) {
pathComponents = pathComponents.slice(0, pathComponents.length - 1);
urlObj.pathname = pathComponents.slice(1).join('/') + '/';
}
}
// resolve relative paths, but only for slashed protocols
if (slashedProtocol[urlObj.protocol]) {
var domain = urlObj.protocol + '//' + urlObj.hostname;
var relative = url.resolve(domain, urlObj.pathname);
urlObj.pathname = relative.replace(domain, '');
}
if (urlObj.hostname) {
// IDN to Unicode
urlObj.hostname = punycode.toUnicode(urlObj.hostname).toLowerCase();
// remove trailing dot
urlObj.hostname = urlObj.hostname.replace(/\.$/, '');
// remove `www.`
if (opts.stripWWW) {
urlObj.hostname = urlObj.hostname.replace(/^www\./, '');
}
}
// remove URL with empty query string
if (urlObj.search === '?') {
delete urlObj.search;
}
var queryParameters = queryString.parse(urlObj.search);
// remove query unwanted parameters
if (Array.isArray(opts.removeQueryParameters)) {
for (var key in queryParameters) {
if (testParameter(key, opts.removeQueryParameters)) {
delete queryParameters[key];
}
}
}
// sort query parameters
urlObj.search = queryString.stringify(sortKeys(queryParameters));
// decode query parameters
urlObj.search = decodeURIComponent(urlObj.search);
// take advantage of many of the Node `url` normalizations
str = url.format(urlObj);
// remove ending `/`
if (opts.removeTrailingSlash || urlObj.pathname === '/') {
str = str.replace(/\/$/, '');
}
// restore relative protocol, if applicable
if (hasRelativeProtocol && !opts.normalizeProtocol) {
str = str.replace(/^http:\/\//, '//');
}
return str;
};
/***/ }),
/***/ "./node_modules/events/events.js":
/*!***************************************!*\
!*** ./node_modules/events/events.js ***!
\***************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var R = typeof Reflect === 'object' ? Reflect : null
var ReflectApply = R && typeof R.apply === 'function'
? R.apply
: function ReflectApply(target, receiver, args) {
return Function.prototype.apply.call(target, receiver, args);
}
var ReflectOwnKeys
if (R && typeof R.ownKeys === 'function') {
ReflectOwnKeys = R.ownKeys
} else if (Object.getOwnPropertySymbols) {
ReflectOwnKeys = function ReflectOwnKeys(target) {
return Object.getOwnPropertyNames(target)
.concat(Object.getOwnPropertySymbols(target));
};
} else {
ReflectOwnKeys = function ReflectOwnKeys(target) {
return Object.getOwnPropertyNames(target);
};
}
function ProcessEmitWarning(warning) {
if (console && console.warn) console.warn(warning);
}
var NumberIsNaN = Number.isNaN || function NumberIsNaN(value) {
return value !== value;
}
function EventEmitter() {
EventEmitter.init.call(this);
}
module.exports = EventEmitter;
// Backwards-compat with node 0.10.x
EventEmitter.EventEmitter = EventEmitter;
EventEmitter.prototype._events = undefined;
EventEmitter.prototype._eventsCount = 0;
EventEmitter.prototype._maxListeners = undefined;
// By default EventEmitters will print a warning if more than 10 listeners are
// added to it. This is a useful default which helps finding memory leaks.
var defaultMaxListeners = 10;
Object.defineProperty(EventEmitter, 'defaultMaxListeners', {
enumerable: true,
get: function() {
return defaultMaxListeners;
},
set: function(arg) {
if (typeof arg !== 'number' || arg < 0 || NumberIsNaN(arg)) {
throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received ' + arg + '.');
}
defaultMaxListeners = arg;
}
});
EventEmitter.init = function() {
if (this._events === undefined ||
this._events === Object.getPrototypeOf(this)._events) {
this._events = Object.create(null);
this._eventsCount = 0;
}
this._maxListeners = this._maxListeners || undefined;
};
// Obviously not all Emitters should be limited to 10. This function allows
// that to be increased. Set to zero for unlimited.
EventEmitter.prototype.setMaxListeners = function setMaxListeners(n) {
if (typeof n !== 'number' || n < 0 || NumberIsNaN(n)) {
throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received ' + n + '.');
}
this._maxListeners = n;
return this;
};
function $getMaxListeners(that) {
if (that._maxListeners === undefined)
return EventEmitter.defaultMaxListeners;
return that._maxListeners;
}
EventEmitter.prototype.getMaxListeners = function getMaxListeners() {
return $getMaxListeners(this);
};
EventEmitter.prototype.emit = function emit(type) {
var args = [];
for (var i = 1; i < arguments.length; i++) args.push(arguments[i]);
var doError = (type === 'error');
var events = this._events;
if (events !== undefined)
doError = (doError && events.error === undefined);
else if (!doError)
return false;
// If there is no 'error' event listener then throw.
if (doError) {
var er;
if (args.length > 0)
er = args[0];
if (er instanceof Error) {
// Note: The comments on the `throw` lines are intentional, they show
// up in Node's output if this results in an unhandled exception.
throw er; // Unhandled 'error' event
}
// At least give some kind of context to the user
var err = new Error('Unhandled error.' + (er ? ' (' + er.message + ')' : ''));
err.context = er;
throw err; // Unhandled 'error' event
}
var handler = events[type];
if (handler === undefined)
return false;
if (typeof handler === 'function') {
ReflectApply(handler, this, args);
} else {
var len = handler.length;
var listeners = arrayClone(handler, len);
for (var i = 0; i < len; ++i)
ReflectApply(listeners[i], this, args);
}
return true;
};
function _addListener(target, type, listener, prepend) {
var m;
var events;
var existing;
if (typeof listener !== 'function') {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
events = target._events;
if (events === undefined) {
events = target._events = Object.create(null);
target._eventsCount = 0;
} else {
// To avoid recursion in the case that type === "newListener"! Before
// adding it to the listeners, first emit "newListener".
if (events.newListener !== undefined) {
target.emit('newListener', type,
listener.listener ? listener.listener : listener);
// Re-assign `events` because a newListener handler could have caused the
// this._events to be assigned to a new object
events = target._events;
}
existing = events[type];
}
if (existing === undefined) {
// Optimize the case of one listener. Don't need the extra array object.
existing = events[type] = listener;
++target._eventsCount;
} else {
if (typeof existing === 'function') {
// Adding the second element, need to change to array.
existing = events[type] =
prepend ? [listener, existing] : [existing, listener];
// If we've already got an array, just append.
} else if (prepend) {
existing.unshift(listener);
} else {
existing.push(listener);
}
// Check for listener leak
m = $getMaxListeners(target);
if (m > 0 && existing.length > m && !existing.warned) {
existing.warned = true;
// No error code for this since it is a Warning
// eslint-disable-next-line no-restricted-syntax
var w = new Error('Possible EventEmitter memory leak detected. ' +
existing.length + ' ' + String(type) + ' listeners ' +
'added. Use emitter.setMaxListeners() to ' +
'increase limit');
w.name = 'MaxListenersExceededWarning';
w.emitter = target;
w.type = type;
w.count = existing.length;
ProcessEmitWarning(w);
}
}
return target;
}
EventEmitter.prototype.addListener = function addListener(type, listener) {
return _addListener(this, type, listener, false);
};
EventEmitter.prototype.on = EventEmitter.prototype.addListener;
EventEmitter.prototype.prependListener =
function prependListener(type, listener) {
return _addListener(this, type, listener, true);
};
function onceWrapper() {
var args = [];
for (var i = 0; i < arguments.length; i++) args.push(arguments[i]);
if (!this.fired) {
this.target.removeListener(this.type, this.wrapFn);
this.fired = true;
ReflectApply(this.listener, this.target, args);
}
}
function _onceWrap(target, type, listener) {
var state = { fired: false, wrapFn: undefined, target: target, type: type, listener: listener };
var wrapped = onceWrapper.bind(state);
wrapped.listener = listener;
state.wrapFn = wrapped;
return wrapped;
}
EventEmitter.prototype.once = function once(type, listener) {
if (typeof listener !== 'function') {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
this.on(type, _onceWrap(this, type, listener));
return this;
};
EventEmitter.prototype.prependOnceListener =
function prependOnceListener(type, listener) {
if (typeof listener !== 'function') {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
this.prependListener(type, _onceWrap(this, type, listener));
return this;
};
// Emits a 'removeListener' event if and only if the listener was removed.
EventEmitter.prototype.removeListener =
function removeListener(type, listener) {
var list, events, position, i, originalListener;
if (typeof listener !== 'function') {
throw new TypeError('The "listener" argument must be of type Function. Received type ' + typeof listener);
}
events = this._events;
if (events === undefined)
return this;
list = events[type];
if (list === undefined)
return this;
if (list === listener || list.listener === listener) {
if (--this._eventsCount === 0)
this._events = Object.create(null);
else {
delete events[type];
if (events.removeListener)
this.emit('removeListener', type, list.listener || listener);
}
} else if (typeof list !== 'function') {
position = -1;
for (i = list.length - 1; i >= 0; i--) {
if (list[i] === listener || list[i].listener === listener) {
originalListener = list[i].listener;
position = i;
break;
}
}
if (position < 0)
return this;
if (position === 0)
list.shift();
else {
spliceOne(list, position);
}
if (list.length === 1)
events[type] = list[0];
if (events.removeListener !== undefined)
this.emit('removeListener', type, originalListener || listener);
}
return this;
};
EventEmitter.prototype.off = EventEmitter.prototype.removeListener;
EventEmitter.prototype.removeAllListeners =
function removeAllListeners(type) {
var listeners, events, i;
events = this._events;
if (events === undefined)
return this;
// not listening for removeListener, no need to emit
if (events.removeListener === undefined) {
if (arguments.length === 0) {
this._events = Object.create(null);
this._eventsCount = 0;
} else if (events[type] !== undefined) {
if (--this._eventsCount === 0)
this._events = Object.create(null);
else
delete events[type];
}
return this;
}
// emit removeListener for all listeners on all events
if (arguments.length === 0) {
var keys = Object.keys(events);
var key;
for (i = 0; i < keys.length; ++i) {
key = keys[i];
if (key === 'removeListener') continue;
this.removeAllListeners(key);
}
this.removeAllListeners('removeListener');
this._events = Object.create(null);
this._eventsCount = 0;
return this;
}
listeners = events[type];
if (typeof listeners === 'function') {
this.removeListener(type, listeners);
} else if (listeners !== undefined) {
// LIFO order
for (i = listeners.length - 1; i >= 0; i--) {
this.removeListener(type, listeners[i]);
}
}
return this;
};
function _listeners(target, type, unwrap) {
var events = target._events;
if (events === undefined)
return [];
var evlistener = events[type];
if (evlistener === undefined)
return [];
if (typeof evlistener === 'function')
return unwrap ? [evlistener.listener || evlistener] : [evlistener];
return unwrap ?
unwrapListeners(evlistener) : arrayClone(evlistener, evlistener.length);
}
EventEmitter.prototype.listeners = function listeners(type) {
return _listeners(this, type, true);
};
EventEmitter.prototype.rawListeners = function rawListeners(type) {
return _listeners(this, type, false);
};
EventEmitter.listenerCount = function(emitter, type) {
if (typeof emitter.listenerCount === 'function') {
return emitter.listenerCount(type);
} else {
return listenerCount.call(emitter, type);
}
};
EventEmitter.prototype.listenerCount = listenerCount;
function listenerCount(type) {
var events = this._events;
if (events !== undefined) {
var evlistener = events[type];
if (typeof evlistener === 'function') {
return 1;
} else if (evlistener !== undefined) {
return evlistener.length;
}
}
return 0;
}
EventEmitter.prototype.eventNames = function eventNames() {
return this._eventsCount > 0 ? ReflectOwnKeys(this._events) : [];
};
function arrayClone(arr, n) {
var copy = new Array(n);
for (var i = 0; i < n; ++i)
copy[i] = arr[i];
return copy;
}
function spliceOne(list, index) {
for (; index + 1 < list.length; index++)
list[index] = list[index + 1];
list.pop();
}
function unwrapListeners(arr) {
var ret = new Array(arr.length);
for (var i = 0; i < ret.length; ++i) {
ret[i] = arr[i].listener || arr[i];
}
return ret;
}
/***/ }),
/***/ "./node_modules/html-entities/index.js":
/*!*********************************************!*\
!*** ./node_modules/html-entities/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
module.exports = {
XmlEntities: __webpack_require__(/*! ./lib/xml-entities.js */ "./node_modules/html-entities/lib/xml-entities.js"),
Html4Entities: __webpack_require__(/*! ./lib/html4-entities.js */ "./node_modules/html-entities/lib/html4-entities.js"),
Html5Entities: __webpack_require__(/*! ./lib/html5-entities.js */ "./node_modules/html-entities/lib/html5-entities.js"),
AllHtmlEntities: __webpack_require__(/*! ./lib/html5-entities.js */ "./node_modules/html-entities/lib/html5-entities.js")
};
/***/ }),
/***/ "./node_modules/html-entities/lib/html4-entities.js":
/*!**********************************************************!*\
!*** ./node_modules/html-entities/lib/html4-entities.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var HTML_ALPHA = ['apos', 'nbsp', 'iexcl', 'cent', 'pound', 'curren', 'yen', 'brvbar', 'sect', 'uml', 'copy', 'ordf', 'laquo', 'not', 'shy', 'reg', 'macr', 'deg', 'plusmn', 'sup2', 'sup3', 'acute', 'micro', 'para', 'middot', 'cedil', 'sup1', 'ordm', 'raquo', 'frac14', 'frac12', 'frac34', 'iquest', 'Agrave', 'Aacute', 'Acirc', 'Atilde', 'Auml', 'Aring', 'Aelig', 'Ccedil', 'Egrave', 'Eacute', 'Ecirc', 'Euml', 'Igrave', 'Iacute', 'Icirc', 'Iuml', 'ETH', 'Ntilde', 'Ograve', 'Oacute', 'Ocirc', 'Otilde', 'Ouml', 'times', 'Oslash', 'Ugrave', 'Uacute', 'Ucirc', 'Uuml', 'Yacute', 'THORN', 'szlig', 'agrave', 'aacute', 'acirc', 'atilde', 'auml', 'aring', 'aelig', 'ccedil', 'egrave', 'eacute', 'ecirc', 'euml', 'igrave', 'iacute', 'icirc', 'iuml', 'eth', 'ntilde', 'ograve', 'oacute', 'ocirc', 'otilde', 'ouml', 'divide', 'oslash', 'ugrave', 'uacute', 'ucirc', 'uuml', 'yacute', 'thorn', 'yuml', 'quot', 'amp', 'lt', 'gt', 'OElig', 'oelig', 'Scaron', 'scaron', 'Yuml', 'circ', 'tilde', 'ensp', 'emsp', 'thinsp', 'zwnj', 'zwj', 'lrm', 'rlm', 'ndash', 'mdash', 'lsquo', 'rsquo', 'sbquo', 'ldquo', 'rdquo', 'bdquo', 'dagger', 'Dagger', 'permil', 'lsaquo', 'rsaquo', 'euro', 'fnof', 'Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta', 'Eta', 'Theta', 'Iota', 'Kappa', 'Lambda', 'Mu', 'Nu', 'Xi', 'Omicron', 'Pi', 'Rho', 'Sigma', 'Tau', 'Upsilon', 'Phi', 'Chi', 'Psi', 'Omega', 'alpha', 'beta', 'gamma', 'delta', 'epsilon', 'zeta', 'eta', 'theta', 'iota', 'kappa', 'lambda', 'mu', 'nu', 'xi', 'omicron', 'pi', 'rho', 'sigmaf', 'sigma', 'tau', 'upsilon', 'phi', 'chi', 'psi', 'omega', 'thetasym', 'upsih', 'piv', 'bull', 'hellip', 'prime', 'Prime', 'oline', 'frasl', 'weierp', 'image', 'real', 'trade', 'alefsym', 'larr', 'uarr', 'rarr', 'darr', 'harr', 'crarr', 'lArr', 'uArr', 'rArr', 'dArr', 'hArr', 'forall', 'part', 'exist', 'empty', 'nabla', 'isin', 'notin', 'ni', 'prod', 'sum', 'minus', 'lowast', 'radic', 'prop', 'infin', 'ang', 'and', 'or', 'cap', 'cup', 'int', 'there4', 'sim', 'cong', 'asymp', 'ne', 'equiv', 'le', 'ge', 'sub', 'sup', 'nsub', 'sube', 'supe', 'oplus', 'otimes', 'perp', 'sdot', 'lceil', 'rceil', 'lfloor', 'rfloor', 'lang', 'rang', 'loz', 'spades', 'clubs', 'hearts', 'diams'];
var HTML_CODES = [39, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206, 207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219, 220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232, 233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245, 246, 247, 248, 249, 250, 251, 252, 253, 254, 255, 34, 38, 60, 62, 338, 339, 352, 353, 376, 710, 732, 8194, 8195, 8201, 8204, 8205, 8206, 8207, 8211, 8212, 8216, 8217, 8218, 8220, 8221, 8222, 8224, 8225, 8240, 8249, 8250, 8364, 402, 913, 914, 915, 916, 917, 918, 919, 920, 921, 922, 923, 924, 925, 926, 927, 928, 929, 931, 932, 933, 934, 935, 936, 937, 945, 946, 947, 948, 949, 950, 951, 952, 953, 954, 955, 956, 957, 958, 959, 960, 961, 962, 963, 964, 965, 966, 967, 968, 969, 977, 978, 982, 8226, 8230, 8242, 8243, 8254, 8260, 8472, 8465, 8476, 8482, 8501, 8592, 8593, 8594, 8595, 8596, 8629, 8656, 8657, 8658, 8659, 8660, 8704, 8706, 8707, 8709, 8711, 8712, 8713, 8715, 8719, 8721, 8722, 8727, 8730, 8733, 8734, 8736, 8743, 8744, 8745, 8746, 8747, 8756, 8764, 8773, 8776, 8800, 8801, 8804, 8805, 8834, 8835, 8836, 8838, 8839, 8853, 8855, 8869, 8901, 8968, 8969, 8970, 8971, 9001, 9002, 9674, 9824, 9827, 9829, 9830];
var alphaIndex = {};
var numIndex = {};
var i = 0;
var length = HTML_ALPHA.length;
while (i < length) {
var a = HTML_ALPHA[i];
var c = HTML_CODES[i];
alphaIndex[a] = String.fromCharCode(c);
numIndex[c] = a;
i++;
}
/**
* @constructor
*/
function Html4Entities() {}
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.prototype.decode = function(str) {
if (!str || !str.length) {
return '';
}
return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) {
var chr;
if (entity.charAt(0) === "#") {
var code = entity.charAt(1).toLowerCase() === 'x' ?
parseInt(entity.substr(2), 16) :
parseInt(entity.substr(1));
if (!(isNaN(code) || code < -32768 || code > 65535)) {
chr = String.fromCharCode(code);
}
} else {
chr = alphaIndex[entity];
}
return chr || s;
});
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.decode = function(str) {
return new Html4Entities().decode(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.prototype.encode = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var alpha = numIndex[str.charCodeAt(i)];
result += alpha ? "&" + alpha + ";" : str.charAt(i);
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.encode = function(str) {
return new Html4Entities().encode(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.prototype.encodeNonUTF = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var cc = str.charCodeAt(i);
var alpha = numIndex[cc];
if (alpha) {
result += "&" + alpha + ";";
} else if (cc < 32 || cc > 126) {
result += "&#" + cc + ";";
} else {
result += str.charAt(i);
}
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.encodeNonUTF = function(str) {
return new Html4Entities().encodeNonUTF(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.prototype.encodeNonASCII = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
if (c <= 255) {
result += str[i++];
continue;
}
result += '&#' + c + ';';
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html4Entities.encodeNonASCII = function(str) {
return new Html4Entities().encodeNonASCII(str);
};
module.exports = Html4Entities;
/***/ }),
/***/ "./node_modules/html-entities/lib/html5-entities.js":
/*!**********************************************************!*\
!*** ./node_modules/html-entities/lib/html5-entities.js ***!
\**********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var ENTITIES = [['Aacute', [193]], ['aacute', [225]], ['Abreve', [258]], ['abreve', [259]], ['ac', [8766]], ['acd', [8767]], ['acE', [8766, 819]], ['Acirc', [194]], ['acirc', [226]], ['acute', [180]], ['Acy', [1040]], ['acy', [1072]], ['AElig', [198]], ['aelig', [230]], ['af', [8289]], ['Afr', [120068]], ['afr', [120094]], ['Agrave', [192]], ['agrave', [224]], ['alefsym', [8501]], ['aleph', [8501]], ['Alpha', [913]], ['alpha', [945]], ['Amacr', [256]], ['amacr', [257]], ['amalg', [10815]], ['amp', [38]], ['AMP', [38]], ['andand', [10837]], ['And', [10835]], ['and', [8743]], ['andd', [10844]], ['andslope', [10840]], ['andv', [10842]], ['ang', [8736]], ['ange', [10660]], ['angle', [8736]], ['angmsdaa', [10664]], ['angmsdab', [10665]], ['angmsdac', [10666]], ['angmsdad', [10667]], ['angmsdae', [10668]], ['angmsdaf', [10669]], ['angmsdag', [10670]], ['angmsdah', [10671]], ['angmsd', [8737]], ['angrt', [8735]], ['angrtvb', [8894]], ['angrtvbd', [10653]], ['angsph', [8738]], ['angst', [197]], ['angzarr', [9084]], ['Aogon', [260]], ['aogon', [261]], ['Aopf', [120120]], ['aopf', [120146]], ['apacir', [10863]], ['ap', [8776]], ['apE', [10864]], ['ape', [8778]], ['apid', [8779]], ['apos', [39]], ['ApplyFunction', [8289]], ['approx', [8776]], ['approxeq', [8778]], ['Aring', [197]], ['aring', [229]], ['Ascr', [119964]], ['ascr', [119990]], ['Assign', [8788]], ['ast', [42]], ['asymp', [8776]], ['asympeq', [8781]], ['Atilde', [195]], ['atilde', [227]], ['Auml', [196]], ['auml', [228]], ['awconint', [8755]], ['awint', [10769]], ['backcong', [8780]], ['backepsilon', [1014]], ['backprime', [8245]], ['backsim', [8765]], ['backsimeq', [8909]], ['Backslash', [8726]], ['Barv', [10983]], ['barvee', [8893]], ['barwed', [8965]], ['Barwed', [8966]], ['barwedge', [8965]], ['bbrk', [9141]], ['bbrktbrk', [9142]], ['bcong', [8780]], ['Bcy', [1041]], ['bcy', [1073]], ['bdquo', [8222]], ['becaus', [8757]], ['because', [8757]], ['Because', [8757]], ['bemptyv', [10672]], ['bepsi', [1014]], ['bernou', [8492]], ['Bernoullis', [8492]], ['Beta', [914]], ['beta', [946]], ['beth', [8502]], ['between', [8812]], ['Bfr', [120069]], ['bfr', [120095]], ['bigcap', [8898]], ['bigcirc', [9711]], ['bigcup', [8899]], ['bigodot', [10752]], ['bigoplus', [10753]], ['bigotimes', [10754]], ['bigsqcup', [10758]], ['bigstar', [9733]], ['bigtriangledown', [9661]], ['bigtriangleup', [9651]], ['biguplus', [10756]], ['bigvee', [8897]], ['bigwedge', [8896]], ['bkarow', [10509]], ['blacklozenge', [10731]], ['blacksquare', [9642]], ['blacktriangle', [9652]], ['blacktriangledown', [9662]], ['blacktriangleleft', [9666]], ['blacktriangleright', [9656]], ['blank', [9251]], ['blk12', [9618]], ['blk14', [9617]], ['blk34', [9619]], ['block', [9608]], ['bne', [61, 8421]], ['bnequiv', [8801, 8421]], ['bNot', [10989]], ['bnot', [8976]], ['Bopf', [120121]], ['bopf', [120147]], ['bot', [8869]], ['bottom', [8869]], ['bowtie', [8904]], ['boxbox', [10697]], ['boxdl', [9488]], ['boxdL', [9557]], ['boxDl', [9558]], ['boxDL', [9559]], ['boxdr', [9484]], ['boxdR', [9554]], ['boxDr', [9555]], ['boxDR', [9556]], ['boxh', [9472]], ['boxH', [9552]], ['boxhd', [9516]], ['boxHd', [9572]], ['boxhD', [9573]], ['boxHD', [9574]], ['boxhu', [9524]], ['boxHu', [9575]], ['boxhU', [9576]], ['boxHU', [9577]], ['boxminus', [8863]], ['boxplus', [8862]], ['boxtimes', [8864]], ['boxul', [9496]], ['boxuL', [9563]], ['boxUl', [9564]], ['boxUL', [9565]], ['boxur', [9492]], ['boxuR', [9560]], ['boxUr', [9561]], ['boxUR', [9562]], ['boxv', [9474]], ['boxV', [9553]], ['boxvh', [9532]], ['boxvH', [9578]], ['boxVh', [9579]], ['boxVH', [9580]], ['boxvl', [9508]], ['boxvL', [9569]], ['boxVl', [9570]], ['boxVL', [9571]], ['boxvr', [9500]], ['boxvR', [9566]], ['boxVr', [9567]], ['boxVR', [9568]], ['bprime', [8245]], ['breve', [728]], ['Breve', [728]], ['brvbar', [166]], ['bscr', [119991]], ['Bscr', [8492]], ['bsemi', [8271]], ['bsim', [8765]], ['bsime', [8909]], ['bsolb', [10693]], ['bsol', [92]], ['bsolhsub', [10184]], ['bull', [8226]], ['bullet', [8226]], ['bump', [8782]], ['bumpE', [10926]], ['bumpe', [8783]], ['Bumpeq', [8782]], ['bumpeq', [8783]], ['Cacute', [262]], ['cacute', [263]], ['capand', [10820]], ['capbrcup', [10825]], ['capcap', [10827]], ['cap', [8745]], ['Cap', [8914]], ['capcup', [10823]], ['capdot', [10816]], ['CapitalDifferentialD', [8517]], ['caps', [8745, 65024]], ['caret', [8257]], ['caron', [711]], ['Cayleys', [8493]], ['ccaps', [10829]], ['Ccaron', [268]], ['ccaron', [269]], ['Ccedil', [199]], ['ccedil', [231]], ['Ccirc', [264]], ['ccirc', [265]], ['Cconint', [8752]], ['ccups', [10828]], ['ccupssm', [10832]], ['Cdot', [266]], ['cdot', [267]], ['cedil', [184]], ['Cedilla', [184]], ['cemptyv', [10674]], ['cent', [162]], ['centerdot', [183]], ['CenterDot', [183]], ['cfr', [120096]], ['Cfr', [8493]], ['CHcy', [1063]], ['chcy', [1095]], ['check', [10003]], ['checkmark', [10003]], ['Chi', [935]], ['chi', [967]], ['circ', [710]], ['circeq', [8791]], ['circlearrowleft', [8634]], ['circlearrowright', [8635]], ['circledast', [8859]], ['circledcirc', [8858]], ['circleddash', [8861]], ['CircleDot', [8857]], ['circledR', [174]], ['circledS', [9416]], ['CircleMinus', [8854]], ['CirclePlus', [8853]], ['CircleTimes', [8855]], ['cir', [9675]], ['cirE', [10691]], ['cire', [8791]], ['cirfnint', [10768]], ['cirmid', [10991]], ['cirscir', [10690]], ['ClockwiseContourIntegral', [8754]], ['clubs', [9827]], ['clubsuit', [9827]], ['colon', [58]], ['Colon', [8759]], ['Colone', [10868]], ['colone', [8788]], ['coloneq', [8788]], ['comma', [44]], ['commat', [64]], ['comp', [8705]], ['compfn', [8728]], ['complement', [8705]], ['complexes', [8450]], ['cong', [8773]], ['congdot', [10861]], ['Congruent', [8801]], ['conint', [8750]], ['Conint', [8751]], ['ContourIntegral', [8750]], ['copf', [120148]], ['Copf', [8450]], ['coprod', [8720]], ['Coproduct', [8720]], ['copy', [169]], ['COPY', [169]], ['copysr', [8471]], ['CounterClockwiseContourIntegral', [8755]], ['crarr', [8629]], ['cross', [10007]], ['Cross', [10799]], ['Cscr', [119966]], ['cscr', [119992]], ['csub', [10959]], ['csube', [10961]], ['csup', [10960]], ['csupe', [10962]], ['ctdot', [8943]], ['cudarrl', [10552]], ['cudarrr', [10549]], ['cuepr', [8926]], ['cuesc', [8927]], ['cularr', [8630]], ['cularrp', [10557]], ['cupbrcap', [10824]], ['cupcap', [10822]], ['CupCap', [8781]], ['cup', [8746]], ['Cup', [8915]], ['cupcup', [10826]], ['cupdot', [8845]], ['cupor', [10821]], ['cups', [8746, 65024]], ['curarr', [8631]], ['curarrm', [10556]], ['curlyeqprec', [8926]], ['curlyeqsucc', [8927]], ['curlyvee', [8910]], ['curlywedge', [8911]], ['curren', [164]], ['curvearrowleft', [8630]], ['curvearrowright', [8631]], ['cuvee', [8910]], ['cuwed', [8911]], ['cwconint', [8754]], ['cwint', [8753]], ['cylcty', [9005]], ['dagger', [8224]], ['Dagger', [8225]], ['daleth', [8504]], ['darr', [8595]], ['Darr', [8609]], ['dArr', [8659]], ['dash', [8208]], ['Dashv', [10980]], ['dashv', [8867]], ['dbkarow', [10511]], ['dblac', [733]], ['Dcaron', [270]], ['dcaron', [271]], ['Dcy', [1044]], ['dcy', [1076]], ['ddagger', [8225]], ['ddarr', [8650]], ['DD', [8517]], ['dd', [8518]], ['DDotrahd', [10513]], ['ddotseq', [10871]], ['deg', [176]], ['Del', [8711]], ['Delta', [916]], ['delta', [948]], ['demptyv', [10673]], ['dfisht', [10623]], ['Dfr', [120071]], ['dfr', [120097]], ['dHar', [10597]], ['dharl', [8643]], ['dharr', [8642]], ['DiacriticalAcute', [180]], ['DiacriticalDot', [729]], ['DiacriticalDoubleAcute', [733]], ['DiacriticalGrave', [96]], ['DiacriticalTilde', [732]], ['diam', [8900]], ['diamond', [8900]], ['Diamond', [8900]], ['diamondsuit', [9830]], ['diams', [9830]], ['die', [168]], ['DifferentialD', [8518]], ['digamma', [989]], ['disin', [8946]], ['div', [247]], ['divide', [247]], ['divideontimes', [8903]], ['divonx', [8903]], ['DJcy', [1026]], ['djcy', [1106]], ['dlcorn', [8990]], ['dlcrop', [8973]], ['dollar', [36]], ['Dopf', [120123]], ['dopf', [120149]], ['Dot', [168]], ['dot', [729]], ['DotDot', [8412]], ['doteq', [8784]], ['doteqdot', [8785]], ['DotEqual', [8784]], ['dotminus', [8760]], ['dotplus', [8724]], ['dotsquare', [8865]], ['doublebarwedge', [8966]], ['DoubleContourIntegral', [8751]], ['DoubleDot', [168]], ['DoubleDownArrow', [8659]], ['DoubleLeftArrow', [8656]], ['DoubleLeftRightArrow', [8660]], ['DoubleLeftTee', [10980]], ['DoubleLongLeftArrow', [10232]], ['DoubleLongLeftRightArrow', [10234]], ['DoubleLongRightArrow', [10233]], ['DoubleRightArrow', [8658]], ['DoubleRightTee', [8872]], ['DoubleUpArrow', [8657]], ['DoubleUpDownArrow', [8661]], ['DoubleVerticalBar', [8741]], ['DownArrowBar', [10515]], ['downarrow', [8595]], ['DownArrow', [8595]], ['Downarrow', [8659]], ['DownArrowUpArrow', [8693]], ['DownBreve', [785]], ['downdownarrows', [8650]], ['downharpoonleft', [8643]], ['downharpoonright', [8642]], ['DownLeftRightVector', [10576]], ['DownLeftTeeVector', [10590]], ['DownLeftVectorBar', [10582]], ['DownLeftVector', [8637]], ['DownRightTeeVector', [10591]], ['DownRightVectorBar', [10583]], ['DownRightVector', [8641]], ['DownTeeArrow', [8615]], ['DownTee', [8868]], ['drbkarow', [10512]], ['drcorn', [8991]], ['drcrop', [8972]], ['Dscr', [119967]], ['dscr', [119993]], ['DScy', [1029]], ['dscy', [1109]], ['dsol', [10742]], ['Dstrok', [272]], ['dstrok', [273]], ['dtdot', [8945]], ['dtri', [9663]], ['dtrif', [9662]], ['duarr', [8693]], ['duhar', [10607]], ['dwangle', [10662]], ['DZcy', [1039]], ['dzcy', [1119]], ['dzigrarr', [10239]], ['Eacute', [201]], ['eacute', [233]], ['easter', [10862]], ['Ecaron', [282]], ['ecaron', [283]], ['Ecirc', [202]], ['ecirc', [234]], ['ecir', [8790]], ['ecolon', [8789]], ['Ecy', [1069]], ['ecy', [1101]], ['eDDot', [10871]], ['Edot', [278]], ['edot', [279]], ['eDot', [8785]], ['ee', [8519]], ['efDot', [8786]], ['Efr', [120072]], ['efr', [120098]], ['eg', [10906]], ['Egrave', [200]], ['egrave', [232]], ['egs', [10902]], ['egsdot', [10904]], ['el', [10905]], ['Element', [8712]], ['elinters', [9191]], ['ell', [8467]], ['els', [10901]], ['elsdot', [10903]], ['Emacr', [274]], ['emacr', [275]], ['empty', [8709]], ['emptyset', [8709]], ['EmptySmallSquare', [9723]], ['emptyv', [8709]], ['EmptyVerySmallSquare', [9643]], ['emsp13', [8196]], ['emsp14', [8197]], ['emsp', [8195]], ['ENG', [330]], ['eng', [331]], ['ensp', [8194]], ['Eogon', [280]], ['eogon', [281]], ['Eopf', [120124]], ['eopf', [120150]], ['epar', [8917]], ['eparsl', [10723]], ['eplus', [10865]], ['epsi', [949]], ['Epsilon', [917]], ['epsilon', [949]], ['epsiv', [1013]], ['eqcirc', [8790]], ['eqcolon', [8789]], ['eqsim', [8770]], ['eqslantgtr', [10902]], ['eqslantless', [10901]], ['Equal', [10869]], ['equals', [61]], ['EqualTilde', [8770]], ['equest', [8799]], ['Equilibrium', [8652]], ['equiv', [8801]], ['equivDD', [10872]], ['eqvparsl', [10725]], ['erarr', [10609]], ['erDot', [8787]], ['escr', [8495]], ['Escr', [8496]], ['esdot', [8784]], ['Esim', [10867]], ['esim', [8770]], ['Eta', [919]], ['eta', [951]], ['ETH', [208]], ['eth', [240]], ['Euml', [203]], ['euml', [235]], ['euro', [8364]], ['excl', [33]], ['exist', [8707]], ['Exists', [8707]], ['expectation', [8496]], ['exponentiale', [8519]], ['ExponentialE', [8519]], ['fallingdotseq', [8786]], ['Fcy', [1060]], ['fcy', [1092]], ['female', [9792]], ['ffilig', [64259]], ['fflig', [64256]], ['ffllig', [64260]], ['Ffr', [120073]], ['ffr', [120099]], ['filig', [64257]], ['FilledSmallSquare', [9724]], ['FilledVerySmallSquare', [9642]], ['fjlig', [102, 106]], ['flat', [9837]], ['fllig', [64258]], ['fltns', [9649]], ['fnof', [402]], ['Fopf', [120125]], ['fopf', [120151]], ['forall', [8704]], ['ForAll', [8704]], ['fork', [8916]], ['forkv', [10969]], ['Fouriertrf', [8497]], ['fpartint', [10765]], ['frac12', [189]], ['frac13', [8531]], ['frac14', [188]], ['frac15', [8533]], ['frac16', [8537]], ['frac18', [8539]], ['frac23', [8532]], ['frac25', [8534]], ['frac34', [190]], ['frac35', [8535]], ['frac38', [8540]], ['frac45', [8536]], ['frac56', [8538]], ['frac58', [8541]], ['frac78', [8542]], ['frasl', [8260]], ['frown', [8994]], ['fscr', [119995]], ['Fscr', [8497]], ['gacute', [501]], ['Gamma', [915]], ['gamma', [947]], ['Gammad', [988]], ['gammad', [989]], ['gap', [10886]], ['Gbreve', [286]], ['gbreve', [287]], ['Gcedil', [290]], ['Gcirc', [284]], ['gcirc', [285]], ['Gcy', [1043]], ['gcy', [1075]], ['Gdot', [288]], ['gdot', [289]], ['ge', [8805]], ['gE', [8807]], ['gEl', [10892]], ['gel', [8923]], ['geq', [8805]], ['geqq', [8807]], ['geqslant', [10878]], ['gescc', [10921]], ['ges', [10878]], ['gesdot', [10880]], ['gesdoto', [10882]], ['gesdotol', [10884]], ['gesl', [8923, 65024]], ['gesles', [10900]], ['Gfr', [120074]], ['gfr', [120100]], ['gg', [8811]], ['Gg', [8921]], ['ggg', [8921]], ['gimel', [8503]], ['GJcy', [1027]], ['gjcy', [1107]], ['gla', [10917]], ['gl', [8823]], ['glE', [10898]], ['glj', [10916]], ['gnap', [10890]], ['gnapprox', [10890]], ['gne', [10888]], ['gnE', [8809]], ['gneq', [10888]], ['gneqq', [8809]], ['gnsim', [8935]], ['Gopf', [120126]], ['gopf', [120152]], ['grave', [96]], ['GreaterEqual', [8805]], ['GreaterEqualLess', [8923]], ['GreaterFullEqual', [8807]], ['GreaterGreater', [10914]], ['GreaterLess', [8823]], ['GreaterSlantEqual', [10878]], ['GreaterTilde', [8819]], ['Gscr', [119970]], ['gscr', [8458]], ['gsim', [8819]], ['gsime', [10894]], ['gsiml', [10896]], ['gtcc', [10919]], ['gtcir', [10874]], ['gt', [62]], ['GT', [62]], ['Gt', [8811]], ['gtdot', [8919]], ['gtlPar', [10645]], ['gtquest', [10876]], ['gtrapprox', [10886]], ['gtrarr', [10616]], ['gtrdot', [8919]], ['gtreqless', [8923]], ['gtreqqless', [10892]], ['gtrless', [8823]], ['gtrsim', [8819]], ['gvertneqq', [8809, 65024]], ['gvnE', [8809, 65024]], ['Hacek', [711]], ['hairsp', [8202]], ['half', [189]], ['hamilt', [8459]], ['HARDcy', [1066]], ['hardcy', [1098]], ['harrcir', [10568]], ['harr', [8596]], ['hArr', [8660]], ['harrw', [8621]], ['Hat', [94]], ['hbar', [8463]], ['Hcirc', [292]], ['hcirc', [293]], ['hearts', [9829]], ['heartsuit', [9829]], ['hellip', [8230]], ['hercon', [8889]], ['hfr', [120101]], ['Hfr', [8460]], ['HilbertSpace', [8459]], ['hksearow', [10533]], ['hkswarow', [10534]], ['hoarr', [8703]], ['homtht', [8763]], ['hookleftarrow', [8617]], ['hookrightarrow', [8618]], ['hopf', [120153]], ['Hopf', [8461]], ['horbar', [8213]], ['HorizontalLine', [9472]], ['hscr', [119997]], ['Hscr', [8459]], ['hslash', [8463]], ['Hstrok', [294]], ['hstrok', [295]], ['HumpDownHump', [8782]], ['HumpEqual', [8783]], ['hybull', [8259]], ['hyphen', [8208]], ['Iacute', [205]], ['iacute', [237]], ['ic', [8291]], ['Icirc', [206]], ['icirc', [238]], ['Icy', [1048]], ['icy', [1080]], ['Idot', [304]], ['IEcy', [1045]], ['iecy', [1077]], ['iexcl', [161]], ['iff', [8660]], ['ifr', [120102]], ['Ifr', [8465]], ['Igrave', [204]], ['igrave', [236]], ['ii', [8520]], ['iiiint', [10764]], ['iiint', [8749]], ['iinfin', [10716]], ['iiota', [8489]], ['IJlig', [306]], ['ijlig', [307]], ['Imacr', [298]], ['imacr', [299]], ['image', [8465]], ['ImaginaryI', [8520]], ['imagline', [8464]], ['imagpart', [8465]], ['imath', [305]], ['Im', [8465]], ['imof', [8887]], ['imped', [437]], ['Implies', [8658]], ['incare', [8453]], ['in', [8712]], ['infin', [8734]], ['infintie', [10717]], ['inodot', [305]], ['intcal', [8890]], ['int', [8747]], ['Int', [8748]], ['integers', [8484]], ['Integral', [8747]], ['intercal', [8890]], ['Intersection', [8898]], ['intlarhk', [10775]], ['intprod', [10812]], ['InvisibleComma', [8291]], ['InvisibleTimes', [8290]], ['IOcy', [1025]], ['iocy', [1105]], ['Iogon', [302]], ['iogon', [303]], ['Iopf', [120128]], ['iopf', [120154]], ['Iota', [921]], ['iota', [953]], ['iprod', [10812]], ['iquest', [191]], ['iscr', [119998]], ['Iscr', [8464]], ['isin', [8712]], ['isindot', [8949]], ['isinE', [8953]], ['isins', [8948]], ['isinsv', [8947]], ['isinv', [8712]], ['it', [8290]], ['Itilde', [296]], ['itilde', [297]], ['Iukcy', [1030]], ['iukcy', [1110]], ['Iuml', [207]], ['iuml', [239]], ['Jcirc', [308]], ['jcirc', [309]], ['Jcy', [1049]], ['jcy', [1081]], ['Jfr', [120077]], ['jfr', [120103]], ['jmath', [567]], ['Jopf', [120129]], ['jopf', [120155]], ['Jscr', [119973]], ['jscr', [119999]], ['Jsercy', [1032]], ['jsercy', [1112]], ['Jukcy', [1028]], ['jukcy', [1108]], ['Kappa', [922]], ['kappa', [954]], ['kappav', [1008]], ['Kcedil', [310]], ['kcedil', [311]], ['Kcy', [1050]], ['kcy', [1082]], ['Kfr', [120078]], ['kfr', [120104]], ['kgreen', [312]], ['KHcy', [1061]], ['khcy', [1093]], ['KJcy', [1036]], ['kjcy', [1116]], ['Kopf', [120130]], ['kopf', [120156]], ['Kscr', [119974]], ['kscr', [120000]], ['lAarr', [8666]], ['Lacute', [313]], ['lacute', [314]], ['laemptyv', [10676]], ['lagran', [8466]], ['Lambda', [923]], ['lambda', [955]], ['lang', [10216]], ['Lang', [10218]], ['langd', [10641]], ['langle', [10216]], ['lap', [10885]], ['Laplacetrf', [8466]], ['laquo', [171]], ['larrb', [8676]], ['larrbfs', [10527]], ['larr', [8592]], ['Larr', [8606]], ['lArr', [8656]], ['larrfs', [10525]], ['larrhk', [8617]], ['larrlp', [8619]], ['larrpl', [10553]], ['larrsim', [10611]], ['larrtl', [8610]], ['latail', [10521]], ['lAtail', [10523]], ['lat', [10923]], ['late', [10925]], ['lates', [10925, 65024]], ['lbarr', [10508]], ['lBarr', [10510]], ['lbbrk', [10098]], ['lbrace', [123]], ['lbrack', [91]], ['lbrke', [10635]], ['lbrksld', [10639]], ['lbrkslu', [10637]], ['Lcaron', [317]], ['lcaron', [318]], ['Lcedil', [315]], ['lcedil', [316]], ['lceil', [8968]], ['lcub', [123]], ['Lcy', [1051]], ['lcy', [1083]], ['ldca', [10550]], ['ldquo', [8220]], ['ldquor', [8222]], ['ldrdhar', [10599]], ['ldrushar', [10571]], ['ldsh', [8626]], ['le', [8804]], ['lE', [8806]], ['LeftAngleBracket', [10216]], ['LeftArrowBar', [8676]], ['leftarrow', [8592]], ['LeftArrow', [8592]], ['Leftarrow', [8656]], ['LeftArrowRightArrow', [8646]], ['leftarrowtail', [8610]], ['LeftCeiling', [8968]], ['LeftDoubleBracket', [10214]], ['LeftDownTeeVector', [10593]], ['LeftDownVectorBar', [10585]], ['LeftDownVector', [8643]], ['LeftFloor', [8970]], ['leftharpoondown', [8637]], ['leftharpoonup', [8636]], ['leftleftarrows', [8647]], ['leftrightarrow', [8596]], ['LeftRightArrow', [8596]], ['Leftrightarrow', [8660]], ['leftrightarrows', [8646]], ['leftrightharpoons', [8651]], ['leftrightsquigarrow', [8621]], ['LeftRightVector', [10574]], ['LeftTeeArrow', [8612]], ['LeftTee', [8867]], ['LeftTeeVector', [10586]], ['leftthreetimes', [8907]], ['LeftTriangleBar', [10703]], ['LeftTriangle', [8882]], ['LeftTriangleEqual', [8884]], ['LeftUpDownVector', [10577]], ['LeftUpTeeVector', [10592]], ['LeftUpVectorBar', [10584]], ['LeftUpVector', [8639]], ['LeftVectorBar', [10578]], ['LeftVector', [8636]], ['lEg', [10891]], ['leg', [8922]], ['leq', [8804]], ['leqq', [8806]], ['leqslant', [10877]], ['lescc', [10920]], ['les', [10877]], ['lesdot', [10879]], ['lesdoto', [10881]], ['lesdotor', [10883]], ['lesg', [8922, 65024]], ['lesges', [10899]], ['lessapprox', [10885]], ['lessdot', [8918]], ['lesseqgtr', [8922]], ['lesseqqgtr', [10891]], ['LessEqualGreater', [8922]], ['LessFullEqual', [8806]], ['LessGreater', [8822]], ['lessgtr', [8822]], ['LessLess', [10913]], ['lesssim', [8818]], ['LessSlantEqual', [10877]], ['LessTilde', [8818]], ['lfisht', [10620]], ['lfloor', [8970]], ['Lfr', [120079]], ['lfr', [120105]], ['lg', [8822]], ['lgE', [10897]], ['lHar', [10594]], ['lhard', [8637]], ['lharu', [8636]], ['lharul', [10602]], ['lhblk', [9604]], ['LJcy', [1033]], ['ljcy', [1113]], ['llarr', [8647]], ['ll', [8810]], ['Ll', [8920]], ['llcorner', [8990]], ['Lleftarrow', [8666]], ['llhard', [10603]], ['lltri', [9722]], ['Lmidot', [319]], ['lmidot', [320]], ['lmoustache', [9136]], ['lmoust', [9136]], ['lnap', [10889]], ['lnapprox', [10889]], ['lne', [10887]], ['lnE', [8808]], ['lneq', [10887]], ['lneqq', [8808]], ['lnsim', [8934]], ['loang', [10220]], ['loarr', [8701]], ['lobrk', [10214]], ['longleftarrow', [10229]], ['LongLeftArrow', [10229]], ['Longleftarrow', [10232]], ['longleftrightarrow', [10231]], ['LongLeftRightArrow', [10231]], ['Longleftrightarrow', [10234]], ['longmapsto', [10236]], ['longrightarrow', [10230]], ['LongRightArrow', [10230]], ['Longrightarrow', [10233]], ['looparrowleft', [8619]], ['looparrowright', [8620]], ['lopar', [10629]], ['Lopf', [120131]], ['lopf', [120157]], ['loplus', [10797]], ['lotimes', [10804]], ['lowast', [8727]], ['lowbar', [95]], ['LowerLeftArrow', [8601]], ['LowerRightArrow', [8600]], ['loz', [9674]], ['lozenge', [9674]], ['lozf', [10731]], ['lpar', [40]], ['lparlt', [10643]], ['lrarr', [8646]], ['lrcorner', [8991]], ['lrhar', [8651]], ['lrhard', [10605]], ['lrm', [8206]], ['lrtri', [8895]], ['lsaquo', [8249]], ['lscr', [120001]], ['Lscr', [8466]], ['lsh', [8624]], ['Lsh', [8624]], ['lsim', [8818]], ['lsime', [10893]], ['lsimg', [10895]], ['lsqb', [91]], ['lsquo', [8216]], ['lsquor', [8218]], ['Lstrok', [321]], ['lstrok', [322]], ['ltcc', [10918]], ['ltcir', [10873]], ['lt', [60]], ['LT', [60]], ['Lt', [8810]], ['ltdot', [8918]], ['lthree', [8907]], ['ltimes', [8905]], ['ltlarr', [10614]], ['ltquest', [10875]], ['ltri', [9667]], ['ltrie', [8884]], ['ltrif', [9666]], ['ltrPar', [10646]], ['lurdshar', [10570]], ['luruhar', [10598]], ['lvertneqq', [8808, 65024]], ['lvnE', [8808, 65024]], ['macr', [175]], ['male', [9794]], ['malt', [10016]], ['maltese', [10016]], ['Map', [10501]], ['map', [8614]], ['mapsto', [8614]], ['mapstodown', [8615]], ['mapstoleft', [8612]], ['mapstoup', [8613]], ['marker', [9646]], ['mcomma', [10793]], ['Mcy', [1052]], ['mcy', [1084]], ['mdash', [8212]], ['mDDot', [8762]], ['measuredangle', [8737]], ['MediumSpace', [8287]], ['Mellintrf', [8499]], ['Mfr', [120080]], ['mfr', [120106]], ['mho', [8487]], ['micro', [181]], ['midast', [42]], ['midcir', [10992]], ['mid', [8739]], ['middot', [183]], ['minusb', [8863]], ['minus', [8722]], ['minusd', [8760]], ['minusdu', [10794]], ['MinusPlus', [8723]], ['mlcp', [10971]], ['mldr', [8230]], ['mnplus', [8723]], ['models', [8871]], ['Mopf', [120132]], ['mopf', [120158]], ['mp', [8723]], ['mscr', [120002]], ['Mscr', [8499]], ['mstpos', [8766]], ['Mu', [924]], ['mu', [956]], ['multimap', [8888]], ['mumap', [8888]], ['nabla', [8711]], ['Nacute', [323]], ['nacute', [324]], ['nang', [8736, 8402]], ['nap', [8777]], ['napE', [10864, 824]], ['napid', [8779, 824]], ['napos', [329]], ['napprox', [8777]], ['natural', [9838]], ['naturals', [8469]], ['natur', [9838]], ['nbsp', [160]], ['nbump', [8782, 824]], ['nbumpe', [8783, 824]], ['ncap', [10819]], ['Ncaron', [327]], ['ncaron', [328]], ['Ncedil', [325]], ['ncedil', [326]], ['ncong', [8775]], ['ncongdot', [10861, 824]], ['ncup', [10818]], ['Ncy', [1053]], ['ncy', [1085]], ['ndash', [8211]], ['nearhk', [10532]], ['nearr', [8599]], ['neArr', [8663]], ['nearrow', [8599]], ['ne', [8800]], ['nedot', [8784, 824]], ['NegativeMediumSpace', [8203]], ['NegativeThickSpace', [8203]], ['NegativeThinSpace', [8203]], ['NegativeVeryThinSpace', [8203]], ['nequiv', [8802]], ['nesear', [10536]], ['nesim', [8770, 824]], ['NestedGreaterGreater', [8811]], ['NestedLessLess', [8810]], ['nexist', [8708]], ['nexists', [8708]], ['Nfr', [120081]], ['nfr', [120107]], ['ngE', [8807, 824]], ['nge', [8817]], ['ngeq', [8817]], ['ngeqq', [8807, 824]], ['ngeqslant', [10878, 824]], ['nges', [10878, 824]], ['nGg', [8921, 824]], ['ngsim', [8821]], ['nGt', [8811, 8402]], ['ngt', [8815]], ['ngtr', [8815]], ['nGtv', [8811, 824]], ['nharr', [8622]], ['nhArr', [8654]], ['nhpar', [10994]], ['ni', [8715]], ['nis', [8956]], ['nisd', [8954]], ['niv', [8715]], ['NJcy', [1034]], ['njcy', [1114]], ['nlarr', [8602]], ['nlArr', [8653]], ['nldr', [8229]], ['nlE', [8806, 824]], ['nle', [8816]], ['nleftarrow', [8602]], ['nLeftarrow', [8653]], ['nleftrightarrow', [8622]], ['nLeftrightarrow', [8654]], ['nleq', [8816]], ['nleqq', [8806, 824]], ['nleqslant', [10877, 824]], ['nles', [10877, 824]], ['nless', [8814]], ['nLl', [8920, 824]], ['nlsim', [8820]], ['nLt', [8810, 8402]], ['nlt', [8814]], ['nltri', [8938]], ['nltrie', [8940]], ['nLtv', [8810, 824]], ['nmid', [8740]], ['NoBreak', [8288]], ['NonBreakingSpace', [160]], ['nopf', [120159]], ['Nopf', [8469]], ['Not', [10988]], ['not', [172]], ['NotCongruent', [8802]], ['NotCupCap', [8813]], ['NotDoubleVerticalBar', [8742]], ['NotElement', [8713]], ['NotEqual', [8800]], ['NotEqualTilde', [8770, 824]], ['NotExists', [8708]], ['NotGreater', [8815]], ['NotGreaterEqual', [8817]], ['NotGreaterFullEqual', [8807, 824]], ['NotGreaterGreater', [8811, 824]], ['NotGreaterLess', [8825]], ['NotGreaterSlantEqual', [10878, 824]], ['NotGreaterTilde', [8821]], ['NotHumpDownHump', [8782, 824]], ['NotHumpEqual', [8783, 824]], ['notin', [8713]], ['notindot', [8949, 824]], ['notinE', [8953, 824]], ['notinva', [8713]], ['notinvb', [8951]], ['notinvc', [8950]], ['NotLeftTriangleBar', [10703, 824]], ['NotLeftTriangle', [8938]], ['NotLeftTriangleEqual', [8940]], ['NotLess', [8814]], ['NotLessEqual', [8816]], ['NotLessGreater', [8824]], ['NotLessLess', [8810, 824]], ['NotLessSlantEqual', [10877, 824]], ['NotLessTilde', [8820]], ['NotNestedGreaterGreater', [10914, 824]], ['NotNestedLessLess', [10913, 824]], ['notni', [8716]], ['notniva', [8716]], ['notnivb', [8958]], ['notnivc', [8957]], ['NotPrecedes', [8832]], ['NotPrecedesEqual', [10927, 824]], ['NotPrecedesSlantEqual', [8928]], ['NotReverseElement', [8716]], ['NotRightTriangleBar', [10704, 824]], ['NotRightTriangle', [8939]], ['NotRightTriangleEqual', [8941]], ['NotSquareSubset', [8847, 824]], ['NotSquareSubsetEqual', [8930]], ['NotSquareSuperset', [8848, 824]], ['NotSquareSupersetEqual', [8931]], ['NotSubset', [8834, 8402]], ['NotSubsetEqual', [8840]], ['NotSucceeds', [8833]], ['NotSucceedsEqual', [10928, 824]], ['NotSucceedsSlantEqual', [8929]], ['NotSucceedsTilde', [8831, 824]], ['NotSuperset', [8835, 8402]], ['NotSupersetEqual', [8841]], ['NotTilde', [8769]], ['NotTildeEqual', [8772]], ['NotTildeFullEqual', [8775]], ['NotTildeTilde', [8777]], ['NotVerticalBar', [8740]], ['nparallel', [8742]], ['npar', [8742]], ['nparsl', [11005, 8421]], ['npart', [8706, 824]], ['npolint', [10772]], ['npr', [8832]], ['nprcue', [8928]], ['nprec', [8832]], ['npreceq', [10927, 824]], ['npre', [10927, 824]], ['nrarrc', [10547, 824]], ['nrarr', [8603]], ['nrArr', [8655]], ['nrarrw', [8605, 824]], ['nrightarrow', [8603]], ['nRightarrow', [8655]], ['nrtri', [8939]], ['nrtrie', [8941]], ['nsc', [8833]], ['nsccue', [8929]], ['nsce', [10928, 824]], ['Nscr', [119977]], ['nscr', [120003]], ['nshortmid', [8740]], ['nshortparallel', [8742]], ['nsim', [8769]], ['nsime', [8772]], ['nsimeq', [8772]], ['nsmid', [8740]], ['nspar', [8742]], ['nsqsube', [8930]], ['nsqsupe', [8931]], ['nsub', [8836]], ['nsubE', [10949, 824]], ['nsube', [8840]], ['nsubset', [8834, 8402]], ['nsubseteq', [8840]], ['nsubseteqq', [10949, 824]], ['nsucc', [8833]], ['nsucceq', [10928, 824]], ['nsup', [8837]], ['nsupE', [10950, 824]], ['nsupe', [8841]], ['nsupset', [8835, 8402]], ['nsupseteq', [8841]], ['nsupseteqq', [10950, 824]], ['ntgl', [8825]], ['Ntilde', [209]], ['ntilde', [241]], ['ntlg', [8824]], ['ntriangleleft', [8938]], ['ntrianglelefteq', [8940]], ['ntriangleright', [8939]], ['ntrianglerighteq', [8941]], ['Nu', [925]], ['nu', [957]], ['num', [35]], ['numero', [8470]], ['numsp', [8199]], ['nvap', [8781, 8402]], ['nvdash', [8876]], ['nvDash', [8877]], ['nVdash', [8878]], ['nVDash', [8879]], ['nvge', [8805, 8402]], ['nvgt', [62, 8402]], ['nvHarr', [10500]], ['nvinfin', [10718]], ['nvlArr', [10498]], ['nvle', [8804, 8402]], ['nvlt', [60, 8402]], ['nvltrie', [8884, 8402]], ['nvrArr', [10499]], ['nvrtrie', [8885, 8402]], ['nvsim', [8764, 8402]], ['nwarhk', [10531]], ['nwarr', [8598]], ['nwArr', [8662]], ['nwarrow', [8598]], ['nwnear', [10535]], ['Oacute', [211]], ['oacute', [243]], ['oast', [8859]], ['Ocirc', [212]], ['ocirc', [244]], ['ocir', [8858]], ['Ocy', [1054]], ['ocy', [1086]], ['odash', [8861]], ['Odblac', [336]], ['odblac', [337]], ['odiv', [10808]], ['odot', [8857]], ['odsold', [10684]], ['OElig', [338]], ['oelig', [339]], ['ofcir', [10687]], ['Ofr', [120082]], ['ofr', [120108]], ['ogon', [731]], ['Ograve', [210]], ['ograve', [242]], ['ogt', [10689]], ['ohbar', [10677]], ['ohm', [937]], ['oint', [8750]], ['olarr', [8634]], ['olcir', [10686]], ['olcross', [10683]], ['oline', [8254]], ['olt', [10688]], ['Omacr', [332]], ['omacr', [333]], ['Omega', [937]], ['omega', [969]], ['Omicron', [927]], ['omicron', [959]], ['omid', [10678]], ['ominus', [8854]], ['Oopf', [120134]], ['oopf', [120160]], ['opar', [10679]], ['OpenCurlyDoubleQuote', [8220]], ['OpenCurlyQuote', [8216]], ['operp', [10681]], ['oplus', [8853]], ['orarr', [8635]], ['Or', [10836]], ['or', [8744]], ['ord', [10845]], ['order', [8500]], ['orderof', [8500]], ['ordf', [170]], ['ordm', [186]], ['origof', [8886]], ['oror', [10838]], ['orslope', [10839]], ['orv', [10843]], ['oS', [9416]], ['Oscr', [119978]], ['oscr', [8500]], ['Oslash', [216]], ['oslash', [248]], ['osol', [8856]], ['Otilde', [213]], ['otilde', [245]], ['otimesas', [10806]], ['Otimes', [10807]], ['otimes', [8855]], ['Ouml', [214]], ['ouml', [246]], ['ovbar', [9021]], ['OverBar', [8254]], ['OverBrace', [9182]], ['OverBracket', [9140]], ['OverParenthesis', [9180]], ['para', [182]], ['parallel', [8741]], ['par', [8741]], ['parsim', [10995]], ['parsl', [11005]], ['part', [8706]], ['PartialD', [8706]], ['Pcy', [1055]], ['pcy', [1087]], ['percnt', [37]], ['period', [46]], ['permil', [8240]], ['perp', [8869]], ['pertenk', [8241]], ['Pfr', [120083]], ['pfr', [120109]], ['Phi', [934]], ['phi', [966]], ['phiv', [981]], ['phmmat', [8499]], ['phone', [9742]], ['Pi', [928]], ['pi', [960]], ['pitchfork', [8916]], ['piv', [982]], ['planck', [8463]], ['planckh', [8462]], ['plankv', [8463]], ['plusacir', [10787]], ['plusb', [8862]], ['pluscir', [10786]], ['plus', [43]], ['plusdo', [8724]], ['plusdu', [10789]], ['pluse', [10866]], ['PlusMinus', [177]], ['plusmn', [177]], ['plussim', [10790]], ['plustwo', [10791]], ['pm', [177]], ['Poincareplane', [8460]], ['pointint', [10773]], ['popf', [120161]], ['Popf', [8473]], ['pound', [163]], ['prap', [10935]], ['Pr', [10939]], ['pr', [8826]], ['prcue', [8828]], ['precapprox', [10935]], ['prec', [8826]], ['preccurlyeq', [8828]], ['Precedes', [8826]], ['PrecedesEqual', [10927]], ['PrecedesSlantEqual', [8828]], ['PrecedesTilde', [8830]], ['preceq', [10927]], ['precnapprox', [10937]], ['precneqq', [10933]], ['precnsim', [8936]], ['pre', [10927]], ['prE', [10931]], ['precsim', [8830]], ['prime', [8242]], ['Prime', [8243]], ['primes', [8473]], ['prnap', [10937]], ['prnE', [10933]], ['prnsim', [8936]], ['prod', [8719]], ['Product', [8719]], ['profalar', [9006]], ['profline', [8978]], ['profsurf', [8979]], ['prop', [8733]], ['Proportional', [8733]], ['Proportion', [8759]], ['propto', [8733]], ['prsim', [8830]], ['prurel', [8880]], ['Pscr', [119979]], ['pscr', [120005]], ['Psi', [936]], ['psi', [968]], ['puncsp', [8200]], ['Qfr', [120084]], ['qfr', [120110]], ['qint', [10764]], ['qopf', [120162]], ['Qopf', [8474]], ['qprime', [8279]], ['Qscr', [119980]], ['qscr', [120006]], ['quaternions', [8461]], ['quatint', [10774]], ['quest', [63]], ['questeq', [8799]], ['quot', [34]], ['QUOT', [34]], ['rAarr', [8667]], ['race', [8765, 817]], ['Racute', [340]], ['racute', [341]], ['radic', [8730]], ['raemptyv', [10675]], ['rang', [10217]], ['Rang', [10219]], ['rangd', [10642]], ['range', [10661]], ['rangle', [10217]], ['raquo', [187]], ['rarrap', [10613]], ['rarrb', [8677]], ['rarrbfs', [10528]], ['rarrc', [10547]], ['rarr', [8594]], ['Rarr', [8608]], ['rArr', [8658]], ['rarrfs', [10526]], ['rarrhk', [8618]], ['rarrlp', [8620]], ['rarrpl', [10565]], ['rarrsim', [10612]], ['Rarrtl', [10518]], ['rarrtl', [8611]], ['rarrw', [8605]], ['ratail', [10522]], ['rAtail', [10524]], ['ratio', [8758]], ['rationals', [8474]], ['rbarr', [10509]], ['rBarr', [10511]], ['RBarr', [10512]], ['rbbrk', [10099]], ['rbrace', [125]], ['rbrack', [93]], ['rbrke', [10636]], ['rbrksld', [10638]], ['rbrkslu', [10640]], ['Rcaron', [344]], ['rcaron', [345]], ['Rcedil', [342]], ['rcedil', [343]], ['rceil', [8969]], ['rcub', [125]], ['Rcy', [1056]], ['rcy', [1088]], ['rdca', [10551]], ['rdldhar', [10601]], ['rdquo', [8221]], ['rdquor', [8221]], ['CloseCurlyDoubleQuote', [8221]], ['rdsh', [8627]], ['real', [8476]], ['realine', [8475]], ['realpart', [8476]], ['reals', [8477]], ['Re', [8476]], ['rect', [9645]], ['reg', [174]], ['REG', [174]], ['ReverseElement', [8715]], ['ReverseEquilibrium', [8651]], ['ReverseUpEquilibrium', [10607]], ['rfisht', [10621]], ['rfloor', [8971]], ['rfr', [120111]], ['Rfr', [8476]], ['rHar', [10596]], ['rhard', [8641]], ['rharu', [8640]], ['rharul', [10604]], ['Rho', [929]], ['rho', [961]], ['rhov', [1009]], ['RightAngleBracket', [10217]], ['RightArrowBar', [8677]], ['rightarrow', [8594]], ['RightArrow', [8594]], ['Rightarrow', [8658]], ['RightArrowLeftArrow', [8644]], ['rightarrowtail', [8611]], ['RightCeiling', [8969]], ['RightDoubleBracket', [10215]], ['RightDownTeeVector', [10589]], ['RightDownVectorBar', [10581]], ['RightDownVector', [8642]], ['RightFloor', [8971]], ['rightharpoondown', [8641]], ['rightharpoonup', [8640]], ['rightleftarrows', [8644]], ['rightleftharpoons', [8652]], ['rightrightarrows', [8649]], ['rightsquigarrow', [8605]], ['RightTeeArrow', [8614]], ['RightTee', [8866]], ['RightTeeVector', [10587]], ['rightthreetimes', [8908]], ['RightTriangleBar', [10704]], ['RightTriangle', [8883]], ['RightTriangleEqual', [8885]], ['RightUpDownVector', [10575]], ['RightUpTeeVector', [10588]], ['RightUpVectorBar', [10580]], ['RightUpVector', [8638]], ['RightVectorBar', [10579]], ['RightVector', [8640]], ['ring', [730]], ['risingdotseq', [8787]], ['rlarr', [8644]], ['rlhar', [8652]], ['rlm', [8207]], ['rmoustache', [9137]], ['rmoust', [9137]], ['rnmid', [10990]], ['roang', [10221]], ['roarr', [8702]], ['robrk', [10215]], ['ropar', [10630]], ['ropf', [120163]], ['Ropf', [8477]], ['roplus', [10798]], ['rotimes', [10805]], ['RoundImplies', [10608]], ['rpar', [41]], ['rpargt', [10644]], ['rppolint', [10770]], ['rrarr', [8649]], ['Rrightarrow', [8667]], ['rsaquo', [8250]], ['rscr', [120007]], ['Rscr', [8475]], ['rsh', [8625]], ['Rsh', [8625]], ['rsqb', [93]], ['rsquo', [8217]], ['rsquor', [8217]], ['CloseCurlyQuote', [8217]], ['rthree', [8908]], ['rtimes', [8906]], ['rtri', [9657]], ['rtrie', [8885]], ['rtrif', [9656]], ['rtriltri', [10702]], ['RuleDelayed', [10740]], ['ruluhar', [10600]], ['rx', [8478]], ['Sacute', [346]], ['sacute', [347]], ['sbquo', [8218]], ['scap', [10936]], ['Scaron', [352]], ['scaron', [353]], ['Sc', [10940]], ['sc', [8827]], ['sccue', [8829]], ['sce', [10928]], ['scE', [10932]], ['Scedil', [350]], ['scedil', [351]], ['Scirc', [348]], ['scirc', [349]], ['scnap', [10938]], ['scnE', [10934]], ['scnsim', [8937]], ['scpolint', [10771]], ['scsim', [8831]], ['Scy', [1057]], ['scy', [1089]], ['sdotb', [8865]], ['sdot', [8901]], ['sdote', [10854]], ['searhk', [10533]], ['searr', [8600]], ['seArr', [8664]], ['searrow', [8600]], ['sect', [167]], ['semi', [59]], ['seswar', [10537]], ['setminus', [8726]], ['setmn', [8726]], ['sext', [10038]], ['Sfr', [120086]], ['sfr', [120112]], ['sfrown', [8994]], ['sharp', [9839]], ['SHCHcy', [1065]], ['shchcy', [1097]], ['SHcy', [1064]], ['shcy', [1096]], ['ShortDownArrow', [8595]], ['ShortLeftArrow', [8592]], ['shortmid', [8739]], ['shortparallel', [8741]], ['ShortRightArrow', [8594]], ['ShortUpArrow', [8593]], ['shy', [173]], ['Sigma', [931]], ['sigma', [963]], ['sigmaf', [962]], ['sigmav', [962]], ['sim', [8764]], ['simdot', [10858]], ['sime', [8771]], ['simeq', [8771]], ['simg', [10910]], ['simgE', [10912]], ['siml', [10909]], ['simlE', [10911]], ['simne', [8774]], ['simplus', [10788]], ['simrarr', [10610]], ['slarr', [8592]], ['SmallCircle', [8728]], ['smallsetminus', [8726]], ['smashp', [10803]], ['smeparsl', [10724]], ['smid', [8739]], ['smile', [8995]], ['smt', [10922]], ['smte', [10924]], ['smtes', [10924, 65024]], ['SOFTcy', [1068]], ['softcy', [1100]], ['solbar', [9023]], ['solb', [10692]], ['sol', [47]], ['Sopf', [120138]], ['sopf', [120164]], ['spades', [9824]], ['spadesuit', [9824]], ['spar', [8741]], ['sqcap', [8851]], ['sqcaps', [8851, 65024]], ['sqcup', [8852]], ['sqcups', [8852, 65024]], ['Sqrt', [8730]], ['sqsub', [8847]], ['sqsube', [8849]], ['sqsubset', [8847]], ['sqsubseteq', [8849]], ['sqsup', [8848]], ['sqsupe', [8850]], ['sqsupset', [8848]], ['sqsupseteq', [8850]], ['square', [9633]], ['Square', [9633]], ['SquareIntersection', [8851]], ['SquareSubset', [8847]], ['SquareSubsetEqual', [8849]], ['SquareSuperset', [8848]], ['SquareSupersetEqual', [8850]], ['SquareUnion', [8852]], ['squarf', [9642]], ['squ', [9633]], ['squf', [9642]], ['srarr', [8594]], ['Sscr', [119982]], ['sscr', [120008]], ['ssetmn', [8726]], ['ssmile', [8995]], ['sstarf', [8902]], ['Star', [8902]], ['star', [9734]], ['starf', [9733]], ['straightepsilon', [1013]], ['straightphi', [981]], ['strns', [175]], ['sub', [8834]], ['Sub', [8912]], ['subdot', [10941]], ['subE', [10949]], ['sube', [8838]], ['subedot', [10947]], ['submult', [10945]], ['subnE', [10955]], ['subne', [8842]], ['subplus', [10943]], ['subrarr', [10617]], ['subset', [8834]], ['Subset', [8912]], ['subseteq', [8838]], ['subseteqq', [10949]], ['SubsetEqual', [8838]], ['subsetneq', [8842]], ['subsetneqq', [10955]], ['subsim', [10951]], ['subsub', [10965]], ['subsup', [10963]], ['succapprox', [10936]], ['succ', [8827]], ['succcurlyeq', [8829]], ['Succeeds', [8827]], ['SucceedsEqual', [10928]], ['SucceedsSlantEqual', [8829]], ['SucceedsTilde', [8831]], ['succeq', [10928]], ['succnapprox', [10938]], ['succneqq', [10934]], ['succnsim', [8937]], ['succsim', [8831]], ['SuchThat', [8715]], ['sum', [8721]], ['Sum', [8721]], ['sung', [9834]], ['sup1', [185]], ['sup2', [178]], ['sup3', [179]], ['sup', [8835]], ['Sup', [8913]], ['supdot', [10942]], ['supdsub', [10968]], ['supE', [10950]], ['supe', [8839]], ['supedot', [10948]], ['Superset', [8835]], ['SupersetEqual', [8839]], ['suphsol', [10185]], ['suphsub', [10967]], ['suplarr', [10619]], ['supmult', [10946]], ['supnE', [10956]], ['supne', [8843]], ['supplus', [10944]], ['supset', [8835]], ['Supset', [8913]], ['supseteq', [8839]], ['supseteqq', [10950]], ['supsetneq', [8843]], ['supsetneqq', [10956]], ['supsim', [10952]], ['supsub', [10964]], ['supsup', [10966]], ['swarhk', [10534]], ['swarr', [8601]], ['swArr', [8665]], ['swarrow', [8601]], ['swnwar', [10538]], ['szlig', [223]], ['Tab', [9]], ['target', [8982]], ['Tau', [932]], ['tau', [964]], ['tbrk', [9140]], ['Tcaron', [356]], ['tcaron', [357]], ['Tcedil', [354]], ['tcedil', [355]], ['Tcy', [1058]], ['tcy', [1090]], ['tdot', [8411]], ['telrec', [8981]], ['Tfr', [120087]], ['tfr', [120113]], ['there4', [8756]], ['therefore', [8756]], ['Therefore', [8756]], ['Theta', [920]], ['theta', [952]], ['thetasym', [977]], ['thetav', [977]], ['thickapprox', [8776]], ['thicksim', [8764]], ['ThickSpace', [8287, 8202]], ['ThinSpace', [8201]], ['thinsp', [8201]], ['thkap', [8776]], ['thksim', [8764]], ['THORN', [222]], ['thorn', [254]], ['tilde', [732]], ['Tilde', [8764]], ['TildeEqual', [8771]], ['TildeFullEqual', [8773]], ['TildeTilde', [8776]], ['timesbar', [10801]], ['timesb', [8864]], ['times', [215]], ['timesd', [10800]], ['tint', [8749]], ['toea', [10536]], ['topbot', [9014]], ['topcir', [10993]], ['top', [8868]], ['Topf', [120139]], ['topf', [120165]], ['topfork', [10970]], ['tosa', [10537]], ['tprime', [8244]], ['trade', [8482]], ['TRADE', [8482]], ['triangle', [9653]], ['triangledown', [9663]], ['triangleleft', [9667]], ['trianglelefteq', [8884]], ['triangleq', [8796]], ['triangleright', [9657]], ['trianglerighteq', [8885]], ['tridot', [9708]], ['trie', [8796]], ['triminus', [10810]], ['TripleDot', [8411]], ['triplus', [10809]], ['trisb', [10701]], ['tritime', [10811]], ['trpezium', [9186]], ['Tscr', [119983]], ['tscr', [120009]], ['TScy', [1062]], ['tscy', [1094]], ['TSHcy', [1035]], ['tshcy', [1115]], ['Tstrok', [358]], ['tstrok', [359]], ['twixt', [8812]], ['twoheadleftarrow', [8606]], ['twoheadrightarrow', [8608]], ['Uacute', [218]], ['uacute', [250]], ['uarr', [8593]], ['Uarr', [8607]], ['uArr', [8657]], ['Uarrocir', [10569]], ['Ubrcy', [1038]], ['ubrcy', [1118]], ['Ubreve', [364]], ['ubreve', [365]], ['Ucirc', [219]], ['ucirc', [251]], ['Ucy', [1059]], ['ucy', [1091]], ['udarr', [8645]], ['Udblac', [368]], ['udblac', [369]], ['udhar', [10606]], ['ufisht', [10622]], ['Ufr', [120088]], ['ufr', [120114]], ['Ugrave', [217]], ['ugrave', [249]], ['uHar', [10595]], ['uharl', [8639]], ['uharr', [8638]], ['uhblk', [9600]], ['ulcorn', [8988]], ['ulcorner', [8988]], ['ulcrop', [8975]], ['ultri', [9720]], ['Umacr', [362]], ['umacr', [363]], ['uml', [168]], ['UnderBar', [95]], ['UnderBrace', [9183]], ['UnderBracket', [9141]], ['UnderParenthesis', [9181]], ['Union', [8899]], ['UnionPlus', [8846]], ['Uogon', [370]], ['uogon', [371]], ['Uopf', [120140]], ['uopf', [120166]], ['UpArrowBar', [10514]], ['uparrow', [8593]], ['UpArrow', [8593]], ['Uparrow', [8657]], ['UpArrowDownArrow', [8645]], ['updownarrow', [8597]], ['UpDownArrow', [8597]], ['Updownarrow', [8661]], ['UpEquilibrium', [10606]], ['upharpoonleft', [8639]], ['upharpoonright', [8638]], ['uplus', [8846]], ['UpperLeftArrow', [8598]], ['UpperRightArrow', [8599]], ['upsi', [965]], ['Upsi', [978]], ['upsih', [978]], ['Upsilon', [933]], ['upsilon', [965]], ['UpTeeArrow', [8613]], ['UpTee', [8869]], ['upuparrows', [8648]], ['urcorn', [8989]], ['urcorner', [8989]], ['urcrop', [8974]], ['Uring', [366]], ['uring', [367]], ['urtri', [9721]], ['Uscr', [119984]], ['uscr', [120010]], ['utdot', [8944]], ['Utilde', [360]], ['utilde', [361]], ['utri', [9653]], ['utrif', [9652]], ['uuarr', [8648]], ['Uuml', [220]], ['uuml', [252]], ['uwangle', [10663]], ['vangrt', [10652]], ['varepsilon', [1013]], ['varkappa', [1008]], ['varnothing', [8709]], ['varphi', [981]], ['varpi', [982]], ['varpropto', [8733]], ['varr', [8597]], ['vArr', [8661]], ['varrho', [1009]], ['varsigma', [962]], ['varsubsetneq', [8842, 65024]], ['varsubsetneqq', [10955, 65024]], ['varsupsetneq', [8843, 65024]], ['varsupsetneqq', [10956, 65024]], ['vartheta', [977]], ['vartriangleleft', [8882]], ['vartriangleright', [8883]], ['vBar', [10984]], ['Vbar', [10987]], ['vBarv', [10985]], ['Vcy', [1042]], ['vcy', [1074]], ['vdash', [8866]], ['vDash', [8872]], ['Vdash', [8873]], ['VDash', [8875]], ['Vdashl', [10982]], ['veebar', [8891]], ['vee', [8744]], ['Vee', [8897]], ['veeeq', [8794]], ['vellip', [8942]], ['verbar', [124]], ['Verbar', [8214]], ['vert', [124]], ['Vert', [8214]], ['VerticalBar', [8739]], ['VerticalLine', [124]], ['VerticalSeparator', [10072]], ['VerticalTilde', [8768]], ['VeryThinSpace', [8202]], ['Vfr', [120089]], ['vfr', [120115]], ['vltri', [8882]], ['vnsub', [8834, 8402]], ['vnsup', [8835, 8402]], ['Vopf', [120141]], ['vopf', [120167]], ['vprop', [8733]], ['vrtri', [8883]], ['Vscr', [119985]], ['vscr', [120011]], ['vsubnE', [10955, 65024]], ['vsubne', [8842, 65024]], ['vsupnE', [10956, 65024]], ['vsupne', [8843, 65024]], ['Vvdash', [8874]], ['vzigzag', [10650]], ['Wcirc', [372]], ['wcirc', [373]], ['wedbar', [10847]], ['wedge', [8743]], ['Wedge', [8896]], ['wedgeq', [8793]], ['weierp', [8472]], ['Wfr', [120090]], ['wfr', [120116]], ['Wopf', [120142]], ['wopf', [120168]], ['wp', [8472]], ['wr', [8768]], ['wreath', [8768]], ['Wscr', [119986]], ['wscr', [120012]], ['xcap', [8898]], ['xcirc', [9711]], ['xcup', [8899]], ['xdtri', [9661]], ['Xfr', [120091]], ['xfr', [120117]], ['xharr', [10231]], ['xhArr', [10234]], ['Xi', [926]], ['xi', [958]], ['xlarr', [10229]], ['xlArr', [10232]], ['xmap', [10236]], ['xnis', [8955]], ['xodot', [10752]], ['Xopf', [120143]], ['xopf', [120169]], ['xoplus', [10753]], ['xotime', [10754]], ['xrarr', [10230]], ['xrArr', [10233]], ['Xscr', [119987]], ['xscr', [120013]], ['xsqcup', [10758]], ['xuplus', [10756]], ['xutri', [9651]], ['xvee', [8897]], ['xwedge', [8896]], ['Yacute', [221]], ['yacute', [253]], ['YAcy', [1071]], ['yacy', [1103]], ['Ycirc', [374]], ['ycirc', [375]], ['Ycy', [1067]], ['ycy', [1099]], ['yen', [165]], ['Yfr', [120092]], ['yfr', [120118]], ['YIcy', [1031]], ['yicy', [1111]], ['Yopf', [120144]], ['yopf', [120170]], ['Yscr', [119988]], ['yscr', [120014]], ['YUcy', [1070]], ['yucy', [1102]], ['yuml', [255]], ['Yuml', [376]], ['Zacute', [377]], ['zacute', [378]], ['Zcaron', [381]], ['zcaron', [382]], ['Zcy', [1047]], ['zcy', [1079]], ['Zdot', [379]], ['zdot', [380]], ['zeetrf', [8488]], ['ZeroWidthSpace', [8203]], ['Zeta', [918]], ['zeta', [950]], ['zfr', [120119]], ['Zfr', [8488]], ['ZHcy', [1046]], ['zhcy', [1078]], ['zigrarr', [8669]], ['zopf', [120171]], ['Zopf', [8484]], ['Zscr', [119989]], ['zscr', [120015]], ['zwj', [8205]], ['zwnj', [8204]]];
var alphaIndex = {};
var charIndex = {};
createIndexes(alphaIndex, charIndex);
/**
* @constructor
*/
function Html5Entities() {}
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.prototype.decode = function(str) {
if (!str || !str.length) {
return '';
}
return str.replace(/&(#?[\w\d]+);?/g, function(s, entity) {
var chr;
if (entity.charAt(0) === "#") {
var code = entity.charAt(1) === 'x' ?
parseInt(entity.substr(2).toLowerCase(), 16) :
parseInt(entity.substr(1));
if (!(isNaN(code) || code < -32768 || code > 65535)) {
chr = String.fromCharCode(code);
}
} else {
chr = alphaIndex[entity];
}
return chr || s;
});
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.decode = function(str) {
return new Html5Entities().decode(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.prototype.encode = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var charInfo = charIndex[str.charCodeAt(i)];
if (charInfo) {
var alpha = charInfo[str.charCodeAt(i + 1)];
if (alpha) {
i++;
} else {
alpha = charInfo[''];
}
if (alpha) {
result += "&" + alpha + ";";
i++;
continue;
}
}
result += str.charAt(i);
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.encode = function(str) {
return new Html5Entities().encode(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.prototype.encodeNonUTF = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
var charInfo = charIndex[c];
if (charInfo) {
var alpha = charInfo[str.charCodeAt(i + 1)];
if (alpha) {
i++;
} else {
alpha = charInfo[''];
}
if (alpha) {
result += "&" + alpha + ";";
i++;
continue;
}
}
if (c < 32 || c > 126) {
result += '&#' + c + ';';
} else {
result += str.charAt(i);
}
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.encodeNonUTF = function(str) {
return new Html5Entities().encodeNonUTF(str);
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.prototype.encodeNonASCII = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
if (c <= 255) {
result += str[i++];
continue;
}
result += '&#' + c + ';';
i++
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
Html5Entities.encodeNonASCII = function(str) {
return new Html5Entities().encodeNonASCII(str);
};
/**
* @param {Object} alphaIndex Passed by reference.
* @param {Object} charIndex Passed by reference.
*/
function createIndexes(alphaIndex, charIndex) {
var i = ENTITIES.length;
var _results = [];
while (i--) {
var e = ENTITIES[i];
var alpha = e[0];
var chars = e[1];
var chr = chars[0];
var addChar = (chr < 32 || chr > 126) || chr === 62 || chr === 60 || chr === 38 || chr === 34 || chr === 39;
var charInfo;
if (addChar) {
charInfo = charIndex[chr] = charIndex[chr] || {};
}
if (chars[1]) {
var chr2 = chars[1];
alphaIndex[alpha] = String.fromCharCode(chr) + String.fromCharCode(chr2);
_results.push(addChar && (charInfo[chr2] = alpha));
} else {
alphaIndex[alpha] = String.fromCharCode(chr);
_results.push(addChar && (charInfo[''] = alpha));
}
}
}
module.exports = Html5Entities;
/***/ }),
/***/ "./node_modules/html-entities/lib/xml-entities.js":
/*!********************************************************!*\
!*** ./node_modules/html-entities/lib/xml-entities.js ***!
\********************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
var ALPHA_INDEX = {
'&lt': '<',
'&gt': '>',
'&quot': '"',
'&apos': '\'',
'&amp': '&',
'&lt;': '<',
'&gt;': '>',
'&quot;': '"',
'&apos;': '\'',
'&amp;': '&'
};
var CHAR_INDEX = {
60: 'lt',
62: 'gt',
34: 'quot',
39: 'apos',
38: 'amp'
};
var CHAR_S_INDEX = {
'<': '&lt;',
'>': '&gt;',
'"': '&quot;',
'\'': '&apos;',
'&': '&amp;'
};
/**
* @constructor
*/
function XmlEntities() {}
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.prototype.encode = function(str) {
if (!str || !str.length) {
return '';
}
return str.replace(/<|>|"|'|&/g, function(s) {
return CHAR_S_INDEX[s];
});
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.encode = function(str) {
return new XmlEntities().encode(str);
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.prototype.decode = function(str) {
if (!str || !str.length) {
return '';
}
return str.replace(/&#?[0-9a-zA-Z]+;?/g, function(s) {
if (s.charAt(1) === '#') {
var code = s.charAt(2).toLowerCase() === 'x' ?
parseInt(s.substr(3), 16) :
parseInt(s.substr(2));
if (isNaN(code) || code < -32768 || code > 65535) {
return '';
}
return String.fromCharCode(code);
}
return ALPHA_INDEX[s] || s;
});
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.decode = function(str) {
return new XmlEntities().decode(str);
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.prototype.encodeNonUTF = function(str) {
if (!str || !str.length) {
return '';
}
var strLength = str.length;
var result = '';
var i = 0;
while (i < strLength) {
var c = str.charCodeAt(i);
var alpha = CHAR_INDEX[c];
if (alpha) {
result += "&" + alpha + ";";
i++;
continue;
}
if (c < 32 || c > 126) {
result += '&#' + c + ';';
} else {
result += str.charAt(i);
}
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.encodeNonUTF = function(str) {
return new XmlEntities().encodeNonUTF(str);
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.prototype.encodeNonASCII = function(str) {
if (!str || !str.length) {
return '';
}
var strLenght = str.length;
var result = '';
var i = 0;
while (i < strLenght) {
var c = str.charCodeAt(i);
if (c <= 255) {
result += str[i++];
continue;
}
result += '&#' + c + ';';
i++;
}
return result;
};
/**
* @param {String} str
* @returns {String}
*/
XmlEntities.encodeNonASCII = function(str) {
return new XmlEntities().encodeNonASCII(str);
};
module.exports = XmlEntities;
/***/ }),
/***/ "./node_modules/is-plain-obj/index.js":
/*!********************************************!*\
!*** ./node_modules/is-plain-obj/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toString = Object.prototype.toString;
module.exports = function (x) {
var prototype;
return toString.call(x) === '[object Object]' && (prototype = Object.getPrototypeOf(x), prototype === null || prototype === Object.getPrototypeOf({}));
};
/***/ }),
/***/ "./node_modules/lodash/_Symbol.js":
/*!****************************************!*\
!*** ./node_modules/lodash/_Symbol.js ***!
\****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/***/ "./node_modules/lodash/_baseGetTag.js":
/*!********************************************!*\
!*** ./node_modules/lodash/_baseGetTag.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(/*! ./_Symbol */ "./node_modules/lodash/_Symbol.js"),
getRawTag = __webpack_require__(/*! ./_getRawTag */ "./node_modules/lodash/_getRawTag.js"),
objectToString = __webpack_require__(/*! ./_objectToString */ "./node_modules/lodash/_objectToString.js");
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/***/ "./node_modules/lodash/_freeGlobal.js":
/*!********************************************!*\
!*** ./node_modules/lodash/_freeGlobal.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/lodash/_getRawTag.js":
/*!*******************************************!*\
!*** ./node_modules/lodash/_getRawTag.js ***!
\*******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__(/*! ./_Symbol */ "./node_modules/lodash/_Symbol.js");
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/***/ "./node_modules/lodash/_objectToString.js":
/*!************************************************!*\
!*** ./node_modules/lodash/_objectToString.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/***/ "./node_modules/lodash/_root.js":
/*!**************************************!*\
!*** ./node_modules/lodash/_root.js ***!
\**************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__(/*! ./_freeGlobal */ "./node_modules/lodash/_freeGlobal.js");
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/***/ "./node_modules/lodash/debounce.js":
/*!*****************************************!*\
!*** ./node_modules/lodash/debounce.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
now = __webpack_require__(/*! ./now */ "./node_modules/lodash/now.js"),
toNumber = __webpack_require__(/*! ./toNumber */ "./node_modules/lodash/toNumber.js");
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=false]
* Specify invoking on the leading edge of the timeout.
* @param {number} [options.maxWait]
* The maximum time `func` is allowed to be delayed before it's invoked.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
* var source = new EventSource('/stream');
* jQuery(source).on('message', debounced);
*
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time;
// Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait);
// Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
timeWaiting = wait - timeSinceLastCall;
return maxing
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
: timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
// Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
module.exports = debounce;
/***/ }),
/***/ "./node_modules/lodash/isObject.js":
/*!*****************************************!*\
!*** ./node_modules/lodash/isObject.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ }),
/***/ "./node_modules/lodash/isObjectLike.js":
/*!*********************************************!*\
!*** ./node_modules/lodash/isObjectLike.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/***/ "./node_modules/lodash/isSymbol.js":
/*!*****************************************!*\
!*** ./node_modules/lodash/isSymbol.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__(/*! ./_baseGetTag */ "./node_modules/lodash/_baseGetTag.js"),
isObjectLike = __webpack_require__(/*! ./isObjectLike */ "./node_modules/lodash/isObjectLike.js");
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
}
module.exports = isSymbol;
/***/ }),
/***/ "./node_modules/lodash/now.js":
/*!************************************!*\
!*** ./node_modules/lodash/now.js ***!
\************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__(/*! ./_root */ "./node_modules/lodash/_root.js");
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
module.exports = now;
/***/ }),
/***/ "./node_modules/lodash/toNumber.js":
/*!*****************************************!*\
!*** ./node_modules/lodash/toNumber.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__(/*! ./isObject */ "./node_modules/lodash/isObject.js"),
isSymbol = __webpack_require__(/*! ./isSymbol */ "./node_modules/lodash/isSymbol.js");
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to match leading and trailing whitespace. */
var reTrim = /^\s+|\s+$/g;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = value.replace(reTrim, '');
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
module.exports = toNumber;
/***/ }),
/***/ "./node_modules/loglevel/lib/loglevel.js":
/*!***********************************************!*\
!*** ./node_modules/loglevel/lib/loglevel.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*
* loglevel - https://github.com/pimterry/loglevel
*
* Copyright (c) 2013 Tim Perry
* Licensed under the MIT license.
*/
(function (root, definition) {
"use strict";
if (true) {
!(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition),
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?
(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :
__WEBPACK_AMD_DEFINE_FACTORY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(this, function () {
"use strict";
// Slightly dubious tricks to cut down minimized file size
var noop = function() {};
var undefinedType = "undefined";
var logMethods = [
"trace",
"debug",
"info",
"warn",
"error"
];
// Cross-browser bind equivalent that works at least back to IE6
function bindMethod(obj, methodName) {
var method = obj[methodName];
if (typeof method.bind === 'function') {
return method.bind(obj);
} else {
try {
return Function.prototype.bind.call(method, obj);
} catch (e) {
// Missing bind shim or IE8 + Modernizr, fallback to wrapping
return function() {
return Function.prototype.apply.apply(method, [obj, arguments]);
};
}
}
}
// Build the best logging method possible for this env
// Wherever possible we want to bind, not wrap, to preserve stack traces
function realMethod(methodName) {
if (methodName === 'debug') {
methodName = 'log';
}
if (typeof console === undefinedType) {
return false; // No method possible, for now - fixed later by enableLoggingWhenConsoleArrives
} else if (console[methodName] !== undefined) {
return bindMethod(console, methodName);
} else if (console.log !== undefined) {
return bindMethod(console, 'log');
} else {
return noop;
}
}
// These private functions always need `this` to be set properly
function replaceLoggingMethods(level, loggerName) {
/*jshint validthis:true */
for (var i = 0; i < logMethods.length; i++) {
var methodName = logMethods[i];
this[methodName] = (i < level) ?
noop :
this.methodFactory(methodName, level, loggerName);
}
// Define log.log as an alias for log.debug
this.log = this.debug;
}
// In old IE versions, the console isn't present until you first open it.
// We build realMethod() replacements here that regenerate logging methods
function enableLoggingWhenConsoleArrives(methodName, level, loggerName) {
return function () {
if (typeof console !== undefinedType) {
replaceLoggingMethods.call(this, level, loggerName);
this[methodName].apply(this, arguments);
}
};
}
// By default, we use closely bound real methods wherever possible, and
// otherwise we wait for a console to appear, and then try again.
function defaultMethodFactory(methodName, level, loggerName) {
/*jshint validthis:true */
return realMethod(methodName) ||
enableLoggingWhenConsoleArrives.apply(this, arguments);
}
function Logger(name, defaultLevel, factory) {
var self = this;
var currentLevel;
var storageKey = "loglevel";
if (name) {
storageKey += ":" + name;
}
function persistLevelIfPossible(levelNum) {
var levelName = (logMethods[levelNum] || 'silent').toUpperCase();
if (typeof window === undefinedType) return;
// Use localStorage if available
try {
window.localStorage[storageKey] = levelName;
return;
} catch (ignore) {}
// Use session cookie as fallback
try {
window.document.cookie =
encodeURIComponent(storageKey) + "=" + levelName + ";";
} catch (ignore) {}
}
function getPersistedLevel() {
var storedLevel;
if (typeof window === undefinedType) return;
try {
storedLevel = window.localStorage[storageKey];
} catch (ignore) {}
// Fallback to cookies if local storage gives us nothing
if (typeof storedLevel === undefinedType) {
try {
var cookie = window.document.cookie;
var location = cookie.indexOf(
encodeURIComponent(storageKey) + "=");
if (location !== -1) {
storedLevel = /^([^;]+)/.exec(cookie.slice(location))[1];
}
} catch (ignore) {}
}
// If the stored level is not valid, treat it as if nothing was stored.
if (self.levels[storedLevel] === undefined) {
storedLevel = undefined;
}
return storedLevel;
}
/*
*
* Public logger API - see https://github.com/pimterry/loglevel for details
*
*/
self.name = name;
self.levels = { "TRACE": 0, "DEBUG": 1, "INFO": 2, "WARN": 3,
"ERROR": 4, "SILENT": 5};
self.methodFactory = factory || defaultMethodFactory;
self.getLevel = function () {
return currentLevel;
};
self.setLevel = function (level, persist) {
if (typeof level === "string" && self.levels[level.toUpperCase()] !== undefined) {
level = self.levels[level.toUpperCase()];
}
if (typeof level === "number" && level >= 0 && level <= self.levels.SILENT) {
currentLevel = level;
if (persist !== false) { // defaults to true
persistLevelIfPossible(level);
}
replaceLoggingMethods.call(self, level, name);
if (typeof console === undefinedType && level < self.levels.SILENT) {
return "No console available for logging";
}
} else {
throw "log.setLevel() called with invalid level: " + level;
}
};
self.setDefaultLevel = function (level) {
if (!getPersistedLevel()) {
self.setLevel(level, false);
}
};
self.enableAll = function(persist) {
self.setLevel(self.levels.TRACE, persist);
};
self.disableAll = function(persist) {
self.setLevel(self.levels.SILENT, persist);
};
// Initialize with the right level
var initialLevel = getPersistedLevel();
if (initialLevel == null) {
initialLevel = defaultLevel == null ? "WARN" : defaultLevel;
}
self.setLevel(initialLevel, false);
}
/*
*
* Top-level API
*
*/
var defaultLogger = new Logger();
var _loggersByName = {};
defaultLogger.getLogger = function getLogger(name) {
if (typeof name !== "string" || name === "") {
throw new TypeError("You must supply a name when creating a logger.");
}
var logger = _loggersByName[name];
if (!logger) {
logger = _loggersByName[name] = new Logger(
name, defaultLogger.getLevel(), defaultLogger.methodFactory);
}
return logger;
};
// Grab the current global log variable in case of overwrite
var _log = (typeof window !== undefinedType) ? window.log : undefined;
defaultLogger.noConflict = function() {
if (typeof window !== undefinedType &&
window.log === defaultLogger) {
window.log = _log;
}
return defaultLogger;
};
defaultLogger.getLoggers = function getLoggers() {
return _loggersByName;
};
return defaultLogger;
}));
/***/ }),
/***/ "./node_modules/node-libs-browser/node_modules/punycode/punycode.js":
/*!**************************************************************************!*\
!*** ./node_modules/node-libs-browser/node_modules/punycode/punycode.js ***!
\**************************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(module, global) {var __WEBPACK_AMD_DEFINE_RESULT__;/*! https://mths.be/punycode v1.4.1 by @mathias */
;(function(root) {
/** Detect free variables */
var freeExports = true && exports &&
!exports.nodeType && exports;
var freeModule = true && module &&
!module.nodeType && module;
var freeGlobal = typeof global == 'object' && global;
if (
freeGlobal.global === freeGlobal ||
freeGlobal.window === freeGlobal ||
freeGlobal.self === freeGlobal
) {
root = freeGlobal;
}
/**
* The `punycode` object.
* @name punycode
* @type Object
*/
var punycode,
/** Highest positive signed 32-bit float value */
maxInt = 2147483647, // aka. 0x7FFFFFFF or 2^31-1
/** Bootstring parameters */
base = 36,
tMin = 1,
tMax = 26,
skew = 38,
damp = 700,
initialBias = 72,
initialN = 128, // 0x80
delimiter = '-', // '\x2D'
/** Regular expressions */
regexPunycode = /^xn--/,
regexNonASCII = /[^\x20-\x7E]/, // unprintable ASCII chars + non-ASCII chars
regexSeparators = /[\x2E\u3002\uFF0E\uFF61]/g, // RFC 3490 separators
/** Error messages */
errors = {
'overflow': 'Overflow: input needs wider integers to process',
'not-basic': 'Illegal input >= 0x80 (not a basic code point)',
'invalid-input': 'Invalid input'
},
/** Convenience shortcuts */
baseMinusTMin = base - tMin,
floor = Math.floor,
stringFromCharCode = String.fromCharCode,
/** Temporary variable */
key;
/*--------------------------------------------------------------------------*/
/**
* A generic error utility function.
* @private
* @param {String} type The error type.
* @returns {Error} Throws a `RangeError` with the applicable error message.
*/
function error(type) {
throw new RangeError(errors[type]);
}
/**
* A generic `Array#map` utility function.
* @private
* @param {Array} array The array to iterate over.
* @param {Function} callback The function that gets called for every array
* item.
* @returns {Array} A new array of values returned by the callback function.
*/
function map(array, fn) {
var length = array.length;
var result = [];
while (length--) {
result[length] = fn(array[length]);
}
return result;
}
/**
* A simple `Array#map`-like wrapper to work with domain name strings or email
* addresses.
* @private
* @param {String} domain The domain name or email address.
* @param {Function} callback The function that gets called for every
* character.
* @returns {Array} A new string of characters returned by the callback
* function.
*/
function mapDomain(string, fn) {
var parts = string.split('@');
var result = '';
if (parts.length > 1) {
// In email addresses, only the domain name should be punycoded. Leave
// the local part (i.e. everything up to `@`) intact.
result = parts[0] + '@';
string = parts[1];
}
// Avoid `split(regex)` for IE8 compatibility. See #17.
string = string.replace(regexSeparators, '\x2E');
var labels = string.split('.');
var encoded = map(labels, fn).join('.');
return result + encoded;
}
/**
* Creates an array containing the numeric code points of each Unicode
* character in the string. While JavaScript uses UCS-2 internally,
* this function will convert a pair of surrogate halves (each of which
* UCS-2 exposes as separate characters) into a single code point,
* matching UTF-16.
* @see `punycode.ucs2.encode`
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode.ucs2
* @name decode
* @param {String} string The Unicode input string (UCS-2).
* @returns {Array} The new array of code points.
*/
function ucs2decode(string) {
var output = [],
counter = 0,
length = string.length,
value,
extra;
while (counter < length) {
value = string.charCodeAt(counter++);
if (value >= 0xD800 && value <= 0xDBFF && counter < length) {
// high surrogate, and there is a next character
extra = string.charCodeAt(counter++);
if ((extra & 0xFC00) == 0xDC00) { // low surrogate
output.push(((value & 0x3FF) << 10) + (extra & 0x3FF) + 0x10000);
} else {
// unmatched surrogate; only append this code unit, in case the next
// code unit is the high surrogate of a surrogate pair
output.push(value);
counter--;
}
} else {
output.push(value);
}
}
return output;
}
/**
* Creates a string based on an array of numeric code points.
* @see `punycode.ucs2.decode`
* @memberOf punycode.ucs2
* @name encode
* @param {Array} codePoints The array of numeric code points.
* @returns {String} The new Unicode string (UCS-2).
*/
function ucs2encode(array) {
return map(array, function(value) {
var output = '';
if (value > 0xFFFF) {
value -= 0x10000;
output += stringFromCharCode(value >>> 10 & 0x3FF | 0xD800);
value = 0xDC00 | value & 0x3FF;
}
output += stringFromCharCode(value);
return output;
}).join('');
}
/**
* Converts a basic code point into a digit/integer.
* @see `digitToBasic()`
* @private
* @param {Number} codePoint The basic numeric code point value.
* @returns {Number} The numeric value of a basic code point (for use in
* representing integers) in the range `0` to `base - 1`, or `base` if
* the code point does not represent a value.
*/
function basicToDigit(codePoint) {
if (codePoint - 48 < 10) {
return codePoint - 22;
}
if (codePoint - 65 < 26) {
return codePoint - 65;
}
if (codePoint - 97 < 26) {
return codePoint - 97;
}
return base;
}
/**
* Converts a digit/integer into a basic code point.
* @see `basicToDigit()`
* @private
* @param {Number} digit The numeric value of a basic code point.
* @returns {Number} The basic code point whose value (when used for
* representing integers) is `digit`, which needs to be in the range
* `0` to `base - 1`. If `flag` is non-zero, the uppercase form is
* used; else, the lowercase form is used. The behavior is undefined
* if `flag` is non-zero and `digit` has no uppercase form.
*/
function digitToBasic(digit, flag) {
// 0..25 map to ASCII a..z or A..Z
// 26..35 map to ASCII 0..9
return digit + 22 + 75 * (digit < 26) - ((flag != 0) << 5);
}
/**
* Bias adaptation function as per section 3.4 of RFC 3492.
* https://tools.ietf.org/html/rfc3492#section-3.4
* @private
*/
function adapt(delta, numPoints, firstTime) {
var k = 0;
delta = firstTime ? floor(delta / damp) : delta >> 1;
delta += floor(delta / numPoints);
for (/* no initialization */; delta > baseMinusTMin * tMax >> 1; k += base) {
delta = floor(delta / baseMinusTMin);
}
return floor(k + (baseMinusTMin + 1) * delta / (delta + skew));
}
/**
* Converts a Punycode string of ASCII-only symbols to a string of Unicode
* symbols.
* @memberOf punycode
* @param {String} input The Punycode string of ASCII-only symbols.
* @returns {String} The resulting string of Unicode symbols.
*/
function decode(input) {
// Don't use UCS-2
var output = [],
inputLength = input.length,
out,
i = 0,
n = initialN,
bias = initialBias,
basic,
j,
index,
oldi,
w,
k,
digit,
t,
/** Cached calculation results */
baseMinusT;
// Handle the basic code points: let `basic` be the number of input code
// points before the last delimiter, or `0` if there is none, then copy
// the first basic code points to the output.
basic = input.lastIndexOf(delimiter);
if (basic < 0) {
basic = 0;
}
for (j = 0; j < basic; ++j) {
// if it's not a basic code point
if (input.charCodeAt(j) >= 0x80) {
error('not-basic');
}
output.push(input.charCodeAt(j));
}
// Main decoding loop: start just after the last delimiter if any basic code
// points were copied; start at the beginning otherwise.
for (index = basic > 0 ? basic + 1 : 0; index < inputLength; /* no final expression */) {
// `index` is the index of the next character to be consumed.
// Decode a generalized variable-length integer into `delta`,
// which gets added to `i`. The overflow checking is easier
// if we increase `i` as we go, then subtract off its starting
// value at the end to obtain `delta`.
for (oldi = i, w = 1, k = base; /* no condition */; k += base) {
if (index >= inputLength) {
error('invalid-input');
}
digit = basicToDigit(input.charCodeAt(index++));
if (digit >= base || digit > floor((maxInt - i) / w)) {
error('overflow');
}
i += digit * w;
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
if (digit < t) {
break;
}
baseMinusT = base - t;
if (w > floor(maxInt / baseMinusT)) {
error('overflow');
}
w *= baseMinusT;
}
out = output.length + 1;
bias = adapt(i - oldi, out, oldi == 0);
// `i` was supposed to wrap around from `out` to `0`,
// incrementing `n` each time, so we'll fix that now:
if (floor(i / out) > maxInt - n) {
error('overflow');
}
n += floor(i / out);
i %= out;
// Insert `n` at position `i` of the output
output.splice(i++, 0, n);
}
return ucs2encode(output);
}
/**
* Converts a string of Unicode symbols (e.g. a domain name label) to a
* Punycode string of ASCII-only symbols.
* @memberOf punycode
* @param {String} input The string of Unicode symbols.
* @returns {String} The resulting Punycode string of ASCII-only symbols.
*/
function encode(input) {
var n,
delta,
handledCPCount,
basicLength,
bias,
j,
m,
q,
k,
t,
currentValue,
output = [],
/** `inputLength` will hold the number of code points in `input`. */
inputLength,
/** Cached calculation results */
handledCPCountPlusOne,
baseMinusT,
qMinusT;
// Convert the input in UCS-2 to Unicode
input = ucs2decode(input);
// Cache the length
inputLength = input.length;
// Initialize the state
n = initialN;
delta = 0;
bias = initialBias;
// Handle the basic code points
for (j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue < 0x80) {
output.push(stringFromCharCode(currentValue));
}
}
handledCPCount = basicLength = output.length;
// `handledCPCount` is the number of code points that have been handled;
// `basicLength` is the number of basic code points.
// Finish the basic string - if it is not empty - with a delimiter
if (basicLength) {
output.push(delimiter);
}
// Main encoding loop:
while (handledCPCount < inputLength) {
// All non-basic code points < n have been handled already. Find the next
// larger one:
for (m = maxInt, j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue >= n && currentValue < m) {
m = currentValue;
}
}
// Increase `delta` enough to advance the decoder's <n,i> state to <m,0>,
// but guard against overflow
handledCPCountPlusOne = handledCPCount + 1;
if (m - n > floor((maxInt - delta) / handledCPCountPlusOne)) {
error('overflow');
}
delta += (m - n) * handledCPCountPlusOne;
n = m;
for (j = 0; j < inputLength; ++j) {
currentValue = input[j];
if (currentValue < n && ++delta > maxInt) {
error('overflow');
}
if (currentValue == n) {
// Represent delta as a generalized variable-length integer
for (q = delta, k = base; /* no condition */; k += base) {
t = k <= bias ? tMin : (k >= bias + tMax ? tMax : k - bias);
if (q < t) {
break;
}
qMinusT = q - t;
baseMinusT = base - t;
output.push(
stringFromCharCode(digitToBasic(t + qMinusT % baseMinusT, 0))
);
q = floor(qMinusT / baseMinusT);
}
output.push(stringFromCharCode(digitToBasic(q, 0)));
bias = adapt(delta, handledCPCountPlusOne, handledCPCount == basicLength);
delta = 0;
++handledCPCount;
}
}
++delta;
++n;
}
return output.join('');
}
/**
* Converts a Punycode string representing a domain name or an email address
* to Unicode. Only the Punycoded parts of the input will be converted, i.e.
* it doesn't matter if you call it on a string that has already been
* converted to Unicode.
* @memberOf punycode
* @param {String} input The Punycoded domain name or email address to
* convert to Unicode.
* @returns {String} The Unicode representation of the given Punycode
* string.
*/
function toUnicode(input) {
return mapDomain(input, function(string) {
return regexPunycode.test(string)
? decode(string.slice(4).toLowerCase())
: string;
});
}
/**
* Converts a Unicode string representing a domain name or an email address to
* Punycode. Only the non-ASCII parts of the domain name will be converted,
* i.e. it doesn't matter if you call it with a domain that's already in
* ASCII.
* @memberOf punycode
* @param {String} input The domain name or email address to convert, as a
* Unicode string.
* @returns {String} The Punycode representation of the given domain name or
* email address.
*/
function toASCII(input) {
return mapDomain(input, function(string) {
return regexNonASCII.test(string)
? 'xn--' + encode(string)
: string;
});
}
/*--------------------------------------------------------------------------*/
/** Define the public API */
punycode = {
/**
* A string representing the current Punycode.js version number.
* @memberOf punycode
* @type String
*/
'version': '1.4.1',
/**
* An object of methods to convert from JavaScript's internal character
* representation (UCS-2) to Unicode code points, and back.
* @see <https://mathiasbynens.be/notes/javascript-encoding>
* @memberOf punycode
* @type Object
*/
'ucs2': {
'decode': ucs2decode,
'encode': ucs2encode
},
'decode': decode,
'encode': encode,
'toASCII': toASCII,
'toUnicode': toUnicode
};
/** Expose `punycode` */
// Some AMD build optimizers, like r.js, check for specific condition patterns
// like the following:
if (
true
) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function() {
return punycode;
}).call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}(this));
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(/*! ./../../../webpack/buildin/module.js */ "./node_modules/webpack/buildin/module.js")(module), __webpack_require__(/*! ./../../../webpack/buildin/global.js */ "./node_modules/webpack/buildin/global.js")))
/***/ }),
/***/ "./node_modules/object-assign/index.js":
/*!*********************************************!*\
!*** ./node_modules/object-assign/index.js ***!
\*********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/*
object-assign
(c) Sindre Sorhus
@license MIT
*/
/* eslint-disable no-unused-vars */
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var hasOwnProperty = Object.prototype.hasOwnProperty;
var propIsEnumerable = Object.prototype.propertyIsEnumerable;
function toObject(val) {
if (val === null || val === undefined) {
throw new TypeError('Object.assign cannot be called with null or undefined');
}
return Object(val);
}
function shouldUseNative() {
try {
if (!Object.assign) {
return false;
}
// Detect buggy property enumeration order in older V8 versions.
// https://bugs.chromium.org/p/v8/issues/detail?id=4118
var test1 = new String('abc'); // eslint-disable-line no-new-wrappers
test1[5] = 'de';
if (Object.getOwnPropertyNames(test1)[0] === '5') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test2 = {};
for (var i = 0; i < 10; i++) {
test2['_' + String.fromCharCode(i)] = i;
}
var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
return test2[n];
});
if (order2.join('') !== '0123456789') {
return false;
}
// https://bugs.chromium.org/p/v8/issues/detail?id=3056
var test3 = {};
'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
test3[letter] = letter;
});
if (Object.keys(Object.assign({}, test3)).join('') !==
'abcdefghijklmnopqrst') {
return false;
}
return true;
} catch (err) {
// We don't expect any of the above to throw, but better to be safe.
return false;
}
}
module.exports = shouldUseNative() ? Object.assign : function (target, source) {
var from;
var to = toObject(target);
var symbols;
for (var s = 1; s < arguments.length; s++) {
from = Object(arguments[s]);
for (var key in from) {
if (hasOwnProperty.call(from, key)) {
to[key] = from[key];
}
}
if (getOwnPropertySymbols) {
symbols = getOwnPropertySymbols(from);
for (var i = 0; i < symbols.length; i++) {
if (propIsEnumerable.call(from, symbols[i])) {
to[symbols[i]] = from[symbols[i]];
}
}
}
}
return to;
};
/***/ }),
/***/ "./node_modules/prepend-http/index.js":
/*!********************************************!*\
!*** ./node_modules/prepend-http/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function (url) {
if (typeof url !== 'string') {
throw new TypeError('Expected a string, got ' + typeof url);
}
url = url.trim();
if (/^\.*\/|^(?!localhost)\w+:/.test(url)) {
return url;
}
return url.replace(/^(?!(?:\w+:)?\/\/)/, 'http://');
};
/***/ }),
/***/ "./node_modules/process/browser.js":
/*!*****************************************!*\
!*** ./node_modules/process/browser.js ***!
\*****************************************/
/*! no static exports found */
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/***/ "./node_modules/prop-types/checkPropTypes.js":
/*!***************************************************!*\
!*** ./node_modules/prop-types/checkPropTypes.js ***!
\***************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var printWarning = function() {};
if (true) {
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
var loggedTypeFailures = {};
var has = Function.call.bind(Object.prototype.hasOwnProperty);
printWarning = function(text) {
var message = 'Warning: ' + text;
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
}
/**
* Assert that the values match with the type specs.
* Error messages are memorized and will only be shown once.
*
* @param {object} typeSpecs Map of name to a ReactPropType
* @param {object} values Runtime values that need to be type-checked
* @param {string} location e.g. "prop", "context", "child context"
* @param {string} componentName Name of the component for error messages.
* @param {?Function} getStack Returns the component stack.
* @private
*/
function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
if (true) {
for (var typeSpecName in typeSpecs) {
if (has(typeSpecs, typeSpecName)) {
var error;
// Prop type validation may throw. In case they do, we don't want to
// fail the render phase where it didn't fail before. So we log it.
// After these have been cleaned up, we'll let them throw.
try {
// This is intentionally an invariant that gets caught. It's the same
// behavior as without this statement except with a better message.
if (typeof typeSpecs[typeSpecName] !== 'function') {
var err = Error(
(componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.'
);
err.name = 'Invariant Violation';
throw err;
}
error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
} catch (ex) {
error = ex;
}
if (error && !(error instanceof Error)) {
printWarning(
(componentName || 'React class') + ': type specification of ' +
location + ' `' + typeSpecName + '` is invalid; the type checker ' +
'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
'You may have forgotten to pass an argument to the type checker ' +
'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
'shape all require an argument).'
);
}
if (error instanceof Error && !(error.message in loggedTypeFailures)) {
// Only monitor this failure once because there tends to be a lot of the
// same error.
loggedTypeFailures[error.message] = true;
var stack = getStack ? getStack() : '';
printWarning(
'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
);
}
}
}
}
}
/**
* Resets warning cache when testing.
*
* @private
*/
checkPropTypes.resetWarningCache = function() {
if (true) {
loggedTypeFailures = {};
}
}
module.exports = checkPropTypes;
/***/ }),
/***/ "./node_modules/prop-types/factoryWithTypeCheckers.js":
/*!************************************************************!*\
!*** ./node_modules/prop-types/factoryWithTypeCheckers.js ***!
\************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js");
var assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
var ReactPropTypesSecret = __webpack_require__(/*! ./lib/ReactPropTypesSecret */ "./node_modules/prop-types/lib/ReactPropTypesSecret.js");
var checkPropTypes = __webpack_require__(/*! ./checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
var has = Function.call.bind(Object.prototype.hasOwnProperty);
var printWarning = function() {};
if (true) {
printWarning = function(text) {
var message = 'Warning: ' + text;
if (typeof console !== 'undefined') {
console.error(message);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
throw new Error(message);
} catch (x) {}
};
}
function emptyFunctionThatReturnsNull() {
return null;
}
module.exports = function(isValidElement, throwOnDirectAccess) {
/* global Symbol */
var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.
/**
* Returns the iterator method function contained on the iterable object.
*
* Be sure to invoke the function with the iterable as context:
*
* var iteratorFn = getIteratorFn(myIterable);
* if (iteratorFn) {
* var iterator = iteratorFn.call(myIterable);
* ...
* }
*
* @param {?object} maybeIterable
* @return {?function}
*/
function getIteratorFn(maybeIterable) {
var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
if (typeof iteratorFn === 'function') {
return iteratorFn;
}
}
/**
* Collection of methods that allow declaration and validation of props that are
* supplied to React components. Example usage:
*
* var Props = require('ReactPropTypes');
* var MyArticle = React.createClass({
* propTypes: {
* // An optional string prop named "description".
* description: Props.string,
*
* // A required enum prop named "category".
* category: Props.oneOf(['News','Photos']).isRequired,
*
* // A prop named "dialog" that requires an instance of Dialog.
* dialog: Props.instanceOf(Dialog).isRequired
* },
* render: function() { ... }
* });
*
* A more formal specification of how these methods are used:
*
* type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
* decl := ReactPropTypes.{type}(.isRequired)?
*
* Each and every declaration produces a function with the same signature. This
* allows the creation of custom validation functions. For example:
*
* var MyLink = React.createClass({
* propTypes: {
* // An optional string or URI prop named "href".
* href: function(props, propName, componentName) {
* var propValue = props[propName];
* if (propValue != null && typeof propValue !== 'string' &&
* !(propValue instanceof URI)) {
* return new Error(
* 'Expected a string or an URI for ' + propName + ' in ' +
* componentName
* );
* }
* }
* },
* render: function() {...}
* });
*
* @internal
*/
var ANONYMOUS = '<<anonymous>>';
// Important!
// Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
var ReactPropTypes = {
array: createPrimitiveTypeChecker('array'),
bool: createPrimitiveTypeChecker('boolean'),
func: createPrimitiveTypeChecker('function'),
number: createPrimitiveTypeChecker('number'),
object: createPrimitiveTypeChecker('object'),
string: createPrimitiveTypeChecker('string'),
symbol: createPrimitiveTypeChecker('symbol'),
any: createAnyTypeChecker(),
arrayOf: createArrayOfTypeChecker,
element: createElementTypeChecker(),
elementType: createElementTypeTypeChecker(),
instanceOf: createInstanceTypeChecker,
node: createNodeChecker(),
objectOf: createObjectOfTypeChecker,
oneOf: createEnumTypeChecker,
oneOfType: createUnionTypeChecker,
shape: createShapeTypeChecker,
exact: createStrictShapeTypeChecker,
};
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
/*eslint-disable no-self-compare*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
return x !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/*eslint-enable no-self-compare*/
/**
* We use an Error-like object for backward compatibility as people may call
* PropTypes directly and inspect their output. However, we don't use real
* Errors anymore. We don't inspect their stack anyway, and creating them
* is prohibitively expensive if they are created too often, such as what
* happens in oneOfType() for any type before the one that matched.
*/
function PropTypeError(message) {
this.message = message;
this.stack = '';
}
// Make `instanceof Error` still work for returned errors.
PropTypeError.prototype = Error.prototype;
function createChainableTypeChecker(validate) {
if (true) {
var manualPropTypeCallCache = {};
var manualPropTypeWarningCount = 0;
}
function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
componentName = componentName || ANONYMOUS;
propFullName = propFullName || propName;
if (secret !== ReactPropTypesSecret) {
if (throwOnDirectAccess) {
// New behavior only for users of `prop-types` package
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use `PropTypes.checkPropTypes()` to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
} else if ( true && typeof console !== 'undefined') {
// Old behavior for people using React.PropTypes
var cacheKey = componentName + ':' + propName;
if (
!manualPropTypeCallCache[cacheKey] &&
// Avoid spamming the console because they are often not actionable except for lib authors
manualPropTypeWarningCount < 3
) {
printWarning(
'You are manually calling a React.PropTypes validation ' +
'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
'and will throw in the standalone `prop-types` package. ' +
'You may be seeing this warning due to a third-party PropTypes ' +
'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
);
manualPropTypeCallCache[cacheKey] = true;
manualPropTypeWarningCount++;
}
}
}
if (props[propName] == null) {
if (isRequired) {
if (props[propName] === null) {
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
}
return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
}
return null;
} else {
return validate(props, propName, componentName, location, propFullName);
}
}
var chainedCheckType = checkType.bind(null, false);
chainedCheckType.isRequired = checkType.bind(null, true);
return chainedCheckType;
}
function createPrimitiveTypeChecker(expectedType) {
function validate(props, propName, componentName, location, propFullName, secret) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== expectedType) {
// `propValue` being instance of, say, date/regexp, pass the 'object'
// check, but we can offer a more precise error message here rather than
// 'of type `object`'.
var preciseType = getPreciseType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createAnyTypeChecker() {
return createChainableTypeChecker(emptyFunctionThatReturnsNull);
}
function createArrayOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
}
var propValue = props[propName];
if (!Array.isArray(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
}
for (var i = 0; i < propValue.length; i++) {
var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!isValidElement(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createElementTypeTypeChecker() {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
if (!ReactIs.isValidElementType(propValue)) {
var propType = getPropType(propValue);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createInstanceTypeChecker(expectedClass) {
function validate(props, propName, componentName, location, propFullName) {
if (!(props[propName] instanceof expectedClass)) {
var expectedClassName = expectedClass.name || ANONYMOUS;
var actualClassName = getClassName(props[propName]);
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createEnumTypeChecker(expectedValues) {
if (!Array.isArray(expectedValues)) {
if (true) {
if (arguments.length > 1) {
printWarning(
'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
);
} else {
printWarning('Invalid argument supplied to oneOf, expected an array.');
}
}
return emptyFunctionThatReturnsNull;
}
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
for (var i = 0; i < expectedValues.length; i++) {
if (is(propValue, expectedValues[i])) {
return null;
}
}
var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
var type = getPreciseType(value);
if (type === 'symbol') {
return String(value);
}
return value;
});
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
}
return createChainableTypeChecker(validate);
}
function createObjectOfTypeChecker(typeChecker) {
function validate(props, propName, componentName, location, propFullName) {
if (typeof typeChecker !== 'function') {
return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
}
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
}
for (var key in propValue) {
if (has(propValue, key)) {
var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error instanceof Error) {
return error;
}
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createUnionTypeChecker(arrayOfTypeCheckers) {
if (!Array.isArray(arrayOfTypeCheckers)) {
true ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : undefined;
return emptyFunctionThatReturnsNull;
}
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (typeof checker !== 'function') {
printWarning(
'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
);
return emptyFunctionThatReturnsNull;
}
}
function validate(props, propName, componentName, location, propFullName) {
for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
var checker = arrayOfTypeCheckers[i];
if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {
return null;
}
}
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));
}
return createChainableTypeChecker(validate);
}
function createNodeChecker() {
function validate(props, propName, componentName, location, propFullName) {
if (!isNode(props[propName])) {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
}
return null;
}
return createChainableTypeChecker(validate);
}
function createShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
for (var key in shapeTypes) {
var checker = shapeTypes[key];
if (!checker) {
continue;
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function createStrictShapeTypeChecker(shapeTypes) {
function validate(props, propName, componentName, location, propFullName) {
var propValue = props[propName];
var propType = getPropType(propValue);
if (propType !== 'object') {
return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
}
// We need to check all keys in case some are required but missing from
// props.
var allKeys = assign({}, props[propName], shapeTypes);
for (var key in allKeys) {
var checker = shapeTypes[key];
if (!checker) {
return new PropTypeError(
'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
'\nBad object: ' + JSON.stringify(props[propName], null, ' ') +
'\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')
);
}
var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
if (error) {
return error;
}
}
return null;
}
return createChainableTypeChecker(validate);
}
function isNode(propValue) {
switch (typeof propValue) {
case 'number':
case 'string':
case 'undefined':
return true;
case 'boolean':
return !propValue;
case 'object':
if (Array.isArray(propValue)) {
return propValue.every(isNode);
}
if (propValue === null || isValidElement(propValue)) {
return true;
}
var iteratorFn = getIteratorFn(propValue);
if (iteratorFn) {
var iterator = iteratorFn.call(propValue);
var step;
if (iteratorFn !== propValue.entries) {
while (!(step = iterator.next()).done) {
if (!isNode(step.value)) {
return false;
}
}
} else {
// Iterator will provide entry [k,v] tuples rather than values.
while (!(step = iterator.next()).done) {
var entry = step.value;
if (entry) {
if (!isNode(entry[1])) {
return false;
}
}
}
}
} else {
return false;
}
return true;
default:
return false;
}
}
function isSymbol(propType, propValue) {
// Native Symbol.
if (propType === 'symbol') {
return true;
}
// falsy value can't be a Symbol
if (!propValue) {
return false;
}
// 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
if (propValue['@@toStringTag'] === 'Symbol') {
return true;
}
// Fallback for non-spec compliant Symbols which are polyfilled.
if (typeof Symbol === 'function' && propValue instanceof Symbol) {
return true;
}
return false;
}
// Equivalent of `typeof` but with special handling for array and regexp.
function getPropType(propValue) {
var propType = typeof propValue;
if (Array.isArray(propValue)) {
return 'array';
}
if (propValue instanceof RegExp) {
// Old webkits (at least until Android 4.0) return 'function' rather than
// 'object' for typeof a RegExp. We'll normalize this here so that /bla/
// passes PropTypes.object.
return 'object';
}
if (isSymbol(propType, propValue)) {
return 'symbol';
}
return propType;
}
// This handles more types than `getPropType`. Only used for error messages.
// See `createPrimitiveTypeChecker`.
function getPreciseType(propValue) {
if (typeof propValue === 'undefined' || propValue === null) {
return '' + propValue;
}
var propType = getPropType(propValue);
if (propType === 'object') {
if (propValue instanceof Date) {
return 'date';
} else if (propValue instanceof RegExp) {
return 'regexp';
}
}
return propType;
}
// Returns a string that is postfixed to a warning about an invalid type.
// For example, "undefined" or "of type array"
function getPostfixForTypeWarning(value) {
var type = getPreciseType(value);
switch (type) {
case 'array':
case 'object':
return 'an ' + type;
case 'boolean':
case 'date':
case 'regexp':
return 'a ' + type;
default:
return type;
}
}
// Returns class name of the object, if any.
function getClassName(propValue) {
if (!propValue.constructor || !propValue.constructor.name) {
return ANONYMOUS;
}
return propValue.constructor.name;
}
ReactPropTypes.checkPropTypes = checkPropTypes;
ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/***/ "./node_modules/prop-types/index.js":
/*!******************************************!*\
!*** ./node_modules/prop-types/index.js ***!
\******************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
var ReactIs = __webpack_require__(/*! react-is */ "./node_modules/react-is/index.js");
// By explicitly using `prop-types` you are opting into new development behavior.
// http://fb.me/prop-types-in-prod
var throwOnDirectAccess = true;
module.exports = __webpack_require__(/*! ./factoryWithTypeCheckers */ "./node_modules/prop-types/factoryWithTypeCheckers.js")(ReactIs.isElement, throwOnDirectAccess);
} else {}
/***/ }),
/***/ "./node_modules/prop-types/lib/ReactPropTypesSecret.js":
/*!*************************************************************!*\
!*** ./node_modules/prop-types/lib/ReactPropTypesSecret.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/***/ "./node_modules/query-string/index.js":
/*!********************************************!*\
!*** ./node_modules/query-string/index.js ***!
\********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var strictUriEncode = __webpack_require__(/*! strict-uri-encode */ "./node_modules/strict-uri-encode/index.js");
var objectAssign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
function encoderForArrayFormat(opts) {
switch (opts.arrayFormat) {
case 'index':
return function (key, value, index) {
return value === null ? [
encode(key, opts),
'[',
index,
']'
].join('') : [
encode(key, opts),
'[',
encode(index, opts),
']=',
encode(value, opts)
].join('');
};
case 'bracket':
return function (key, value) {
return value === null ? encode(key, opts) : [
encode(key, opts),
'[]=',
encode(value, opts)
].join('');
};
default:
return function (key, value) {
return value === null ? encode(key, opts) : [
encode(key, opts),
'=',
encode(value, opts)
].join('');
};
}
}
function parserForArrayFormat(opts) {
var result;
switch (opts.arrayFormat) {
case 'index':
return function (key, value, accumulator) {
result = /\[(\d*)\]$/.exec(key);
key = key.replace(/\[\d*\]$/, '');
if (!result) {
accumulator[key] = value;
return;
}
if (accumulator[key] === undefined) {
accumulator[key] = {};
}
accumulator[key][result[1]] = value;
};
case 'bracket':
return function (key, value, accumulator) {
result = /(\[\])$/.exec(key);
key = key.replace(/\[\]$/, '');
if (!result) {
accumulator[key] = value;
return;
} else if (accumulator[key] === undefined) {
accumulator[key] = [value];
return;
}
accumulator[key] = [].concat(accumulator[key], value);
};
default:
return function (key, value, accumulator) {
if (accumulator[key] === undefined) {
accumulator[key] = value;
return;
}
accumulator[key] = [].concat(accumulator[key], value);
};
}
}
function encode(value, opts) {
if (opts.encode) {
return opts.strict ? strictUriEncode(value) : encodeURIComponent(value);
}
return value;
}
function keysSorter(input) {
if (Array.isArray(input)) {
return input.sort();
} else if (typeof input === 'object') {
return keysSorter(Object.keys(input)).sort(function (a, b) {
return Number(a) - Number(b);
}).map(function (key) {
return input[key];
});
}
return input;
}
exports.extract = function (str) {
return str.split('?')[1] || '';
};
exports.parse = function (str, opts) {
opts = objectAssign({arrayFormat: 'none'}, opts);
var formatter = parserForArrayFormat(opts);
// Create an object with no prototype
// https://github.com/sindresorhus/query-string/issues/47
var ret = Object.create(null);
if (typeof str !== 'string') {
return ret;
}
str = str.trim().replace(/^(\?|#|&)/, '');
if (!str) {
return ret;
}
str.split('&').forEach(function (param) {
var parts = param.replace(/\+/g, ' ').split('=');
// Firefox (pre 40) decodes `%3D` to `=`
// https://github.com/sindresorhus/query-string/pull/37
var key = parts.shift();
var val = parts.length > 0 ? parts.join('=') : undefined;
// missing `=` should be `null`:
// http://w3.org/TR/2012/WD-url-20120524/#collect-url-parameters
val = val === undefined ? null : decodeURIComponent(val);
formatter(decodeURIComponent(key), val, ret);
});
return Object.keys(ret).sort().reduce(function (result, key) {
var val = ret[key];
if (Boolean(val) && typeof val === 'object' && !Array.isArray(val)) {
// Sort object keys, not values
result[key] = keysSorter(val);
} else {
result[key] = val;
}
return result;
}, Object.create(null));
};
exports.stringify = function (obj, opts) {
var defaults = {
encode: true,
strict: true,
arrayFormat: 'none'
};
opts = objectAssign(defaults, opts);
var formatter = encoderForArrayFormat(opts);
return obj ? Object.keys(obj).sort().map(function (key) {
var val = obj[key];
if (val === undefined) {
return '';
}
if (val === null) {
return encode(key, opts);
}
if (Array.isArray(val)) {
var result = [];
val.slice().forEach(function (val2) {
if (val2 === undefined) {
return;
}
result.push(formatter(key, val2, result.length));
});
return result.join('&');
}
return encode(key, opts) + '=' + encode(val, opts);
}).filter(function (x) {
return x.length > 0;
}).join('&') : '';
};
/***/ }),
/***/ "./node_modules/querystring-es3/decode.js":
/*!************************************************!*\
!*** ./node_modules/querystring-es3/decode.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
// If obj.hasOwnProperty has been overridden, then calling
// obj.hasOwnProperty(prop) will break.
// See: https://github.com/joyent/node/issues/1707
function hasOwnProperty(obj, prop) {
return Object.prototype.hasOwnProperty.call(obj, prop);
}
module.exports = function(qs, sep, eq, options) {
sep = sep || '&';
eq = eq || '=';
var obj = {};
if (typeof qs !== 'string' || qs.length === 0) {
return obj;
}
var regexp = /\+/g;
qs = qs.split(sep);
var maxKeys = 1000;
if (options && typeof options.maxKeys === 'number') {
maxKeys = options.maxKeys;
}
var len = qs.length;
// maxKeys <= 0 means that we should not limit keys count
if (maxKeys > 0 && len > maxKeys) {
len = maxKeys;
}
for (var i = 0; i < len; ++i) {
var x = qs[i].replace(regexp, '%20'),
idx = x.indexOf(eq),
kstr, vstr, k, v;
if (idx >= 0) {
kstr = x.substr(0, idx);
vstr = x.substr(idx + 1);
} else {
kstr = x;
vstr = '';
}
k = decodeURIComponent(kstr);
v = decodeURIComponent(vstr);
if (!hasOwnProperty(obj, k)) {
obj[k] = v;
} else if (isArray(obj[k])) {
obj[k].push(v);
} else {
obj[k] = [obj[k], v];
}
}
return obj;
};
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
/***/ }),
/***/ "./node_modules/querystring-es3/encode.js":
/*!************************************************!*\
!*** ./node_modules/querystring-es3/encode.js ***!
\************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to permit
// persons to whom the Software is furnished to do so, subject to the
// following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
// USE OR OTHER DEALINGS IN THE SOFTWARE.
var stringifyPrimitive = function(v) {
switch (typeof v) {
case 'string':
return v;
case 'boolean':
return v ? 'true' : 'false';
case 'number':
return isFinite(v) ? v : '';
default:
return '';
}
};
module.exports = function(obj, sep, eq, name) {
sep = sep || '&';
eq = eq || '=';
if (obj === null) {
obj = undefined;
}
if (typeof obj === 'object') {
return map(objectKeys(obj), function(k) {
var ks = encodeURIComponent(stringifyPrimitive(k)) + eq;
if (isArray(obj[k])) {
return map(obj[k], function(v) {
return ks + encodeURIComponent(stringifyPrimitive(v));
}).join(sep);
} else {
return ks + encodeURIComponent(stringifyPrimitive(obj[k]));
}
}).join(sep);
}
if (!name) return '';
return encodeURIComponent(stringifyPrimitive(name)) + eq +
encodeURIComponent(stringifyPrimitive(obj));
};
var isArray = Array.isArray || function (xs) {
return Object.prototype.toString.call(xs) === '[object Array]';
};
function map (xs, f) {
if (xs.map) return xs.map(f);
var res = [];
for (var i = 0; i < xs.length; i++) {
res.push(f(xs[i], i));
}
return res;
}
var objectKeys = Object.keys || function (obj) {
var res = [];
for (var key in obj) {
if (Object.prototype.hasOwnProperty.call(obj, key)) res.push(key);
}
return res;
};
/***/ }),
/***/ "./node_modules/querystring-es3/index.js":
/*!***********************************************!*\
!*** ./node_modules/querystring-es3/index.js ***!
\***********************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
exports.decode = exports.parse = __webpack_require__(/*! ./decode */ "./node_modules/querystring-es3/decode.js");
exports.encode = exports.stringify = __webpack_require__(/*! ./encode */ "./node_modules/querystring-es3/encode.js");
/***/ }),
/***/ "./node_modules/react-dom/cjs/react-dom.development.js":
/*!*************************************************************!*\
!*** ./node_modules/react-dom/cjs/react-dom.development.js ***!
\*************************************************************/
/*! no static exports found */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.8.6
* react-dom.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (true) {
(function() {
'use strict';
var React = __webpack_require__(/*! react */ "./node_modules/react/index.js");
var _assign = __webpack_require__(/*! object-assign */ "./node_modules/object-assign/index.js");
var checkPropTypes = __webpack_require__(/*! prop-types/checkPropTypes */ "./node_modules/prop-types/checkPropTypes.js");
var scheduler = __webpack_require__(/*! scheduler */ "./node_modules/scheduler/index.js");
var tracing = __webpack_require__(/*! scheduler/tracing */ "./node_modules/scheduler/tracing.js");
/**
* Use invariant() to assert state which your program assumes to be true.
*
* Provide sprintf-style format (only %s is supported) and arguments
* to provide information about what broke and what you were
* expecting.
*
* The invariant message will be stripped in production, but the invariant
* will remain to ensure logic does not differ in production.
*/
var validateFormat = function () {};
{
validateFormat = function (format) {
if (format === undefined) {
throw new Error('invariant requires an error message argument');
}
};
}
function invariant(condition, format, a, b, c, d, e, f) {
validateFormat(format);
if (!condition) {
var error = void 0;
if (format === undefined) {
error = new Error('Minified exception occurred; use the non-minified dev environment ' + 'for the full error message and additional helpful warnings.');
} else {
var args = [a, b, c, d, e, f];
var argIndex = 0;
error = new Error(format.replace(/%s/g, function () {
return args[argIndex++];
}));
error.name = 'Invariant Violation';
}
error.framesToPop = 1; // we don't care about invariant's own frame
throw error;
}
}
// Relying on the `invariant()` implementation lets us
// preserve the format and params in the www builds.
!React ? invariant(false, 'ReactDOM was loaded before React. Make sure you load the React package before loading ReactDOM.') : void 0;
var invokeGuardedCallbackImpl = function (name, func, context, a, b, c, d, e, f) {
var funcArgs = Array.prototype.slice.call(arguments, 3);
try {
func.apply(context, funcArgs);
} catch (error) {
this.onError(error);
}
};
{
// In DEV mode, we swap out invokeGuardedCallback for a special version
// that plays more nicely with the browser's DevTools. The idea is to preserve
// "Pause on exceptions" behavior. Because React wraps all user-provided
// functions in invokeGuardedCallback, and the production version of
// invokeGuardedCallback uses a try-catch, all user exceptions are treated
// like caught exceptions, and the DevTools won't pause unless the developer
// takes the extra step of enabling pause on caught exceptions. This is
// unintuitive, though, because even though React has caught the error, from
// the developer's perspective, the error is uncaught.
//
// To preserve the expected "Pause on exceptions" behavior, we don't use a
// try-catch in DEV. Instead, we synchronously dispatch a fake event to a fake
// DOM node, and call the user-provided callback from inside an event handler
// for that fake event. If the callback throws, the error is "captured" using
// a global event handler. But because the error happens in a different
// event loop context, it does not interrupt the normal program flow.
// Effectively, this gives us try-catch behavior without actually using
// try-catch. Neat!
// Check that the browser supports the APIs we need to implement our special
// DEV version of invokeGuardedCallback
if (typeof window !== 'undefined' && typeof window.dispatchEvent === 'function' && typeof document !== 'undefined' && typeof document.createEvent === 'function') {
var fakeNode = document.createElement('react');
var invokeGuardedCallbackDev = function (name, func, context, a, b, c, d, e, f) {
// If document doesn't exist we know for sure we will crash in this method
// when we call document.createEvent(). However this can cause confusing
// errors: https://github.com/facebookincubator/create-react-app/issues/3482
// So we preemptively throw with a better message instead.
!(typeof document !== 'undefined') ? invariant(false, 'The `document` global was defined when React was initialized, but is not defined anymore. This can happen in a test environment if a component schedules an update from an asynchronous callback, but the test has already finished running. To solve this, you can either unmount the component at the end of your test (and ensure that any asynchronous operations get canceled in `componentWillUnmount`), or you can change the test itself to be asynchronous.') : void 0;
var evt = document.createEvent('Event');
// Keeps track of whether the user-provided callback threw an error. We
// set this to true at the beginning, then set it to false right after
// calling the function. If the function errors, `didError` will never be
// set to false. This strategy works even if the browser is flaky and
// fails to call our global error handler, because it doesn't rely on
// the error event at all.
var didError = true;
// Keeps track of the value of window.event so that we can reset it
// during the callback to let user code access window.event in the
// browsers that support it.
var windowEvent = window.event;
// Keeps track of the descriptor of window.event to restore it after event
// dispatching: https://github.com/facebook/react/issues/13688
var windowEventDescriptor = Object.getOwnPropertyDescriptor(window, 'event');
// Create an event handler for our fake event. We will synchronously
// dispatch our fake event using `dispatchEvent`. Inside the handler, we
// call the user-provided callback.
var funcArgs = Array.prototype.slice.call(arguments, 3);
function callCallback() {
// We immediately remove the callback from event listeners so that
// nested `invokeGuardedCallback` calls do not clash. Otherwise, a
// nested call would trigger the fake event handlers of any call higher
// in the stack.
fakeNode.removeEventListener(evtType, callCallback, false);
// We check for window.hasOwnProperty('event') to prevent the
// window.event assignment in both IE <= 10 as they throw an error
// "Member not found" in strict mode, and in Firefox which does not
// support window.event.
if (typeof window.event !== 'undefined' && window.hasOwnProperty('event')) {
window.event = windowEvent;
}
func.apply(context, funcArgs);
didError = false;
}
// Create a global error event handler. We use this to capture the value
// that was thrown. It's possible that this error handler will fire more
// than once; for example, if non-React code also calls `dispatchEvent`
// and a handler for that event throws. We should be resilient to most of
// those cases. Even if our error event handler fires more than once, the
// last error event is always used. If the callback actually does error,
// we know that the last error event is the correct one, because it's not
// possible for anything else to have happened in between our callback
// erroring and the code that follows the `dispatchEvent` call below. If
// the callback doesn't error, but the error event was fired, we know to
// ignore it because `didError` will be false, as described above.
var error = void 0;
// Use this to track whether the error event is ever called.
var didSetError = false;
var isCrossOriginError = false;
function handleWindowError(event) {
error = event.error;
didSetError = true;
if (error === null && event.colno === 0 && event.lineno === 0) {
isCrossOriginError = true;
}
if (event.defaultPrevented) {
// Some other error handler has prevented default.
// Browsers silence the error report if this happens.
// We'll remember this to later decide whether to log it or not.
if (error != null && typeof error === 'object') {
try {
error._suppressLogging = true;
} catch (inner) {
// Ignore.
}
}
}
}
// Create a fake event type.
var evtType = 'react-' + (name ? name : 'invokeguardedcallback');
// Attach our event handlers
window.addEventListener('error', handleWindowError);
fakeNode.addEventListener(evtType, callCallback, false);
// Synchronously dispatch our fake event. If the user-provided function
// errors, it will trigger our global error handler.
evt.initEvent(evtType, false, false);
fakeNode.dispatchEvent(evt);
if (windowEventDescriptor) {
Object.defineProperty(window, 'event', windowEventDescriptor);
}
if (didError) {
if (!didSetError) {
// The callback errored, but the error event never fired.
error = new Error('An error was thrown inside one of your components, but React ' + "doesn't know what it was. This is likely due to browser " + 'flakiness. React does its best to preserve the "Pause on ' + 'exceptions" behavior of the DevTools, which requires some ' + "DEV-mode only tricks. It's possible that these don't work in " + 'your browser. Try triggering the error in production mode, ' + 'or switching to a modern browser. If you suspect that this is ' + 'actually an issue with React, please file an issue.');
} else if (isCrossOriginError) {
error = new Error("A cross-origin error was thrown. React doesn't have access to " + 'the actual error object in development. ' + 'See https://fb.me/react-crossorigin-error for more information.');
}
this.onError(error);
}
// Remove our event listeners
window.removeEventListener('error', handleWindowError);
};
invokeGuardedCallbackImpl = invokeGuardedCallbackDev;
}
}
var invokeGuardedCallbackImpl$1 = invokeGuardedCallbackImpl;
// Used by Fiber to simulate a try-catch.
var hasError = false;
var caughtError = null;
// Used by event system to capture/rethrow the first error.
var hasRethrowError = false;
var rethrowError = null;
var reporter = {
onError: function (error) {
hasError = true;
caughtError = error;
}
};
/**
* Call a function while guarding against errors that happens within it.
* Returns an error if it throws, otherwise null.
*
* In production, this is implemented using a try-catch. The reason we don't
* use a try-catch directly is so that we can swap out a different
* implementation in DEV mode.
*
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
function invokeGuardedCallback(name, func, context, a, b, c, d, e, f) {
hasError = false;
caughtError = null;
invokeGuardedCallbackImpl$1.apply(reporter, arguments);
}
/**
* Same as invokeGuardedCallback, but instead of returning an error, it stores
* it in a global so it can be rethrown by `rethrowCaughtError` later.
* TODO: See if caughtError and rethrowError can be unified.
*
* @param {String} name of the guard to use for logging or debugging
* @param {Function} func The function to invoke
* @param {*} context The context to use when calling the function
* @param {...*} args Arguments for function
*/
function invokeGuardedCallbackAndCatchFirstError(name, func, context, a, b, c, d, e, f) {
invokeGuardedCallback.apply(this, arguments);
if (hasError) {
var error = clearCaughtError();
if (!hasRethrowError) {
hasRethrowError = true;
rethrowError = error;
}
}
}
/**
* During execution of guarded functions we will capture the first error which
* we will rethrow to be handled by the top level error handler.
*/
function rethrowCaughtError() {
if (hasRethrowError) {
var error = rethrowError;
hasRethrowError = false;
rethrowError = null;
throw error;
}
}
function hasCaughtError() {
return hasError;
}
function clearCaughtError() {
if (hasError) {
var error = caughtError;
hasError = false;
caughtError = null;
return error;
} else {
invariant(false, 'clearCaughtError was called but no error was captured. This error is likely caused by a bug in React. Please file an issue.');
}
}
/**
* Injectable ordering of event plugins.
*/
var eventPluginOrder = null;
/**
* Injectable mapping from names to event plugin modules.
*/
var namesToPlugins = {};
/**
* Recomputes the plugin list using the injected plugins and plugin ordering.
*
* @private
*/
function recomputePluginOrdering() {
if (!eventPluginOrder) {
// Wait until an `eventPluginOrder` is injected.
return;
}
for (var pluginName in namesToPlugins) {
var pluginModule = namesToPlugins[pluginName];
var pluginIndex = eventPluginOrder.indexOf(pluginName);
!(pluginIndex > -1) ? invariant(false, 'EventPluginRegistry: Cannot inject event plugins that do not exist in the plugin ordering, `%s`.', pluginName) : void 0;
if (plugins[pluginIndex]) {
continue;
}
!pluginModule.extractEvents ? invariant(false, 'EventPluginRegistry: Event plugins must implement an `extractEvents` method, but `%s` does not.', pluginName) : void 0;
plugins[pluginIndex] = pluginModule;
var publishedEvents = pluginModule.eventTypes;
for (var eventName in publishedEvents) {
!publishEventForPlugin(publishedEvents[eventName], pluginModule, eventName) ? invariant(false, 'EventPluginRegistry: Failed to publish event `%s` for plugin `%s`.', eventName, pluginName) : void 0;
}
}
}
/**
* Publishes an event so that it can be dispatched by the supplied plugin.
*
* @param {object} dispatchConfig Dispatch configuration for the event.
* @param {object} PluginModule Plugin publishing the event.
* @return {boolean} True if the event was successfully published.
* @private
*/
function publishEventForPlugin(dispatchConfig, pluginModule, eventName) {
!!eventNameDispatchConfigs.hasOwnProperty(eventName) ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same event name, `%s`.', eventName) : void 0;
eventNameDispatchConfigs[eventName] = dispatchConfig;
var phasedRegistrationNames = dispatchConfig.phasedRegistrationNames;
if (phasedRegistrationNames) {
for (var phaseName in phasedRegistrationNames) {
if (phasedRegistrationNames.hasOwnProperty(phaseName)) {
var phasedRegistrationName = phasedRegistrationNames[phaseName];
publishRegistrationName(phasedRegistrationName, pluginModule, eventName);
}
}
return true;
} else if (dispatchConfig.registrationName) {
publishRegistrationName(dispatchConfig.registrationName, pluginModule, eventName);
return true;
}
return false;
}
/**
* Publishes a registration name that is used to identify dispatched events.
*
* @param {string} registrationName Registration name to add.
* @param {object} PluginModule Plugin publishing the event.
* @private
*/
function publishRegistrationName(registrationName, pluginModule, eventName) {
!!registrationNameModules[registrationName] ? invariant(false, 'EventPluginHub: More than one plugin attempted to publish the same registration name, `%s`.', registrationName) : void 0;
registrationNameModules[registrationName] = pluginModule;
registrationNameDependencies[registrationName] = pluginModule.eventTypes[eventName].dependencies;
{
var lowerCasedName = registrationName.toLowerCase();
possibleRegistrationNames[lowerCasedName] = registrationName;
if (registrationName === 'onDoubleClick') {
possibleRegistrationNames.ondblclick = registrationName;
}
}
}
/**
* Registers plugins so that they can extract and dispatch events.
*
* @see {EventPluginHub}
*/
/**
* Ordered list of injected plugins.
*/
var plugins = [];
/**
* Mapping from event name to dispatch config
*/
var eventNameDispatchConfigs = {};
/**
* Mapping from registration name to plugin module
*/
var registrationNameModules = {};
/**
* Mapping from registration name to event name
*/
var registrationNameDependencies = {};
/**
* Mapping from lowercase registration names to the properly cased version,
* used to warn in the case of missing event handlers. Available
* only in true.
* @type {Object}
*/
var possibleRegistrationNames = {};
// Trust the developer to only use possibleRegistrationNames in true
/**
* Injects an ordering of plugins (by plugin name). This allows the ordering
* to be decoupled from injection of the actual plugins so that ordering is
* always deterministic regardless of packaging, on-the-fly injection, etc.
*
* @param {array} InjectedEventPluginOrder
* @internal
* @see {EventPluginHub.injection.injectEventPluginOrder}
*/
function injectEventPluginOrder(injectedEventPluginOrder) {
!!eventPluginOrder ? invariant(false, 'EventPluginRegistry: Cannot inject event plugin ordering more than once. You are likely trying to load more than one copy of React.') : void 0;
// Clone the ordering so it cannot be dynamically mutated.
eventPluginOrder = Array.prototype.slice.call(injectedEventPluginOrder);
recomputePluginOrdering();
}
/**
* Injects plugins to be used by `EventPluginHub`. The plugin names must be
* in the ordering injected by `injectEventPluginOrder`.
*
* Plugins can be injected as part of page initialization or on-the-fly.
*
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
* @internal
* @see {EventPluginHub.injection.injectEventPluginsByName}
*/
function injectEventPluginsByName(injectedNamesToPlugins) {
var isOrderingDirty = false;
for (var pluginName in injectedNamesToPlugins) {
if (!injectedNamesToPlugins.hasOwnProperty(pluginName)) {
continue;
}
var pluginModule = injectedNamesToPlugins[pluginName];
if (!namesToPlugins.hasOwnProperty(pluginName) || namesToPlugins[pluginName] !== pluginModule) {
!!namesToPlugins[pluginName] ? invariant(false, 'EventPluginRegistry: Cannot inject two different event plugins using the same name, `%s`.', pluginName) : void 0;
namesToPlugins[pluginName] = pluginModule;
isOrderingDirty = true;
}
}
if (isOrderingDirty) {
recomputePluginOrdering();
}
}
/**
* Similar to invariant but only logs a warning if the condition is not met.
* This can be used to log issues in development environments in critical
* paths. Removing the logging code for production environments will keep the
* same logic and follow the same code paths.
*/
var warningWithoutStack = function () {};
{
warningWithoutStack = function (condition, format) {
for (var _len = arguments.length, args = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
if (format === undefined) {
throw new Error('`warningWithoutStack(condition, format, ...args)` requires a warning ' + 'message argument');
}
if (args.length > 8) {
// Check before the condition to catch violations early.
throw new Error('warningWithoutStack() currently supports at most 8 arguments.');
}
if (condition) {
return;
}
if (typeof console !== 'undefined') {
var argsWithFormat = args.map(function (item) {
return '' + item;
});
argsWithFormat.unshift('Warning: ' + format);
// We intentionally don't use spread (or .apply) directly because it
// breaks IE9: https://github.com/facebook/react/issues/13610
Function.prototype.apply.call(console.error, console, argsWithFormat);
}
try {
// --- Welcome to debugging React ---
// This error was thrown as a convenience so that you can use this stack
// to find the callsite that caused this warning to fire.
var argIndex = 0;
var message = 'Warning: ' + format.replace(/%s/g, function () {
return args[argIndex++];
});
throw new Error(message);
} catch (x) {}
};
}
var warningWithoutStack$1 = warningWithoutStack;
var getFiberCurrentPropsFromNode = null;
var getInstanceFromNode = null;
var getNodeFromInstance = null;
function setComponentTree(getFiberCurrentPropsFromNodeImpl, getInstanceFromNodeImpl, getNodeFromInstanceImpl) {
getFiberCurrentPropsFromNode = getFiberCurrentPropsFromNodeImpl;
getInstanceFromNode = getInstanceFromNodeImpl;
getNodeFromInstance = getNodeFromInstanceImpl;
{
!(getNodeFromInstance && getInstanceFromNode) ? warningWithoutStack$1(false, 'EventPluginUtils.setComponentTree(...): Injected ' + 'module is missing getNodeFromInstance or getInstanceFromNode.') : void 0;
}
}
var validateEventDispatches = void 0;
{
validateEventDispatches = function (event) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
var listenersIsArr = Array.isArray(dispatchListeners);
var listenersLen = listenersIsArr ? dispatchListeners.length : dispatchListeners ? 1 : 0;
var instancesIsArr = Array.isArray(dispatchInstances);
var instancesLen = instancesIsArr ? dispatchInstances.length : dispatchInstances ? 1 : 0;
!(instancesIsArr === listenersIsArr && instancesLen === listenersLen) ? warningWithoutStack$1(false, 'EventPluginUtils: Invalid `event`.') : void 0;
};
}
/**
* Dispatch the event to the listener.
* @param {SyntheticEvent} event SyntheticEvent to handle
* @param {function} listener Application-level callback
* @param {*} inst Internal component instance
*/
function executeDispatch(event, listener, inst) {
var type = event.type || 'unknown-event';
event.currentTarget = getNodeFromInstance(inst);
invokeGuardedCallbackAndCatchFirstError(type, listener, undefined, event);
event.currentTarget = null;
}
/**
* Standard/simple iteration through an event's collected dispatches.
*/
function executeDispatchesInOrder(event) {
var dispatchListeners = event._dispatchListeners;
var dispatchInstances = event._dispatchInstances;
{
validateEventDispatches(event);
}
if (Array.isArray(dispatchListeners)) {
for (var i = 0; i < dispatchListeners.length; i++) {
if (event.isPropagationStopped()) {
break;
}
// Listeners and Instances are two parallel arrays that are always in sync.
executeDispatch(event, dispatchListeners[i], dispatchInstances[i]);
}
} else if (dispatchListeners) {
executeDispatch(event, dispatchListeners, dispatchInstances);
}
event._dispatchListeners = null;
event._dispatchInstances = null;
}
/**
* @see executeDispatchesInOrderStopAtTrueImpl
*/
/**
* Execution of a "direct" dispatch - there must be at most one dispatch
* accumulated on the event or it is considered an error. It doesn't really make
* sense for an event with multiple dispatches (bubbled) to keep track of the
* return values at each dispatch execution, but it does tend to make sense when
* dealing with "direct" dispatches.
*
* @return {*} The return value of executing the single dispatch.
*/
/**
* @param {SyntheticEvent} event
* @return {boolean} True iff number of dispatches accumulated is greater than 0.
*/
/**
* Accumulates items that must not be null or undefined into the first one. This
* is used to conserve memory by avoiding array allocations, and thus sacrifices
* API cleanness. Since `current` can be null before being passed in and not
* null after this function, make sure to assign it back to `current`:
*
* `a = accumulateInto(a, b);`
*
* This API should be sparingly used. Try `accumulate` for something cleaner.
*
* @return {*|array<*>} An accumulation of items.
*/
function accumulateInto(current, next) {
!(next != null) ? invariant(false, 'accumulateInto(...): Accumulated items must not be null or undefined.') : void 0;
if (current == null) {
return next;
}
// Both are not empty. Warning: Never call x.concat(y) when you are not
// certain that x is an Array (x could be a string with concat method).
if (Array.isArray(current)) {
if (Array.isArray(next)) {
current.push.apply(current, next);
return current;
}
current.push(next);
return current;
}
if (Array.isArray(next)) {
// A bit too dangerous to mutate `next`.
return [current].concat(next);
}
return [current, next];
}
/**
* @param {array} arr an "accumulation" of items which is either an Array or
* a single item. Useful when paired with the `accumulate` module. This is a
* simple utility that allows us to reason about a collection of items, but
* handling the case when there is exactly one item (and we do not need to
* allocate an array).
* @param {function} cb Callback invoked with each element or a collection.
* @param {?} [scope] Scope used as `this` in a callback.
*/
function forEachAccumulated(arr, cb, scope) {
if (Array.isArray(arr)) {
arr.forEach(cb, scope);
} else if (arr) {
cb.call(scope, arr);
}
}
/**
* Internal queue of events that have accumulated their dispatches and are
* waiting to have their dispatches executed.
*/
var eventQueue = null;
/**
* Dispatches an event and releases it back into the pool, unless persistent.
*
* @param {?object} event Synthetic event to be dispatched.
* @private
*/
var executeDispatchesAndRelease = function (event) {
if (event) {
executeDispatchesInOrder(event);
if (!event.isPersistent()) {
event.constructor.release(event);
}
}
};
var executeDispatchesAndReleaseTopLevel = function (e) {
return executeDispatchesAndRelease(e);
};
function isInteractive(tag) {
return tag === 'button' || tag === 'input' || tag === 'select' || tag === 'textarea';
}
function shouldPreventMouseEvent(name, type, props) {
switch (name) {
case 'onClick':
case 'onClickCapture':
case 'onDoubleClick':
case 'onDoubleClickCapture':
case 'onMouseDown':
case 'onMouseDownCapture':
case 'onMouseMove':
case 'onMouseMoveCapture':
case 'onMouseUp':
case 'onMouseUpCapture':
return !!(props.disabled && isInteractive(type));
default:
return false;
}
}
/**
* This is a unified interface for event plugins to be installed and configured.
*
* Event plugins can implement the following properties:
*
* `extractEvents` {function(string, DOMEventTarget, string, object): *}
* Required. When a top-level event is fired, this method is expected to
* extract synthetic events that will in turn be queued and dispatched.
*
* `eventTypes` {object}
* Optional, plugins that fire events must publish a mapping of registration
* names that are used to register listeners. Values of this mapping must
* be objects that contain `registrationName` or `phasedRegistrationNames`.
*
* `executeDispatch` {function(object, function, string)}
* Optional, allows plugins to override how an event gets dispatched. By
* default, the listener is simply invoked.
*
* Each plugin that is injected into `EventsPluginHub` is immediately operable.
*
* @public
*/
/**
* Methods for injecting dependencies.
*/
var injection = {
/**
* @param {array} InjectedEventPluginOrder
* @public
*/
injectEventPluginOrder: injectEventPluginOrder,
/**
* @param {object} injectedNamesToPlugins Map from names to plugin modules.
*/
injectEventPluginsByName: injectEventPluginsByName
};
/**
* @param {object} inst The instance, which is the source of events.
* @param {string} registrationName Name of listener (e.g. `onClick`).
* @return {?function} The stored callback.
*/
function getListener(inst, registrationName) {
var listener = void 0;
// TODO: shouldPreventMouseEvent is DOM-specific and definitely should not
// live here; needs to be moved to a better place soon
var stateNode = inst.stateNode;
if (!stateNode) {
// Work in progress (ex: onload events in incremental mode).
return null;
}
var props = getFiberCurrentPropsFromNode(stateNode);
if (!props) {
// Work in progress.
return null;
}
listener = props[registrationName];
if (shouldPreventMouseEvent(registrationName, inst.type, props)) {
return null;
}
!(!listener || typeof listener === 'function') ? invariant(false, 'Expected `%s` listener to be a function, instead got a value of `%s` type.', registrationName, typeof listener) : void 0;
return listener;
}
/**
* Allows registered plugins an opportunity to extract events from top-level
* native browser events.
*
* @return {*} An accumulation of synthetic events.
* @internal
*/
function extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events = null;
for (var i = 0; i < plugins.length; i++) {
// Not every plugin in the ordering may be loaded at runtime.
var possiblePlugin = plugins[i];
if (possiblePlugin) {
var extractedEvents = possiblePlugin.extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
if (extractedEvents) {
events = accumulateInto(events, extractedEvents);
}
}
}
return events;
}
function runEventsInBatch(events) {
if (events !== null) {
eventQueue = accumulateInto(eventQueue, events);
}
// Set `eventQueue` to null before processing it so that we can tell if more
// events get enqueued while processing.
var processingEventQueue = eventQueue;
eventQueue = null;
if (!processingEventQueue) {
return;
}
forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel);
!!eventQueue ? invariant(false, 'processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented.') : void 0;
// This would be a good time to rethrow if any of the event handlers threw.
rethrowCaughtError();
}
function runExtractedEventsInBatch(topLevelType, targetInst, nativeEvent, nativeEventTarget) {
var events = extractEvents(topLevelType, targetInst, nativeEvent, nativeEventTarget);
runEventsInBatch(events);
}
var FunctionComponent = 0;
var ClassComponent = 1;
var IndeterminateComponent = 2; // Before we know whether it is function or class
var HostRoot = 3; // Root of a host tree. Could be nested inside another node.
var HostPortal = 4; // A subtree. Could be an entry point to a different renderer.
var HostComponent = 5;
var HostText = 6;
var Fragment = 7;
var Mode = 8;
var ContextConsumer = 9;
var ContextProvider = 10;
var ForwardRef = 11;
var Profiler = 12;
var SuspenseComponent = 13;
var MemoComponent = 14;
var SimpleMemoComponent = 15;
var LazyComponent = 16;
var IncompleteClassComponent = 17;
var DehydratedSuspenseComponent = 18;
var randomKey = Math.random().toString(36).slice(2);
var internalInstanceKey = '__reactInternalInstance$' + randomKey;
var internalEventHandlersKey = '__reactEventHandlers$' + randomKey;
function precacheFiberNode(hostInst, node) {
node[internalInstanceKey] = hostInst;
}
/**
* Given a DOM node, return the closest ReactDOMComponent or
* ReactDOMTextComponent instance ancestor.
*/
function getClosestInstanceFromNode(node) {
if (node[internalInstanceKey]) {
return node[internalInstanceKey];
}
while (!node[internalInstanceKey]) {
if (node.parentNode) {
node = node.parentNode;
} else {
// Top of the tree. This node must not be part of a React tree (or is
// unmounted, potentially).
return null;
}
}
var inst = node[internalInstanceKey];
if (inst.tag === HostComponent || inst.tag === HostText) {
// In Fiber, this will always be the deepest root.
return inst;
}
return null;
}
/**
* Given a DOM node, return the ReactDOMComponent or ReactDOMTextComponent
* instance, or null if the node was not rendered by this React.
*/
function getInstanceFromNode$1(node) {
var inst = node[internalInstanceKey];
if (inst) {
if (inst.tag === HostComponent || inst.tag === HostText) {
return inst;
} else {
return null;
}
}
return null;
}
/**
* Given a ReactDOMComponent or ReactDOMTextComponent, return the corresponding
* DOM node.
*/
function getNodeFromInstance$1(inst) {
if (inst.tag === HostComponent || inst.tag === HostText) {
// In Fiber this, is just the state node right now. We assume it will be
// a host component or host text.
return inst.stateNode;
}
// Without this first invariant, passing a non-DOM-component triggers the next
// invariant for a missing parent, which is super confusing.
invariant(false, 'getNodeFromInstance: Invalid argument.');
}
function getFiberCurrentPropsFromNode$1(node) {
return node[internalEventHandlersKey] || null;
}
function updateFiberProps(node, props) {
node[internalEventHandlersKey] = props;
}
function getParent(inst) {
do {
inst = inst.return;
// TODO: If this is a HostRoot we might want to bail out.
// That is depending on if we want nested subtrees (layers) to bubble
// events to their parent. We could also go through parentNode on the
// host node but that wouldn't work for React Native and doesn't let us
// do the portal feature.
} while (inst && inst.tag !== HostComponent);
if (inst) {
return inst;
}
return null;
}
/**
* Return the lowest common ancestor of A and B, or null if they are in
* different trees.
*/
function getLowestCommonAncestor(instA, instB) {
var depthA = 0;
for (var tempA = instA; tempA; tempA = getParent(tempA)) {
depthA++;
}
var depthB = 0;
for (var tempB = instB; tempB; tempB = getParent(tempB)) {
depthB++;
}
// If A is deeper, crawl up.
while (depthA - depthB > 0) {
instA = getParent(instA);
depthA--;
}
// If B is deeper, crawl up.
while (depthB - depthA > 0) {
instB = getParent(instB);
depthB--;
}
// Walk in lockstep until we find a match.
var depth = depthA;
while (depth--) {
if (instA === instB || instA === instB.alternate) {
return instA;
}
instA = getParent(instA);
instB = getParent(instB);
}
return null;
}
/**
* Return if A is an ancestor of B.
*/
/**
* Return the parent instance of the passed-in instance.
*/
/**
* Simulates the traversal of a two-phase, capture/bubble event dispatch.
*/
function traverseTwoPhase(inst, fn, arg) {
var path = [];
while (inst) {
path.push(inst);
inst = getParent(inst);
}
var i = void 0;
for (i = path.length; i-- > 0;) {
fn(path[i], 'captured', arg);
}
for (i = 0; i < path.length; i++) {
fn(path[i], 'bubbled', arg);
}
}
/**
* Traverses the ID hierarchy and invokes the supplied `cb` on any IDs that
* should would receive a `mouseEnter` or `mouseLeave` event.
*
* Does not invoke the callback on the nearest common ancestor because nothing
* "entered" or "left" that element.
*/
function traverseEnterLeave(from, to, fn, argFrom, argTo) {
var common = from && to ? getLowestCommonAncestor(from, to) : null;
var pathFrom = [];
while (true) {
if (!from) {
break;
}
if (from === common) {
break;
}
var alternate = from.alternate;
if (alternate !== null && alternate === common) {
break;
}
pathFrom.push(from);
from = getParent(from);
}
var pathTo = [];
while (true) {
if (!to) {
break;
}
if (to === common) {
break;
}
var _alternate = to.alternate;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment