]*data-sp-htmlproperties[^>]*?>/i, function (markup) {
return markup.replace(/^
]*data-sp-htmlproperties[^>]*?>/i, "").replace(/<\/div>$/i, "");
});
this.htmlProperties = htmlProps.length > 0 ? htmlProps[0] : "";
};
ClientSideWebpart.prototype.getControlData = function () {
return {
controlType: this.controlType,
id: this.id,
position: {
controlIndex: this.order,
sectionFactor: this.column.factor,
sectionIndex: this.column.order,
zoneIndex: this.column.section.order,
},
webPartId: this.webPartId,
};
};
ClientSideWebpart.prototype.renderHtmlProperties = function () {
var html = [];
if (this.serverProcessedContent === undefined || this.serverProcessedContent === null) {
html.push(this.htmlProperties);
}
else if (this.serverProcessedContent !== undefined) {
if (this.serverProcessedContent.searchablePlainTexts !== undefined) {
var keys = Object.keys(this.serverProcessedContent.searchablePlainTexts);
for (var i = 0; i < keys.length; i++) {
html.push("
");
html.push(this.serverProcessedContent.searchablePlainTexts[keys[i]]);
html.push("
");
}
}
if (this.serverProcessedContent.imageSources !== undefined) {
var keys = Object.keys(this.serverProcessedContent.imageSources);
for (var i = 0; i < keys.length; i++) {
html.push("
");
}
}
if (this.serverProcessedContent.links !== undefined) {
var keys = Object.keys(this.serverProcessedContent.links);
for (var i = 0; i < keys.length; i++) {
html.push("
");
}
}
}
return html.join("");
};
ClientSideWebpart.prototype.parseJsonProperties = function (props) {
// If the web part has the serverProcessedContent property then keep this one as it might be needed as input to render the web part HTML later on
if (props.webPartData !== undefined && props.webPartData.serverProcessedContent !== undefined) {
this.serverProcessedContent = props.webPartData.serverProcessedContent;
}
else if (props.serverProcessedContent !== undefined) {
this.serverProcessedContent = props.serverProcessedContent;
}
else {
this.serverProcessedContent = null;
}
if (props.webPartData !== undefined && props.webPartData.properties !== undefined) {
return props.webPartData.properties;
}
else if (props.properties !== undefined) {
return props.properties;
}
else {
return props;
}
};
return ClientSideWebpart;
}(ClientSidePart));
/**
* Represents a collection of navigation nodes
*
*/
var NavigationNodes = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NavigationNodes, _super);
function NavigationNodes() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.getById = _this._getById(NavigationNode);
return _this;
}
/**
* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])(Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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);
};
return NavigationNode;
}(SharePointQueryableInstance));
/**
* Exposes the navigation components
*
*/
var Navigation = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("navigation")
], Navigation);
return Navigation;
}(SharePointQueryable));
/**
* Represents the top level navigation service
*/
var NavigationService = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(NavigationService, _super);
function NavigationService(path) {
if (path === void 0) { path = null; }
return _super.call(this, "_api/navigation", 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("MenuState")).postCore({
body: Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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("MenuNodeKey")).postCore({
body: Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
currentUrl: currentUrl,
mapProviderName: mapProviderName,
}),
});
};
return NavigationService;
}(SharePointQueryable));
/**
* Describes regional settings ODada object
*/
var RegionalSettings = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("regionalsettings")
], RegionalSettings);
return RegionalSettings;
}(SharePointQueryableInstance));
/**
* Describes installed languages ODada queriable collection
*/
var InstalledLanguages = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(InstalledLanguages, _super);
function InstalledLanguages() {
return _super !== null && _super.apply(this, arguments) || this;
}
InstalledLanguages = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("installedlanguages")
], InstalledLanguages);
return InstalledLanguages;
}(SharePointQueryableCollection));
/**
* Describes TimeZone ODada object
*/
var TimeZone = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["e" /* dateAdd */])(localTime, "minute", localTime.getTimezoneOffset() * -1).toISOString();
}
return this.clone(TimeZone_1, "localtimetoutc('" + dateIsoString + "')")
.postCore()
.then(function (res) { return Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* hOP */])(res, "LocalTimeToUTC") ? res.LocalTimeToUTC : res; });
};
var TimeZone_1;
TimeZone = TimeZone_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("timezone")
], TimeZone);
return TimeZone;
}(SharePointQueryableInstance));
/**
* Describes time zones queriable collection
*/
var TimeZones = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __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) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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 formattedBody;
formattedBody = query;
if (formattedBody.SelectProperties) {
formattedBody.SelectProperties = this.fixupProp(query.SelectProperties);
}
if (formattedBody.RefinementFilters) {
formattedBody.RefinementFilters = this.fixupProp(query.RefinementFilters);
}
if (formattedBody.SortList) {
formattedBody.SortList = this.fixupProp(query.SortList);
}
if (formattedBody.HithighlightedProperties) {
formattedBody.HithighlightedProperties = this.fixupProp(query.HitHighlightedProperties);
}
if (formattedBody.ReorderingRules) {
formattedBody.ReorderingRules = this.fixupProp(query.ReorderingRules);
}
if (formattedBody.Properties) {
formattedBody.Properties = this.fixupProp(query.Properties);
}
var postBody = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
request: Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(metadata("Microsoft.Office.Server.Search.REST.SearchRequest"), formattedBody),
});
// 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["j" /* getHashCode */])(postBody) + ")";
if (Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["q" /* 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 __WEBPACK_IMPORTED_MODULE_3__pnp_odata__["c" /* CachingOptions */](cacheKey);
}
}
return this.postCore({ body: postBody }).then(function (data) { return new SearchResults(data, _this.toUrl(), query); });
};
/**
* Fixes up properties that expect to consist of a "results" collection when needed
*
* @param prop property to fixup for container struct
*/
Search.prototype.fixupProp = function (prop) {
return Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* hOP */])(this._query, "RowLimit") ? this._query.RowLimit : 10;
var query = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/search/suggest")
], SearchSuggest);
return SearchSuggest;
}(SharePointQueryableInstance));
/**
* Describes a collection of List objects
*
*/
var Features = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(Features, _super);
function Features() {
var _this = _super !== null && _super.apply(this, arguments) || this;
/**
* Gets a list from the collection by guid id
*
* @param id The Id of the feature (GUID)
*/
_this.getById = _this._getById(Feature);
return _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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
featdefScope: 0,
featureId: id,
force: force,
}),
}).then(function (data) {
return {
data: data,
feature: _this.getById(id),
};
});
};
/**
* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
featureId: id,
force: force,
}),
});
};
var Features_1;
Features = Features_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("features")
], Features);
return Features;
}(SharePointQueryableCollection));
var Feature = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
SourceItemID: sourceItemId,
SourceListName: sourceListName,
SourceWebUrl: sourceWebUrl,
TargetItemID: targetItemId,
TargetListName: targetListName,
TargetWebUrl: targetWebUrl,
TryDeleteReverseLink: tryDeleteReverseLink,
}),
});
};
var RelatedItemManagerImpl_1;
RelatedItemManagerImpl = RelatedItemManagerImpl_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/SP.RelatedItemManager")
], RelatedItemManagerImpl);
return RelatedItemManagerImpl;
}(SharePointQueryable));
/**
* Describes a collection of webs
*
*/
var Webs = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
"parameters": Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("webs")
], Webs);
return Webs;
}(SharePointQueryableCollection));
/**
* Describes a collection of web infos
*
*/
var WebInfos = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __extends */])(WebInfos, _super);
function WebInfos() {
return _super !== null && _super.apply(this, arguments) || this;
}
WebInfos = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("webinfos")
], WebInfos);
return WebInfos;
}(SharePointQueryableCollection));
/**
* Describes a web
*
*/
var Web = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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 new Site(_this.toUrlAndQuery().split("/_api")[0]).openWebById(ParentWeb.Id);
});
};
/**
* 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(SharePointQueryableCollection, "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
});
/**
* 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 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])(Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({ "query": Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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 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 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, libraryTitle) {
if (title === void 0) { title = pageName.replace(/\.[^/.]+$/, ""); }
if (libraryTitle === void 0) { libraryTitle = "Site Pages"; }
return ClientSidePage.create(this.lists.getByTitle(libraryTitle), 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, listRelativePath, title) {
if (title === void 0) { title = pageName.replace(/\.[^/.]+$/, ""); }
return ClientSidePage.create(this.getList(listRelativePath), pageName, title);
};
var Web_1;
Web = Web_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/web")
], Web);
return Web;
}(SharePointQueryableShareableWeb));
/**
* Describes a site collection
*
*/
var Site = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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),
}); });
};
var Site_1;
Site = Site_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/site")
], Site);
return Site;
}(SharePointQueryableInstance));
var UserProfileQuery = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/sp.userprofiles.profileloader.getprofileloader")
], ProfileLoader);
return ProfileLoader;
}(SharePointQueryable));
var ClientPeoplePickerQuery = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
"queryParams": Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(metadata("SP.UI.ApplicationPages.ClientPeoplePickerQueryParameters"), queryParams),
});
};
var ClientPeoplePickerQuery_1;
ClientPeoplePickerQuery = ClientPeoplePickerQuery_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/sp.ui.applicationpages.clientpeoplepickerwebserviceinterface")
], ClientPeoplePickerQuery);
return ClientPeoplePickerQuery;
}(SharePointQueryable));
/**
* Exposes social following methods
*/
var SocialQuery = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* jsS */])({
"actor": Object.assign(metadata("SP.Social.SocialActorInfo"), {
Id: null,
}, actorInfo),
});
};
var SocialQuery_1;
SocialQuery = SocialQuery_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __decorate */])([
defaultPath("_api/social.following")
], SocialQuery);
return SocialQuery;
}(SharePointQueryableInstance));
var MySocialQuery = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["k" /* hOP */])(r, "Suggestions") ? r.Suggestions.results : r;
});
};
var MySocialQuery_1;
MySocialQuery = MySocialQuery_1 = Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["a" /* __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 = {}));
/**
* Allows for calling of the static SP.Utilities.Utility methods by supplying the method name
*/
var UtilityMethod = /** @class */ (function (_super) {
Object(__WEBPACK_IMPORTED_MODULE_1_tslib__["b" /* __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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["n" /* 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(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(metadata("SP.Utilities.EmailProperties"), {
Body: props.Body,
From: props.From,
Subject: props.Subject,
}),
};
if (props.To && props.To.length > 0) {
params.properties = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(params.properties, {
To: { results: props.To },
});
}
if (props.CC && props.CC.length > 0) {
params.properties = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(params.properties, {
CC: { results: props.CC },
});
}
if (props.BCC && props.BCC.length > 0) {
params.properties = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* extend */])(params.properties, {
BCC: { results: props.BCC },
});
}
if (props.AdditionalHeaders) {
params.properties = Object(__WEBPACK_IMPORTED_MODULE_0__pnp_common__["f" /* 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({});
};
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);
};
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);
};
UtilityMethod.prototype.createEmailBodyForInvitation = function (pageAddress) {
var params = {
pageAddress: pageAddress,
};
return this.clone(UtilityMethod, "CreateEmailBodyForInvitation", true).excute(params);
};
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);
};
UtilityMethod.prototype.createWikiPage = function (info) {
return this.clone(UtilityMethod, "CreateWikiPageInContextWeb", true).excute({
parameters: info,
}).then(function (r) {
return {
data: r,
file: new File(odataUrlFrom(r)),
};
});
};
return UtilityMethod;
}(SharePointQueryable));
/**
* 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 new 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
});
/**
* 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(__webpack_exports__, __webpack_require__(9)))
/***/ })
/******/ ]);
});
//# sourceMappingURL=sp-clientsvc.es5.umd.bundle.js.map