From 37425dc7892cca9f642fad21beccf824ab9ab54e Mon Sep 17 00:00:00 2001 From: Elio Struyf Date: Wed, 12 Oct 2016 19:46:48 +0200 Subject: [PATCH] Added the webhook subscription functionality --- .vscode/launch.json | 19 + .vscode/settings.json | 3 +- buildtasks/test.js | 6 + dist/pnp-provisioning.js | 2453 --------- dist/pnp-provisioning.min.js | 11 - dist/pnp-provisioning.min.js.map | 1 - dist/pnp.d.ts | 5058 ------------------- dist/pnp.js | 4763 ----------------- dist/pnp.js.map | 1 - dist/pnp.min.js | 13 - dist/pnp.min.js.map | 1 - server-root/scratchpad.js | 31 + settings.example.js | 1 + src/net/httpclient.ts | 10 + src/sharepoint/rest/lists.ts | 48 + src/sharepoint/rest/queryable.ts | 72 + tests/sharepoint/rest/subscriptions.test.ts | 76 + tslint.json | 2 +- 18 files changed, 266 insertions(+), 12303 deletions(-) delete mode 100644 dist/pnp-provisioning.js delete mode 100644 dist/pnp-provisioning.min.js delete mode 100644 dist/pnp-provisioning.min.js.map delete mode 100644 dist/pnp.d.ts delete mode 100644 dist/pnp.js delete mode 100644 dist/pnp.js.map delete mode 100644 dist/pnp.min.js delete mode 100644 dist/pnp.min.js.map create mode 100644 tests/sharepoint/rest/subscriptions.test.ts diff --git a/.vscode/launch.json b/.vscode/launch.json index f8b0debe..d6094460 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -20,6 +20,25 @@ "sourceMaps": false, "outDir": null }, + { + "name": "Gulp", + "type": "node", + "request": "launch", + "program": "${workspaceRoot}/node_modules/gulp/bin/gulp.js", + "stopOnEntry": false, + "args": ["subscriptions-test"], + "cwd": "${workspaceRoot}", + "runtimeExecutable": null, + "runtimeArgs": [ + "--nolazy" + ], + "env": { + "NODE_ENV": "development" + }, + "externalConsole": false, + "sourceMaps": false, + "outDir": null + }, { "name": "Attach", "type": "node", diff --git a/.vscode/settings.json b/.vscode/settings.json index c55211f9..b5f16082 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -7,5 +7,6 @@ "build/": true, "node_modules/": true, "coverage": true - } + }, + "typescript.tsdk": "./node_modules/typescript/lib" } \ No newline at end of file diff --git a/buildtasks/test.js b/buildtasks/test.js index 09e722ba..00e2d8a1 100644 --- a/buildtasks/test.js +++ b/buildtasks/test.js @@ -34,3 +34,9 @@ gulp.task("test", ["build", "build-tests", "istanbul:hook"], function() { .pipe(mocha({ ui: 'bdd', reporter: 'dot', timeout: 10000 })) .pipe(istanbul.writeReports()); }); + +gulp.task("subscriptions-test", ["build", "build-tests", "istanbul:hook"], function() { + return gulp.src('./build/tests/sharepoint/rest/subscriptions.test.js') + .pipe(mocha({ ui: 'bdd', reporter: 'dot', timeout: 10000 })) + .pipe(istanbul.writeReports()); +}); \ No newline at end of file diff --git a/dist/pnp-provisioning.js b/dist/pnp-provisioning.js deleted file mode 100644 index b99d019f..00000000 --- a/dist/pnp-provisioning.js +++ /dev/null @@ -1,2453 +0,0 @@ -/** - * sp-pnp-js v1.0.4 - A reusable JavaScript library targeting SharePoint client-side development. - * MIT (https://github.com/OfficeDev/PnP-JS-Core/blob/master/LICENSE) - * Copyright (c) 2016 Microsoft - * docs: http://officedev.github.io/PnP-JS-Core - * source: https://github.com/OfficeDev/PnP-JS-Core - * bugs: https://github.com/OfficeDev/PnP-JS-Core/issues - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}(g.$pnp || (g.$pnp = {})).Provisioning = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1) { - this.values[index] = o; - } - else { - this.keys.push(key); - this.values.push(o); - } - }; - Dictionary.prototype.merge = function (source) { - if (util_1.Util.isFunction(source["getKeys"])) { - var sourceAsDictionary = source; - var keys = sourceAsDictionary.getKeys(); - var l = keys.length; - for (var i = 0; i < l; i++) { - this.add(keys[i], sourceAsDictionary.get(keys[i])); - } - } - else { - var sourceAsHash = source; - for (var key in sourceAsHash) { - if (sourceAsHash.hasOwnProperty(key)) { - this.add(key, source[key]); - } - } - } - }; - Dictionary.prototype.remove = function (key) { - var index = this.keys.indexOf(key); - if (index < 0) { - return null; - } - var val = this.values[index]; - this.keys.splice(index, 1); - this.values.splice(index, 1); - return val; - }; - Dictionary.prototype.getKeys = function () { - return this.keys; - }; - Dictionary.prototype.getValues = function () { - return this.values; - }; - Dictionary.prototype.clear = function () { - this.keys = []; - this.values = []; - }; - Dictionary.prototype.count = function () { - return this.keys.length; - }; - return Dictionary; -}()); -exports.Dictionary = Dictionary; - -},{"../utils/util":23}],2:[function(require,module,exports){ -(function (global){ -"use strict"; -var RuntimeConfigImpl = (function () { - function RuntimeConfigImpl() { - this._headers = null; - this._defaultCachingStore = "session"; - this._defaultCachingTimeoutSeconds = 30; - this._globalCacheDisable = false; - this._useSPRequestExecutor = false; - } - RuntimeConfigImpl.prototype.set = function (config) { - if (config.hasOwnProperty("headers")) { - this._headers = config.headers; - } - if (config.hasOwnProperty("globalCacheDisable")) { - this._globalCacheDisable = config.globalCacheDisable; - } - if (config.hasOwnProperty("defaultCachingStore")) { - this._defaultCachingStore = config.defaultCachingStore; - } - if (config.hasOwnProperty("defaultCachingTimeoutSeconds")) { - this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds; - } - if (config.hasOwnProperty("useSPRequestExecutor")) { - this._useSPRequestExecutor = config.useSPRequestExecutor; - } - if (config.hasOwnProperty("nodeClientOptions")) { - this._useNodeClient = true; - this._useSPRequestExecutor = false; - this._nodeClientData = config.nodeClientOptions; - global._spPageContextInfo = { - webAbsoluteUrl: config.nodeClientOptions.siteUrl, - }; - } - }; - Object.defineProperty(RuntimeConfigImpl.prototype, "headers", { - get: function () { - return this._headers; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingStore", { - get: function () { - return this._defaultCachingStore; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingTimeoutSeconds", { - get: function () { - return this._defaultCachingTimeoutSeconds; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "globalCacheDisable", { - get: function () { - return this._globalCacheDisable; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "useSPRequestExecutor", { - get: function () { - return this._useSPRequestExecutor; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "useNodeFetchClient", { - get: function () { - return this._useNodeClient; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "nodeRequestOptions", { - get: function () { - return this._nodeClientData; - }, - enumerable: true, - configurable: true - }); - return RuntimeConfigImpl; -}()); -exports.RuntimeConfigImpl = RuntimeConfigImpl; -var _runtimeConfig = new RuntimeConfigImpl(); -exports.RuntimeConfig = _runtimeConfig; -function setRuntimeConfig(config) { - _runtimeConfig.set(config); -} -exports.setRuntimeConfig = setRuntimeConfig; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],3:[function(require,module,exports){ -"use strict"; -var collections_1 = require("../collections/collections"); -var util_1 = require("../utils/util"); -var odata_1 = require("../sharepoint/rest/odata"); -var CachedDigest = (function () { - function CachedDigest() { - } - return CachedDigest; -}()); -exports.CachedDigest = CachedDigest; -var DigestCache = (function () { - function DigestCache(_httpClient, _digests) { - if (_digests === void 0) { _digests = new collections_1.Dictionary(); } - this._httpClient = _httpClient; - this._digests = _digests; - } - DigestCache.prototype.getDigest = function (webUrl) { - var self = this; - var cachedDigest = this._digests.get(webUrl); - if (cachedDigest !== null) { - var now = new Date(); - if (now < cachedDigest.expiration) { - return Promise.resolve(cachedDigest.value); - } - } - var url = util_1.Util.combinePaths(webUrl, "/_api/contextinfo"); - return self._httpClient.fetchRaw(url, { - cache: "no-cache", - credentials: "same-origin", - headers: { - "Accept": "application/json;odata=verbose", - "Content-type": "application/json;odata=verbose;charset=utf-8", - }, - method: "POST", - }).then(function (response) { - var parser = new odata_1.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; - self._digests.add(webUrl, newCachedDigest); - return newCachedDigest.value; - }); - }; - DigestCache.prototype.clear = function () { - this._digests.clear(); - }; - return DigestCache; -}()); -exports.DigestCache = DigestCache; - -},{"../collections/collections":1,"../sharepoint/rest/odata":21,"../utils/util":23}],4:[function(require,module,exports){ -(function (global){ -"use strict"; -var FetchClient = (function () { - function FetchClient() { - } - FetchClient.prototype.fetch = function (url, options) { - return global.fetch(url, options); - }; - return FetchClient; -}()); -exports.FetchClient = FetchClient; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}],5:[function(require,module,exports){ -"use strict"; -var fetchclient_1 = require("./fetchclient"); -var digestcache_1 = require("./digestcache"); -var util_1 = require("../utils/util"); -var pnplibconfig_1 = require("../configuration/pnplibconfig"); -var sprequestexecutorclient_1 = require("./sprequestexecutorclient"); -var nodefetchclient_1 = require("./nodefetchclient"); -var HttpClient = (function () { - function HttpClient() { - this._impl = this.getFetchImpl(); - this._digestCache = new digestcache_1.DigestCache(this); - } - HttpClient.prototype.fetch = function (url, options) { - if (options === void 0) { options = {}; } - var self = this; - var opts = util_1.Util.extend(options, { cache: "no-cache", credentials: "same-origin" }, true); - var headers = new Headers(); - this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers); - this.mergeHeaders(headers, options.headers); - 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:1.0.4"); - } - opts = util_1.Util.extend(opts, { headers: headers }); - if (opts.method && opts.method.toUpperCase() !== "GET") { - if (!headers.has("X-RequestDigest")) { - var index = url.indexOf("_api/"); - if (index < 0) { - throw new Error("Unable to determine API url"); - } - var webUrl = url.substr(0, index); - return this._digestCache.getDigest(webUrl) - .then(function (digest) { - headers.append("X-RequestDigest", digest); - return self.fetchRaw(url, opts); - }); - } - } - return self.fetchRaw(url, opts); - }; - HttpClient.prototype.fetchRaw = function (url, options) { - var _this = this; - if (options === void 0) { options = {}; } - var rawHeaders = new Headers(); - this.mergeHeaders(rawHeaders, options.headers); - options = util_1.Util.extend(options, { headers: rawHeaders }); - var retry = function (ctx) { - _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) { - var delay = ctx.delay; - if (response.status !== 429 && response.status !== 503) { - ctx.reject(response); - } - ctx.delay *= 2; - ctx.attempts++; - if (ctx.retryCount <= ctx.attempts) { - ctx.reject(response); - } - setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay); - }); - }; - return new Promise(function (resolve, reject) { - var retryContext = { - attempts: 0, - delay: 100, - reject: reject, - resolve: resolve, - retryCount: 7, - }; - retry.call(_this, retryContext); - }); - }; - HttpClient.prototype.get = function (url, options) { - if (options === void 0) { options = {}; } - var opts = util_1.Util.extend(options, { method: "GET" }); - return this.fetch(url, opts); - }; - HttpClient.prototype.post = function (url, options) { - if (options === void 0) { options = {}; } - var opts = util_1.Util.extend(options, { method: "POST" }); - return this.fetch(url, opts); - }; - HttpClient.prototype.getFetchImpl = function () { - if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) { - return new sprequestexecutorclient_1.SPRequestExecutorClient(); - } - else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) { - var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions; - return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret); - } - else { - return new fetchclient_1.FetchClient(); - } - }; - HttpClient.prototype.mergeHeaders = function (target, source) { - if (typeof source !== "undefined" && source !== null) { - var temp = new Request("", { headers: source }); - temp.headers.forEach(function (value, name) { - target.append(name, value); - }); - } - }; - return HttpClient; -}()); -exports.HttpClient = HttpClient; - -},{"../configuration/pnplibconfig":2,"../utils/util":23,"./digestcache":3,"./fetchclient":4,"./nodefetchclient":6,"./sprequestexecutorclient":7}],6:[function(require,module,exports){ -"use strict"; -var NodeFetchClient = (function () { - function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) { - if (_realm === void 0) { _realm = ""; } - this.siteUrl = siteUrl; - this._clientId = _clientId; - this._clientSecret = _clientSecret; - this._realm = _realm; - } - NodeFetchClient.prototype.fetch = function (url, options) { - throw new Error("Using NodeFetchClient in the browser is not supported."); - }; - return NodeFetchClient; -}()); -exports.NodeFetchClient = NodeFetchClient; - -},{}],7:[function(require,module,exports){ -"use strict"; -var util_1 = require("../utils/util"); -var SPRequestExecutorClient = (function () { - function SPRequestExecutorClient() { - this.convertToResponse = function (spResponse) { - var responseHeaders = new Headers(); - for (var h in spResponse.headers) { - if (spResponse.headers[h]) { - responseHeaders.append(h, spResponse.headers[h]); - } - } - return new Response(spResponse.body, { - headers: responseHeaders, - status: spResponse.statusCode, - statusText: spResponse.statusText, - }); - }; - } - SPRequestExecutorClient.prototype.fetch = function (url, options) { - var _this = this; - if (typeof SP === "undefined" || typeof SP.RequestExecutor === "undefined") { - throw new Error("SP.RequestExecutor is undefined. " + - "Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library."); - } - var addinWebUrl = url.substring(0, url.indexOf("/_api")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp; - if (options.headers && options.headers instanceof Headers) { - iterator = options.headers.entries(); - temp = iterator.next(); - while (!temp.done) { - headers[temp.value[0]] = temp.value[1]; - temp = iterator.next(); - } - } - else { - headers = options.headers; - } - return new Promise(function (resolve, reject) { - var requestOptions = { - error: function (error) { - reject(_this.convertToResponse(error)); - }, - headers: headers, - method: options.method, - success: function (response) { - resolve(_this.convertToResponse(response)); - }, - url: url, - }; - if (options.body) { - util_1.Util.extend(requestOptions, { body: options.body }); - } - else { - util_1.Util.extend(requestOptions, { binaryStringRequestBody: true }); - } - executor.executeAsync(requestOptions); - }); - }; - return SPRequestExecutorClient; -}()); -exports.SPRequestExecutorClient = SPRequestExecutorClient; - -},{"../utils/util":23}],8:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../util"); -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectComposedLook = (function (_super) { - __extends(ObjectComposedLook, _super); - function ObjectComposedLook() { - _super.call(this, "ComposedLook"); - } - ObjectComposedLook.prototype.ProvisionObjects = function (object) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var colorPaletteUrl = object.ColorPaletteUrl ? util_1.Util.replaceUrlTokens(object.ColorPaletteUrl) : ""; - var fontSchemeUrl = object.FontSchemeUrl ? util_1.Util.replaceUrlTokens(object.FontSchemeUrl) : ""; - var backgroundImageUrl = object.BackgroundImageUrl ? util_1.Util.replaceUrlTokens(object.BackgroundImageUrl) : null; - web.applyTheme(util_1.Util.getRelativeUrl(colorPaletteUrl), util_1.Util.getRelativeUrl(fontSchemeUrl), backgroundImageUrl, true); - web.update(); - clientContext.executeQueryAsync(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }); - }; - return ObjectComposedLook; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectComposedLook = ObjectComposedLook; - -},{"../util":20,"./objecthandlerbase":12}],9:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectCustomActions = (function (_super) { - __extends(ObjectCustomActions, _super); - function ObjectCustomActions() { - _super.call(this, "CustomActions"); - } - ObjectCustomActions.prototype.ProvisionObjects = function (customactions) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var userCustomActions = clientContext.get_web().get_userCustomActions(); - clientContext.load(userCustomActions); - clientContext.executeQueryAsync(function () { - customactions.forEach(function (obj) { - var objExists = userCustomActions.get_data().filter(function (userCustomAction) { - return userCustomAction.get_title() === obj.Title; - }).length > 0; - if (!objExists) { - var objCreationInformation = userCustomActions.add(); - if (obj.Description) { - objCreationInformation.set_description(obj.Description); - } - if (obj.CommandUIExtension) { - objCreationInformation.set_commandUIExtension(obj.CommandUIExtension); - } - if (obj.Group) { - objCreationInformation.set_group(obj.Group); - } - if (obj.Title) { - objCreationInformation.set_title(obj.Title); - } - if (obj.Url) { - objCreationInformation.set_url(obj.Url); - } - if (obj.ScriptBlock) { - objCreationInformation.set_scriptBlock(obj.ScriptBlock); - } - if (obj.ScriptSrc) { - objCreationInformation.set_scriptSrc(obj.ScriptSrc); - } - if (obj.Location) { - objCreationInformation.set_location(obj.Location); - } - if (obj.ImageUrl) { - objCreationInformation.set_imageUrl(obj.ImageUrl); - } - if (obj.Name) { - objCreationInformation.set_name(obj.Name); - } - if (obj.RegistrationId) { - objCreationInformation.set_registrationId(obj.RegistrationId); - } - if (obj.RegistrationType) { - objCreationInformation.set_registrationType(obj.RegistrationType); - } - if (obj.Rights) { - objCreationInformation.set_rights(obj.Rights); - } - if (obj.Sequence) { - objCreationInformation.set_sequence(obj.Sequence); - } - objCreationInformation.update(); - } - }); - clientContext.executeQueryAsync(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }); - }; - return ObjectCustomActions; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectCustomActions = ObjectCustomActions; - -},{"./objecthandlerbase":12}],10:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectFeatures = (function (_super) { - __extends(ObjectFeatures, _super); - function ObjectFeatures() { - _super.call(this, "Features"); - } - ObjectFeatures.prototype.ProvisionObjects = function (features) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var webFeatures = web.get_features(); - features.forEach(function (f) { - if (f.Deactivate === true) { - webFeatures.remove(new SP.Guid(f.ID), true); - } - else { - webFeatures.add(new SP.Guid(f.ID), true, SP.FeatureDefinitionScope.none); - } - }); - web.update(); - clientContext.load(webFeatures); - clientContext.executeQueryAsync(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }); - }; - return ObjectFeatures; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectFeatures = ObjectFeatures; - -},{"./objecthandlerbase":12}],11:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var CoreUtil = require("../../../utils/util"); -var util_1 = require("../util"); -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectFiles = (function (_super) { - __extends(ObjectFiles, _super); - function ObjectFiles() { - _super.call(this, "Files"); - } - ObjectFiles.prototype.ProvisionObjects = function (objects) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var fileInfos = []; - var promises = []; - objects.forEach(function (obj, index) { - promises.push(_this.httpClient.fetchRaw(util_1.Util.replaceUrlTokens(obj.Src)).then(function (response) { - return response.text(); - })); - }); - Promise.all(promises).then(function (responses) { - responses.forEach(function (response, index) { - var obj = objects[index]; - var filename = _this.GetFilenameFromFilePath(obj.Dest); - var webServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl; - var folder = web.getFolderByServerRelativeUrl(webServerRelativeUrl + "/" + _this.GetFolderFromFilePath(obj.Dest)); - var fi = { - Contents: response, - Dest: obj.Dest, - Filename: filename, - Folder: folder, - Instance: null, - Overwrite: false, - Properties: [], - RemoveExistingWebParts: true, - ServerRelativeUrl: obj.Dest, - Src: obj.Src, - Views: [], - WebParts: [], - }; - CoreUtil.Util.extend(fi, obj); - if (fi.Filename.indexOf("Form.aspx") !== -1) { - return; - } - var objCreationInformation = new SP.FileCreationInformation(); - objCreationInformation.set_overwrite(fi.Overwrite); - objCreationInformation.set_url(fi.Filename); - objCreationInformation.set_content(new SP.Base64EncodedByteArray()); - for (var i = 0; i < fi.Contents.length; i++) { - objCreationInformation.get_content().append(fi.Contents.charCodeAt(i)); - } - clientContext.load(fi.Folder.get_files().add(objCreationInformation)); - fileInfos.push(fi); - }); - }); - clientContext.executeQueryAsync(function () { - promises = []; - fileInfos.forEach(function (fi) { - if (fi.Properties && Object.keys(fi.Properties).length > 0) { - promises.push(_this.ApplyFileProperties(fi.Dest, fi.Properties)); - } - if (fi.WebParts && fi.WebParts.length > 0) { - promises.push(_this.AddWebPartsToWebPartPage(fi.Dest, fi.Src, fi.WebParts, fi.RemoveExistingWebParts)); - } - }); - Promise.all(promises).then(function () { - _this.ModifyHiddenViews(objects).then(function (value) { - _super.prototype.scope_ended.call(_this); - resolve(value); - }, function (error) { - _super.prototype.scope_ended.call(_this); - reject(error); - }); - }); - }, function (error) { - _super.prototype.scope_ended.call(_this); - reject(error); - }); - }); - }; - ObjectFiles.prototype.RemoveWebPartsFromFileIfSpecified = function (clientContext, limitedWebPartManager, shouldRemoveExisting) { - return new Promise(function (resolve, reject) { - if (!shouldRemoveExisting) { - resolve(); - } - var existingWebParts = limitedWebPartManager.get_webParts(); - clientContext.load(existingWebParts); - clientContext.executeQueryAsync(function () { - existingWebParts.get_data().forEach(function (wp) { - wp.deleteWebPart(); - }); - clientContext.load(existingWebParts); - clientContext.executeQueryAsync(resolve, reject); - }, reject); - }); - }; - ObjectFiles.prototype.GetWebPartXml = function (webParts) { - var _this = this; - return new Promise(function (resolve, reject) { - var promises = []; - webParts.forEach(function (wp, index) { - if (wp.Contents.FileUrl) { - var fileUrl = util_1.Util.replaceUrlTokens(wp.Contents.FileUrl); - promises.push(_this.httpClient.fetchRaw(fileUrl).then(function (response) { - return response.text(); - })); - } - else { - promises.push((function () { - return new Promise(function (res, rej) { - res(); - }); - })()); - } - }); - Promise.all(promises).then(function (responses) { - responses.forEach(function (response, index) { - var wp = webParts[index]; - if (wp !== null && response && response.length > 0) { - wp.Contents.Xml = response; - } - }); - resolve(webParts); - }); - }); - }; - ObjectFiles.prototype.AddWebPartsToWebPartPage = function (dest, src, webParts, shouldRemoveExisting) { - var _this = this; - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var fileServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + "/" + dest; - var file = web.getFileByServerRelativeUrl(fileServerRelativeUrl); - clientContext.load(file); - clientContext.executeQueryAsync(function () { - var limitedWebPartManager = file.getLimitedWebPartManager(SP.WebParts.PersonalizationScope.shared); - _this.RemoveWebPartsFromFileIfSpecified(clientContext, limitedWebPartManager, shouldRemoveExisting).then(function () { - _this.GetWebPartXml(webParts).then(function (webPartsWithXml) { - webPartsWithXml.forEach(function (wp) { - if (!wp.Contents.Xml) { - return; - } - var oWebPartDefinition = limitedWebPartManager.importWebPart(util_1.Util.replaceUrlTokens(wp.Contents.Xml)); - var oWebPart = oWebPartDefinition.get_webPart(); - limitedWebPartManager.addWebPart(oWebPart, wp.Zone, wp.Order); - }); - clientContext.executeQueryAsync(resolve, resolve); - }); - }); - }, resolve); - }); - }; - ObjectFiles.prototype.ApplyFileProperties = function (dest, fileProperties) { - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var fileServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + "/" + dest; - var file = web.getFileByServerRelativeUrl(fileServerRelativeUrl); - var listItemAllFields = file.get_listItemAllFields(); - Object.keys(fileProperties).forEach(function (key) { - listItemAllFields.set_item(key, fileProperties[key]); - }); - listItemAllFields.update(); - clientContext.executeQueryAsync(resolve, resolve); - }); - }; - ObjectFiles.prototype.GetViewFromCollectionByUrl = function (viewCollection, url) { - var serverRelativeUrl = _spPageContextInfo.webServerRelativeUrl + "/" + url; - var viewCollectionEnumerator = viewCollection.getEnumerator(); - while (viewCollectionEnumerator.moveNext()) { - var view = viewCollectionEnumerator.get_current(); - if (view.get_serverRelativeUrl().toString().toLowerCase() === serverRelativeUrl.toLowerCase()) { - return view; - } - } - return null; - }; - ObjectFiles.prototype.ModifyHiddenViews = function (objects) { - var _this = this; - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - var mapping = {}; - var lists = []; - var listViewCollections = []; - objects.forEach(function (obj) { - if (!obj.Views) { - return; - } - obj.Views.forEach(function (v) { - mapping[v.List] = mapping[v.List] || []; - mapping[v.List].push(CoreUtil.Util.extend(v, { "Url": obj.Dest })); - }); - }); - Object.keys(mapping).forEach(function (l, index) { - lists.push(web.get_lists().getByTitle(l)); - listViewCollections.push(web.get_lists().getByTitle(l).get_views()); - clientContext.load(lists[index]); - clientContext.load(listViewCollections[index]); - }); - clientContext.executeQueryAsync(function () { - Object.keys(mapping).forEach(function (l, index) { - var views = mapping[l]; - var list = lists[index]; - var viewCollection = listViewCollections[index]; - views.forEach(function (v) { - var view = _this.GetViewFromCollectionByUrl(viewCollection, v.Url); - if (view == null) { - return; - } - if (v.Paged) { - view.set_paged(v.Paged); - } - if (v.Query) { - view.set_viewQuery(v.Query); - } - if (v.RowLimit) { - view.set_rowLimit(v.RowLimit); - } - if (v.ViewFields && v.ViewFields.length > 0) { - var columns_1 = view.get_viewFields(); - columns_1.removeAll(); - v.ViewFields.forEach(function (vf) { - columns_1.add(vf); - }); - } - view.update(); - }); - clientContext.load(viewCollection); - list.update(); - }); - clientContext.executeQueryAsync(resolve, resolve); - }, resolve); - }); - }; - ObjectFiles.prototype.GetFolderFromFilePath = function (filePath) { - var split = filePath.split("/"); - return split.splice(0, split.length - 1).join("/"); - }; - ObjectFiles.prototype.GetFilenameFromFilePath = function (filePath) { - var split = filePath.split("/"); - return split[split.length - 1]; - }; - return ObjectFiles; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectFiles = ObjectFiles; -; - -},{"../../../utils/util":23,"../util":20,"./objecthandlerbase":12}],12:[function(require,module,exports){ -"use strict"; -var httpclient_1 = require("../../../net/httpclient"); -var logging_1 = require("../../../utils/logging"); -var ObjectHandlerBase = (function () { - function ObjectHandlerBase(name) { - this.name = name; - this.httpClient = new httpclient_1.HttpClient(); - } - ObjectHandlerBase.prototype.ProvisionObjects = function (objects, parameters) { - return new Promise(function (resolve, reject) { resolve("Not implemented."); }); - }; - ObjectHandlerBase.prototype.scope_started = function () { - logging_1.Logger.write(this.name + ": Code execution scope started"); - }; - ObjectHandlerBase.prototype.scope_ended = function () { - logging_1.Logger.write(this.name + ": Code execution scope stopped"); - }; - return ObjectHandlerBase; -}()); -exports.ObjectHandlerBase = ObjectHandlerBase; - -},{"../../../net/httpclient":5,"../../../utils/logging":22}],13:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var sequencer_1 = require("../sequencer/sequencer"); -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectLists = (function (_super) { - __extends(ObjectLists, _super); - function ObjectLists() { - _super.call(this, "Lists"); - } - ObjectLists.prototype.ProvisionObjects = function (objects) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var lists = clientContext.get_web().get_lists(); - var listInstances = []; - clientContext.load(lists); - clientContext.executeQueryAsync(function () { - objects.forEach(function (obj, index) { - var existingObj = lists.get_data().filter(function (list) { - return list.get_title() === obj.Title; - })[0]; - if (existingObj) { - if (obj.Description) { - existingObj.set_description(obj.Description); - } - if (obj.EnableVersioning !== undefined) { - existingObj.set_enableVersioning(obj.EnableVersioning); - } - if (obj.EnableMinorVersions !== undefined) { - existingObj.set_enableMinorVersions(obj.EnableMinorVersions); - } - if (obj.EnableModeration !== undefined) { - existingObj.set_enableModeration(obj.EnableModeration); - } - if (obj.EnableFolderCreation !== undefined) { - existingObj.set_enableFolderCreation(obj.EnableFolderCreation); - } - if (obj.EnableAttachments !== undefined) { - existingObj.set_enableAttachments(obj.EnableAttachments); - } - if (obj.NoCrawl !== undefined) { - existingObj.set_noCrawl(obj.NoCrawl); - } - if (obj.DefaultDisplayFormUrl) { - existingObj.set_defaultDisplayFormUrl(obj.DefaultDisplayFormUrl); - } - if (obj.DefaultEditFormUrl) { - existingObj.set_defaultEditFormUrl(obj.DefaultEditFormUrl); - } - if (obj.DefaultNewFormUrl) { - existingObj.set_defaultNewFormUrl(obj.DefaultNewFormUrl); - } - if (obj.DraftVersionVisibility) { - existingObj.set_draftVersionVisibility(SP.DraftVisibilityType[obj.DraftVersionVisibility]); - } - if (obj.ImageUrl) { - existingObj.set_imageUrl(obj.ImageUrl); - } - if (obj.Hidden !== undefined) { - existingObj.set_hidden(obj.Hidden); - } - if (obj.ForceCheckout !== undefined) { - existingObj.set_forceCheckout(obj.ForceCheckout); - } - existingObj.update(); - listInstances.push(existingObj); - clientContext.load(listInstances[index]); - } - else { - var objCreationInformation = new SP.ListCreationInformation(); - if (obj.Description) { - objCreationInformation.set_description(obj.Description); - } - if (obj.OnQuickLaunch !== undefined) { - var value = obj.OnQuickLaunch ? SP.QuickLaunchOptions.on : SP.QuickLaunchOptions.off; - objCreationInformation.set_quickLaunchOption(value); - } - if (obj.TemplateType) { - objCreationInformation.set_templateType(obj.TemplateType); - } - if (obj.Title) { - objCreationInformation.set_title(obj.Title); - } - if (obj.Url) { - objCreationInformation.set_url(obj.Url); - } - var createdList = lists.add(objCreationInformation); - if (obj.EnableVersioning !== undefined) { - createdList.set_enableVersioning(obj.EnableVersioning); - } - if (obj.EnableMinorVersions !== undefined) { - createdList.set_enableMinorVersions(obj.EnableMinorVersions); - } - if (obj.EnableModeration !== undefined) { - createdList.set_enableModeration(obj.EnableModeration); - } - if (obj.EnableFolderCreation !== undefined) { - createdList.set_enableFolderCreation(obj.EnableFolderCreation); - } - if (obj.EnableAttachments !== undefined) { - createdList.set_enableAttachments(obj.EnableAttachments); - } - if (obj.NoCrawl !== undefined) { - createdList.set_noCrawl(obj.NoCrawl); - } - if (obj.DefaultDisplayFormUrl) { - createdList.set_defaultDisplayFormUrl(obj.DefaultDisplayFormUrl); - } - if (obj.DefaultEditFormUrl) { - createdList.set_defaultEditFormUrl(obj.DefaultEditFormUrl); - } - if (obj.DefaultNewFormUrl) { - createdList.set_defaultNewFormUrl(obj.DefaultNewFormUrl); - } - if (obj.DraftVersionVisibility) { - var value = SP.DraftVisibilityType[obj.DraftVersionVisibility.toLocaleLowerCase()]; - createdList.set_draftVersionVisibility(value); - } - if (obj.ImageUrl) { - createdList.set_imageUrl(obj.ImageUrl); - } - if (obj.Hidden !== undefined) { - createdList.set_hidden(obj.Hidden); - } - if (obj.ForceCheckout !== undefined) { - createdList.set_forceCheckout(obj.ForceCheckout); - } - listInstances.push(createdList); - clientContext.load(listInstances[index]); - } - }); - clientContext.executeQueryAsync(function () { - var sequencer = new sequencer_1.Sequencer([ - _this.ApplyContentTypeBindings, - _this.ApplyListInstanceFieldRefs, - _this.ApplyFields, - _this.ApplyLookupFields, - _this.ApplyListSecurity, - _this.CreateViews, - _this.InsertDataRows, - _this.CreateFolders, - ], { ClientContext: clientContext, ListInstances: listInstances, Objects: objects }, _this); - sequencer.execute().then(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }); - }; - ObjectLists.prototype.EnsureLocationBasedMetadataDefaultsReceiver = function (clientContext, list) { - var eventReceivers = list.get_eventReceivers(); - var eventRecCreationInfo = new SP.EventReceiverDefinitionCreationInformation(); - eventRecCreationInfo.set_receiverName("LocationBasedMetadataDefaultsReceiver ItemAdded"); - eventRecCreationInfo.set_synchronization(1); - eventRecCreationInfo.set_sequenceNumber(1000); - eventRecCreationInfo.set_receiverAssembly("Microsoft.Office.DocumentManagement, Version=15.0.0.0, Culture=neutral, " + - "PublicKeyToken=71e9bce111e9429c"); - eventRecCreationInfo.set_receiverClass("Microsoft.Office.DocumentManagement.LocationBasedMetadataDefaultsReceiver"); - eventRecCreationInfo.set_eventType(SP.EventReceiverType.itemAdded); - eventReceivers.add(eventRecCreationInfo); - list.update(); - }; - ObjectLists.prototype.CreateFolders = function (params) { - var _this = this; - return new Promise(function (resolve, reject) { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (!obj.Folders) { - return; - } - var folderServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + "/" + obj.Url; - var rootFolder = l.get_rootFolder(); - var metadataDefaults = ""; - var setMetadataDefaults = false; - obj.Folders.forEach(function (f) { - var folderUrl = folderServerRelativeUrl + "/" + f.Name; - rootFolder.get_folders().add(folderUrl); - if (f.DefaultValues) { - var keys = Object.keys(f.DefaultValues).length; - if (keys > 0) { - metadataDefaults += ""; - Object.keys(f.DefaultValues).forEach(function (key) { - metadataDefaults += "" + f.DefaultValues[key] + ""; - }); - metadataDefaults += ""; - } - setMetadataDefaults = true; - } - }); - metadataDefaults += ""; - if (setMetadataDefaults) { - var metadataDefaultsFileCreateInfo = new SP.FileCreationInformation(); - metadataDefaultsFileCreateInfo.set_url(folderServerRelativeUrl + "/Forms/client_LocationBasedDefaults.html"); - metadataDefaultsFileCreateInfo.set_content(new SP.Base64EncodedByteArray()); - metadataDefaultsFileCreateInfo.set_overwrite(true); - for (var i = 0; i < metadataDefaults.length; i++) { - metadataDefaultsFileCreateInfo.get_content().append(metadataDefaults.charCodeAt(i)); - } - rootFolder.get_files().add(metadataDefaultsFileCreateInfo); - _this.EnsureLocationBasedMetadataDefaultsReceiver(params.ClientContext, l); - } - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }); - }; - ObjectLists.prototype.ApplyContentTypeBindings = function (params) { - return new Promise(function (resolve, reject) { - var webCts = params.ClientContext.get_site().get_rootWeb().get_contentTypes(); - var listCts = []; - params.ListInstances.forEach(function (l, index) { - listCts.push(l.get_contentTypes()); - params.ClientContext.load(listCts[index], "Include(Name,Id)"); - if (params.Objects[index].ContentTypeBindings) { - l.set_contentTypesEnabled(true); - l.update(); - } - }); - params.ClientContext.load(webCts); - params.ClientContext.executeQueryAsync(function () { - params.ListInstances.forEach(function (list, index) { - var obj = params.Objects[index]; - if (!obj.ContentTypeBindings) { - return; - } - var listContentTypes = listCts[index]; - var existingContentTypes = new Array(); - if (obj.RemoveExistingContentTypes && obj.ContentTypeBindings.length > 0) { - listContentTypes.get_data().forEach(function (ct) { - existingContentTypes.push(ct); - }); - } - obj.ContentTypeBindings.forEach(function (ctb) { - listContentTypes.addExistingContentType(webCts.getById(ctb.ContentTypeId)); - }); - if (obj.RemoveExistingContentTypes && obj.ContentTypeBindings.length > 0) { - for (var j = 0; j < existingContentTypes.length; j++) { - var ect = existingContentTypes[j]; - ect.deleteObject(); - } - } - list.update(); - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }, resolve); - }); - }; - ObjectLists.prototype.ApplyListInstanceFieldRefs = function (params) { - return new Promise(function (resolve, reject) { - var siteFields = params.ClientContext.get_site().get_rootWeb().get_fields(); - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (obj.FieldRefs) { - obj.FieldRefs.forEach(function (fr) { - var field = siteFields.getByInternalNameOrTitle(fr.Name); - l.get_fields().add(field); - }); - l.update(); - } - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }); - }; - ObjectLists.prototype.ApplyFields = function (params) { - var _this = this; - return new Promise(function (resolve, reject) { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (obj.Fields) { - obj.Fields.forEach(function (f) { - var fieldXml = _this.GetFieldXml(f, params.ListInstances, l); - var fieldType = _this.GetFieldXmlAttr(fieldXml, "Type"); - if (fieldType !== "Lookup" && fieldType !== "LookupMulti") { - l.get_fields().addFieldAsXml(fieldXml, true, SP.AddFieldOptions.addToAllContentTypes); - } - }); - l.update(); - } - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }); - }; - ObjectLists.prototype.ApplyLookupFields = function (params) { - var _this = this; - return new Promise(function (resolve, reject) { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (obj.Fields) { - obj.Fields.forEach(function (f) { - var fieldXml = _this.GetFieldXml(f, params.ListInstances, l); - if (!fieldXml) { - return; - } - var fieldType = _this.GetFieldXmlAttr(fieldXml, "Type"); - if (fieldType === "Lookup" || fieldType === "LookupMulti") { - l.get_fields().addFieldAsXml(fieldXml, true, SP.AddFieldOptions.addToAllContentTypes); - } - }); - l.update(); - } - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }); - }; - ObjectLists.prototype.GetFieldXmlAttr = function (fieldXml, attr) { - var regex = new RegExp(attr + '=[\'|\"](?:(.+?))[\'|\"]'); - var match = regex.exec(fieldXml); - return match[1]; - }; - ObjectLists.prototype.GetFieldXml = function (field, lists, list) { - var fieldXml = ""; - if (!field.SchemaXml) { - var properties_1 = []; - Object.keys(field).forEach(function (prop) { - var value = field[prop]; - if (prop === "List") { - var targetList = lists.filter(function (v) { - return v.get_title() === value; - }); - if (targetList.length > 0) { - value = "{" + targetList[0].get_id().toString() + "}"; - } - else { - return null; - } - properties_1.push(prop + "=\"" + value + "\""); - } - }); - fieldXml = ""; - if (field.Type === "Calculated") { - fieldXml += "" + field.Formula + ""; - } - fieldXml += ""; - } - return fieldXml; - }; - ObjectLists.prototype.ApplyListSecurity = function (params) { - return new Promise(function (resolve, reject) { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (!obj.Security) { - return; - } - if (obj.Security.BreakRoleInheritance) { - l.breakRoleInheritance(obj.Security.CopyRoleAssignments, obj.Security.ClearSubscopes); - l.update(); - params.ClientContext.load(l.get_roleAssignments()); - } - }); - var web = params.ClientContext.get_web(); - var allProperties = web.get_allProperties(); - var siteGroups = web.get_siteGroups(); - var roleDefinitions = web.get_roleDefinitions(); - params.ClientContext.load(allProperties); - params.ClientContext.load(roleDefinitions); - params.ClientContext.executeQueryAsync(function () { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (!obj.Security) { - return; - } - obj.Security.RoleAssignments.forEach(function (ra) { - var roleDef = null; - if (typeof ra.RoleDefinition === "number") { - roleDef = roleDefinitions.getById(ra.RoleDefinition); - } - else { - roleDef = roleDefinitions.getByName(ra.RoleDefinition); - } - var roleBindings = SP.RoleDefinitionBindingCollection.newObject(params.ClientContext); - roleBindings.add(roleDef); - var principal = null; - if (ra.Principal.match(/\{[A-Za-z]*\}+/g)) { - var token = ra.Principal.substring(1, ra.Principal.length - 1); - var groupId = allProperties.get_fieldValues()[("vti_" + token)]; - principal = siteGroups.getById(groupId); - } - else { - principal = siteGroups.getByName(principal); - } - l.get_roleAssignments().add(principal, roleBindings); - }); - l.update(); - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }, resolve); - }); - }; - ObjectLists.prototype.CreateViews = function (params) { - return new Promise(function (resolve, reject) { - var listViewCollections = []; - params.ListInstances.forEach(function (l, index) { - listViewCollections.push(l.get_views()); - params.ClientContext.load(listViewCollections[index]); - }); - params.ClientContext.executeQueryAsync(function () { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (!obj.Views) { - return; - } - listViewCollections.push(l.get_views()); - params.ClientContext.load(listViewCollections[index]); - obj.Views.forEach(function (v) { - var viewExists = listViewCollections[index].get_data().filter(function (ev) { - if (obj.RemoveExistingViews && obj.Views.length > 0) { - ev.deleteObject(); - return false; - } - return ev.get_title() === v.Title; - }).length > 0; - if (viewExists) { - var view = listViewCollections[index].getByTitle(v.Title); - if (v.Paged) { - view.set_paged(v.Paged); - } - if (v.Query) { - view.set_viewQuery(v.Query); - } - if (v.RowLimit) { - view.set_rowLimit(v.RowLimit); - } - if (v.ViewFields && v.ViewFields.length > 0) { - var columns_1 = view.get_viewFields(); - columns_1.removeAll(); - v.ViewFields.forEach(function (vf) { - columns_1.add(vf); - }); - } - if (v.Scope) { - view.set_scope(v.Scope); - } - view.update(); - } - else { - var viewCreationInformation = new SP.ViewCreationInformation(); - if (v.Title) { - viewCreationInformation.set_title(v.Title); - } - if (v.PersonalView) { - viewCreationInformation.set_personalView(v.PersonalView); - } - if (v.Paged) { - viewCreationInformation.set_paged(v.Paged); - } - if (v.Query) { - viewCreationInformation.set_query(v.Query); - } - if (v.RowLimit) { - viewCreationInformation.set_rowLimit(v.RowLimit); - } - if (v.SetAsDefaultView) { - viewCreationInformation.set_setAsDefaultView(v.SetAsDefaultView); - } - if (v.ViewFields) { - viewCreationInformation.set_viewFields(v.ViewFields); - } - if (v.ViewTypeKind) { - viewCreationInformation.set_viewTypeKind(SP.ViewType.html); - } - var view = l.get_views().add(viewCreationInformation); - if (v.Scope) { - view.set_scope(v.Scope); - view.update(); - } - l.update(); - } - params.ClientContext.load(l.get_views()); - }); - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }, resolve); - }); - }; - ObjectLists.prototype.InsertDataRows = function (params) { - return new Promise(function (resolve, reject) { - params.ListInstances.forEach(function (l, index) { - var obj = params.Objects[index]; - if (obj.DataRows) { - obj.DataRows.forEach(function (r) { - var item = l.addItem(new SP.ListItemCreationInformation()); - Object.keys(r).forEach(function (key) { - item.set_item(key, r[key]); - }); - item.update(); - params.ClientContext.load(item); - }); - } - }); - params.ClientContext.executeQueryAsync(resolve, resolve); - }); - }; - return ObjectLists; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectLists = ObjectLists; - -},{"../sequencer/sequencer":19,"./objecthandlerbase":12}],14:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../util"); -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectNavigation = (function (_super) { - __extends(ObjectNavigation, _super); - function ObjectNavigation() { - _super.call(this, "Navigation"); - } - ObjectNavigation.prototype.ProvisionObjects = function (object) { - var _this = this; - _super.prototype.scope_started.call(this); - var clientContext = SP.ClientContext.get_current(); - var navigation = clientContext.get_web().get_navigation(); - return new Promise(function (resolve, reject) { - _this.ConfigureQuickLaunch(object.QuickLaunch, clientContext, _this.httpClient, navigation).then(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - reject(); - }); - }); - }; - ObjectNavigation.prototype.getNodeFromCollectionByTitle = function (nodeCollection, title) { - var f = nodeCollection.filter(function (val) { - return val.get_title() === title; - }); - return f[0] || null; - }; - ; - ObjectNavigation.prototype.ConfigureQuickLaunch = function (nodes, clientContext, httpClient, navigation) { - var _this = this; - return new Promise(function (resolve, reject) { - if (nodes.length === 0) { - resolve(); - } - else { - var quickLaunchNodeCollection_1 = navigation.get_quickLaunch(); - clientContext.load(quickLaunchNodeCollection_1); - clientContext.executeQueryAsync(function () { - var temporaryQuickLaunch = []; - var index = quickLaunchNodeCollection_1.get_count() - 1; - while (index >= 0) { - var oldNode = quickLaunchNodeCollection_1.itemAt(index); - temporaryQuickLaunch.push(oldNode); - oldNode.deleteObject(); - index--; - } - clientContext.executeQueryAsync(function () { - nodes.forEach(function (n) { - var existingNode = _this.getNodeFromCollectionByTitle(temporaryQuickLaunch, n.Title); - var newNode = new SP.NavigationNodeCreationInformation(); - newNode.set_title(n.Title); - newNode.set_url(existingNode ? existingNode.get_url() : util_1.Util.replaceUrlTokens(n.Url)); - newNode.set_asLastNode(true); - quickLaunchNodeCollection_1.add(newNode); - }); - clientContext.executeQueryAsync(function () { - httpClient.get(_spPageContextInfo.webAbsoluteUrl + "/_api/web/Navigation/QuickLaunch").then(function (response) { - response.json().then(function (json) { - json.value.forEach(function (d) { - var node = navigation.getNodeById(d.Id); - var childrenNodeCollection = node.get_children(); - var parentNode = nodes.filter(function (value) { return value.Title === d.Title; })[0]; - if (parentNode && parentNode.Children) { - parentNode.Children.forEach(function (n) { - var existingNode = _this.getNodeFromCollectionByTitle(temporaryQuickLaunch, n.Title); - var newNode = new SP.NavigationNodeCreationInformation(); - newNode.set_title(n.Title); - newNode.set_url(existingNode - ? existingNode.get_url() - : util_1.Util.replaceUrlTokens(n.Url)); - newNode.set_asLastNode(true); - childrenNodeCollection.add(newNode); - }); - } - }); - clientContext.executeQueryAsync(resolve, resolve); - }); - }); - }, resolve); - }); - }); - } - }); - }; - return ObjectNavigation; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectNavigation = ObjectNavigation; - -},{"../util":20,"./objecthandlerbase":12}],15:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../util"); -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectPropertyBagEntries = (function (_super) { - __extends(ObjectPropertyBagEntries, _super); - function ObjectPropertyBagEntries() { - _super.call(this, "PropertyBagEntries"); - } - ObjectPropertyBagEntries.prototype.ProvisionObjects = function (entries) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - if (!entries || entries.length === 0) { - resolve(); - } - else { - var clientContext_1 = SP.ClientContext.get_current(); - var web_1 = clientContext_1.get_web(); - var propBag_1 = web_1.get_allProperties(); - var indexedProperties_1 = []; - for (var i = 0; i < entries.length; i++) { - var entry = entries[i]; - propBag_1.set_item(entry.Key, entry.Value); - if (entry.Indexed) { - indexedProperties_1.push(util_1.Util.encodePropertyKey(entry.Key)); - } - ; - } - ; - web_1.update(); - clientContext_1.load(propBag_1); - clientContext_1.executeQueryAsync(function () { - if (indexedProperties_1.length > 0) { - propBag_1.set_item("vti_indexedpropertykeys", indexedProperties_1.join("|")); - web_1.update(); - clientContext_1.executeQueryAsync(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - } - else { - _super.prototype.scope_ended.call(_this); - resolve(); - } - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - } - }); - }; - return ObjectPropertyBagEntries; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectPropertyBagEntries = ObjectPropertyBagEntries; - -},{"../util":20,"./objecthandlerbase":12}],16:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var objecthandlerbase_1 = require("./objecthandlerbase"); -var ObjectWebSettings = (function (_super) { - __extends(ObjectWebSettings, _super); - function ObjectWebSettings() { - _super.call(this, "WebSettings"); - } - ObjectWebSettings.prototype.ProvisionObjects = function (object) { - var _this = this; - _super.prototype.scope_started.call(this); - return new Promise(function (resolve, reject) { - var clientContext = SP.ClientContext.get_current(); - var web = clientContext.get_web(); - if (object.WelcomePage) { - web.get_rootFolder().set_welcomePage(object.WelcomePage); - web.get_rootFolder().update(); - } - if (object.MasterUrl) { - web.set_masterUrl(object.MasterUrl); - } - if (object.CustomMasterUrl) { - web.set_customMasterUrl(object.CustomMasterUrl); - } - if (object.SaveSiteAsTemplateEnabled !== undefined) { - web.set_saveSiteAsTemplateEnabled(object.SaveSiteAsTemplateEnabled); - } - if (object.QuickLaunchEnabled !== undefined) { - web.set_saveSiteAsTemplateEnabled(object.QuickLaunchEnabled); - } - if (object.TreeViewEnabled !== undefined) { - web.set_treeViewEnabled(object.TreeViewEnabled); - } - web.update(); - clientContext.load(web); - clientContext.executeQueryAsync(function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }, function () { - _super.prototype.scope_ended.call(_this); - resolve(); - }); - }); - }; - return ObjectWebSettings; -}(objecthandlerbase_1.ObjectHandlerBase)); -exports.ObjectWebSettings = ObjectWebSettings; - -},{"./objecthandlerbase":12}],17:[function(require,module,exports){ -"use strict"; -var provisioningstep_1 = require("./provisioningstep"); -var objectnavigation_1 = require("./objecthandlers/objectnavigation"); -var objectpropertybagentries_1 = require("./objecthandlers/objectpropertybagentries"); -var objectfeatures_1 = require("./objecthandlers/objectfeatures"); -var objectwebsettings_1 = require("./objecthandlers/objectwebsettings"); -var objectcomposedlook_1 = require("./objecthandlers/objectcomposedlook"); -var objectcustomactions_1 = require("./objecthandlers/objectcustomactions"); -var objectfiles_1 = require("./objecthandlers/objectfiles"); -var objectlists_1 = require("./objecthandlers/objectlists"); -var util_1 = require("./util"); -var logging_1 = require("../../utils/logging"); -var httpclient_1 = require("../../net/httpclient"); -var Provisioning = (function () { - function Provisioning() { - this.handlers = { - "Navigation": objectnavigation_1.ObjectNavigation, - "PropertyBagEntries": objectpropertybagentries_1.ObjectPropertyBagEntries, - "Features": objectfeatures_1.ObjectFeatures, - "WebSettings": objectwebsettings_1.ObjectWebSettings, - "ComposedLook": objectcomposedlook_1.ObjectComposedLook, - "CustomActions": objectcustomactions_1.ObjectCustomActions, - "Files": objectfiles_1.ObjectFiles, - "Lists": objectlists_1.ObjectLists, - }; - this.httpClient = new httpclient_1.HttpClient(); - } - Provisioning.prototype.applyTemplate = function (path) { - var _this = this; - var url = util_1.Util.replaceUrlTokens(path); - return new Promise(function (resolve, reject) { - _this.httpClient.get(url).then(function (response) { - if (response.ok) { - response.json().then(function (template) { - _this.start(template, Object.keys(template)).then(resolve, reject); - }); - } - else { - reject(response.statusText); - } - }, function (error) { - logging_1.Logger.write("Provisioning: The provided template is invalid", logging_1.Logger.LogLevel.Error); - }); - }); - }; - Provisioning.prototype.start = function (json, queue) { - var _this = this; - return new Promise(function (resolve, reject) { - _this.startTime = new Date().getTime(); - _this.queueItems = []; - queue.forEach(function (q, index) { - if (!_this.handlers[q]) { - return; - } - _this.queueItems.push(new provisioningstep_1.ProvisioningStep(q, index, json[q], json.Parameters, _this.handlers[q])); - }); - var promises = []; - promises.push(new Promise(function (res) { - logging_1.Logger.write("Provisioning: Code execution scope started", logging_1.Logger.LogLevel.Info); - res(); - })); - var index = 1; - while (_this.queueItems[index - 1] !== undefined) { - var i = promises.length - 1; - promises.push(_this.queueItems[index - 1].execute(promises[i])); - index++; - } - ; - Promise.all(promises).then(function (value) { - logging_1.Logger.write("Provisioning: Code execution scope ended", logging_1.Logger.LogLevel.Info); - resolve(value); - }, function (error) { - logging_1.Logger.write("Provisioning: Code execution scope ended" + JSON.stringify(error), logging_1.Logger.LogLevel.Error); - reject(error); - }); - }); - }; - return Provisioning; -}()); -exports.Provisioning = Provisioning; - -},{"../../net/httpclient":5,"../../utils/logging":22,"./objecthandlers/objectcomposedlook":8,"./objecthandlers/objectcustomactions":9,"./objecthandlers/objectfeatures":10,"./objecthandlers/objectfiles":11,"./objecthandlers/objectlists":13,"./objecthandlers/objectnavigation":14,"./objecthandlers/objectpropertybagentries":15,"./objecthandlers/objectwebsettings":16,"./provisioningstep":18,"./util":20}],18:[function(require,module,exports){ -"use strict"; -var ProvisioningStep = (function () { - function ProvisioningStep(name, index, objects, parameters, handler) { - this.name = name; - this.index = index; - this.objects = objects; - this.parameters = parameters; - this.handler = handler; - } - ProvisioningStep.prototype.execute = function (dependentPromise) { - var _this = this; - var _handler = new this.handler(); - if (!dependentPromise) { - return _handler.ProvisionObjects(this.objects, this.parameters); - } - return new Promise(function (resolve, reject) { - dependentPromise.then(function () { - return _handler.ProvisionObjects(_this.objects, _this.parameters).then(resolve, resolve); - }); - }); - }; - return ProvisioningStep; -}()); -exports.ProvisioningStep = ProvisioningStep; - -},{}],19:[function(require,module,exports){ -"use strict"; -var Sequencer = (function () { - function Sequencer(functions, parameter, scope) { - this.functions = functions; - this.parameter = parameter; - this.scope = scope; - } - Sequencer.prototype.execute = function (progressFunction) { - var promiseSequence = Promise.resolve(); - this.functions.forEach(function (sequenceFunction, functionNr) { - promiseSequence = promiseSequence.then(function () { - return sequenceFunction.call(this.scope, this.parameter); - }).then(function (result) { - if (progressFunction) { - progressFunction.call(this, functionNr, this.functions); - } - }); - }, this); - return promiseSequence; - }; - return Sequencer; -}()); -exports.Sequencer = Sequencer; - -},{}],20:[function(require,module,exports){ -"use strict"; -var Util = (function () { - function Util() { - } - Util.getRelativeUrl = function (url) { - return url.replace(document.location.protocol + "//" + document.location.hostname, ""); - }; - Util.replaceUrlTokens = function (url) { - return url.replace(/{site}/g, _spPageContextInfo.webAbsoluteUrl) - .replace(/{sitecollection}/g, _spPageContextInfo.siteAbsoluteUrl) - .replace(/{themegallery}/g, _spPageContextInfo.siteAbsoluteUrl + "/_catalogs/theme/15"); - }; - ; - Util.encodePropertyKey = function (propKey) { - var bytes = []; - for (var i = 0; i < propKey.length; ++i) { - bytes.push(propKey.charCodeAt(i)); - bytes.push(0); - } - var b64encoded = window.btoa(String.fromCharCode.apply(null, bytes)); - return b64encoded; - }; - return Util; -}()); -exports.Util = Util; - -},{}],21:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../../utils/util"); -var logging_1 = require("../../utils/logging"); -var httpclient_1 = require("../../net/httpclient"); -var pnplibconfig_1 = require("../../configuration/pnplibconfig"); -function extractOdataId(candidate) { - if (candidate.hasOwnProperty("odata.id")) { - return candidate["odata.id"]; - } - else if (candidate.hasOwnProperty("__metadata") && candidate.__metadata.hasOwnProperty("id")) { - return candidate.__metadata.id; - } - else { - logging_1.Logger.log({ - data: candidate, - level: logging_1.Logger.LogLevel.Error, - message: "Could not extract odata id in object, you may be using nometadata. Object data logged to logger.", - }); - throw new Error("Could not extract odata id in object, you may be using nometadata. Object data logged to logger."); - } -} -exports.extractOdataId = extractOdataId; -var ODataParserBase = (function () { - function ODataParserBase() { - } - ODataParserBase.prototype.parse = function (r) { - return r.json().then(function (json) { - var result = json; - if (json.hasOwnProperty("d")) { - if (json.d.hasOwnProperty("results")) { - result = json.d.results; - } - else { - result = json.d; - } - } - else if (json.hasOwnProperty("value")) { - result = json.value; - } - return result; - }); - }; - return ODataParserBase; -}()); -exports.ODataParserBase = ODataParserBase; -var ODataDefaultParser = (function (_super) { - __extends(ODataDefaultParser, _super); - function ODataDefaultParser() { - _super.apply(this, arguments); - } - return ODataDefaultParser; -}(ODataParserBase)); -exports.ODataDefaultParser = ODataDefaultParser; -var ODataRawParserImpl = (function () { - function ODataRawParserImpl() { - } - ODataRawParserImpl.prototype.parse = function (r) { - return r.json(); - }; - return ODataRawParserImpl; -}()); -exports.ODataRawParserImpl = ODataRawParserImpl; -var ODataValueParserImpl = (function (_super) { - __extends(ODataValueParserImpl, _super); - function ODataValueParserImpl() { - _super.apply(this, arguments); - } - ODataValueParserImpl.prototype.parse = function (r) { - return _super.prototype.parse.call(this, r).then(function (d) { return d; }); - }; - return ODataValueParserImpl; -}(ODataParserBase)); -var ODataEntityParserImpl = (function (_super) { - __extends(ODataEntityParserImpl, _super); - function ODataEntityParserImpl(factory) { - _super.call(this); - this.factory = factory; - } - ODataEntityParserImpl.prototype.parse = function (r) { - var _this = this; - return _super.prototype.parse.call(this, r).then(function (d) { - var o = new _this.factory(getEntityUrl(d), null); - return util_1.Util.extend(o, d); - }); - }; - return ODataEntityParserImpl; -}(ODataParserBase)); -var ODataEntityArrayParserImpl = (function (_super) { - __extends(ODataEntityArrayParserImpl, _super); - function ODataEntityArrayParserImpl(factory) { - _super.call(this); - this.factory = factory; - } - ODataEntityArrayParserImpl.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(getEntityUrl(v), null); - return util_1.Util.extend(o, v); - }); - }); - }; - return ODataEntityArrayParserImpl; -}(ODataParserBase)); -function getEntityUrl(entity) { - if (entity.hasOwnProperty("__metadata")) { - return entity.__metadata.uri; - } - else if (entity.hasOwnProperty("odata.editLink")) { - return util_1.Util.combinePaths("_api", entity["odata.editLink"]); - } - else { - logging_1.Logger.write("No uri information found in ODataEntity parsing, chaining will fail for this object.", logging_1.Logger.LogLevel.Warning); - return ""; - } -} -exports.ODataRaw = new ODataRawParserImpl(); -function ODataValue() { - return new ODataValueParserImpl(); -} -exports.ODataValue = ODataValue; -function ODataEntity(factory) { - return new ODataEntityParserImpl(factory); -} -exports.ODataEntity = ODataEntity; -function ODataEntityArray(factory) { - return new ODataEntityArrayParserImpl(factory); -} -exports.ODataEntityArray = ODataEntityArray; -var ODataBatch = (function () { - function ODataBatch(_batchId) { - if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); } - this._batchId = _batchId; - this._requests = []; - this._batchDepCount = 0; - } - ODataBatch.prototype.add = function (url, method, options, parser) { - var info = { - 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._requests.push(info); - return p; - }; - ODataBatch.prototype.incrementBatchDep = function () { - this._batchDepCount++; - }; - ODataBatch.prototype.decrementBatchDep = function () { - this._batchDepCount--; - }; - ODataBatch.prototype.execute = function () { - var _this = this; - return new Promise(function (resolve, reject) { - if (_this._batchDepCount > 0) { - setTimeout(function () { return _this.execute(); }, 100); - } - else { - _this.executeImpl().then(function () { return resolve(); }).catch(reject); - } - }); - }; - ODataBatch.prototype.executeImpl = function () { - var _this = this; - if (this._requests.length < 1) { - return new Promise(function (r) { return r(); }); - } - var batchBody = []; - var currentChangeSetId = ""; - this._requests.forEach(function (reqInfo, index) { - if (reqInfo.method === "GET") { - if (currentChangeSetId.length > 0) { - batchBody.push("--changeset_" + currentChangeSetId + "--\n\n"); - currentChangeSetId = ""; - } - batchBody.push("--batch_" + _this._batchId + "\n"); - } - else { - if (currentChangeSetId.length < 1) { - currentChangeSetId = util_1.Util.getGUID(); - batchBody.push("--batch_" + _this._batchId + "\n"); - batchBody.push("Content-Type: multipart/mixed; boundary=\"changeset_" + currentChangeSetId + "\"\n\n"); - } - batchBody.push("--changeset_" + currentChangeSetId + "\n"); - } - batchBody.push("Content-Type: application/http\n"); - batchBody.push("Content-Transfer-Encoding: binary\n\n"); - var headers = { - "Accept": "application/json;", - }; - if (reqInfo.method !== "GET") { - var method = reqInfo.method; - if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers["X-HTTP-Method"] !== typeof undefined) { - method = reqInfo.options.headers["X-HTTP-Method"]; - delete reqInfo.options.headers["X-HTTP-Method"]; - } - batchBody.push(method + " " + reqInfo.url + " HTTP/1.1\n"); - headers = util_1.Util.extend(headers, { "Content-Type": "application/json;odata=verbose;charset=utf-8" }); - } - else { - batchBody.push(reqInfo.method + " " + reqInfo.url + " HTTP/1.1\n"); - } - if (typeof pnplibconfig_1.RuntimeConfig.headers !== "undefined") { - headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers); - } - if (reqInfo.options && reqInfo.options.headers) { - headers = util_1.Util.extend(headers, reqInfo.options.headers); - } - for (var name_1 in headers) { - if (headers.hasOwnProperty(name_1)) { - batchBody.push(name_1 + ": " + headers[name_1] + "\n"); - } - } - batchBody.push("\n"); - if (reqInfo.options.body) { - batchBody.push(reqInfo.options.body + "\n\n"); - } - }); - if (currentChangeSetId.length > 0) { - batchBody.push("--changeset_" + currentChangeSetId + "--\n\n"); - currentChangeSetId = ""; - } - batchBody.push("--batch_" + this._batchId + "--\n"); - var batchHeaders = { - "Content-Type": "multipart/mixed; boundary=batch_" + this._batchId, - }; - var batchOptions = { - "body": batchBody.join(""), - "headers": batchHeaders, - }; - var client = new httpclient_1.HttpClient(); - return client.post(util_1.Util.makeUrlAbsolute("/_api/$batch"), batchOptions) - .then(function (r) { return r.text(); }) - .then(this._parseResponse) - .then(function (responses) { - if (responses.length !== _this._requests.length) { - throw new Error("Could not properly parse responses to match requests in batch."); - } - var resolutions = []; - for (var i = 0; i < responses.length; i++) { - var request = _this._requests[i]; - var response = responses[i]; - if (!response.ok) { - request.reject(new Error(response.statusText)); - } - resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject)); - } - return Promise.all(resolutions); - }); - }; - ODataBatch.prototype._parseResponse = function (body) { - return new Promise(function (resolve, reject) { - var responses = []; - var header = "--batchresponse_"; - 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 new 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 new 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": - var response = void 0; - if (status === 204) { - response = new Response(); - } - else { - response = new Response(line, { status: status, statusText: statusText }); - } - responses.push(response); - state = "batch"; - break; - } - } - if (state !== "status") { - reject(new Error("Unexpected end of input")); - } - resolve(responses); - }); - }; - return ODataBatch; -}()); -exports.ODataBatch = ODataBatch; - -},{"../../configuration/pnplibconfig":2,"../../net/httpclient":5,"../../utils/logging":22,"../../utils/util":23}],22:[function(require,module,exports){ -"use strict"; -var Logger = (function () { - function Logger() { - } - Object.defineProperty(Logger, "activeLogLevel", { - get: function () { - return Logger.instance.activeLogLevel; - }, - set: function (value) { - Logger.instance.activeLogLevel = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Logger, "instance", { - get: function () { - if (typeof Logger._instance === "undefined" || Logger._instance === null) { - Logger._instance = new LoggerImpl(); - } - return Logger._instance; - }, - enumerable: true, - configurable: true - }); - Logger.subscribe = function () { - var listeners = []; - for (var _i = 0; _i < arguments.length; _i++) { - listeners[_i - 0] = arguments[_i]; - } - for (var i = 0; i < listeners.length; i++) { - Logger.instance.subscribe(listeners[i]); - } - }; - Logger.clearSubscribers = function () { - return Logger.instance.clearSubscribers(); - }; - Object.defineProperty(Logger, "count", { - get: function () { - return Logger.instance.count; - }, - enumerable: true, - configurable: true - }); - Logger.write = function (message, level) { - if (level === void 0) { level = Logger.LogLevel.Verbose; } - Logger.instance.log({ level: level, message: message }); - }; - Logger.log = function (entry) { - Logger.instance.log(entry); - }; - Logger.measure = function (name, f) { - return Logger.instance.measure(name, f); - }; - return Logger; -}()); -exports.Logger = Logger; -var LoggerImpl = (function () { - function LoggerImpl(activeLogLevel, subscribers) { - if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.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 = Logger.LogLevel.Verbose; } - this.log({ level: level, message: message }); - }; - LoggerImpl.prototype.log = function (entry) { - if (typeof entry === "undefined" || entry.level < this.activeLogLevel) { - return; - } - for (var i = 0; i < this.subscribers.length; i++) { - this.subscribers[i].log(entry); - } - }; - LoggerImpl.prototype.measure = function (name, f) { - console.profile(name); - try { - return f(); - } - finally { - console.profileEnd(); - } - }; - return LoggerImpl; -}()); -var Logger; -(function (Logger) { - (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"; - })(Logger.LogLevel || (Logger.LogLevel = {})); - var LogLevel = Logger.LogLevel; - var ConsoleListener = (function () { - function ConsoleListener() { - } - ConsoleListener.prototype.log = function (entry) { - var msg = this.format(entry); - switch (entry.level) { - case LogLevel.Verbose: - case LogLevel.Info: - console.log(msg); - break; - case LogLevel.Warning: - console.warn(msg); - break; - case LogLevel.Error: - console.error(msg); - break; - } - }; - ConsoleListener.prototype.format = function (entry) { - return "Message: " + entry.message + ". Data: " + JSON.stringify(entry.data); - }; - return ConsoleListener; - }()); - Logger.ConsoleListener = ConsoleListener; - var AzureInsightsListener = (function () { - function AzureInsightsListener(azureInsightsInstrumentationKey) { - this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey; - var appInsights = window["appInsights"] || function (config) { - function r(config) { - t[config] = function () { - var i = arguments; - t.queue.push(function () { t[config].apply(t, i); }); - }; - } - var t = { config: config }, u = document, e = window, o = "script", s = u.createElement(o), i, f; - for (s.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) { - r("track" + i.pop()); - } - return r("setAuthenticatedUserContext"), r("clearAuthenticatedUserContext"), config.disableExceptionTracking || (i = "onerror", r("_" + i), f = e[i], e[i] = function (config, r, u, e, o) { - var s = f && f(config, r, u, e, o); - return s !== !0 && t["_" + i](config, r, u, e, o), s; - }), t; - }({ - instrumentationKey: this.azureInsightsInstrumentationKey - }); - window["appInsights"] = appInsights; - } - AzureInsightsListener.prototype.log = function (entry) { - var ai = window["appInsights"]; - var msg = this.format(entry); - if (entry.level === LogLevel.Error) { - ai.trackException(msg); - } - else { - ai.trackEvent(msg); - } - }; - AzureInsightsListener.prototype.format = function (entry) { - return "Message: " + entry.message + ". Data: " + JSON.stringify(entry.data); - }; - return AzureInsightsListener; - }()); - Logger.AzureInsightsListener = AzureInsightsListener; - var FunctionListener = (function () { - function FunctionListener(method) { - this.method = method; - } - FunctionListener.prototype.log = function (entry) { - this.method(entry); - }; - return FunctionListener; - }()); - Logger.FunctionListener = FunctionListener; -})(Logger = exports.Logger || (exports.Logger = {})); - -},{}],23:[function(require,module,exports){ -(function (global){ -"use strict"; -var Util = (function () { - function Util() { - } - Util.getCtxCallback = function (context, method) { - var params = []; - for (var _i = 2; _i < arguments.length; _i++) { - params[_i - 2] = arguments[_i]; - } - return function () { - method.apply(context, params); - }; - }; - Util.urlParamExists = function (name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); - return regex.test(location.search); - }; - Util.getUrlParamByName = function (name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); - var results = regex.exec(location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - }; - Util.getUrlParamBoolByName = function (name) { - var p = this.getUrlParamByName(name); - var isFalse = (p === "" || /false|0/i.test(p)); - return !isFalse; - }; - Util.stringInsert = function (target, index, s) { - if (index > 0) { - return target.substring(0, index) + s + target.substring(index, target.length); - } - return s + target; - }; - Util.dateAdd = function (date, interval, units) { - var ret = new Date(date.toLocaleString()); - 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; - }; - Util.loadStylesheet = function (path, avoidCache) { - if (avoidCache) { - path += "?" + encodeURIComponent((new Date()).getTime().toString()); - } - var head = document.getElementsByTagName("head"); - if (head.length > 0) { - var e = document.createElement("link"); - head[0].appendChild(e); - e.setAttribute("type", "text/css"); - e.setAttribute("rel", "stylesheet"); - e.setAttribute("href", path); - } - }; - Util.combinePaths = function () { - var paths = []; - for (var _i = 0; _i < arguments.length; _i++) { - paths[_i - 0] = arguments[_i]; - } - var parts = []; - for (var i = 0; i < paths.length; i++) { - if (typeof paths[i] !== "undefined" && paths[i] !== null) { - parts.push(paths[i].replace(/^[\\|\/]/, "").replace(/[\\|\/]$/, "")); - } - } - return parts.join("/").replace(/\\/, "/"); - }; - Util.getRandomString = function (chars) { - var text = ""; - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (var i = 0; i < chars; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; - }; - Util.getGUID = function () { - var d = new Date().getTime(); - 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; - }; - Util.isFunction = function (candidateFunction) { - return typeof candidateFunction === "function"; - }; - Util.isArray = function (array) { - if (Array.isArray) { - return Array.isArray(array); - } - return array && typeof array.length === "number" && array.constructor === Array; - }; - Util.stringIsNullOrEmpty = function (s) { - return typeof s === "undefined" || s === null || s === ""; - }; - Util.extend = function (target, source, noOverwrite) { - if (noOverwrite === void 0) { noOverwrite = false; } - var result = {}; - for (var id in target) { - result[id] = target[id]; - } - var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; }; - for (var id in source) { - if (check(result, id)) { - result[id] = source[id]; - } - } - return result; - }; - Util.applyMixins = function (derivedCtor) { - var baseCtors = []; - for (var _i = 1; _i < arguments.length; _i++) { - baseCtors[_i - 1] = arguments[_i]; - } - baseCtors.forEach(function (baseCtor) { - Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) { - derivedCtor.prototype[name] = baseCtor.prototype[name]; - }); - }); - }; - Util.isUrlAbsolute = function (url) { - return /^https?:\/\/|^\/\//i.test(url); - }; - Util.makeUrlAbsolute = function (url) { - if (Util.isUrlAbsolute(url)) { - return url; - } - if (typeof global._spPageContextInfo !== "undefined") { - if (global._spPageContextInfo.hasOwnProperty("webAbsoluteUrl")) { - return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url); - } - else if (global._spPageContextInfo.hasOwnProperty("webServerRelativeUrl")) { - return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url); - } - } - else { - return url; - } - }; - return Util; -}()); -exports.Util = Util; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) -},{}]},{},[17])(17) -}); \ No newline at end of file diff --git a/dist/pnp-provisioning.min.js b/dist/pnp-provisioning.min.js deleted file mode 100644 index ddcfc30f..00000000 --- a/dist/pnp-provisioning.min.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * sp-pnp-js v1.0.4 - A reusable JavaScript library targeting SharePoint client-side development. - * MIT (https://github.com/OfficeDev/PnP-JS-Core/blob/master/LICENSE) - * Copyright (c) 2016 Microsoft - * docs: http://officedev.github.io/PnP-JS-Core - * source: https://github.com/OfficeDev/PnP-JS-Core - * bugs: https://github.com/OfficeDev/PnP-JS-Core/issues - */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,(t.$pnp||(t.$pnp={})).Provisioning=e()}}(function(){return function e(t,n,o){function r(s,a){if(!n[s]){if(!t[s]){var c="function"==typeof require&&require;if(!a&&c)return c(s,!0);if(i)return i(s,!0);var u=new Error("Cannot find module '"+s+"'");throw u.code="MODULE_NOT_FOUND",u}var l=n[s]={exports:{}};t[s][0].call(l.exports,function(e){var n=t[s][1][e];return r(n?n:e)},l,l.exports,e,t,n,o)}return n[s].exports}for(var i="function"==typeof require&&require,s=0;s-1?this.values[n]=t:(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){if(o.Util.isFunction(e.getKeys))for(var t=e,n=t.getKeys(),r=n.length,i=0;i0;if(!t){var n=s.add();e.Description&&n.set_description(e.Description),e.CommandUIExtension&&n.set_commandUIExtension(e.CommandUIExtension),e.Group&&n.set_group(e.Group),e.Title&&n.set_title(e.Title),e.Url&&n.set_url(e.Url),e.ScriptBlock&&n.set_scriptBlock(e.ScriptBlock),e.ScriptSrc&&n.set_scriptSrc(e.ScriptSrc),e.Location&&n.set_location(e.Location),e.ImageUrl&&n.set_imageUrl(e.ImageUrl),e.Name&&n.set_name(e.Name),e.RegistrationId&&n.set_registrationId(e.RegistrationId),e.RegistrationType&&n.set_registrationType(e.RegistrationType),e.Rights&&n.set_rights(e.Rights),e.Sequence&&n.set_sequence(e.Sequence),n.update()}}),i.executeQueryAsync(function(){e.prototype.scope_ended.call(n),o()},function(){e.prototype.scope_ended.call(n),o()})},function(){e.prototype.scope_ended.call(n),o()})})},t}(r.ObjectHandlerBase);n.ObjectCustomActions=i},{"./objecthandlerbase":12}],10:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("./objecthandlerbase"),i=function(e){function t(){e.call(this,"Features")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;return e.prototype.scope_started.call(this),new Promise(function(o,r){var i=SP.ClientContext.get_current(),s=i.get_web(),a=s.get_features();t.forEach(function(e){e.Deactivate===!0?a.remove(new SP.Guid(e.ID),!0):a.add(new SP.Guid(e.ID),!0,SP.FeatureDefinitionScope.none)}),s.update(),i.load(a),i.executeQueryAsync(function(){e.prototype.scope_ended.call(n),o()},function(){e.prototype.scope_ended.call(n),o()})})},t}(r.ObjectHandlerBase);n.ObjectFeatures=i},{"./objecthandlerbase":12}],11:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("../../../utils/util"),i=e("../util"),s=e("./objecthandlerbase"),a=function(e){function t(){e.call(this,"Files")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;return e.prototype.scope_started.call(this),new Promise(function(o,s){var a=SP.ClientContext.get_current(),c=a.get_web(),u=[],l=[];t.forEach(function(e,t){l.push(n.httpClient.fetchRaw(i.Util.replaceUrlTokens(e.Src)).then(function(e){return e.text()}))}),Promise.all(l).then(function(e){e.forEach(function(e,o){var i=t[o],s=n.GetFilenameFromFilePath(i.Dest),l=_spPageContextInfo.webServerRelativeUrl,p=c.getFolderByServerRelativeUrl(l+"/"+n.GetFolderFromFilePath(i.Dest)),f={Contents:e,Dest:i.Dest,Filename:s,Folder:p,Instance:null,Overwrite:!1,Properties:[],RemoveExistingWebParts:!0,ServerRelativeUrl:i.Dest,Src:i.Src,Views:[],WebParts:[]};if(r.Util.extend(f,i),f.Filename.indexOf("Form.aspx")===-1){var d=new SP.FileCreationInformation;d.set_overwrite(f.Overwrite),d.set_url(f.Filename),d.set_content(new SP.Base64EncodedByteArray);for(var h=0;h0&&l.push(n.ApplyFileProperties(e.Dest,e.Properties)),e.WebParts&&e.WebParts.length>0&&l.push(n.AddWebPartsToWebPartPage(e.Dest,e.Src,e.WebParts,e.RemoveExistingWebParts))}),Promise.all(l).then(function(){n.ModifyHiddenViews(t).then(function(t){e.prototype.scope_ended.call(n),o(t)},function(t){e.prototype.scope_ended.call(n),s(t)})})},function(t){e.prototype.scope_ended.call(n),s(t)})})},t.prototype.RemoveWebPartsFromFileIfSpecified=function(e,t,n){return new Promise(function(o,r){n||o();var i=t.get_webParts();e.load(i),e.executeQueryAsync(function(){i.get_data().forEach(function(e){e.deleteWebPart()}),e.load(i),e.executeQueryAsync(o,r)},r)})},t.prototype.GetWebPartXml=function(e){var t=this;return new Promise(function(n,o){var r=[];e.forEach(function(e,n){if(e.Contents.FileUrl){var o=i.Util.replaceUrlTokens(e.Contents.FileUrl);r.push(t.httpClient.fetchRaw(o).then(function(e){return e.text()}))}else r.push(function(){return new Promise(function(e,t){e()})}())}),Promise.all(r).then(function(t){t.forEach(function(t,n){var o=e[n];null!==o&&t&&t.length>0&&(o.Contents.Xml=t)}),n(e)})})},t.prototype.AddWebPartsToWebPartPage=function(e,t,n,o){var r=this;return new Promise(function(t,s){var a=SP.ClientContext.get_current(),c=a.get_web(),u=_spPageContextInfo.webServerRelativeUrl+"/"+e,l=c.getFileByServerRelativeUrl(u);a.load(l),a.executeQueryAsync(function(){var e=l.getLimitedWebPartManager(SP.WebParts.PersonalizationScope.shared);r.RemoveWebPartsFromFileIfSpecified(a,e,o).then(function(){r.GetWebPartXml(n).then(function(n){n.forEach(function(t){if(t.Contents.Xml){var n=e.importWebPart(i.Util.replaceUrlTokens(t.Contents.Xml)),o=n.get_webPart();e.addWebPart(o,t.Zone,t.Order)}}),a.executeQueryAsync(t,t)})})},t)})},t.prototype.ApplyFileProperties=function(e,t){return new Promise(function(n,o){var r=SP.ClientContext.get_current(),i=r.get_web(),s=_spPageContextInfo.webServerRelativeUrl+"/"+e,a=i.getFileByServerRelativeUrl(s),c=a.get_listItemAllFields();Object.keys(t).forEach(function(e){c.set_item(e,t[e])}),c.update(),r.executeQueryAsync(n,n)})},t.prototype.GetViewFromCollectionByUrl=function(e,t){for(var n=_spPageContextInfo.webServerRelativeUrl+"/"+t,o=e.getEnumerator();o.moveNext();){var r=o.get_current();if(r.get_serverRelativeUrl().toString().toLowerCase()===n.toLowerCase())return r}return null},t.prototype.ModifyHiddenViews=function(e){var t=this;return new Promise(function(n,o){var i=SP.ClientContext.get_current(),s=i.get_web(),a={},c=[],u=[];e.forEach(function(e){e.Views&&e.Views.forEach(function(t){a[t.List]=a[t.List]||[],a[t.List].push(r.Util.extend(t,{Url:e.Dest}))})}),Object.keys(a).forEach(function(e,t){c.push(s.get_lists().getByTitle(e)),u.push(s.get_lists().getByTitle(e).get_views()),i.load(c[t]),i.load(u[t])}),i.executeQueryAsync(function(){Object.keys(a).forEach(function(e,n){var o=a[e],r=c[n],s=u[n];o.forEach(function(e){var n=t.GetViewFromCollectionByUrl(s,e.Url);if(null!=n){if(e.Paged&&n.set_paged(e.Paged),e.Query&&n.set_viewQuery(e.Query),e.RowLimit&&n.set_rowLimit(e.RowLimit),e.ViewFields&&e.ViewFields.length>0){var o=n.get_viewFields();o.removeAll(),e.ViewFields.forEach(function(e){o.add(e)})}n.update()}}),i.load(s),r.update()}),i.executeQueryAsync(n,n)},n)})},t.prototype.GetFolderFromFilePath=function(e){var t=e.split("/");return t.splice(0,t.length-1).join("/")},t.prototype.GetFilenameFromFilePath=function(e){var t=e.split("/");return t[t.length-1]},t}(s.ObjectHandlerBase);n.ObjectFiles=a},{"../../../utils/util":23,"../util":20,"./objecthandlerbase":12}],12:[function(e,t,n){"use strict";var o=e("../../../net/httpclient"),r=e("../../../utils/logging"),i=function(){function e(e){this.name=e,this.httpClient=new o.HttpClient}return e.prototype.ProvisionObjects=function(e,t){return new Promise(function(e,t){e("Not implemented.")})},e.prototype.scope_started=function(){r.Logger.write(this.name+": Code execution scope started")},e.prototype.scope_ended=function(){r.Logger.write(this.name+": Code execution scope stopped")},e}();n.ObjectHandlerBase=i},{"../../../net/httpclient":5,"../../../utils/logging":22}],13:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("../sequencer/sequencer"),i=e("./objecthandlerbase"),s=function(e){function t(){e.call(this,"Lists")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;return e.prototype.scope_started.call(this),new Promise(function(o,i){var s=SP.ClientContext.get_current(),a=s.get_web().get_lists(),c=[];s.load(a),s.executeQueryAsync(function(){t.forEach(function(e,t){var n=a.get_data().filter(function(t){return t.get_title()===e.Title})[0];if(n)e.Description&&n.set_description(e.Description),void 0!==e.EnableVersioning&&n.set_enableVersioning(e.EnableVersioning),void 0!==e.EnableMinorVersions&&n.set_enableMinorVersions(e.EnableMinorVersions),void 0!==e.EnableModeration&&n.set_enableModeration(e.EnableModeration),void 0!==e.EnableFolderCreation&&n.set_enableFolderCreation(e.EnableFolderCreation),void 0!==e.EnableAttachments&&n.set_enableAttachments(e.EnableAttachments),void 0!==e.NoCrawl&&n.set_noCrawl(e.NoCrawl),e.DefaultDisplayFormUrl&&n.set_defaultDisplayFormUrl(e.DefaultDisplayFormUrl),e.DefaultEditFormUrl&&n.set_defaultEditFormUrl(e.DefaultEditFormUrl),e.DefaultNewFormUrl&&n.set_defaultNewFormUrl(e.DefaultNewFormUrl),e.DraftVersionVisibility&&n.set_draftVersionVisibility(SP.DraftVisibilityType[e.DraftVersionVisibility]),e.ImageUrl&&n.set_imageUrl(e.ImageUrl),void 0!==e.Hidden&&n.set_hidden(e.Hidden),void 0!==e.ForceCheckout&&n.set_forceCheckout(e.ForceCheckout),n.update(),c.push(n),s.load(c[t]);else{var o=new SP.ListCreationInformation;if(e.Description&&o.set_description(e.Description),void 0!==e.OnQuickLaunch){var r=e.OnQuickLaunch?SP.QuickLaunchOptions.on:SP.QuickLaunchOptions.off;o.set_quickLaunchOption(r)}e.TemplateType&&o.set_templateType(e.TemplateType),e.Title&&o.set_title(e.Title),e.Url&&o.set_url(e.Url);var i=a.add(o);if(void 0!==e.EnableVersioning&&i.set_enableVersioning(e.EnableVersioning),void 0!==e.EnableMinorVersions&&i.set_enableMinorVersions(e.EnableMinorVersions),void 0!==e.EnableModeration&&i.set_enableModeration(e.EnableModeration),void 0!==e.EnableFolderCreation&&i.set_enableFolderCreation(e.EnableFolderCreation),void 0!==e.EnableAttachments&&i.set_enableAttachments(e.EnableAttachments),void 0!==e.NoCrawl&&i.set_noCrawl(e.NoCrawl),e.DefaultDisplayFormUrl&&i.set_defaultDisplayFormUrl(e.DefaultDisplayFormUrl),e.DefaultEditFormUrl&&i.set_defaultEditFormUrl(e.DefaultEditFormUrl),e.DefaultNewFormUrl&&i.set_defaultNewFormUrl(e.DefaultNewFormUrl),e.DraftVersionVisibility){var r=SP.DraftVisibilityType[e.DraftVersionVisibility.toLocaleLowerCase()];i.set_draftVersionVisibility(r)}e.ImageUrl&&i.set_imageUrl(e.ImageUrl),void 0!==e.Hidden&&i.set_hidden(e.Hidden),void 0!==e.ForceCheckout&&i.set_forceCheckout(e.ForceCheckout),c.push(i),s.load(c[t])}}),s.executeQueryAsync(function(){var i=new r.Sequencer([n.ApplyContentTypeBindings,n.ApplyListInstanceFieldRefs,n.ApplyFields,n.ApplyLookupFields,n.ApplyListSecurity,n.CreateViews,n.InsertDataRows,n.CreateFolders],{ClientContext:s,ListInstances:c,Objects:t},n);i.execute().then(function(){e.prototype.scope_ended.call(n),o()})},function(){e.prototype.scope_ended.call(n),o()})},function(){e.prototype.scope_ended.call(n),o()})})},t.prototype.EnsureLocationBasedMetadataDefaultsReceiver=function(e,t){var n=t.get_eventReceivers(),o=new SP.EventReceiverDefinitionCreationInformation;o.set_receiverName("LocationBasedMetadataDefaultsReceiver ItemAdded"),o.set_synchronization(1),o.set_sequenceNumber(1e3),o.set_receiverAssembly("Microsoft.Office.DocumentManagement, Version=15.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c"),o.set_receiverClass("Microsoft.Office.DocumentManagement.LocationBasedMetadataDefaultsReceiver"),o.set_eventType(SP.EventReceiverType.itemAdded),n.add(o),t.update()},t.prototype.CreateFolders=function(e){var t=this;return new Promise(function(n,o){e.ListInstances.forEach(function(n,o){var r=e.Objects[o];if(r.Folders){var i=_spPageContextInfo.webServerRelativeUrl+"/"+r.Url,s=n.get_rootFolder(),a="",c=!1;if(r.Folders.forEach(function(e){var t=i+"/"+e.Name;if(s.get_folders().add(t),e.DefaultValues){var n=Object.keys(e.DefaultValues).length;n>0&&(a+="",Object.keys(e.DefaultValues).forEach(function(t){a+=''+e.DefaultValues[t]+""}),a+=""),c=!0}}),a+="",c){var u=new SP.FileCreationInformation;u.set_url(i+"/Forms/client_LocationBasedDefaults.html"),u.set_content(new SP.Base64EncodedByteArray),u.set_overwrite(!0);for(var l=0;l0&&s.get_data().forEach(function(e){a.push(e)}),i.ContentTypeBindings.forEach(function(e){s.addExistingContentType(o.getById(e.ContentTypeId))}),i.RemoveExistingContentTypes&&i.ContentTypeBindings.length>0)for(var c=0;c0))return null;o="{"+i[0].get_id().toString()+"}",r.push(n+'="'+o+'"')}}),o="","Calculated"===e.Type&&(o+=""+e.Formula+""),o+=""}return o},t.prototype.ApplyListSecurity=function(e){return new Promise(function(t,n){e.ListInstances.forEach(function(t,n){var o=e.Objects[n];o.Security&&o.Security.BreakRoleInheritance&&(t.breakRoleInheritance(o.Security.CopyRoleAssignments,o.Security.ClearSubscopes),t.update(),e.ClientContext.load(t.get_roleAssignments()))});var o=e.ClientContext.get_web(),r=o.get_allProperties(),i=o.get_siteGroups(),s=o.get_roleDefinitions();e.ClientContext.load(r),e.ClientContext.load(s),e.ClientContext.executeQueryAsync(function(){e.ListInstances.forEach(function(t,n){var o=e.Objects[n];o.Security&&(o.Security.RoleAssignments.forEach(function(n){var o=null;o="number"==typeof n.RoleDefinition?s.getById(n.RoleDefinition):s.getByName(n.RoleDefinition);var a=SP.RoleDefinitionBindingCollection.newObject(e.ClientContext);a.add(o);var c=null;if(n.Principal.match(/\{[A-Za-z]*\}+/g)){var u=n.Principal.substring(1,n.Principal.length-1),l=r.get_fieldValues()["vti_"+u];c=i.getById(l)}else c=i.getByName(c);t.get_roleAssignments().add(c,a)}),t.update())}),e.ClientContext.executeQueryAsync(t,t)},t)})},t.prototype.CreateViews=function(e){return new Promise(function(t,n){var o=[];e.ListInstances.forEach(function(t,n){o.push(t.get_views()),e.ClientContext.load(o[n])}),e.ClientContext.executeQueryAsync(function(){e.ListInstances.forEach(function(t,n){var r=e.Objects[n];r.Views&&(o.push(t.get_views()),e.ClientContext.load(o[n]),r.Views.forEach(function(i){var s=o[n].get_data().filter(function(e){return r.RemoveExistingViews&&r.Views.length>0?(e.deleteObject(),!1):e.get_title()===i.Title}).length>0;if(s){var a=o[n].getByTitle(i.Title);if(i.Paged&&a.set_paged(i.Paged),i.Query&&a.set_viewQuery(i.Query),i.RowLimit&&a.set_rowLimit(i.RowLimit),i.ViewFields&&i.ViewFields.length>0){var c=a.get_viewFields();c.removeAll(),i.ViewFields.forEach(function(e){c.add(e)})}i.Scope&&a.set_scope(i.Scope),a.update()}else{var u=new SP.ViewCreationInformation;i.Title&&u.set_title(i.Title),i.PersonalView&&u.set_personalView(i.PersonalView),i.Paged&&u.set_paged(i.Paged),i.Query&&u.set_query(i.Query),i.RowLimit&&u.set_rowLimit(i.RowLimit),i.SetAsDefaultView&&u.set_setAsDefaultView(i.SetAsDefaultView),i.ViewFields&&u.set_viewFields(i.ViewFields),i.ViewTypeKind&&u.set_viewTypeKind(SP.ViewType.html);var a=t.get_views().add(u);i.Scope&&(a.set_scope(i.Scope),a.update()),t.update()}e.ClientContext.load(t.get_views())}))}),e.ClientContext.executeQueryAsync(t,t)},t)})},t.prototype.InsertDataRows=function(e){return new Promise(function(t,n){e.ListInstances.forEach(function(t,n){var o=e.Objects[n];o.DataRows&&o.DataRows.forEach(function(n){var o=t.addItem(new SP.ListItemCreationInformation);Object.keys(n).forEach(function(e){o.set_item(e,n[e])}),o.update(),e.ClientContext.load(o)})}),e.ClientContext.executeQueryAsync(t,t)})},t}(i.ObjectHandlerBase);n.ObjectLists=s},{"../sequencer/sequencer":19,"./objecthandlerbase":12}],14:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("../util"),i=e("./objecthandlerbase"),s=function(e){function t(){e.call(this,"Navigation")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;e.prototype.scope_started.call(this);var o=SP.ClientContext.get_current(),r=o.get_web().get_navigation();return new Promise(function(i,s){n.ConfigureQuickLaunch(t.QuickLaunch,o,n.httpClient,r).then(function(){e.prototype.scope_ended.call(n),i()},function(){e.prototype.scope_ended.call(n),s()})})},t.prototype.getNodeFromCollectionByTitle=function(e,t){var n=e.filter(function(e){return e.get_title()===t});return n[0]||null},t.prototype.ConfigureQuickLaunch=function(e,t,n,o){var i=this;return new Promise(function(s,a){if(0===e.length)s();else{var c=o.get_quickLaunch();t.load(c),t.executeQueryAsync(function(){for(var a=[],u=c.get_count()-1;u>=0;){var l=c.itemAt(u);a.push(l),l.deleteObject(),u--}t.executeQueryAsync(function(){e.forEach(function(e){var t=i.getNodeFromCollectionByTitle(a,e.Title),n=new SP.NavigationNodeCreationInformation;n.set_title(e.Title),n.set_url(t?t.get_url():r.Util.replaceUrlTokens(e.Url)),n.set_asLastNode(!0),c.add(n)}),t.executeQueryAsync(function(){n.get(_spPageContextInfo.webAbsoluteUrl+"/_api/web/Navigation/QuickLaunch").then(function(n){n.json().then(function(n){n.value.forEach(function(t){var n=o.getNodeById(t.Id),s=n.get_children(),c=e.filter(function(e){return e.Title===t.Title})[0];c&&c.Children&&c.Children.forEach(function(e){var t=i.getNodeFromCollectionByTitle(a,e.Title),n=new SP.NavigationNodeCreationInformation;n.set_title(e.Title),n.set_url(t?t.get_url():r.Util.replaceUrlTokens(e.Url)),n.set_asLastNode(!0),s.add(n)})}),t.executeQueryAsync(s,s)})})},s)})})}})},t}(i.ObjectHandlerBase);n.ObjectNavigation=s},{"../util":20,"./objecthandlerbase":12}],15:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("../util"),i=e("./objecthandlerbase"),s=function(e){function t(){e.call(this,"PropertyBagEntries")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;return e.prototype.scope_started.call(this),new Promise(function(o,i){if(t&&0!==t.length){for(var s=SP.ClientContext.get_current(),a=s.get_web(),c=a.get_allProperties(),u=[],l=0;l0?(c.set_item("vti_indexedpropertykeys",u.join("|")),a.update(),s.executeQueryAsync(function(){e.prototype.scope_ended.call(n),o()},function(){e.prototype.scope_ended.call(n),o()})):(e.prototype.scope_ended.call(n),o())},function(){e.prototype.scope_ended.call(n),o()})}else o()})},t}(i.ObjectHandlerBase);n.ObjectPropertyBagEntries=s},{"../util":20,"./objecthandlerbase":12}],16:[function(e,t,n){"use strict";var o=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var o in t)t.hasOwnProperty(o)&&(e[o]=t[o]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},r=e("./objecthandlerbase"),i=function(e){function t(){e.call(this,"WebSettings")}return o(t,e),t.prototype.ProvisionObjects=function(t){var n=this;return e.prototype.scope_started.call(this),new Promise(function(o,r){var i=SP.ClientContext.get_current(),s=i.get_web(); -t.WelcomePage&&(s.get_rootFolder().set_welcomePage(t.WelcomePage),s.get_rootFolder().update()),t.MasterUrl&&s.set_masterUrl(t.MasterUrl),t.CustomMasterUrl&&s.set_customMasterUrl(t.CustomMasterUrl),void 0!==t.SaveSiteAsTemplateEnabled&&s.set_saveSiteAsTemplateEnabled(t.SaveSiteAsTemplateEnabled),void 0!==t.QuickLaunchEnabled&&s.set_saveSiteAsTemplateEnabled(t.QuickLaunchEnabled),void 0!==t.TreeViewEnabled&&s.set_treeViewEnabled(t.TreeViewEnabled),s.update(),i.load(s),i.executeQueryAsync(function(){e.prototype.scope_ended.call(n),o()},function(){e.prototype.scope_ended.call(n),o()})})},t}(r.ObjectHandlerBase);n.ObjectWebSettings=i},{"./objecthandlerbase":12}],17:[function(e,t,n){"use strict";var o=e("./provisioningstep"),r=e("./objecthandlers/objectnavigation"),i=e("./objecthandlers/objectpropertybagentries"),s=e("./objecthandlers/objectfeatures"),a=e("./objecthandlers/objectwebsettings"),c=e("./objecthandlers/objectcomposedlook"),u=e("./objecthandlers/objectcustomactions"),l=e("./objecthandlers/objectfiles"),p=e("./objecthandlers/objectlists"),f=e("./util"),d=e("../../utils/logging"),h=e("../../net/httpclient"),g=function(){function e(){this.handlers={Navigation:r.ObjectNavigation,PropertyBagEntries:i.ObjectPropertyBagEntries,Features:s.ObjectFeatures,WebSettings:a.ObjectWebSettings,ComposedLook:c.ObjectComposedLook,CustomActions:u.ObjectCustomActions,Files:l.ObjectFiles,Lists:p.ObjectLists},this.httpClient=new h.HttpClient}return e.prototype.applyTemplate=function(e){var t=this,n=f.Util.replaceUrlTokens(e);return new Promise(function(e,o){t.httpClient.get(n).then(function(n){n.ok?n.json().then(function(n){t.start(n,Object.keys(n)).then(e,o)}):o(n.statusText)},function(e){d.Logger.write("Provisioning: The provided template is invalid",d.Logger.LogLevel.Error)})})},e.prototype.start=function(e,t){var n=this;return new Promise(function(r,i){n.startTime=(new Date).getTime(),n.queueItems=[],t.forEach(function(t,r){n.handlers[t]&&n.queueItems.push(new o.ProvisioningStep(t,r,e[t],e.Parameters,n.handlers[t]))});var s=[];s.push(new Promise(function(e){d.Logger.write("Provisioning: Code execution scope started",d.Logger.LogLevel.Info),e()}));for(var a=1;void 0!==n.queueItems[a-1];){var c=s.length-1;s.push(n.queueItems[a-1].execute(s[c])),a++}Promise.all(s).then(function(e){d.Logger.write("Provisioning: Code execution scope ended",d.Logger.LogLevel.Info),r(e)},function(e){d.Logger.write("Provisioning: Code execution scope ended"+JSON.stringify(e),d.Logger.LogLevel.Error),i(e)})})},e}();n.Provisioning=g},{"../../net/httpclient":5,"../../utils/logging":22,"./objecthandlers/objectcomposedlook":8,"./objecthandlers/objectcustomactions":9,"./objecthandlers/objectfeatures":10,"./objecthandlers/objectfiles":11,"./objecthandlers/objectlists":13,"./objecthandlers/objectnavigation":14,"./objecthandlers/objectpropertybagentries":15,"./objecthandlers/objectwebsettings":16,"./provisioningstep":18,"./util":20}],18:[function(e,t,n){"use strict";var o=function(){function e(e,t,n,o,r){this.name=e,this.index=t,this.objects=n,this.parameters=o,this.handler=r}return e.prototype.execute=function(e){var t=this,n=new this.handler;return e?new Promise(function(o,r){e.then(function(){return n.ProvisionObjects(t.objects,t.parameters).then(o,o)})}):n.ProvisionObjects(this.objects,this.parameters)},e}();n.ProvisioningStep=o},{}],19:[function(e,t,n){"use strict";var o=function(){function e(e,t,n){this.functions=e,this.parameter=t,this.scope=n}return e.prototype.execute=function(e){var t=Promise.resolve();return this.functions.forEach(function(n,o){t=t.then(function(){return n.call(this.scope,this.parameter)}).then(function(t){e&&e.call(this,o,this.functions)})},this),t},e}();n.Sequencer=o},{}],20:[function(e,t,n){"use strict";var o=function(){function e(){}return e.getRelativeUrl=function(e){return e.replace(document.location.protocol+"//"+document.location.hostname,"")},e.replaceUrlTokens=function(e){return e.replace(/{site}/g,_spPageContextInfo.webAbsoluteUrl).replace(/{sitecollection}/g,_spPageContextInfo.siteAbsoluteUrl).replace(/{themegallery}/g,_spPageContextInfo.siteAbsoluteUrl+"/_catalogs/theme/15")},e.encodePropertyKey=function(e){for(var t=[],n=0;n0?setTimeout(function(){return e.execute()},100):e.executeImpl().then(function(){return t()})["catch"](n)})},e.prototype.executeImpl=function(){var e=this;if(this._requests.length<1)return new Promise(function(e){return e()});var t=[],n="";this._requests.forEach(function(o,r){"GET"===o.method?(n.length>0&&(t.push("--changeset_"+n+"--\n\n"),n=""),t.push("--batch_"+e._batchId+"\n")):(n.length<1&&(n=u.Util.getGUID(),t.push("--batch_"+e._batchId+"\n"),t.push('Content-Type: multipart/mixed; boundary="changeset_'+n+'"\n\n')),t.push("--changeset_"+n+"\n")),t.push("Content-Type: application/http\n"),t.push("Content-Transfer-Encoding: binary\n\n");var i={Accept:"application/json;"};if("GET"!==o.method){var s=o.method;o.options&&o.options.headers&&"undefined"!==o.options.headers["X-HTTP-Method"]&&(s=o.options.headers["X-HTTP-Method"],delete o.options.headers["X-HTTP-Method"]),t.push(s+" "+o.url+" HTTP/1.1\n"),i=u.Util.extend(i,{"Content-Type":"application/json;odata=verbose;charset=utf-8"})}else t.push(o.method+" "+o.url+" HTTP/1.1\n");"undefined"!=typeof f.RuntimeConfig.headers&&(i=u.Util.extend(i,f.RuntimeConfig.headers)),o.options&&o.options.headers&&(i=u.Util.extend(i,o.options.headers));for(var a in i)i.hasOwnProperty(a)&&t.push(a+": "+i[a]+"\n");t.push("\n"),o.options.body&&t.push(o.options.body+"\n\n")}),n.length>0&&(t.push("--changeset_"+n+"--\n\n"),n=""),t.push("--batch_"+this._batchId+"--\n");var o={"Content-Type":"multipart/mixed; boundary=batch_"+this._batchId},r={body:t.join(""),headers:o},i=new p.HttpClient;return i.post(u.Util.makeUrlAbsolute("/_api/$batch"),r).then(function(e){return e.text()}).then(this._parseResponse).then(function(t){if(t.length!==e._requests.length)throw new Error("Could not properly parse responses to match requests in batch.");for(var n=[],o=0;o0?e.substring(0,t)+n+e.substring(t,e.length):n+e},t.dateAdd=function(e,t,n){var o=new Date(e.toLocaleString());switch(t.toLowerCase()){case"year":o.setFullYear(o.getFullYear()+n);break;case"quarter":o.setMonth(o.getMonth()+3*n);break;case"month":o.setMonth(o.getMonth()+n);break;case"week":o.setDate(o.getDate()+7*n);break;case"day":o.setDate(o.getDate()+n);break;case"hour":o.setTime(o.getTime()+36e5*n);break;case"minute":o.setTime(o.getTime()+6e4*n);break;case"second":o.setTime(o.getTime()+1e3*n);break;default:o=void 0}return o},t.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var o=document.createElement("link");n[0].appendChild(o),o.setAttribute("type","text/css"),o.setAttribute("rel","stylesheet"),o.setAttribute("href",e)}},t.combinePaths=function(){for(var e=[],t=0;t -1) {\n this.values[index] = o;\n }\n else {\n this.keys.push(key);\n this.values.push(o);\n }\n };\n Dictionary.prototype.merge = function (source) {\n if (util_1.Util.isFunction(source[\"getKeys\"])) {\n var sourceAsDictionary = source;\n var keys = sourceAsDictionary.getKeys();\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n this.add(keys[i], sourceAsDictionary.get(keys[i]));\n }\n }\n else {\n var sourceAsHash = source;\n for (var key in sourceAsHash) {\n if (sourceAsHash.hasOwnProperty(key)) {\n this.add(key, source[key]);\n }\n }\n }\n };\n Dictionary.prototype.remove = function (key) {\n var index = this.keys.indexOf(key);\n if (index < 0) {\n return null;\n }\n var val = this.values[index];\n this.keys.splice(index, 1);\n this.values.splice(index, 1);\n return val;\n };\n Dictionary.prototype.getKeys = function () {\n return this.keys;\n };\n Dictionary.prototype.getValues = function () {\n return this.values;\n };\n Dictionary.prototype.clear = function () {\n this.keys = [];\n this.values = [];\n };\n Dictionary.prototype.count = function () {\n return this.keys.length;\n };\n return Dictionary;\n}());\nexports.Dictionary = Dictionary;\n\n},{\"../utils/util\":23}],2:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar RuntimeConfigImpl = (function () {\n function RuntimeConfigImpl() {\n this._headers = null;\n this._defaultCachingStore = \"session\";\n this._defaultCachingTimeoutSeconds = 30;\n this._globalCacheDisable = false;\n this._useSPRequestExecutor = false;\n }\n RuntimeConfigImpl.prototype.set = function (config) {\n if (config.hasOwnProperty(\"headers\")) {\n this._headers = config.headers;\n }\n if (config.hasOwnProperty(\"globalCacheDisable\")) {\n this._globalCacheDisable = config.globalCacheDisable;\n }\n if (config.hasOwnProperty(\"defaultCachingStore\")) {\n this._defaultCachingStore = config.defaultCachingStore;\n }\n if (config.hasOwnProperty(\"defaultCachingTimeoutSeconds\")) {\n this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds;\n }\n if (config.hasOwnProperty(\"useSPRequestExecutor\")) {\n this._useSPRequestExecutor = config.useSPRequestExecutor;\n }\n if (config.hasOwnProperty(\"nodeClientOptions\")) {\n this._useNodeClient = true;\n this._useSPRequestExecutor = false;\n this._nodeClientData = config.nodeClientOptions;\n global._spPageContextInfo = {\n webAbsoluteUrl: config.nodeClientOptions.siteUrl,\n };\n }\n };\n Object.defineProperty(RuntimeConfigImpl.prototype, \"headers\", {\n get: function () {\n return this._headers;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingStore\", {\n get: function () {\n return this._defaultCachingStore;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingTimeoutSeconds\", {\n get: function () {\n return this._defaultCachingTimeoutSeconds;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"globalCacheDisable\", {\n get: function () {\n return this._globalCacheDisable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useSPRequestExecutor\", {\n get: function () {\n return this._useSPRequestExecutor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useNodeFetchClient\", {\n get: function () {\n return this._useNodeClient;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"nodeRequestOptions\", {\n get: function () {\n return this._nodeClientData;\n },\n enumerable: true,\n configurable: true\n });\n return RuntimeConfigImpl;\n}());\nexports.RuntimeConfigImpl = RuntimeConfigImpl;\nvar _runtimeConfig = new RuntimeConfigImpl();\nexports.RuntimeConfig = _runtimeConfig;\nfunction setRuntimeConfig(config) {\n _runtimeConfig.set(config);\n}\nexports.setRuntimeConfig = setRuntimeConfig;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],3:[function(require,module,exports){\n\"use strict\";\nvar collections_1 = require(\"../collections/collections\");\nvar util_1 = require(\"../utils/util\");\nvar odata_1 = require(\"../sharepoint/rest/odata\");\nvar CachedDigest = (function () {\n function CachedDigest() {\n }\n return CachedDigest;\n}());\nexports.CachedDigest = CachedDigest;\nvar DigestCache = (function () {\n function DigestCache(_httpClient, _digests) {\n if (_digests === void 0) { _digests = new collections_1.Dictionary(); }\n this._httpClient = _httpClient;\n this._digests = _digests;\n }\n DigestCache.prototype.getDigest = function (webUrl) {\n var self = this;\n var cachedDigest = this._digests.get(webUrl);\n if (cachedDigest !== null) {\n var now = new Date();\n if (now < cachedDigest.expiration) {\n return Promise.resolve(cachedDigest.value);\n }\n }\n var url = util_1.Util.combinePaths(webUrl, \"/_api/contextinfo\");\n return self._httpClient.fetchRaw(url, {\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Accept\": \"application/json;odata=verbose\",\n \"Content-type\": \"application/json;odata=verbose;charset=utf-8\",\n },\n method: \"POST\",\n }).then(function (response) {\n var parser = new odata_1.ODataDefaultParser();\n return parser.parse(response).then(function (d) { return d.GetContextWebInformation; });\n }).then(function (data) {\n var newCachedDigest = new CachedDigest();\n newCachedDigest.value = data.FormDigestValue;\n var seconds = data.FormDigestTimeoutSeconds;\n var expiration = new Date();\n expiration.setTime(expiration.getTime() + 1000 * seconds);\n newCachedDigest.expiration = expiration;\n self._digests.add(webUrl, newCachedDigest);\n return newCachedDigest.value;\n });\n };\n DigestCache.prototype.clear = function () {\n this._digests.clear();\n };\n return DigestCache;\n}());\nexports.DigestCache = DigestCache;\n\n},{\"../collections/collections\":1,\"../sharepoint/rest/odata\":21,\"../utils/util\":23}],4:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar FetchClient = (function () {\n function FetchClient() {\n }\n FetchClient.prototype.fetch = function (url, options) {\n return global.fetch(url, options);\n };\n return FetchClient;\n}());\nexports.FetchClient = FetchClient;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}],5:[function(require,module,exports){\n\"use strict\";\nvar fetchclient_1 = require(\"./fetchclient\");\nvar digestcache_1 = require(\"./digestcache\");\nvar util_1 = require(\"../utils/util\");\nvar pnplibconfig_1 = require(\"../configuration/pnplibconfig\");\nvar sprequestexecutorclient_1 = require(\"./sprequestexecutorclient\");\nvar nodefetchclient_1 = require(\"./nodefetchclient\");\nvar HttpClient = (function () {\n function HttpClient() {\n this._impl = this.getFetchImpl();\n this._digestCache = new digestcache_1.DigestCache(this);\n }\n HttpClient.prototype.fetch = function (url, options) {\n if (options === void 0) { options = {}; }\n var self = this;\n var opts = util_1.Util.extend(options, { cache: \"no-cache\", credentials: \"same-origin\" }, true);\n var headers = new Headers();\n this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers);\n this.mergeHeaders(headers, options.headers);\n if (!headers.has(\"Accept\")) {\n headers.append(\"Accept\", \"application/json\");\n }\n if (!headers.has(\"Content-Type\")) {\n headers.append(\"Content-Type\", \"application/json;odata=verbose;charset=utf-8\");\n }\n if (!headers.has(\"X-ClientService-ClientTag\")) {\n headers.append(\"X-ClientService-ClientTag\", \"PnPCoreJS:1.0.4\");\n }\n opts = util_1.Util.extend(opts, { headers: headers });\n if (opts.method && opts.method.toUpperCase() !== \"GET\") {\n if (!headers.has(\"X-RequestDigest\")) {\n var index = url.indexOf(\"_api/\");\n if (index < 0) {\n throw new Error(\"Unable to determine API url\");\n }\n var webUrl = url.substr(0, index);\n return this._digestCache.getDigest(webUrl)\n .then(function (digest) {\n headers.append(\"X-RequestDigest\", digest);\n return self.fetchRaw(url, opts);\n });\n }\n }\n return self.fetchRaw(url, opts);\n };\n HttpClient.prototype.fetchRaw = function (url, options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n var rawHeaders = new Headers();\n this.mergeHeaders(rawHeaders, options.headers);\n options = util_1.Util.extend(options, { headers: rawHeaders });\n var retry = function (ctx) {\n _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {\n var delay = ctx.delay;\n if (response.status !== 429 && response.status !== 503) {\n ctx.reject(response);\n }\n ctx.delay *= 2;\n ctx.attempts++;\n if (ctx.retryCount <= ctx.attempts) {\n ctx.reject(response);\n }\n setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay);\n });\n };\n return new Promise(function (resolve, reject) {\n var retryContext = {\n attempts: 0,\n delay: 100,\n reject: reject,\n resolve: resolve,\n retryCount: 7,\n };\n retry.call(_this, retryContext);\n });\n };\n HttpClient.prototype.get = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"GET\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.post = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"POST\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.getFetchImpl = function () {\n if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) {\n return new sprequestexecutorclient_1.SPRequestExecutorClient();\n }\n else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) {\n var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions;\n return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret);\n }\n else {\n return new fetchclient_1.FetchClient();\n }\n };\n HttpClient.prototype.mergeHeaders = function (target, source) {\n if (typeof source !== \"undefined\" && source !== null) {\n var temp = new Request(\"\", { headers: source });\n temp.headers.forEach(function (value, name) {\n target.append(name, value);\n });\n }\n };\n return HttpClient;\n}());\nexports.HttpClient = HttpClient;\n\n},{\"../configuration/pnplibconfig\":2,\"../utils/util\":23,\"./digestcache\":3,\"./fetchclient\":4,\"./nodefetchclient\":6,\"./sprequestexecutorclient\":7}],6:[function(require,module,exports){\n\"use strict\";\nvar NodeFetchClient = (function () {\n function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) {\n if (_realm === void 0) { _realm = \"\"; }\n this.siteUrl = siteUrl;\n this._clientId = _clientId;\n this._clientSecret = _clientSecret;\n this._realm = _realm;\n }\n NodeFetchClient.prototype.fetch = function (url, options) {\n throw new Error(\"Using NodeFetchClient in the browser is not supported.\");\n };\n return NodeFetchClient;\n}());\nexports.NodeFetchClient = NodeFetchClient;\n\n},{}],7:[function(require,module,exports){\n\"use strict\";\nvar util_1 = require(\"../utils/util\");\nvar SPRequestExecutorClient = (function () {\n function SPRequestExecutorClient() {\n this.convertToResponse = function (spResponse) {\n var responseHeaders = new Headers();\n for (var h in spResponse.headers) {\n if (spResponse.headers[h]) {\n responseHeaders.append(h, spResponse.headers[h]);\n }\n }\n return new Response(spResponse.body, {\n headers: responseHeaders,\n status: spResponse.statusCode,\n statusText: spResponse.statusText,\n });\n };\n }\n SPRequestExecutorClient.prototype.fetch = function (url, options) {\n var _this = this;\n if (typeof SP === \"undefined\" || typeof SP.RequestExecutor === \"undefined\") {\n throw new Error(\"SP.RequestExecutor is undefined. \" +\n \"Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library.\");\n }\n var addinWebUrl = url.substring(0, url.indexOf(\"/_api\")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp;\n if (options.headers && options.headers instanceof Headers) {\n iterator = options.headers.entries();\n temp = iterator.next();\n while (!temp.done) {\n headers[temp.value[0]] = temp.value[1];\n temp = iterator.next();\n }\n }\n else {\n headers = options.headers;\n }\n return new Promise(function (resolve, reject) {\n var requestOptions = {\n error: function (error) {\n reject(_this.convertToResponse(error));\n },\n headers: headers,\n method: options.method,\n success: function (response) {\n resolve(_this.convertToResponse(response));\n },\n url: url,\n };\n if (options.body) {\n util_1.Util.extend(requestOptions, { body: options.body });\n }\n else {\n util_1.Util.extend(requestOptions, { binaryStringRequestBody: true });\n }\n executor.executeAsync(requestOptions);\n });\n };\n return SPRequestExecutorClient;\n}());\nexports.SPRequestExecutorClient = SPRequestExecutorClient;\n\n},{\"../utils/util\":23}],8:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../util\");\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectComposedLook = (function (_super) {\n __extends(ObjectComposedLook, _super);\n function ObjectComposedLook() {\n _super.call(this, \"ComposedLook\");\n }\n ObjectComposedLook.prototype.ProvisionObjects = function (object) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var colorPaletteUrl = object.ColorPaletteUrl ? util_1.Util.replaceUrlTokens(object.ColorPaletteUrl) : \"\";\n var fontSchemeUrl = object.FontSchemeUrl ? util_1.Util.replaceUrlTokens(object.FontSchemeUrl) : \"\";\n var backgroundImageUrl = object.BackgroundImageUrl ? util_1.Util.replaceUrlTokens(object.BackgroundImageUrl) : null;\n web.applyTheme(util_1.Util.getRelativeUrl(colorPaletteUrl), util_1.Util.getRelativeUrl(fontSchemeUrl), backgroundImageUrl, true);\n web.update();\n clientContext.executeQueryAsync(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n });\n };\n return ObjectComposedLook;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectComposedLook = ObjectComposedLook;\n\n},{\"../util\":20,\"./objecthandlerbase\":12}],9:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectCustomActions = (function (_super) {\n __extends(ObjectCustomActions, _super);\n function ObjectCustomActions() {\n _super.call(this, \"CustomActions\");\n }\n ObjectCustomActions.prototype.ProvisionObjects = function (customactions) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var userCustomActions = clientContext.get_web().get_userCustomActions();\n clientContext.load(userCustomActions);\n clientContext.executeQueryAsync(function () {\n customactions.forEach(function (obj) {\n var objExists = userCustomActions.get_data().filter(function (userCustomAction) {\n return userCustomAction.get_title() === obj.Title;\n }).length > 0;\n if (!objExists) {\n var objCreationInformation = userCustomActions.add();\n if (obj.Description) {\n objCreationInformation.set_description(obj.Description);\n }\n if (obj.CommandUIExtension) {\n objCreationInformation.set_commandUIExtension(obj.CommandUIExtension);\n }\n if (obj.Group) {\n objCreationInformation.set_group(obj.Group);\n }\n if (obj.Title) {\n objCreationInformation.set_title(obj.Title);\n }\n if (obj.Url) {\n objCreationInformation.set_url(obj.Url);\n }\n if (obj.ScriptBlock) {\n objCreationInformation.set_scriptBlock(obj.ScriptBlock);\n }\n if (obj.ScriptSrc) {\n objCreationInformation.set_scriptSrc(obj.ScriptSrc);\n }\n if (obj.Location) {\n objCreationInformation.set_location(obj.Location);\n }\n if (obj.ImageUrl) {\n objCreationInformation.set_imageUrl(obj.ImageUrl);\n }\n if (obj.Name) {\n objCreationInformation.set_name(obj.Name);\n }\n if (obj.RegistrationId) {\n objCreationInformation.set_registrationId(obj.RegistrationId);\n }\n if (obj.RegistrationType) {\n objCreationInformation.set_registrationType(obj.RegistrationType);\n }\n if (obj.Rights) {\n objCreationInformation.set_rights(obj.Rights);\n }\n if (obj.Sequence) {\n objCreationInformation.set_sequence(obj.Sequence);\n }\n objCreationInformation.update();\n }\n });\n clientContext.executeQueryAsync(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n });\n };\n return ObjectCustomActions;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectCustomActions = ObjectCustomActions;\n\n},{\"./objecthandlerbase\":12}],10:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectFeatures = (function (_super) {\n __extends(ObjectFeatures, _super);\n function ObjectFeatures() {\n _super.call(this, \"Features\");\n }\n ObjectFeatures.prototype.ProvisionObjects = function (features) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var webFeatures = web.get_features();\n features.forEach(function (f) {\n if (f.Deactivate === true) {\n webFeatures.remove(new SP.Guid(f.ID), true);\n }\n else {\n webFeatures.add(new SP.Guid(f.ID), true, SP.FeatureDefinitionScope.none);\n }\n });\n web.update();\n clientContext.load(webFeatures);\n clientContext.executeQueryAsync(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n });\n };\n return ObjectFeatures;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectFeatures = ObjectFeatures;\n\n},{\"./objecthandlerbase\":12}],11:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar CoreUtil = require(\"../../../utils/util\");\nvar util_1 = require(\"../util\");\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectFiles = (function (_super) {\n __extends(ObjectFiles, _super);\n function ObjectFiles() {\n _super.call(this, \"Files\");\n }\n ObjectFiles.prototype.ProvisionObjects = function (objects) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var fileInfos = [];\n var promises = [];\n objects.forEach(function (obj, index) {\n promises.push(_this.httpClient.fetchRaw(util_1.Util.replaceUrlTokens(obj.Src)).then(function (response) {\n return response.text();\n }));\n });\n Promise.all(promises).then(function (responses) {\n responses.forEach(function (response, index) {\n var obj = objects[index];\n var filename = _this.GetFilenameFromFilePath(obj.Dest);\n var webServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl;\n var folder = web.getFolderByServerRelativeUrl(webServerRelativeUrl + \"/\" + _this.GetFolderFromFilePath(obj.Dest));\n var fi = {\n Contents: response,\n Dest: obj.Dest,\n Filename: filename,\n Folder: folder,\n Instance: null,\n Overwrite: false,\n Properties: [],\n RemoveExistingWebParts: true,\n ServerRelativeUrl: obj.Dest,\n Src: obj.Src,\n Views: [],\n WebParts: [],\n };\n CoreUtil.Util.extend(fi, obj);\n if (fi.Filename.indexOf(\"Form.aspx\") !== -1) {\n return;\n }\n var objCreationInformation = new SP.FileCreationInformation();\n objCreationInformation.set_overwrite(fi.Overwrite);\n objCreationInformation.set_url(fi.Filename);\n objCreationInformation.set_content(new SP.Base64EncodedByteArray());\n for (var i = 0; i < fi.Contents.length; i++) {\n objCreationInformation.get_content().append(fi.Contents.charCodeAt(i));\n }\n clientContext.load(fi.Folder.get_files().add(objCreationInformation));\n fileInfos.push(fi);\n });\n });\n clientContext.executeQueryAsync(function () {\n promises = [];\n fileInfos.forEach(function (fi) {\n if (fi.Properties && Object.keys(fi.Properties).length > 0) {\n promises.push(_this.ApplyFileProperties(fi.Dest, fi.Properties));\n }\n if (fi.WebParts && fi.WebParts.length > 0) {\n promises.push(_this.AddWebPartsToWebPartPage(fi.Dest, fi.Src, fi.WebParts, fi.RemoveExistingWebParts));\n }\n });\n Promise.all(promises).then(function () {\n _this.ModifyHiddenViews(objects).then(function (value) {\n _super.prototype.scope_ended.call(_this);\n resolve(value);\n }, function (error) {\n _super.prototype.scope_ended.call(_this);\n reject(error);\n });\n });\n }, function (error) {\n _super.prototype.scope_ended.call(_this);\n reject(error);\n });\n });\n };\n ObjectFiles.prototype.RemoveWebPartsFromFileIfSpecified = function (clientContext, limitedWebPartManager, shouldRemoveExisting) {\n return new Promise(function (resolve, reject) {\n if (!shouldRemoveExisting) {\n resolve();\n }\n var existingWebParts = limitedWebPartManager.get_webParts();\n clientContext.load(existingWebParts);\n clientContext.executeQueryAsync(function () {\n existingWebParts.get_data().forEach(function (wp) {\n wp.deleteWebPart();\n });\n clientContext.load(existingWebParts);\n clientContext.executeQueryAsync(resolve, reject);\n }, reject);\n });\n };\n ObjectFiles.prototype.GetWebPartXml = function (webParts) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var promises = [];\n webParts.forEach(function (wp, index) {\n if (wp.Contents.FileUrl) {\n var fileUrl = util_1.Util.replaceUrlTokens(wp.Contents.FileUrl);\n promises.push(_this.httpClient.fetchRaw(fileUrl).then(function (response) {\n return response.text();\n }));\n }\n else {\n promises.push((function () {\n return new Promise(function (res, rej) {\n res();\n });\n })());\n }\n });\n Promise.all(promises).then(function (responses) {\n responses.forEach(function (response, index) {\n var wp = webParts[index];\n if (wp !== null && response && response.length > 0) {\n wp.Contents.Xml = response;\n }\n });\n resolve(webParts);\n });\n });\n };\n ObjectFiles.prototype.AddWebPartsToWebPartPage = function (dest, src, webParts, shouldRemoveExisting) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var fileServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + \"/\" + dest;\n var file = web.getFileByServerRelativeUrl(fileServerRelativeUrl);\n clientContext.load(file);\n clientContext.executeQueryAsync(function () {\n var limitedWebPartManager = file.getLimitedWebPartManager(SP.WebParts.PersonalizationScope.shared);\n _this.RemoveWebPartsFromFileIfSpecified(clientContext, limitedWebPartManager, shouldRemoveExisting).then(function () {\n _this.GetWebPartXml(webParts).then(function (webPartsWithXml) {\n webPartsWithXml.forEach(function (wp) {\n if (!wp.Contents.Xml) {\n return;\n }\n var oWebPartDefinition = limitedWebPartManager.importWebPart(util_1.Util.replaceUrlTokens(wp.Contents.Xml));\n var oWebPart = oWebPartDefinition.get_webPart();\n limitedWebPartManager.addWebPart(oWebPart, wp.Zone, wp.Order);\n });\n clientContext.executeQueryAsync(resolve, resolve);\n });\n });\n }, resolve);\n });\n };\n ObjectFiles.prototype.ApplyFileProperties = function (dest, fileProperties) {\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var fileServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + \"/\" + dest;\n var file = web.getFileByServerRelativeUrl(fileServerRelativeUrl);\n var listItemAllFields = file.get_listItemAllFields();\n Object.keys(fileProperties).forEach(function (key) {\n listItemAllFields.set_item(key, fileProperties[key]);\n });\n listItemAllFields.update();\n clientContext.executeQueryAsync(resolve, resolve);\n });\n };\n ObjectFiles.prototype.GetViewFromCollectionByUrl = function (viewCollection, url) {\n var serverRelativeUrl = _spPageContextInfo.webServerRelativeUrl + \"/\" + url;\n var viewCollectionEnumerator = viewCollection.getEnumerator();\n while (viewCollectionEnumerator.moveNext()) {\n var view = viewCollectionEnumerator.get_current();\n if (view.get_serverRelativeUrl().toString().toLowerCase() === serverRelativeUrl.toLowerCase()) {\n return view;\n }\n }\n return null;\n };\n ObjectFiles.prototype.ModifyHiddenViews = function (objects) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n var mapping = {};\n var lists = [];\n var listViewCollections = [];\n objects.forEach(function (obj) {\n if (!obj.Views) {\n return;\n }\n obj.Views.forEach(function (v) {\n mapping[v.List] = mapping[v.List] || [];\n mapping[v.List].push(CoreUtil.Util.extend(v, { \"Url\": obj.Dest }));\n });\n });\n Object.keys(mapping).forEach(function (l, index) {\n lists.push(web.get_lists().getByTitle(l));\n listViewCollections.push(web.get_lists().getByTitle(l).get_views());\n clientContext.load(lists[index]);\n clientContext.load(listViewCollections[index]);\n });\n clientContext.executeQueryAsync(function () {\n Object.keys(mapping).forEach(function (l, index) {\n var views = mapping[l];\n var list = lists[index];\n var viewCollection = listViewCollections[index];\n views.forEach(function (v) {\n var view = _this.GetViewFromCollectionByUrl(viewCollection, v.Url);\n if (view == null) {\n return;\n }\n if (v.Paged) {\n view.set_paged(v.Paged);\n }\n if (v.Query) {\n view.set_viewQuery(v.Query);\n }\n if (v.RowLimit) {\n view.set_rowLimit(v.RowLimit);\n }\n if (v.ViewFields && v.ViewFields.length > 0) {\n var columns_1 = view.get_viewFields();\n columns_1.removeAll();\n v.ViewFields.forEach(function (vf) {\n columns_1.add(vf);\n });\n }\n view.update();\n });\n clientContext.load(viewCollection);\n list.update();\n });\n clientContext.executeQueryAsync(resolve, resolve);\n }, resolve);\n });\n };\n ObjectFiles.prototype.GetFolderFromFilePath = function (filePath) {\n var split = filePath.split(\"/\");\n return split.splice(0, split.length - 1).join(\"/\");\n };\n ObjectFiles.prototype.GetFilenameFromFilePath = function (filePath) {\n var split = filePath.split(\"/\");\n return split[split.length - 1];\n };\n return ObjectFiles;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectFiles = ObjectFiles;\n;\n\n},{\"../../../utils/util\":23,\"../util\":20,\"./objecthandlerbase\":12}],12:[function(require,module,exports){\n\"use strict\";\nvar httpclient_1 = require(\"../../../net/httpclient\");\nvar logging_1 = require(\"../../../utils/logging\");\nvar ObjectHandlerBase = (function () {\n function ObjectHandlerBase(name) {\n this.name = name;\n this.httpClient = new httpclient_1.HttpClient();\n }\n ObjectHandlerBase.prototype.ProvisionObjects = function (objects, parameters) {\n return new Promise(function (resolve, reject) { resolve(\"Not implemented.\"); });\n };\n ObjectHandlerBase.prototype.scope_started = function () {\n logging_1.Logger.write(this.name + \": Code execution scope started\");\n };\n ObjectHandlerBase.prototype.scope_ended = function () {\n logging_1.Logger.write(this.name + \": Code execution scope stopped\");\n };\n return ObjectHandlerBase;\n}());\nexports.ObjectHandlerBase = ObjectHandlerBase;\n\n},{\"../../../net/httpclient\":5,\"../../../utils/logging\":22}],13:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar sequencer_1 = require(\"../sequencer/sequencer\");\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectLists = (function (_super) {\n __extends(ObjectLists, _super);\n function ObjectLists() {\n _super.call(this, \"Lists\");\n }\n ObjectLists.prototype.ProvisionObjects = function (objects) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var lists = clientContext.get_web().get_lists();\n var listInstances = [];\n clientContext.load(lists);\n clientContext.executeQueryAsync(function () {\n objects.forEach(function (obj, index) {\n var existingObj = lists.get_data().filter(function (list) {\n return list.get_title() === obj.Title;\n })[0];\n if (existingObj) {\n if (obj.Description) {\n existingObj.set_description(obj.Description);\n }\n if (obj.EnableVersioning !== undefined) {\n existingObj.set_enableVersioning(obj.EnableVersioning);\n }\n if (obj.EnableMinorVersions !== undefined) {\n existingObj.set_enableMinorVersions(obj.EnableMinorVersions);\n }\n if (obj.EnableModeration !== undefined) {\n existingObj.set_enableModeration(obj.EnableModeration);\n }\n if (obj.EnableFolderCreation !== undefined) {\n existingObj.set_enableFolderCreation(obj.EnableFolderCreation);\n }\n if (obj.EnableAttachments !== undefined) {\n existingObj.set_enableAttachments(obj.EnableAttachments);\n }\n if (obj.NoCrawl !== undefined) {\n existingObj.set_noCrawl(obj.NoCrawl);\n }\n if (obj.DefaultDisplayFormUrl) {\n existingObj.set_defaultDisplayFormUrl(obj.DefaultDisplayFormUrl);\n }\n if (obj.DefaultEditFormUrl) {\n existingObj.set_defaultEditFormUrl(obj.DefaultEditFormUrl);\n }\n if (obj.DefaultNewFormUrl) {\n existingObj.set_defaultNewFormUrl(obj.DefaultNewFormUrl);\n }\n if (obj.DraftVersionVisibility) {\n existingObj.set_draftVersionVisibility(SP.DraftVisibilityType[obj.DraftVersionVisibility]);\n }\n if (obj.ImageUrl) {\n existingObj.set_imageUrl(obj.ImageUrl);\n }\n if (obj.Hidden !== undefined) {\n existingObj.set_hidden(obj.Hidden);\n }\n if (obj.ForceCheckout !== undefined) {\n existingObj.set_forceCheckout(obj.ForceCheckout);\n }\n existingObj.update();\n listInstances.push(existingObj);\n clientContext.load(listInstances[index]);\n }\n else {\n var objCreationInformation = new SP.ListCreationInformation();\n if (obj.Description) {\n objCreationInformation.set_description(obj.Description);\n }\n if (obj.OnQuickLaunch !== undefined) {\n var value = obj.OnQuickLaunch ? SP.QuickLaunchOptions.on : SP.QuickLaunchOptions.off;\n objCreationInformation.set_quickLaunchOption(value);\n }\n if (obj.TemplateType) {\n objCreationInformation.set_templateType(obj.TemplateType);\n }\n if (obj.Title) {\n objCreationInformation.set_title(obj.Title);\n }\n if (obj.Url) {\n objCreationInformation.set_url(obj.Url);\n }\n var createdList = lists.add(objCreationInformation);\n if (obj.EnableVersioning !== undefined) {\n createdList.set_enableVersioning(obj.EnableVersioning);\n }\n if (obj.EnableMinorVersions !== undefined) {\n createdList.set_enableMinorVersions(obj.EnableMinorVersions);\n }\n if (obj.EnableModeration !== undefined) {\n createdList.set_enableModeration(obj.EnableModeration);\n }\n if (obj.EnableFolderCreation !== undefined) {\n createdList.set_enableFolderCreation(obj.EnableFolderCreation);\n }\n if (obj.EnableAttachments !== undefined) {\n createdList.set_enableAttachments(obj.EnableAttachments);\n }\n if (obj.NoCrawl !== undefined) {\n createdList.set_noCrawl(obj.NoCrawl);\n }\n if (obj.DefaultDisplayFormUrl) {\n createdList.set_defaultDisplayFormUrl(obj.DefaultDisplayFormUrl);\n }\n if (obj.DefaultEditFormUrl) {\n createdList.set_defaultEditFormUrl(obj.DefaultEditFormUrl);\n }\n if (obj.DefaultNewFormUrl) {\n createdList.set_defaultNewFormUrl(obj.DefaultNewFormUrl);\n }\n if (obj.DraftVersionVisibility) {\n var value = SP.DraftVisibilityType[obj.DraftVersionVisibility.toLocaleLowerCase()];\n createdList.set_draftVersionVisibility(value);\n }\n if (obj.ImageUrl) {\n createdList.set_imageUrl(obj.ImageUrl);\n }\n if (obj.Hidden !== undefined) {\n createdList.set_hidden(obj.Hidden);\n }\n if (obj.ForceCheckout !== undefined) {\n createdList.set_forceCheckout(obj.ForceCheckout);\n }\n listInstances.push(createdList);\n clientContext.load(listInstances[index]);\n }\n });\n clientContext.executeQueryAsync(function () {\n var sequencer = new sequencer_1.Sequencer([\n _this.ApplyContentTypeBindings,\n _this.ApplyListInstanceFieldRefs,\n _this.ApplyFields,\n _this.ApplyLookupFields,\n _this.ApplyListSecurity,\n _this.CreateViews,\n _this.InsertDataRows,\n _this.CreateFolders,\n ], { ClientContext: clientContext, ListInstances: listInstances, Objects: objects }, _this);\n sequencer.execute().then(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n });\n };\n ObjectLists.prototype.EnsureLocationBasedMetadataDefaultsReceiver = function (clientContext, list) {\n var eventReceivers = list.get_eventReceivers();\n var eventRecCreationInfo = new SP.EventReceiverDefinitionCreationInformation();\n eventRecCreationInfo.set_receiverName(\"LocationBasedMetadataDefaultsReceiver ItemAdded\");\n eventRecCreationInfo.set_synchronization(1);\n eventRecCreationInfo.set_sequenceNumber(1000);\n eventRecCreationInfo.set_receiverAssembly(\"Microsoft.Office.DocumentManagement, Version=15.0.0.0, Culture=neutral, \" +\n \"PublicKeyToken=71e9bce111e9429c\");\n eventRecCreationInfo.set_receiverClass(\"Microsoft.Office.DocumentManagement.LocationBasedMetadataDefaultsReceiver\");\n eventRecCreationInfo.set_eventType(SP.EventReceiverType.itemAdded);\n eventReceivers.add(eventRecCreationInfo);\n list.update();\n };\n ObjectLists.prototype.CreateFolders = function (params) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (!obj.Folders) {\n return;\n }\n var folderServerRelativeUrl = _spPageContextInfo.webServerRelativeUrl + \"/\" + obj.Url;\n var rootFolder = l.get_rootFolder();\n var metadataDefaults = \"\";\n var setMetadataDefaults = false;\n obj.Folders.forEach(function (f) {\n var folderUrl = folderServerRelativeUrl + \"/\" + f.Name;\n rootFolder.get_folders().add(folderUrl);\n if (f.DefaultValues) {\n var keys = Object.keys(f.DefaultValues).length;\n if (keys > 0) {\n metadataDefaults += \"\";\n Object.keys(f.DefaultValues).forEach(function (key) {\n metadataDefaults += \"\" + f.DefaultValues[key] + \"\";\n });\n metadataDefaults += \"\";\n }\n setMetadataDefaults = true;\n }\n });\n metadataDefaults += \"\";\n if (setMetadataDefaults) {\n var metadataDefaultsFileCreateInfo = new SP.FileCreationInformation();\n metadataDefaultsFileCreateInfo.set_url(folderServerRelativeUrl + \"/Forms/client_LocationBasedDefaults.html\");\n metadataDefaultsFileCreateInfo.set_content(new SP.Base64EncodedByteArray());\n metadataDefaultsFileCreateInfo.set_overwrite(true);\n for (var i = 0; i < metadataDefaults.length; i++) {\n metadataDefaultsFileCreateInfo.get_content().append(metadataDefaults.charCodeAt(i));\n }\n rootFolder.get_files().add(metadataDefaultsFileCreateInfo);\n _this.EnsureLocationBasedMetadataDefaultsReceiver(params.ClientContext, l);\n }\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n });\n };\n ObjectLists.prototype.ApplyContentTypeBindings = function (params) {\n return new Promise(function (resolve, reject) {\n var webCts = params.ClientContext.get_site().get_rootWeb().get_contentTypes();\n var listCts = [];\n params.ListInstances.forEach(function (l, index) {\n listCts.push(l.get_contentTypes());\n params.ClientContext.load(listCts[index], \"Include(Name,Id)\");\n if (params.Objects[index].ContentTypeBindings) {\n l.set_contentTypesEnabled(true);\n l.update();\n }\n });\n params.ClientContext.load(webCts);\n params.ClientContext.executeQueryAsync(function () {\n params.ListInstances.forEach(function (list, index) {\n var obj = params.Objects[index];\n if (!obj.ContentTypeBindings) {\n return;\n }\n var listContentTypes = listCts[index];\n var existingContentTypes = new Array();\n if (obj.RemoveExistingContentTypes && obj.ContentTypeBindings.length > 0) {\n listContentTypes.get_data().forEach(function (ct) {\n existingContentTypes.push(ct);\n });\n }\n obj.ContentTypeBindings.forEach(function (ctb) {\n listContentTypes.addExistingContentType(webCts.getById(ctb.ContentTypeId));\n });\n if (obj.RemoveExistingContentTypes && obj.ContentTypeBindings.length > 0) {\n for (var j = 0; j < existingContentTypes.length; j++) {\n var ect = existingContentTypes[j];\n ect.deleteObject();\n }\n }\n list.update();\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n }, resolve);\n });\n };\n ObjectLists.prototype.ApplyListInstanceFieldRefs = function (params) {\n return new Promise(function (resolve, reject) {\n var siteFields = params.ClientContext.get_site().get_rootWeb().get_fields();\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (obj.FieldRefs) {\n obj.FieldRefs.forEach(function (fr) {\n var field = siteFields.getByInternalNameOrTitle(fr.Name);\n l.get_fields().add(field);\n });\n l.update();\n }\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n });\n };\n ObjectLists.prototype.ApplyFields = function (params) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (obj.Fields) {\n obj.Fields.forEach(function (f) {\n var fieldXml = _this.GetFieldXml(f, params.ListInstances, l);\n var fieldType = _this.GetFieldXmlAttr(fieldXml, \"Type\");\n if (fieldType !== \"Lookup\" && fieldType !== \"LookupMulti\") {\n l.get_fields().addFieldAsXml(fieldXml, true, SP.AddFieldOptions.addToAllContentTypes);\n }\n });\n l.update();\n }\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n });\n };\n ObjectLists.prototype.ApplyLookupFields = function (params) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (obj.Fields) {\n obj.Fields.forEach(function (f) {\n var fieldXml = _this.GetFieldXml(f, params.ListInstances, l);\n if (!fieldXml) {\n return;\n }\n var fieldType = _this.GetFieldXmlAttr(fieldXml, \"Type\");\n if (fieldType === \"Lookup\" || fieldType === \"LookupMulti\") {\n l.get_fields().addFieldAsXml(fieldXml, true, SP.AddFieldOptions.addToAllContentTypes);\n }\n });\n l.update();\n }\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n });\n };\n ObjectLists.prototype.GetFieldXmlAttr = function (fieldXml, attr) {\n var regex = new RegExp(attr + '=[\\'|\\\"](?:(.+?))[\\'|\\\"]');\n var match = regex.exec(fieldXml);\n return match[1];\n };\n ObjectLists.prototype.GetFieldXml = function (field, lists, list) {\n var fieldXml = \"\";\n if (!field.SchemaXml) {\n var properties_1 = [];\n Object.keys(field).forEach(function (prop) {\n var value = field[prop];\n if (prop === \"List\") {\n var targetList = lists.filter(function (v) {\n return v.get_title() === value;\n });\n if (targetList.length > 0) {\n value = \"{\" + targetList[0].get_id().toString() + \"}\";\n }\n else {\n return null;\n }\n properties_1.push(prop + \"=\\\"\" + value + \"\\\"\");\n }\n });\n fieldXml = \"\";\n if (field.Type === \"Calculated\") {\n fieldXml += \"\" + field.Formula + \"\";\n }\n fieldXml += \"\";\n }\n return fieldXml;\n };\n ObjectLists.prototype.ApplyListSecurity = function (params) {\n return new Promise(function (resolve, reject) {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (!obj.Security) {\n return;\n }\n if (obj.Security.BreakRoleInheritance) {\n l.breakRoleInheritance(obj.Security.CopyRoleAssignments, obj.Security.ClearSubscopes);\n l.update();\n params.ClientContext.load(l.get_roleAssignments());\n }\n });\n var web = params.ClientContext.get_web();\n var allProperties = web.get_allProperties();\n var siteGroups = web.get_siteGroups();\n var roleDefinitions = web.get_roleDefinitions();\n params.ClientContext.load(allProperties);\n params.ClientContext.load(roleDefinitions);\n params.ClientContext.executeQueryAsync(function () {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (!obj.Security) {\n return;\n }\n obj.Security.RoleAssignments.forEach(function (ra) {\n var roleDef = null;\n if (typeof ra.RoleDefinition === \"number\") {\n roleDef = roleDefinitions.getById(ra.RoleDefinition);\n }\n else {\n roleDef = roleDefinitions.getByName(ra.RoleDefinition);\n }\n var roleBindings = SP.RoleDefinitionBindingCollection.newObject(params.ClientContext);\n roleBindings.add(roleDef);\n var principal = null;\n if (ra.Principal.match(/\\{[A-Za-z]*\\}+/g)) {\n var token = ra.Principal.substring(1, ra.Principal.length - 1);\n var groupId = allProperties.get_fieldValues()[(\"vti_\" + token)];\n principal = siteGroups.getById(groupId);\n }\n else {\n principal = siteGroups.getByName(principal);\n }\n l.get_roleAssignments().add(principal, roleBindings);\n });\n l.update();\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n }, resolve);\n });\n };\n ObjectLists.prototype.CreateViews = function (params) {\n return new Promise(function (resolve, reject) {\n var listViewCollections = [];\n params.ListInstances.forEach(function (l, index) {\n listViewCollections.push(l.get_views());\n params.ClientContext.load(listViewCollections[index]);\n });\n params.ClientContext.executeQueryAsync(function () {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (!obj.Views) {\n return;\n }\n listViewCollections.push(l.get_views());\n params.ClientContext.load(listViewCollections[index]);\n obj.Views.forEach(function (v) {\n var viewExists = listViewCollections[index].get_data().filter(function (ev) {\n if (obj.RemoveExistingViews && obj.Views.length > 0) {\n ev.deleteObject();\n return false;\n }\n return ev.get_title() === v.Title;\n }).length > 0;\n if (viewExists) {\n var view = listViewCollections[index].getByTitle(v.Title);\n if (v.Paged) {\n view.set_paged(v.Paged);\n }\n if (v.Query) {\n view.set_viewQuery(v.Query);\n }\n if (v.RowLimit) {\n view.set_rowLimit(v.RowLimit);\n }\n if (v.ViewFields && v.ViewFields.length > 0) {\n var columns_1 = view.get_viewFields();\n columns_1.removeAll();\n v.ViewFields.forEach(function (vf) {\n columns_1.add(vf);\n });\n }\n if (v.Scope) {\n view.set_scope(v.Scope);\n }\n view.update();\n }\n else {\n var viewCreationInformation = new SP.ViewCreationInformation();\n if (v.Title) {\n viewCreationInformation.set_title(v.Title);\n }\n if (v.PersonalView) {\n viewCreationInformation.set_personalView(v.PersonalView);\n }\n if (v.Paged) {\n viewCreationInformation.set_paged(v.Paged);\n }\n if (v.Query) {\n viewCreationInformation.set_query(v.Query);\n }\n if (v.RowLimit) {\n viewCreationInformation.set_rowLimit(v.RowLimit);\n }\n if (v.SetAsDefaultView) {\n viewCreationInformation.set_setAsDefaultView(v.SetAsDefaultView);\n }\n if (v.ViewFields) {\n viewCreationInformation.set_viewFields(v.ViewFields);\n }\n if (v.ViewTypeKind) {\n viewCreationInformation.set_viewTypeKind(SP.ViewType.html);\n }\n var view = l.get_views().add(viewCreationInformation);\n if (v.Scope) {\n view.set_scope(v.Scope);\n view.update();\n }\n l.update();\n }\n params.ClientContext.load(l.get_views());\n });\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n }, resolve);\n });\n };\n ObjectLists.prototype.InsertDataRows = function (params) {\n return new Promise(function (resolve, reject) {\n params.ListInstances.forEach(function (l, index) {\n var obj = params.Objects[index];\n if (obj.DataRows) {\n obj.DataRows.forEach(function (r) {\n var item = l.addItem(new SP.ListItemCreationInformation());\n Object.keys(r).forEach(function (key) {\n item.set_item(key, r[key]);\n });\n item.update();\n params.ClientContext.load(item);\n });\n }\n });\n params.ClientContext.executeQueryAsync(resolve, resolve);\n });\n };\n return ObjectLists;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectLists = ObjectLists;\n\n},{\"../sequencer/sequencer\":19,\"./objecthandlerbase\":12}],14:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../util\");\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectNavigation = (function (_super) {\n __extends(ObjectNavigation, _super);\n function ObjectNavigation() {\n _super.call(this, \"Navigation\");\n }\n ObjectNavigation.prototype.ProvisionObjects = function (object) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n var clientContext = SP.ClientContext.get_current();\n var navigation = clientContext.get_web().get_navigation();\n return new Promise(function (resolve, reject) {\n _this.ConfigureQuickLaunch(object.QuickLaunch, clientContext, _this.httpClient, navigation).then(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n reject();\n });\n });\n };\n ObjectNavigation.prototype.getNodeFromCollectionByTitle = function (nodeCollection, title) {\n var f = nodeCollection.filter(function (val) {\n return val.get_title() === title;\n });\n return f[0] || null;\n };\n ;\n ObjectNavigation.prototype.ConfigureQuickLaunch = function (nodes, clientContext, httpClient, navigation) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (nodes.length === 0) {\n resolve();\n }\n else {\n var quickLaunchNodeCollection_1 = navigation.get_quickLaunch();\n clientContext.load(quickLaunchNodeCollection_1);\n clientContext.executeQueryAsync(function () {\n var temporaryQuickLaunch = [];\n var index = quickLaunchNodeCollection_1.get_count() - 1;\n while (index >= 0) {\n var oldNode = quickLaunchNodeCollection_1.itemAt(index);\n temporaryQuickLaunch.push(oldNode);\n oldNode.deleteObject();\n index--;\n }\n clientContext.executeQueryAsync(function () {\n nodes.forEach(function (n) {\n var existingNode = _this.getNodeFromCollectionByTitle(temporaryQuickLaunch, n.Title);\n var newNode = new SP.NavigationNodeCreationInformation();\n newNode.set_title(n.Title);\n newNode.set_url(existingNode ? existingNode.get_url() : util_1.Util.replaceUrlTokens(n.Url));\n newNode.set_asLastNode(true);\n quickLaunchNodeCollection_1.add(newNode);\n });\n clientContext.executeQueryAsync(function () {\n httpClient.get(_spPageContextInfo.webAbsoluteUrl + \"/_api/web/Navigation/QuickLaunch\").then(function (response) {\n response.json().then(function (json) {\n json.value.forEach(function (d) {\n var node = navigation.getNodeById(d.Id);\n var childrenNodeCollection = node.get_children();\n var parentNode = nodes.filter(function (value) { return value.Title === d.Title; })[0];\n if (parentNode && parentNode.Children) {\n parentNode.Children.forEach(function (n) {\n var existingNode = _this.getNodeFromCollectionByTitle(temporaryQuickLaunch, n.Title);\n var newNode = new SP.NavigationNodeCreationInformation();\n newNode.set_title(n.Title);\n newNode.set_url(existingNode\n ? existingNode.get_url()\n : util_1.Util.replaceUrlTokens(n.Url));\n newNode.set_asLastNode(true);\n childrenNodeCollection.add(newNode);\n });\n }\n });\n clientContext.executeQueryAsync(resolve, resolve);\n });\n });\n }, resolve);\n });\n });\n }\n });\n };\n return ObjectNavigation;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectNavigation = ObjectNavigation;\n\n},{\"../util\":20,\"./objecthandlerbase\":12}],15:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../util\");\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectPropertyBagEntries = (function (_super) {\n __extends(ObjectPropertyBagEntries, _super);\n function ObjectPropertyBagEntries() {\n _super.call(this, \"PropertyBagEntries\");\n }\n ObjectPropertyBagEntries.prototype.ProvisionObjects = function (entries) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n if (!entries || entries.length === 0) {\n resolve();\n }\n else {\n var clientContext_1 = SP.ClientContext.get_current();\n var web_1 = clientContext_1.get_web();\n var propBag_1 = web_1.get_allProperties();\n var indexedProperties_1 = [];\n for (var i = 0; i < entries.length; i++) {\n var entry = entries[i];\n propBag_1.set_item(entry.Key, entry.Value);\n if (entry.Indexed) {\n indexedProperties_1.push(util_1.Util.encodePropertyKey(entry.Key));\n }\n ;\n }\n ;\n web_1.update();\n clientContext_1.load(propBag_1);\n clientContext_1.executeQueryAsync(function () {\n if (indexedProperties_1.length > 0) {\n propBag_1.set_item(\"vti_indexedpropertykeys\", indexedProperties_1.join(\"|\"));\n web_1.update();\n clientContext_1.executeQueryAsync(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n }\n else {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n }\n });\n };\n return ObjectPropertyBagEntries;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectPropertyBagEntries = ObjectPropertyBagEntries;\n\n},{\"../util\":20,\"./objecthandlerbase\":12}],16:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar objecthandlerbase_1 = require(\"./objecthandlerbase\");\nvar ObjectWebSettings = (function (_super) {\n __extends(ObjectWebSettings, _super);\n function ObjectWebSettings() {\n _super.call(this, \"WebSettings\");\n }\n ObjectWebSettings.prototype.ProvisionObjects = function (object) {\n var _this = this;\n _super.prototype.scope_started.call(this);\n return new Promise(function (resolve, reject) {\n var clientContext = SP.ClientContext.get_current();\n var web = clientContext.get_web();\n if (object.WelcomePage) {\n web.get_rootFolder().set_welcomePage(object.WelcomePage);\n web.get_rootFolder().update();\n }\n if (object.MasterUrl) {\n web.set_masterUrl(object.MasterUrl);\n }\n if (object.CustomMasterUrl) {\n web.set_customMasterUrl(object.CustomMasterUrl);\n }\n if (object.SaveSiteAsTemplateEnabled !== undefined) {\n web.set_saveSiteAsTemplateEnabled(object.SaveSiteAsTemplateEnabled);\n }\n if (object.QuickLaunchEnabled !== undefined) {\n web.set_saveSiteAsTemplateEnabled(object.QuickLaunchEnabled);\n }\n if (object.TreeViewEnabled !== undefined) {\n web.set_treeViewEnabled(object.TreeViewEnabled);\n }\n web.update();\n clientContext.load(web);\n clientContext.executeQueryAsync(function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n }, function () {\n _super.prototype.scope_ended.call(_this);\n resolve();\n });\n });\n };\n return ObjectWebSettings;\n}(objecthandlerbase_1.ObjectHandlerBase));\nexports.ObjectWebSettings = ObjectWebSettings;\n\n},{\"./objecthandlerbase\":12}],17:[function(require,module,exports){\n\"use strict\";\nvar provisioningstep_1 = require(\"./provisioningstep\");\nvar objectnavigation_1 = require(\"./objecthandlers/objectnavigation\");\nvar objectpropertybagentries_1 = require(\"./objecthandlers/objectpropertybagentries\");\nvar objectfeatures_1 = require(\"./objecthandlers/objectfeatures\");\nvar objectwebsettings_1 = require(\"./objecthandlers/objectwebsettings\");\nvar objectcomposedlook_1 = require(\"./objecthandlers/objectcomposedlook\");\nvar objectcustomactions_1 = require(\"./objecthandlers/objectcustomactions\");\nvar objectfiles_1 = require(\"./objecthandlers/objectfiles\");\nvar objectlists_1 = require(\"./objecthandlers/objectlists\");\nvar util_1 = require(\"./util\");\nvar logging_1 = require(\"../../utils/logging\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar Provisioning = (function () {\n function Provisioning() {\n this.handlers = {\n \"Navigation\": objectnavigation_1.ObjectNavigation,\n \"PropertyBagEntries\": objectpropertybagentries_1.ObjectPropertyBagEntries,\n \"Features\": objectfeatures_1.ObjectFeatures,\n \"WebSettings\": objectwebsettings_1.ObjectWebSettings,\n \"ComposedLook\": objectcomposedlook_1.ObjectComposedLook,\n \"CustomActions\": objectcustomactions_1.ObjectCustomActions,\n \"Files\": objectfiles_1.ObjectFiles,\n \"Lists\": objectlists_1.ObjectLists,\n };\n this.httpClient = new httpclient_1.HttpClient();\n }\n Provisioning.prototype.applyTemplate = function (path) {\n var _this = this;\n var url = util_1.Util.replaceUrlTokens(path);\n return new Promise(function (resolve, reject) {\n _this.httpClient.get(url).then(function (response) {\n if (response.ok) {\n response.json().then(function (template) {\n _this.start(template, Object.keys(template)).then(resolve, reject);\n });\n }\n else {\n reject(response.statusText);\n }\n }, function (error) {\n logging_1.Logger.write(\"Provisioning: The provided template is invalid\", logging_1.Logger.LogLevel.Error);\n });\n });\n };\n Provisioning.prototype.start = function (json, queue) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n _this.startTime = new Date().getTime();\n _this.queueItems = [];\n queue.forEach(function (q, index) {\n if (!_this.handlers[q]) {\n return;\n }\n _this.queueItems.push(new provisioningstep_1.ProvisioningStep(q, index, json[q], json.Parameters, _this.handlers[q]));\n });\n var promises = [];\n promises.push(new Promise(function (res) {\n logging_1.Logger.write(\"Provisioning: Code execution scope started\", logging_1.Logger.LogLevel.Info);\n res();\n }));\n var index = 1;\n while (_this.queueItems[index - 1] !== undefined) {\n var i = promises.length - 1;\n promises.push(_this.queueItems[index - 1].execute(promises[i]));\n index++;\n }\n ;\n Promise.all(promises).then(function (value) {\n logging_1.Logger.write(\"Provisioning: Code execution scope ended\", logging_1.Logger.LogLevel.Info);\n resolve(value);\n }, function (error) {\n logging_1.Logger.write(\"Provisioning: Code execution scope ended\" + JSON.stringify(error), logging_1.Logger.LogLevel.Error);\n reject(error);\n });\n });\n };\n return Provisioning;\n}());\nexports.Provisioning = Provisioning;\n\n},{\"../../net/httpclient\":5,\"../../utils/logging\":22,\"./objecthandlers/objectcomposedlook\":8,\"./objecthandlers/objectcustomactions\":9,\"./objecthandlers/objectfeatures\":10,\"./objecthandlers/objectfiles\":11,\"./objecthandlers/objectlists\":13,\"./objecthandlers/objectnavigation\":14,\"./objecthandlers/objectpropertybagentries\":15,\"./objecthandlers/objectwebsettings\":16,\"./provisioningstep\":18,\"./util\":20}],18:[function(require,module,exports){\n\"use strict\";\nvar ProvisioningStep = (function () {\n function ProvisioningStep(name, index, objects, parameters, handler) {\n this.name = name;\n this.index = index;\n this.objects = objects;\n this.parameters = parameters;\n this.handler = handler;\n }\n ProvisioningStep.prototype.execute = function (dependentPromise) {\n var _this = this;\n var _handler = new this.handler();\n if (!dependentPromise) {\n return _handler.ProvisionObjects(this.objects, this.parameters);\n }\n return new Promise(function (resolve, reject) {\n dependentPromise.then(function () {\n return _handler.ProvisionObjects(_this.objects, _this.parameters).then(resolve, resolve);\n });\n });\n };\n return ProvisioningStep;\n}());\nexports.ProvisioningStep = ProvisioningStep;\n\n},{}],19:[function(require,module,exports){\n\"use strict\";\nvar Sequencer = (function () {\n function Sequencer(functions, parameter, scope) {\n this.functions = functions;\n this.parameter = parameter;\n this.scope = scope;\n }\n Sequencer.prototype.execute = function (progressFunction) {\n var promiseSequence = Promise.resolve();\n this.functions.forEach(function (sequenceFunction, functionNr) {\n promiseSequence = promiseSequence.then(function () {\n return sequenceFunction.call(this.scope, this.parameter);\n }).then(function (result) {\n if (progressFunction) {\n progressFunction.call(this, functionNr, this.functions);\n }\n });\n }, this);\n return promiseSequence;\n };\n return Sequencer;\n}());\nexports.Sequencer = Sequencer;\n\n},{}],20:[function(require,module,exports){\n\"use strict\";\nvar Util = (function () {\n function Util() {\n }\n Util.getRelativeUrl = function (url) {\n return url.replace(document.location.protocol + \"//\" + document.location.hostname, \"\");\n };\n Util.replaceUrlTokens = function (url) {\n return url.replace(/{site}/g, _spPageContextInfo.webAbsoluteUrl)\n .replace(/{sitecollection}/g, _spPageContextInfo.siteAbsoluteUrl)\n .replace(/{themegallery}/g, _spPageContextInfo.siteAbsoluteUrl + \"/_catalogs/theme/15\");\n };\n ;\n Util.encodePropertyKey = function (propKey) {\n var bytes = [];\n for (var i = 0; i < propKey.length; ++i) {\n bytes.push(propKey.charCodeAt(i));\n bytes.push(0);\n }\n var b64encoded = window.btoa(String.fromCharCode.apply(null, bytes));\n return b64encoded;\n };\n return Util;\n}());\nexports.Util = Util;\n\n},{}],21:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar logging_1 = require(\"../../utils/logging\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nfunction extractOdataId(candidate) {\n if (candidate.hasOwnProperty(\"odata.id\")) {\n return candidate[\"odata.id\"];\n }\n else if (candidate.hasOwnProperty(\"__metadata\") && candidate.__metadata.hasOwnProperty(\"id\")) {\n return candidate.__metadata.id;\n }\n else {\n logging_1.Logger.log({\n data: candidate,\n level: logging_1.Logger.LogLevel.Error,\n message: \"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\",\n });\n throw new Error(\"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\");\n }\n}\nexports.extractOdataId = extractOdataId;\nvar ODataParserBase = (function () {\n function ODataParserBase() {\n }\n ODataParserBase.prototype.parse = function (r) {\n return r.json().then(function (json) {\n var result = json;\n if (json.hasOwnProperty(\"d\")) {\n if (json.d.hasOwnProperty(\"results\")) {\n result = json.d.results;\n }\n else {\n result = json.d;\n }\n }\n else if (json.hasOwnProperty(\"value\")) {\n result = json.value;\n }\n return result;\n });\n };\n return ODataParserBase;\n}());\nexports.ODataParserBase = ODataParserBase;\nvar ODataDefaultParser = (function (_super) {\n __extends(ODataDefaultParser, _super);\n function ODataDefaultParser() {\n _super.apply(this, arguments);\n }\n return ODataDefaultParser;\n}(ODataParserBase));\nexports.ODataDefaultParser = ODataDefaultParser;\nvar ODataRawParserImpl = (function () {\n function ODataRawParserImpl() {\n }\n ODataRawParserImpl.prototype.parse = function (r) {\n return r.json();\n };\n return ODataRawParserImpl;\n}());\nexports.ODataRawParserImpl = ODataRawParserImpl;\nvar ODataValueParserImpl = (function (_super) {\n __extends(ODataValueParserImpl, _super);\n function ODataValueParserImpl() {\n _super.apply(this, arguments);\n }\n ODataValueParserImpl.prototype.parse = function (r) {\n return _super.prototype.parse.call(this, r).then(function (d) { return d; });\n };\n return ODataValueParserImpl;\n}(ODataParserBase));\nvar ODataEntityParserImpl = (function (_super) {\n __extends(ODataEntityParserImpl, _super);\n function ODataEntityParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n var o = new _this.factory(getEntityUrl(d), null);\n return util_1.Util.extend(o, d);\n });\n };\n return ODataEntityParserImpl;\n}(ODataParserBase));\nvar ODataEntityArrayParserImpl = (function (_super) {\n __extends(ODataEntityArrayParserImpl, _super);\n function ODataEntityArrayParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityArrayParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n return d.map(function (v) {\n var o = new _this.factory(getEntityUrl(v), null);\n return util_1.Util.extend(o, v);\n });\n });\n };\n return ODataEntityArrayParserImpl;\n}(ODataParserBase));\nfunction getEntityUrl(entity) {\n if (entity.hasOwnProperty(\"__metadata\")) {\n return entity.__metadata.uri;\n }\n else if (entity.hasOwnProperty(\"odata.editLink\")) {\n return util_1.Util.combinePaths(\"_api\", entity[\"odata.editLink\"]);\n }\n else {\n logging_1.Logger.write(\"No uri information found in ODataEntity parsing, chaining will fail for this object.\", logging_1.Logger.LogLevel.Warning);\n return \"\";\n }\n}\nexports.ODataRaw = new ODataRawParserImpl();\nfunction ODataValue() {\n return new ODataValueParserImpl();\n}\nexports.ODataValue = ODataValue;\nfunction ODataEntity(factory) {\n return new ODataEntityParserImpl(factory);\n}\nexports.ODataEntity = ODataEntity;\nfunction ODataEntityArray(factory) {\n return new ODataEntityArrayParserImpl(factory);\n}\nexports.ODataEntityArray = ODataEntityArray;\nvar ODataBatch = (function () {\n function ODataBatch(_batchId) {\n if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); }\n this._batchId = _batchId;\n this._requests = [];\n this._batchDepCount = 0;\n }\n ODataBatch.prototype.add = function (url, method, options, parser) {\n var info = {\n method: method.toUpperCase(),\n options: options,\n parser: parser,\n reject: null,\n resolve: null,\n url: url,\n };\n var p = new Promise(function (resolve, reject) {\n info.resolve = resolve;\n info.reject = reject;\n });\n this._requests.push(info);\n return p;\n };\n ODataBatch.prototype.incrementBatchDep = function () {\n this._batchDepCount++;\n };\n ODataBatch.prototype.decrementBatchDep = function () {\n this._batchDepCount--;\n };\n ODataBatch.prototype.execute = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (_this._batchDepCount > 0) {\n setTimeout(function () { return _this.execute(); }, 100);\n }\n else {\n _this.executeImpl().then(function () { return resolve(); }).catch(reject);\n }\n });\n };\n ODataBatch.prototype.executeImpl = function () {\n var _this = this;\n if (this._requests.length < 1) {\n return new Promise(function (r) { return r(); });\n }\n var batchBody = [];\n var currentChangeSetId = \"\";\n this._requests.forEach(function (reqInfo, index) {\n if (reqInfo.method === \"GET\") {\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n }\n else {\n if (currentChangeSetId.length < 1) {\n currentChangeSetId = util_1.Util.getGUID();\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n batchBody.push(\"Content-Type: multipart/mixed; boundary=\\\"changeset_\" + currentChangeSetId + \"\\\"\\n\\n\");\n }\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"\\n\");\n }\n batchBody.push(\"Content-Type: application/http\\n\");\n batchBody.push(\"Content-Transfer-Encoding: binary\\n\\n\");\n var headers = {\n \"Accept\": \"application/json;\",\n };\n if (reqInfo.method !== \"GET\") {\n var method = reqInfo.method;\n if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers[\"X-HTTP-Method\"] !== typeof undefined) {\n method = reqInfo.options.headers[\"X-HTTP-Method\"];\n delete reqInfo.options.headers[\"X-HTTP-Method\"];\n }\n batchBody.push(method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n headers = util_1.Util.extend(headers, { \"Content-Type\": \"application/json;odata=verbose;charset=utf-8\" });\n }\n else {\n batchBody.push(reqInfo.method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n }\n if (typeof pnplibconfig_1.RuntimeConfig.headers !== \"undefined\") {\n headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers);\n }\n if (reqInfo.options && reqInfo.options.headers) {\n headers = util_1.Util.extend(headers, reqInfo.options.headers);\n }\n for (var name_1 in headers) {\n if (headers.hasOwnProperty(name_1)) {\n batchBody.push(name_1 + \": \" + headers[name_1] + \"\\n\");\n }\n }\n batchBody.push(\"\\n\");\n if (reqInfo.options.body) {\n batchBody.push(reqInfo.options.body + \"\\n\\n\");\n }\n });\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + this._batchId + \"--\\n\");\n var batchHeaders = {\n \"Content-Type\": \"multipart/mixed; boundary=batch_\" + this._batchId,\n };\n var batchOptions = {\n \"body\": batchBody.join(\"\"),\n \"headers\": batchHeaders,\n };\n var client = new httpclient_1.HttpClient();\n return client.post(util_1.Util.makeUrlAbsolute(\"/_api/$batch\"), batchOptions)\n .then(function (r) { return r.text(); })\n .then(this._parseResponse)\n .then(function (responses) {\n if (responses.length !== _this._requests.length) {\n throw new Error(\"Could not properly parse responses to match requests in batch.\");\n }\n var resolutions = [];\n for (var i = 0; i < responses.length; i++) {\n var request = _this._requests[i];\n var response = responses[i];\n if (!response.ok) {\n request.reject(new Error(response.statusText));\n }\n resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject));\n }\n return Promise.all(resolutions);\n });\n };\n ODataBatch.prototype._parseResponse = function (body) {\n return new Promise(function (resolve, reject) {\n var responses = [];\n var header = \"--batchresponse_\";\n var statusRegExp = new RegExp(\"^HTTP/[0-9.]+ +([0-9]+) +(.*)\", \"i\");\n var lines = body.split(\"\\n\");\n var state = \"batch\";\n var status;\n var statusText;\n for (var i = 0; i < lines.length; ++i) {\n var line = lines[i];\n switch (state) {\n case \"batch\":\n if (line.substr(0, header.length) === header) {\n state = \"batchHeaders\";\n }\n else {\n if (line.trim() !== \"\") {\n throw new Error(\"Invalid response, line \" + i);\n }\n }\n break;\n case \"batchHeaders\":\n if (line.trim() === \"\") {\n state = \"status\";\n }\n break;\n case \"status\":\n var parts = statusRegExp.exec(line);\n if (parts.length !== 3) {\n throw new Error(\"Invalid status, line \" + i);\n }\n status = parseInt(parts[1], 10);\n statusText = parts[2];\n state = \"statusHeaders\";\n break;\n case \"statusHeaders\":\n if (line.trim() === \"\") {\n state = \"body\";\n }\n break;\n case \"body\":\n var response = void 0;\n if (status === 204) {\n response = new Response();\n }\n else {\n response = new Response(line, { status: status, statusText: statusText });\n }\n responses.push(response);\n state = \"batch\";\n break;\n }\n }\n if (state !== \"status\") {\n reject(new Error(\"Unexpected end of input\"));\n }\n resolve(responses);\n });\n };\n return ODataBatch;\n}());\nexports.ODataBatch = ODataBatch;\n\n},{\"../../configuration/pnplibconfig\":2,\"../../net/httpclient\":5,\"../../utils/logging\":22,\"../../utils/util\":23}],22:[function(require,module,exports){\n\"use strict\";\nvar Logger = (function () {\n function Logger() {\n }\n Object.defineProperty(Logger, \"activeLogLevel\", {\n get: function () {\n return Logger.instance.activeLogLevel;\n },\n set: function (value) {\n Logger.instance.activeLogLevel = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Logger, \"instance\", {\n get: function () {\n if (typeof Logger._instance === \"undefined\" || Logger._instance === null) {\n Logger._instance = new LoggerImpl();\n }\n return Logger._instance;\n },\n enumerable: true,\n configurable: true\n });\n Logger.subscribe = function () {\n var listeners = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n listeners[_i - 0] = arguments[_i];\n }\n for (var i = 0; i < listeners.length; i++) {\n Logger.instance.subscribe(listeners[i]);\n }\n };\n Logger.clearSubscribers = function () {\n return Logger.instance.clearSubscribers();\n };\n Object.defineProperty(Logger, \"count\", {\n get: function () {\n return Logger.instance.count;\n },\n enumerable: true,\n configurable: true\n });\n Logger.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n Logger.instance.log({ level: level, message: message });\n };\n Logger.log = function (entry) {\n Logger.instance.log(entry);\n };\n Logger.measure = function (name, f) {\n return Logger.instance.measure(name, f);\n };\n return Logger;\n}());\nexports.Logger = Logger;\nvar LoggerImpl = (function () {\n function LoggerImpl(activeLogLevel, subscribers) {\n if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.Warning; }\n if (subscribers === void 0) { subscribers = []; }\n this.activeLogLevel = activeLogLevel;\n this.subscribers = subscribers;\n }\n LoggerImpl.prototype.subscribe = function (listener) {\n this.subscribers.push(listener);\n };\n LoggerImpl.prototype.clearSubscribers = function () {\n var s = this.subscribers.slice(0);\n this.subscribers.length = 0;\n return s;\n };\n Object.defineProperty(LoggerImpl.prototype, \"count\", {\n get: function () {\n return this.subscribers.length;\n },\n enumerable: true,\n configurable: true\n });\n LoggerImpl.prototype.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n this.log({ level: level, message: message });\n };\n LoggerImpl.prototype.log = function (entry) {\n if (typeof entry === \"undefined\" || entry.level < this.activeLogLevel) {\n return;\n }\n for (var i = 0; i < this.subscribers.length; i++) {\n this.subscribers[i].log(entry);\n }\n };\n LoggerImpl.prototype.measure = function (name, f) {\n console.profile(name);\n try {\n return f();\n }\n finally {\n console.profileEnd();\n }\n };\n return LoggerImpl;\n}());\nvar Logger;\n(function (Logger) {\n (function (LogLevel) {\n LogLevel[LogLevel[\"Verbose\"] = 0] = \"Verbose\";\n LogLevel[LogLevel[\"Info\"] = 1] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 2] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n LogLevel[LogLevel[\"Off\"] = 99] = \"Off\";\n })(Logger.LogLevel || (Logger.LogLevel = {}));\n var LogLevel = Logger.LogLevel;\n var ConsoleListener = (function () {\n function ConsoleListener() {\n }\n ConsoleListener.prototype.log = function (entry) {\n var msg = this.format(entry);\n switch (entry.level) {\n case LogLevel.Verbose:\n case LogLevel.Info:\n console.log(msg);\n break;\n case LogLevel.Warning:\n console.warn(msg);\n break;\n case LogLevel.Error:\n console.error(msg);\n break;\n }\n };\n ConsoleListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return ConsoleListener;\n }());\n Logger.ConsoleListener = ConsoleListener;\n var AzureInsightsListener = (function () {\n function AzureInsightsListener(azureInsightsInstrumentationKey) {\n this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey;\n var appInsights = window[\"appInsights\"] || function (config) {\n function r(config) {\n t[config] = function () {\n var i = arguments;\n t.queue.push(function () { t[config].apply(t, i); });\n };\n }\n var t = { config: config }, u = document, e = window, o = \"script\", s = u.createElement(o), i, f;\n for (s.src = config.url || \"//az416426.vo.msecnd.net/scripts/a/ai.0.js\", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = [\"Event\", \"Exception\", \"Metric\", \"PageView\", \"Trace\"]; i.length;) {\n r(\"track\" + i.pop());\n }\n return r(\"setAuthenticatedUserContext\"), r(\"clearAuthenticatedUserContext\"), config.disableExceptionTracking || (i = \"onerror\", r(\"_\" + i), f = e[i], e[i] = function (config, r, u, e, o) {\n var s = f && f(config, r, u, e, o);\n return s !== !0 && t[\"_\" + i](config, r, u, e, o), s;\n }), t;\n }({\n instrumentationKey: this.azureInsightsInstrumentationKey\n });\n window[\"appInsights\"] = appInsights;\n }\n AzureInsightsListener.prototype.log = function (entry) {\n var ai = window[\"appInsights\"];\n var msg = this.format(entry);\n if (entry.level === LogLevel.Error) {\n ai.trackException(msg);\n }\n else {\n ai.trackEvent(msg);\n }\n };\n AzureInsightsListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return AzureInsightsListener;\n }());\n Logger.AzureInsightsListener = AzureInsightsListener;\n var FunctionListener = (function () {\n function FunctionListener(method) {\n this.method = method;\n }\n FunctionListener.prototype.log = function (entry) {\n this.method(entry);\n };\n return FunctionListener;\n }());\n Logger.FunctionListener = FunctionListener;\n})(Logger = exports.Logger || (exports.Logger = {}));\n\n},{}],23:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar Util = (function () {\n function Util() {\n }\n Util.getCtxCallback = function (context, method) {\n var params = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n params[_i - 2] = arguments[_i];\n }\n return function () {\n method.apply(context, params);\n };\n };\n Util.urlParamExists = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n return regex.test(location.search);\n };\n Util.getUrlParamByName = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n var results = regex.exec(location.search);\n return results == null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n };\n Util.getUrlParamBoolByName = function (name) {\n var p = this.getUrlParamByName(name);\n var isFalse = (p === \"\" || /false|0/i.test(p));\n return !isFalse;\n };\n Util.stringInsert = function (target, index, s) {\n if (index > 0) {\n return target.substring(0, index) + s + target.substring(index, target.length);\n }\n return s + target;\n };\n Util.dateAdd = function (date, interval, units) {\n var ret = new Date(date.toLocaleString());\n switch (interval.toLowerCase()) {\n case \"year\":\n ret.setFullYear(ret.getFullYear() + units);\n break;\n case \"quarter\":\n ret.setMonth(ret.getMonth() + 3 * units);\n break;\n case \"month\":\n ret.setMonth(ret.getMonth() + units);\n break;\n case \"week\":\n ret.setDate(ret.getDate() + 7 * units);\n break;\n case \"day\":\n ret.setDate(ret.getDate() + units);\n break;\n case \"hour\":\n ret.setTime(ret.getTime() + units * 3600000);\n break;\n case \"minute\":\n ret.setTime(ret.getTime() + units * 60000);\n break;\n case \"second\":\n ret.setTime(ret.getTime() + units * 1000);\n break;\n default:\n ret = undefined;\n break;\n }\n return ret;\n };\n Util.loadStylesheet = function (path, avoidCache) {\n if (avoidCache) {\n path += \"?\" + encodeURIComponent((new Date()).getTime().toString());\n }\n var head = document.getElementsByTagName(\"head\");\n if (head.length > 0) {\n var e = document.createElement(\"link\");\n head[0].appendChild(e);\n e.setAttribute(\"type\", \"text/css\");\n e.setAttribute(\"rel\", \"stylesheet\");\n e.setAttribute(\"href\", path);\n }\n };\n Util.combinePaths = function () {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i - 0] = arguments[_i];\n }\n var parts = [];\n for (var i = 0; i < paths.length; i++) {\n if (typeof paths[i] !== \"undefined\" && paths[i] !== null) {\n parts.push(paths[i].replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"));\n }\n }\n return parts.join(\"/\").replace(/\\\\/, \"/\");\n };\n Util.getRandomString = function (chars) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < chars; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n };\n Util.getGUID = function () {\n var d = new Date().getTime();\n var guid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3 | 0x8)).toString(16);\n });\n return guid;\n };\n Util.isFunction = function (candidateFunction) {\n return typeof candidateFunction === \"function\";\n };\n Util.isArray = function (array) {\n if (Array.isArray) {\n return Array.isArray(array);\n }\n return array && typeof array.length === \"number\" && array.constructor === Array;\n };\n Util.stringIsNullOrEmpty = function (s) {\n return typeof s === \"undefined\" || s === null || s === \"\";\n };\n Util.extend = function (target, source, noOverwrite) {\n if (noOverwrite === void 0) { noOverwrite = false; }\n var result = {};\n for (var id in target) {\n result[id] = target[id];\n }\n var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; };\n for (var id in source) {\n if (check(result, id)) {\n result[id] = source[id];\n }\n }\n return result;\n };\n Util.applyMixins = function (derivedCtor) {\n var baseCtors = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n baseCtors[_i - 1] = arguments[_i];\n }\n baseCtors.forEach(function (baseCtor) {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {\n derivedCtor.prototype[name] = baseCtor.prototype[name];\n });\n });\n };\n Util.isUrlAbsolute = function (url) {\n return /^https?:\\/\\/|^\\/\\//i.test(url);\n };\n Util.makeUrlAbsolute = function (url) {\n if (Util.isUrlAbsolute(url)) {\n return url;\n }\n if (typeof global._spPageContextInfo !== \"undefined\") {\n if (global._spPageContextInfo.hasOwnProperty(\"webAbsoluteUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url);\n }\n else if (global._spPageContextInfo.hasOwnProperty(\"webServerRelativeUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url);\n }\n }\n else {\n return url;\n }\n };\n return Util;\n}());\nexports.Util = Util;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n},{}]},{},[17])(17)\n});"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/pnp.d.ts b/dist/pnp.d.ts deleted file mode 100644 index 348921f7..00000000 --- a/dist/pnp.d.ts +++ /dev/null @@ -1,5058 +0,0 @@ -declare module "utils/util" { - export class Util { - /** - * 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 - */ - static getCtxCallback(context: any, method: Function, ...params: any[]): Function; - /** - * Tests if a url param exists - * - * @param name The name of the url paramter to check - */ - static urlParamExists(name: string): boolean; - /** - * Gets a url param value by name - * - * @param name The name of the paramter for which we want the value - */ - static getUrlParamByName(name: string): string; - /** - * Gets a url param by name and attempts to parse a bool value - * - * @param name The name of the paramter for which we want the boolean value - */ - static getUrlParamBoolByName(name: string): boolean; - /** - * Inserts the string s into the string target as the index specified by index - * - * @param target The string into which we will insert s - * @param index The location in target to insert s (zero based) - * @param s The string to insert into target at position index - */ - static stringInsert(target: string, index: number, s: string): string; - /** - * 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 - */ - static dateAdd(date: Date, interval: string, units: number): Date; - /** - * Loads a stylesheet into the current page - * - * @param path The url to the stylesheet - * @param avoidCache If true a value will be appended as a query string to avoid browser caching issues - */ - static loadStylesheet(path: string, avoidCache: boolean): void; - /** - * Combines an arbitrary set of paths ensuring that the slashes are normalized - * - * @param paths 0 to n path parts to combine - */ - static combinePaths(...paths: string[]): string; - /** - * Gets a random string of chars length - * - * @param chars The length of the random string to generate - */ - static getRandomString(chars: number): string; - /** - * Gets a random GUID value - * - * http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript - */ - static getGUID(): string; - /** - * Determines if a given value is a function - * - * @param candidateFunction The thing to test for being a function - */ - static isFunction(candidateFunction: any): boolean; - /** - * @returns whether the provided parameter is a JavaScript Array or not. - */ - static isArray(array: any): boolean; - /** - * Determines if a string is null or empty or undefined - * - * @param s The string to test - */ - static stringIsNullOrEmpty(s: string): boolean; - /** - * Provides functionality to extend the given object by doign 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 - * - */ - static extend(target: T, source: S, noOverwrite?: boolean): T & S; - /** - * Applies one or more mixins to the supplied target - * - * @param derivedCtor The classto which we will apply the mixins - * @param baseCtors One or more mixin classes to apply - */ - static applyMixins(derivedCtor: any, ...baseCtors: any[]): void; - /** - * Determines if a given url is absolute - * - * @param url The url to check to see if it is absolute - */ - static isUrlAbsolute(url: string): boolean; - /** - * Attempts to make the supplied relative url absolute based on the _spPageContextInfo object, if available - * - * @param url The relative url to make absolute - */ - static makeUrlAbsolute(url: string): string; - } -} -declare module "utils/storage" { - /** - * A wrapper class to provide a consistent interface to browser based storage - * - */ - export class PnPClientStorageWrapper implements PnPClientStore { - private store; - defaultTimeoutMinutes: number; - /** - * True if the wrapped storage is available; otherwise, false - */ - enabled: boolean; - /** - * Creates a new instance of the PnPClientStorageWrapper class - * - * @constructor - */ - constructor(store: Storage, defaultTimeoutMinutes?: number); - /** - * Get a value from storage, or null if that value does not exist - * - * @param key The key whose value we want to retrieve - */ - get(key: string): T; - /** - * 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 - */ - put(key: string, o: any, expire?: Date): void; - /** - * Deletes a value from the underlying storage - * - * @param key The key of the pair we want to remove from storage - */ - delete(key: string): void; - /** - * 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 - */ - getOrPut(key: string, getter: () => Promise, expire?: Date): Promise; - /** - * Used to determine if the wrapped storage is available currently - */ - private test(); - /** - * Creates the persistable to store - */ - private createPersistable(o, expire?); - } - /** - * Interface which defines the operations provided by a client storage object - */ - export interface PnPClientStore { - /** - * True if the wrapped storage is available; otherwise, false - */ - enabled: boolean; - /** - * Get a value from storage, or null if that value does not exist - * - * @param key The key whose value we want to retrieve - */ - get(key: string): any; - /** - * 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 - */ - put(key: string, o: any, expire?: Date): void; - /** - * Deletes a value from the underlying storage - * - * @param key The key of the pair we want to remove from storage - */ - delete(key: string): void; - /** - * 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 - */ - getOrPut(key: string, getter: Function, expire?: Date): any; - } - /** - * A class that will establish wrappers for both local and session storage - */ - export class PnPClientStorage { - /** - * Provides access to the local storage of the browser - */ - local: PnPClientStore; - /** - * Provides access to the session storage of the browser - */ - session: PnPClientStore; - /** - * Creates a new instance of the PnPClientStorage class - * - * @constructor - */ - constructor(); - } -} -declare module "collections/collections" { - /** - * Interface defining an object with a known property type - */ - export interface TypedHash { - [key: string]: T; - } - /** - * Generic dictionary - */ - export class Dictionary { - /** - * The array used to store all the keys - */ - private keys; - /** - * The array used to store all the values - */ - private values; - /** - * Creates a new instance of the Dictionary class - * - * @constructor - */ - constructor(); - /** - * Gets a value from the collection using the specified key - * - * @param key The key whose value we want to return, returns null if the key does not exist - */ - get(key: string): T; - /** - * Adds the supplied key and value to the dictionary - * - * @param key The key to add - * @param o The value to add - */ - add(key: string, o: T): void; - /** - * Merges the supplied typed hash into this dictionary instance. Existing values are updated and new ones are created as appropriate. - */ - merge(source: TypedHash | Dictionary): void; - /** - * Removes a value from the dictionary - * - * @param key The key of the key/value pair to remove. Returns null if the key was not found. - */ - remove(key: string): T; - /** - * Returns all the keys currently in the dictionary as an array - */ - getKeys(): string[]; - /** - * Returns all the values currently in the dictionary as an array - */ - getValues(): T[]; - /** - * Clears the current dictionary - */ - clear(): void; - /** - * Gets a count of the items currently in the dictionary - */ - count(): number; - } -} -declare module "configuration/providers/cachingConfigurationProvider" { - import { IConfigurationProvider } from "configuration/configuration"; - import { TypedHash } from "collections/collections"; - import * as storage from "utils/storage"; - /** - * A caching provider which can wrap other non-caching providers - * - */ - export default class CachingConfigurationProvider implements IConfigurationProvider { - private wrappedProvider; - private store; - private cacheKey; - /** - * Creates a new caching configuration provider - * @constructor - * @param {IConfigurationProvider} wrappedProvider Provider which will be used to fetch the configuration - * @param {string} cacheKey Key that will be used to store cached items to the cache - * @param {IPnPClientStore} cacheStore OPTIONAL storage, which will be used to store cached settings. - */ - constructor(wrappedProvider: IConfigurationProvider, cacheKey: string, cacheStore?: storage.PnPClientStore); - /** - * Gets the wrapped configuration providers - * - * @return {IConfigurationProvider} Wrapped configuration provider - */ - getWrappedProvider(): IConfigurationProvider; - /** - * Loads the configuration values either from the cache or from the wrapped provider - * - * @return {Promise>} Promise of loaded configuration values - */ - getConfiguration(): Promise>; - private selectPnPCache(); - } -} -declare module "net/fetchclient" { - import { HttpClientImpl } from "net/httpclient"; - /** - * Makes requests using the fetch API - */ - export class FetchClient implements HttpClientImpl { - fetch(url: string, options: any): Promise; - } -} -declare module "utils/logging" { - /** - * Interface that defines a log entry - * - */ - export interface LogEntry { - /** - * The main message to be logged - */ - message: string; - /** - * The level of information this message represents - */ - level: Logger.LogLevel; - /** - * Any associated data that a given logging listener may choose to log or ignore - */ - data?: any; - } - /** - * Interface that defines a log listner - * - */ - export interface LogListener { - /** - * Any associated data that a given logging listener may choose to log or ignore - * - * @param entry The information to be logged - */ - log(entry: LogEntry): void; - } - /** - * Class used to subscribe ILogListener and log messages throughout an application - * - */ - export class Logger { - private static _instance; - static activeLogLevel: Logger.LogLevel; - private static instance; - /** - * Adds an ILogListener instance to the set of subscribed listeners - * - * @param listeners One or more listeners to subscribe to this log - */ - static subscribe(...listeners: LogListener[]): void; - /** - * Clears the subscribers collection, returning the collection before modifiction - */ - static clearSubscribers(): LogListener[]; - /** - * Gets the current subscriber count - */ - static count: number; - /** - * 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.Verbose) - */ - static write(message: string, level?: Logger.LogLevel): void; - /** - * Logs the supplied entry to the subscribed listeners - * - * @param entry The message to log - */ - static log(entry: LogEntry): void; - /** - * Logs performance tracking data for the the execution duration of the supplied function using console.profile - * - * @param name The name of this profile boundary - * @param f The function to execute and track within this performance boundary - */ - static measure(name: string, f: () => T): T; - } - /** - * This module is merged with the Logger class and then exposed via the API as path of pnp.log - */ - export module Logger { - /** - * A set of logging levels - * - */ - enum LogLevel { - Verbose = 0, - Info = 1, - Warning = 2, - Error = 3, - Off = 99, - } - /** - * Implementation of ILogListener which logs to the browser console - * - */ - class ConsoleListener implements LogListener { - /** - * Any associated data that a given logging listener may choose to log or ignore - * - * @param entry The information to be logged - */ - log(entry: LogEntry): void; - /** - * Formats the message - * - * @param entry The information to format into a string - */ - private format(entry); - } - /** - * Implementation of ILogListener which logs to Azure Insights - * - */ - class AzureInsightsListener implements LogListener { - private azureInsightsInstrumentationKey; - /** - * Creats a new instance of the AzureInsightsListener class - * - * @constructor - * @param azureInsightsInstrumentationKey The instrumentation key created when the Azure Insights instance was created - */ - constructor(azureInsightsInstrumentationKey: string); - /** - * Any associated data that a given logging listener may choose to log or ignore - * - * @param entry The information to be logged - */ - log(entry: LogEntry): void; - /** - * Formats the message - * - * @param entry The information to format into a string - */ - private format(entry); - } - /** - * Implementation of ILogListener which logs to the supplied function - * - */ - class FunctionListener implements LogListener { - private method; - /** - * Creates a new instance of the FunctionListener class - * - * @constructor - * @param method The method to which any logging data will be passed - */ - constructor(method: (entry: LogEntry) => void); - /** - * Any associated data that a given logging listener may choose to log or ignore - * - * @param entry The information to be logged - */ - log(entry: LogEntry): void; - } - } -} -declare module "configuration/pnplibconfig" { - import { TypedHash } from "collections/collections"; - export interface NodeClientData { - clientId: string; - clientSecret: string; - siteUrl: string; - } - export interface LibraryConfiguration { - /** - * Any headers to apply to all requests - */ - headers?: TypedHash; - /** - * Allows caching to be global disabled, default: false - */ - globalCacheDisable?: boolean; - /** - * Defines the default store used by the usingCaching method, default: session - */ - defaultCachingStore?: "session" | "local"; - /** - * Defines the default timeout in seconds used by the usingCaching method, default 30 - */ - defaultCachingTimeoutSeconds?: number; - /** - * If true the SP.RequestExecutor will be used to make the requests, you must include the required external libs - */ - useSPRequestExecutor?: boolean; - /** - * If set the library will use node-fetch, typically for use with testing but works with any valid client id/secret pair - */ - nodeClientOptions?: NodeClientData; - } - export class RuntimeConfigImpl { - private _headers; - private _defaultCachingStore; - private _defaultCachingTimeoutSeconds; - private _globalCacheDisable; - private _useSPRequestExecutor; - private _useNodeClient; - private _nodeClientData; - constructor(); - set(config: LibraryConfiguration): void; - headers: TypedHash; - defaultCachingStore: "session" | "local"; - defaultCachingTimeoutSeconds: number; - globalCacheDisable: boolean; - useSPRequestExecutor: boolean; - useNodeFetchClient: boolean; - nodeRequestOptions: NodeClientData; - } - export let RuntimeConfig: RuntimeConfigImpl; - export function setRuntimeConfig(config: LibraryConfiguration): void; -} -declare module "sharepoint/rest/odata" { - import { QueryableConstructor } from "sharepoint/rest/queryable"; - export function extractOdataId(candidate: any): string; - export interface ODataParser { - parse(r: Response): Promise; - } - export abstract class ODataParserBase implements ODataParser { - parse(r: Response): Promise; - } - export class ODataDefaultParser extends ODataParserBase { - } - export class ODataRawParserImpl implements ODataParser { - parse(r: Response): Promise; - } - export let ODataRaw: ODataRawParserImpl; - export function ODataValue(): ODataParser; - export function ODataEntity(factory: QueryableConstructor): ODataParser; - export function ODataEntityArray(factory: QueryableConstructor): ODataParser; - /** - * Manages a batch of OData operations - */ - export class ODataBatch { - private _batchId; - private _batchDepCount; - private _requests; - constructor(_batchId?: string); - /** - * Adds a request to a batch (not designed for public use) - * - * @param url The full url of the request - * @param method The http method GET, POST, etc - * @param options Any options to include in the request - * @param parser The parser that will hadle the results of the request - */ - add(url: string, method: string, options: any, parser: ODataParser): Promise; - incrementBatchDep(): void; - decrementBatchDep(): void; - /** - * 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 - */ - execute(): Promise; - private executeImpl(); - /** - * Parses the response from a batch request into an array of Response instances - * - * @param body Text body of the response from the batch request - */ - private _parseResponse(body); - } -} -declare module "net/digestcache" { - import { Dictionary } from "collections/collections"; - import { HttpClient } from "net/httpclient"; - export class CachedDigest { - expiration: Date; - value: string; - } - export class DigestCache { - private _httpClient; - private _digests; - constructor(_httpClient: HttpClient, _digests?: Dictionary); - getDigest(webUrl: string): Promise; - clear(): void; - } -} -declare module "net/sprequestexecutorclient" { - import { HttpClientImpl } from "net/httpclient"; - /** - * Makes requests using the SP.RequestExecutor library. - */ - export class SPRequestExecutorClient implements HttpClientImpl { - /** - * Fetches a URL using the SP.RequestExecutor library. - */ - fetch(url: string, options: any): Promise; - /** - * Converts a SharePoint REST API response to a fetch API response. - */ - private convertToResponse; - } -} -declare module "net/nodefetchclient" { - import { HttpClientImpl } from "net/httpclient"; - export interface AuthToken { - token_type: string; - expires_in: string; - not_before: string; - expires_on: string; - resource: string; - access_token: string; - } - /** - * Fetch client for use within nodejs, requires you register a client id and secret with app only permissions - */ - export class NodeFetchClient implements HttpClientImpl { - siteUrl: string; - private _clientId; - private _clientSecret; - private _realm; - private static SharePointServicePrincipal; - private token; - constructor(siteUrl: string, _clientId: string, _clientSecret: string, _realm?: string); - fetch(url: string, options: any): Promise; - /** - * Gets an add-in only authentication token based on the supplied site url, client id and secret - */ - getAddInOnlyAccessToken(): Promise; - private getRealm(); - private getAuthUrl(realm); - private getFormattedPrincipal(principalName, hostName, realm); - private toDate(epoch); - } -} -declare module "net/httpclient" { - export interface FetchOptions { - method?: string; - headers?: HeaderInit | { - [index: string]: string; - }; - body?: BodyInit; - mode?: string | RequestMode; - credentials?: string | RequestCredentials; - cache?: string | RequestCache; - } - export class HttpClient { - private _digestCache; - private _impl; - constructor(); - fetch(url: string, options?: FetchOptions): Promise; - fetchRaw(url: string, options?: FetchOptions): Promise; - get(url: string, options?: FetchOptions): Promise; - post(url: string, options?: FetchOptions): Promise; - protected getFetchImpl(): HttpClientImpl; - private mergeHeaders(target, source); - } - export interface HttpClientImpl { - fetch(url: string, options: any): Promise; - } -} -declare module "sharepoint/rest/caching" { - import { ODataParser } from "sharepoint/rest/odata"; - import { PnPClientStore, PnPClientStorage } from "utils/storage"; - export interface ICachingOptions { - expiration?: Date; - storeName?: "session" | "local"; - key: string; - } - export class CachingOptions implements ICachingOptions { - key: string; - protected static storage: PnPClientStorage; - expiration: Date; - storeName: "session" | "local"; - constructor(key: string); - store: PnPClientStore; - } - export class CachingParserWrapper implements ODataParser { - private _parser; - private _cacheOptions; - constructor(_parser: ODataParser, _cacheOptions: CachingOptions); - parse(response: Response): Promise; - } -} -declare module "sharepoint/rest/queryable" { - import { Dictionary } from "collections/collections"; - import { FetchOptions } from "net/httpclient"; - import { ODataParser, ODataBatch } from "sharepoint/rest/odata"; - import { ICachingOptions } from "sharepoint/rest/caching"; - export interface QueryableConstructor { - new (baseUrl: string | Queryable, path?: string): T; - } - /** - * Queryable Base Class - * - */ - export class Queryable { - /** - * Tracks the query parts of the url - */ - protected _query: Dictionary; - /** - * Tracks the batch of which this query may be part - */ - private _batch; - /** - * Tracks the url as it is built - */ - private _url; - /** - * Stores the parent url used to create this instance, for recursing back up the tree if needed - */ - private _parentUrl; - /** - * Explicitly tracks if we are using caching for this request - */ - private _useCaching; - /** - * Any options that were supplied when caching was enabled - */ - private _cachingOptions; - /** - * Directly concatonates the supplied string to the current url, not normalizing "/" chars - * - * @param pathPart The string to concatonate to the url - */ - concat(pathPart: string): void; - /** - * Appends the given string and normalizes "/" chars - * - * @param pathPart The string to append - */ - protected append(pathPart: string): void; - /** - * Blocks a batch call from occuring, MUST be cleared with clearBatchDependency before a request will execute - */ - protected addBatchDependency(): void; - /** - * Clears a batch request dependency - */ - protected clearBatchDependency(): void; - /** - * Indicates if the current query has a batch associated - * - */ - protected hasBatch: boolean; - /** - * Gets the parent url used when creating this instance - * - */ - protected parentUrl: string; - /** - * Provides access to the query builder for this url - * - */ - query: Dictionary; - /** - * Creates a new instance of the Queryable class - * - * @constructor - * @param baseUrl A string or Queryable that should form the base part of the url - * - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Adds this query to the supplied batch - * - * @example - * ``` - * - * let b = pnp.sp.createBatch(); - * pnp.sp.web.inBatch(b).get().then(...); - * ``` - */ - inBatch(batch: ODataBatch): this; - /** - * Enables caching for this request - * - * @param options Defines the options used when caching this request - */ - usingCaching(options?: ICachingOptions): this; - /** - * Gets the currentl url, made server relative or absolute based on the availability of the _spPageContextInfo object - * - */ - toUrl(): string; - /** - * Gets the full url with query information - * - */ - toUrlAndQuery(): string; - /** - * Executes the currently built request - * - */ - get(parser?: ODataParser, getOptions?: FetchOptions): Promise; - getAs(parser?: ODataParser, getOptions?: FetchOptions): Promise; - protected post(postOptions?: FetchOptions, parser?: ODataParser): Promise; - protected postAs(postOptions?: FetchOptions, parser?: ODataParser): Promise; - /** - * Gets a parent for this isntance as specified - * - * @param factory The contructor for the class to create - */ - protected getParent(factory: { - new (q: string | Queryable, path?: string): T; - }, baseUrl?: string | Queryable, path?: string): T; - private getImpl(getOptions, parser); - private postImpl(postOptions, parser); - } - /** - * Represents a REST collection which can be filtered, paged, and selected - * - */ - export class QueryableCollection extends Queryable { - /** - * Filters the returned collection (https://msdn.microsoft.com/en-us/library/office/fp142385.aspx#bk_supported) - * - * @param filter The string representing the filter query - */ - filter(filter: string): QueryableCollection; - /** - * Choose which fields to return - * - * @param selects One or more fields to return - */ - select(...selects: string[]): QueryableCollection; - /** - * Expands fields such as lookups to get additional data - * - * @param expands The Fields for which to expand the values - */ - expand(...expands: string[]): QueryableCollection; - /** - * Orders based on the supplied fields ascending - * - * @param orderby The name of the field to sort on - * @param ascending If true ASC is appended, otherwise DESC (default) - */ - orderBy(orderBy: string, ascending?: boolean): QueryableCollection; - /** - * Skips the specified number of items - * - * @param skip The number of items to skip - */ - skip(skip: number): QueryableCollection; - /** - * Limits the query to only return the specified number of items - * - * @param top The query row limit - */ - top(top: number): QueryableCollection; - } - /** - * Represents an instance that can be selected - * - */ - export class QueryableInstance extends Queryable { - /** - * Choose which fields to return - * - * @param selects One or more fields to return - */ - select(...selects: string[]): QueryableInstance; - /** - * Expands fields such as lookups to get additional data - * - * @param expands The Fields for which to expand the values - */ - expand(...expands: string[]): QueryableInstance; - } -} -declare module "sharepoint/rest/types" { - /** - * Represents the unique sequential location of a change within the change log. - */ - export interface ChangeToken { - /** - * Gets or sets a string value that contains the serialized representation of the change token generated by the protocol server. - */ - StringValue: string; - } - /** - * Defines a query that is performed against the change log. - */ - export interface ChangeQuery { - /** - * Gets or sets a value that specifies whether add changes are included in the query. - */ - Add?: boolean; - /** - * Gets or sets a value that specifies whether changes to alerts are included in the query. - */ - Alert?: boolean; - /** - * Gets or sets a value that specifies the end date and end time for changes that are returned through the query. - */ - ChangeTokenEnd?: ChangeToken; - /** - * Gets or sets a value that specifies the start date and start time for changes that are returned through the query. - */ - ChangeTokenStart?: ChangeToken; - /** - * Gets or sets a value that specifies whether changes to content types are included in the query. - */ - ContentType?: boolean; - /** - * Gets or sets a value that specifies whether deleted objects are included in the query. - */ - DeleteObject?: boolean; - /** - * Gets or sets a value that specifies whether changes to fields are included in the query. - */ - Field?: boolean; - /** - * Gets or sets a value that specifies whether changes to files are included in the query. - */ - File?: boolean; - /** - * Gets or sets value that specifies whether changes to folders are included in the query. - */ - Folder?: boolean; - /** - * Gets or sets a value that specifies whether changes to groups are included in the query. - */ - Group?: boolean; - /** - * Gets or sets a value that specifies whether adding users to groups is included in the query. - */ - GroupMembershipAdd?: boolean; - /** - * Gets or sets a value that specifies whether deleting users from the groups is included in the query. - */ - GroupMembershipDelete?: boolean; - /** - * Gets or sets a value that specifies whether general changes to list items are included in the query. - */ - Item?: boolean; - /** - * Gets or sets a value that specifies whether changes to lists are included in the query. - */ - List?: boolean; - /** - * Gets or sets a value that specifies whether move changes are included in the query. - */ - Move?: boolean; - /** - * Gets or sets a value that specifies whether changes to the navigation structure of a site collection are included in the query. - */ - Navigation?: boolean; - /** - * Gets or sets a value that specifies whether renaming changes are included in the query. - */ - Rename?: boolean; - /** - * Gets or sets a value that specifies whether restoring items from the recycle bin or from backups is included in the query. - */ - Restore?: boolean; - /** - * Gets or sets a value that specifies whether adding role assignments is included in the query. - */ - RoleAssignmentAdd?: boolean; - /** - * Gets or sets a value that specifies whether adding role assignments is included in the query. - */ - RoleAssignmentDelete?: boolean; - /** - * Gets or sets a value that specifies whether adding role assignments is included in the query. - */ - RoleDefinitionAdd?: boolean; - /** - * Gets or sets a value that specifies whether adding role assignments is included in the query. - */ - RoleDefinitionDelete?: boolean; - /** - * Gets or sets a value that specifies whether adding role assignments is included in the query. - */ - RoleDefinitionUpdate?: boolean; - /** - * Gets or sets a value that specifies whether modifications to security policies are included in the query. - */ - SecurityPolicy?: boolean; - /** - * Gets or sets a value that specifies whether changes to site collections are included in the query. - */ - Site?: boolean; - /** - * Gets or sets a value that specifies whether updates made using the item SystemUpdate method are included in the query. - */ - SystemUpdate?: boolean; - /** - * Gets or sets a value that specifies whether update changes are included in the query. - */ - Update?: boolean; - /** - * Gets or sets a value that specifies whether changes to users are included in the query. - */ - User?: boolean; - /** - * Gets or sets a value that specifies whether changes to views are included in the query. - */ - View?: boolean; - /** - * Gets or sets a value that specifies whether changes to Web sites are included in the query. - */ - Web?: boolean; - } - /** - * Specifies a Collaborative Application Markup Language (CAML) query on a list or joined lists. - */ - export interface CamlQuery { - /** - * Gets or sets a value that indicates whether the query returns dates in Coordinated Universal Time (UTC) format. - */ - DatesInUtc?: boolean; - /** - * Gets or sets a value that specifies the server relative URL of a list folder from which results will be returned. - */ - FolderServerRelativeUrl?: string; - /** - * Gets or sets a value that specifies the information required to get the next page of data for the list view. - */ - ListItemCollectionPosition?: ListItemCollectionPosition; - /** - * Gets or sets value that specifies the XML schema that defines the list view. - */ - ViewXml?: string; - } - /** - * Specifies the information required to get the next page of data for a list view. - */ - export interface ListItemCollectionPosition { - /** - * Gets or sets a value that specifies information, as name-value pairs, required to get the next page of data for a list view. - */ - PagingInfo: string; - } - /** - * Represents the input parameter of the GetListItemChangesSinceToken method. - */ - export interface ChangeLogitemQuery { - /** - * The change token for the request. - */ - ChangeToken?: string; - /** - * The XML element that defines custom filtering for the query. - */ - Contains?: string; - /** - * The records from the list to return and their return order. - */ - Query?: string; - /** - * The options for modifying the query. - */ - QueryOptions?: string; - /** - * RowLimit - */ - RowLimit?: string; - /** - * The names of the fields to include in the query result. - */ - ViewFields?: string; - /** - * The GUID of the view. - */ - ViewName?: string; - } - /** - * Determines the display mode of the given control or view - */ - export enum ControlMode { - Display = 1, - Edit = 2, - New = 3, - } - /** - * Represents properties of a list item field and its value. - */ - export interface ListItemFormUpdateValue { - /** - * The error message result after validating the value for the field. - */ - ErrorMessage?: string; - /** - * The internal name of the field. - */ - FieldName?: string; - /** - * The value of the field, in string format. - */ - FieldValue?: string; - /** - * Indicates whether there was an error result after validating the value for the field. - */ - HasException?: boolean; - } - /** - * Specifies the type of the field. - */ - export enum FieldTypes { - Invalid = 0, - Integer = 1, - Text = 2, - Note = 3, - DateTime = 4, - Counter = 5, - Choice = 6, - Lookup = 7, - Boolean = 8, - Number = 9, - Currency = 10, - URL = 11, - Computed = 12, - Threading = 13, - Guid = 14, - MultiChoice = 15, - GridChoice = 16, - Calculated = 17, - File = 18, - Attachments = 19, - User = 20, - Recurrence = 21, - CrossProjectLink = 22, - ModStat = 23, - Error = 24, - ContentTypeId = 25, - PageSeparator = 26, - ThreadIndex = 27, - WorkflowStatus = 28, - AllDayEvent = 29, - WorkflowEventType = 30, - } - export enum DateTimeFieldFormatType { - DateOnly = 0, - DateTime = 1, - } - /** - * Specifies the control settings while adding a field. - */ - export enum AddFieldOptions { - /** - * Specify that a new field added to the list must also be added to the default content type in the site collection - */ - DefaultValue = 0, - /** - * Specify that a new field added to the list must also be added to the default content type in the site collection. - */ - AddToDefaultContentType = 1, - /** - * Specify that a new field must not be added to any other content type - */ - AddToNoContentType = 2, - /** - * Specify that a new field that is added to the specified list must also be added to all content types in the site collection - */ - AddToAllContentTypes = 4, - /** - * Specify adding an internal field name hint for the purpose of avoiding possible database locking or field renaming operations - */ - AddFieldInternalNameHint = 8, - /** - * Specify that a new field that is added to the specified list must also be added to the default list view - */ - AddFieldToDefaultView = 16, - /** - * Specify to confirm that no other field has the same display name - */ - AddFieldCheckDisplayName = 32, - } - export interface XmlSchemaFieldCreationInformation { - Options?: AddFieldOptions; - SchemaXml: string; - } - export enum CalendarType { - Gregorian = 1, - Japan = 3, - Taiwan = 4, - Korea = 5, - Hijri = 6, - Thai = 7, - Hebrew = 8, - GregorianMEFrench = 9, - GregorianArabic = 10, - GregorianXLITEnglish = 11, - GregorianXLITFrench = 12, - KoreaJapanLunar = 14, - ChineseLunar = 15, - SakaEra = 16, - UmAlQura = 23, - } - export enum UrlFieldFormatType { - Hyperlink = 0, - Image = 1, - } - export interface BasePermissions { - Low: string; - High: string; - } - export interface FollowedContent { - FollowedDocumentsUrl: string; - FollowedSitesUrl: string; - } - export interface UserProfile { - /** - * An object containing the user's FollowedDocumentsUrl and FollowedSitesUrl. - */ - FollowedContent?: FollowedContent; - /** - * The account name of the user. (SharePoint Online only) - */ - AccountName?: string; - /** - * The display name of the user. (SharePoint Online only) - */ - DisplayName?: string; - /** - * The FirstRun flag of the user. (SharePoint Online only) - */ - O15FirstRunExperience?: number; - /** - * The personal site of the user. - */ - PersonalSite?: string; - /** - * The capabilities of the user's personal site. Represents a bitwise PersonalSiteCapabilities value: - * None = 0; Profile Value = 1; Social Value = 2; Storage Value = 4; MyTasksDashboard Value = 8; Education Value = 16; Guest Value = 32. - */ - PersonalSiteCapabilities?: number; - /** - * The error thrown when the user's personal site was first created, if any. (SharePoint Online only) - */ - PersonalSiteFirstCreationError?: string; - /** - * The date and time when the user's personal site was first created. (SharePoint Online only) - */ - PersonalSiteFirstCreationTime?: Date; - /** - * The status for the state of the personal site instantiation - */ - PersonalSiteInstantiationState?: number; - /** - * The date and time when the user's personal site was last created. (SharePoint Online only) - */ - PersonalSiteLastCreationTime?: Date; - /** - * The number of attempts made to create the user's personal site. (SharePoint Online only) - */ - PersonalSiteNumberOfRetries?: number; - /** - * Indicates whether the user's picture is imported from Exchange. - */ - PictureImportEnabled?: boolean; - /** - * The public URL of the personal site of the current user. (SharePoint Online only) - */ - PublicUrl?: string; - /** - * The URL used to create the user's personal site. - */ - UrlToCreatePersonalSite?: string; - } - export interface HashTag { - /** - * The hash tag's internal name. - */ - Name?: string; - /** - * The number of times that the hash tag is used. - */ - UseCount?: number; - } - export interface HashTagCollection { - Items: HashTag[]; - } - export interface UserIdInfo { - NameId?: string; - NameIdIssuer?: string; - } - export enum PrincipalType { - None = 0, - User = 1, - DistributionList = 2, - SecurityGroup = 4, - SharePointGroup = 8, - All = 15, - } - export interface DocumentLibraryInformation { - AbsoluteUrl?: string; - Modified?: Date; - ModifiedFriendlyDisplay?: string; - ServerRelativeUrl?: string; - Title?: string; - } - export interface ContextInfo { - FormDigestTimeoutSeconds?: number; - FormDigestValue?: number; - LibraryVersion?: string; - SiteFullUrl?: string; - SupportedSchemaVersions?: string[]; - WebFullUrl?: string; - } - export interface RenderListData { - Row: any[]; - FirstRow: number; - FolderPermissions: string; - LastRow: number; - FilterLink: string; - ForceNoHierarchy: string; - HierarchyHasIndention: string; - } - export enum PageType { - Invalid = -1, - DefaultView = 0, - NormalView = 1, - DialogView = 2, - View = 3, - DisplayForm = 4, - DisplayFormDialog = 5, - EditForm = 6, - EditFormDialog = 7, - NewForm = 8, - NewFormDialog = 9, - SolutionForm = 10, - PAGE_MAXITEMS = 11, - } - export interface ListFormData { - ContentType?: string; - Title?: string; - Author?: string; - Editor?: string; - Created?: Date; - Modified: Date; - Attachments?: any; - ListSchema?: any; - FormControlMode?: number; - FieldControlModes?: { - Title?: number; - Author?: number; - Editor?: number; - Created?: number; - Modified?: number; - Attachments?: number; - }; - WebAttributes?: { - WebUrl?: string; - EffectivePresenceEnabled?: boolean; - AllowScriptableWebParts?: boolean; - PermissionCustomizePages?: boolean; - LCID?: number; - CurrentUserId?: number; - }; - ItemAttributes?: { - Id?: number; - FsObjType?: number; - ExternalListItem?: boolean; - Url?: string; - EffectiveBasePermissionsLow?: number; - EffectiveBasePermissionsHigh?: number; - }; - ListAttributes?: { - Id?: string; - BaseType?: number; - Direction?: string; - ListTemplateType?: number; - DefaultItemOpen?: number; - EnableVersioning?: boolean; - }; - CSRCustomLayout?: boolean; - PostBackRequired?: boolean; - PreviousPostBackHandled?: boolean; - UploadMode?: boolean; - SubmitButtonID?: string; - ItemContentTypeName?: string; - ItemContentTypeId?: string; - JSLinks?: string; - } -} -declare module "sharepoint/rest/siteusers" { - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import { SiteGroups } from "sharepoint/rest/sitegroups"; - import { UserIdInfo, PrincipalType } from "sharepoint/rest/types"; - /** - * Properties that provide a getter, but no setter. - * - */ - export interface UserReadOnlyProperties { - id?: number; - isHiddenInUI?: boolean; - loginName?: string; - principalType?: PrincipalType; - userIdInfo?: UserIdInfo; - } - /** - * Properties that provide both a getter, and a setter. - * - */ - export interface UserWriteableProperties { - isSiteAdmin?: string; - email?: string; - title?: string; - } - /** - * Properties that provide both a getter, and a setter. - * - */ - export interface UserUpdateResult { - user: SiteUser; - data: any; - } - export interface UserProps extends UserReadOnlyProperties, UserWriteableProperties { - __metadata: { - id?: string; - url?: string; - type?: string; - }; - } - /** - * Describes a collection of all site collection users - * - */ - export class SiteUsers extends QueryableCollection { - /** - * Creates a new instance of the Users class - * - * @param baseUrl The url or Queryable which forms the parent of this user collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a user from the collection by email - * - * @param email The email of the user - */ - getByEmail(email: string): SiteUser; - /** - * Gets a user from the collection by id - * - * @param id The id of the user - */ - getById(id: number): SiteUser; - /** - * Gets a user from the collection by login name - * - * @param loginName The email address of the user - */ - getByLoginName(loginName: string): SiteUser; - /** - * Removes a user from the collection by id - * - * @param id The id of the user - */ - removeById(id: number | Queryable): Promise; - /** - * Removes a user from the collection by login name - * - * @param loginName The login name of the user - */ - removeByLoginName(loginName: string): Promise; - /** - * Add a user to a group - * - * @param loginName The login name of the user to add to the group - * - */ - add(loginName: string): Promise; - } - /** - * Describes a single user - * - */ - export class SiteUser extends QueryableInstance { - /** - * Creates a new instance of the User class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path Optional, passes the path to the user - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Get's the groups for this user. - * - */ - groups: SiteGroups; - /** - * Updates this user instance with the supplied properties - * - * @param properties A plain object of property names and values to update for the user - */ - update(properties: UserWriteableProperties): Promise; - /** - * Delete this user - * - */ - delete(): Promise; - } -} -declare module "sharepoint/rest/sitegroups" { - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import { SiteUser, SiteUsers } from "sharepoint/rest/siteusers"; - /** - * Properties that provide a getter, but no setter. - * - */ - export interface GroupReadOnlyProperties { - canCurrentUserEditMembership?: boolean; - canCurrentUserManageGroup?: boolean; - canCurrentUserViewMembership?: boolean; - id?: number; - isHiddenInUI?: boolean; - loginName?: string; - ownerTitle?: string; - principalType?: PrincipalType; - users?: SiteUsers; - } - /** - * Properties that provide both a getter, and a setter. - * - */ - export interface GroupWriteableProperties { - allowMembersEditMembership?: boolean; - allowRequestToJoinLeave?: boolean; - autoAcceptRequestToJoinLeave?: boolean; - description?: string; - onlyAllowMembersViewMembership?: boolean; - owner?: number | SiteUser | SiteGroup; - requestToJoinLeaveEmailSetting?: string; - title?: string; - } - /** - * Group Properties - * - */ - export interface GroupProperties extends GroupReadOnlyProperties, GroupWriteableProperties { - __metadata: { - id?: string; - url?: string; - type?: string; - }; - } - /** - * Principal Type enum - * - */ - export enum PrincipalType { - None = 0, - User = 1, - DistributionList = 2, - SecurityGroup = 4, - SharePointGroup = 8, - All = 15, - } - /** - * Result from adding a group. - * - */ - export interface GroupUpdateResult { - group: SiteGroup; - data: any; - } - /** - * Results from updating a group - * - */ - export interface GroupAddResult { - group: SiteGroup; - data: any; - } - /** - * Describes a collection of site users - * - */ - export class SiteGroups extends QueryableCollection { - /** - * Creates a new instance of the SiteUsers class - * - * @param baseUrl The url or Queryable which forms the parent of this user collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Adds a new group to the site collection - * - * @param props The properties to be updated - */ - add(properties: GroupWriteableProperties): Promise; - /** - * Gets a group from the collection by name - * - * @param email The name of the group - */ - getByName(groupName: string): SiteGroup; - /** - * Gets a group from the collection by id - * - * @param id The id of the group - */ - getById(id: number): SiteGroup; - /** - * Removes the group with the specified member ID from the collection. - * - * @param id The id of the group to remove - */ - removeById(id: number): Promise; - /** - * Removes a user from the collection by login name - * - * @param loginName The login name of the user - */ - removeByLoginName(loginName: string): Promise; - } - /** - * Describes a single group - * - */ - export class SiteGroup extends QueryableInstance { - /** - * Creates a new instance of the Group class - * - * @param baseUrl The url or Queryable which forms the parent of this site group - * @param path Optional, passes the path to the group - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Get's the users for this group - * - */ - users: SiteUsers; - /** - * Updates this group instance with the supplied properties - * - * @param properties A GroupWriteableProperties object of property names and values to update for the user - */ - update(properties: GroupWriteableProperties): Promise; - } - export interface SiteGroupAddResult { - group: SiteGroup; - data: GroupProperties; - } -} -declare module "sharepoint/rest/roles" { - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import { SiteGroups } from "sharepoint/rest/sitegroups"; - import { BasePermissions } from "sharepoint/rest/types"; - import { TypedHash } from "collections/collections"; - /** - * Describes a set of role assignments for the current scope - * - */ - export class RoleAssignments extends QueryableCollection { - /** - * Creates a new instance of the RoleAssignments class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * 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 - * - */ - add(principalId: number, roleDefId: number): Promise; - /** - * 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 - * - */ - remove(principalId: number, roleDefId: number): Promise; - /** - * Gets the role assignment associated with the specified principal ID from the collection. - * - * @param id The id of the role assignment - */ - getById(id: number): RoleAssignment; - } - export class RoleAssignment extends QueryableInstance { - /** - * Creates a new instance of the RoleAssignment class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - groups: SiteGroups; - /** - * Get the role definition bindings for this role assignment - * - */ - bindings: RoleDefinitionBindings; - /** - * Delete this role assignment - * - */ - delete(): Promise; - } - export class RoleDefinitions extends QueryableCollection { - /** - * Creates a new instance of the RoleDefinitions class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path - * - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets the role definition with the specified ID from the collection. - * - * @param id The ID of the role definition. - * - */ - getById(id: number): RoleDefinition; - /** - * Gets the role definition with the specified name. - * - * @param name The name of the role definition. - * - */ - getByName(name: string): RoleDefinition; - /** - * Gets the role definition with the specified type. - * - * @param name The name of the role definition. - * - */ - getByType(roleTypeKind: number): RoleDefinition; - /** - * Create 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 - * - */ - add(name: string, description: string, order: number, basePermissions: BasePermissions): Promise; - } - export class RoleDefinition extends QueryableInstance { - constructor(baseUrl: string | Queryable, path?: string); - /** - * Updates this web intance with the supplied properties - * - * @param properties A plain object hash of values to update for the web - */ - update(properties: TypedHash): Promise; - /** - * Delete this role definition - * - */ - delete(): Promise; - } - export interface RoleDefinitionUpdateResult { - definition: RoleDefinition; - data: any; - } - export interface RoleDefinitionAddResult { - definition: RoleDefinition; - data: any; - } - export class RoleDefinitionBindings extends QueryableCollection { - constructor(baseUrl: string | Queryable, path?: string); - } -} -declare module "sharepoint/rest/queryablesecurable" { - import { RoleAssignments } from "sharepoint/rest/roles"; - import { Queryable, QueryableInstance } from "sharepoint/rest/queryable"; - export class QueryableSecurable extends QueryableInstance { - /** - * Gets the set of role assignments for this item - * - */ - roleAssignments: RoleAssignments; - /** - * Gets the closest securable up the security hierarchy whose permissions are applied to this list item - * - */ - firstUniqueAncestorSecurableObject: QueryableInstance; - /** - * Gets the effective permissions for the user supplied - * - * @param loginName The claims username for the user (ex: i:0#.f|membership|user@domain.com) - */ - getUserEffectivePermissions(loginName: string): Queryable; - /** - * 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 - */ - breakRoleInheritance(copyRoleAssignments?: boolean, clearSubscopes?: boolean): Promise; - /** - * Breaks the security inheritance at this level optinally copying permissions and clearing subscopes - * - */ - resetRoleInheritance(): Promise; - } -} -declare module "sharepoint/rest/files" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - import { Item } from "sharepoint/rest/items"; - /** - * Describes a collection of File objects - * - */ - export class Files extends QueryableCollection { - /** - * Creates a new instance of the Files class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a File by filename - * - * @param name The name of the file, including extension. - */ - getByName(name: string): File; - /** - * Uploads a file. - * - * @param url The folder-relative url of the file. - * @param shouldOverWrite Should a file with the same name in the same location be overwritten? - * @param content The file contents blob. - * @returns The new File and the raw response. - */ - add(url: string, content: Blob, shouldOverWrite?: boolean): Promise; - /** - * Adds a ghosted file to an existing list or document library. - * - * @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. - */ - addTemplateFile(fileUrl: string, templateFileType: TemplateFileType): Promise; - } - /** - * Describes a single File instance - * - */ - export class File extends QueryableInstance { - /** - * Creates a new instance of the File class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path Optional, if supplied will be appended to the supplied baseUrl - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a value that specifies the user who added the file. - * - */ - author: Queryable; - /** - * Gets a result indicating the current user who has the file checked out. - * - */ - checkedOutByUser: Queryable; - /** - * Gets a value that returns the comment used when a document is checked in to a document library. - * - */ - checkInComment: Queryable; - /** - * Gets a value that indicates how the file is checked out of a document library. - * The checkout state of a file is independent of its locked state. - * - */ - checkOutType: Queryable; - /** - * Returns internal version of content, used to validate document equality for read purposes. - * - */ - contentTag: Queryable; - /** - * Gets a value that specifies the customization status of the file. - * - */ - customizedPageStatus: Queryable; - /** - * Gets the current eTag of a file - * - */ - eTag: Queryable; - /** - * Gets a value that specifies whether the file exists. - * - */ - exists: Queryable; - /** - * Gets the size of the file in bytes, excluding the size of any Web Parts that are used in the file. - */ - length: Queryable; - /** - * Gets a value that specifies the publishing level of the file. - * - */ - level: Queryable; - /** - * Gets a value that specifies the list item field values for the list item corresponding to the file. - * - */ - listItemAllFields: Item; - /** - * Gets a value that returns the user that owns the current lock on the file. - * - */ - lockedByUser: Queryable; - /** - * Gets a value that specifies the major version of the file. - * - */ - majorVersion: Queryable; - /** - * Gets a value that specifies the minor version of the file. - * - */ - minorVersion: Queryable; - /** - * Gets a value that returns the user who last modified the file. - * - */ - modifiedBy: Queryable; - /** - * Gets the name of the file including the extension. - * - */ - name: Queryable; - /** - * Gets the server relative url of a file - * - */ - serverRelativeUrl: Queryable; - /** - * Gets a value that specifies when the file was created. - * - */ - timeCreated: Queryable; - /** - * Gets a value that specifies when the file was last modified. - * - */ - timeLastModified: Queryable; - /** - * Gets a value that specifies the display name of the file. - * - */ - title: Queryable; - /** - * Gets a value that specifies the implementation-specific version identifier of the file. - * - */ - uiVersion: Queryable; - /** - * Gets a value that specifies the implementation-specific version identifier of the file. - * - */ - uiVersionLabel: Queryable; - /** - * Gets a collection of versions - * - */ - versions: Versions; - /** - * Gets the contents of the file - If the file is not JSON a custom parser function should be used with the get call - * - */ - value: Queryable; - /** - * 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. - */ - approve(comment: string): Promise; - /** - * Stops the chunk upload session without saving the uploaded data. - * 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. - */ - cancelUpload(uploadId: string): Promise; - /** - * 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. - */ - checkin(comment?: string, checkinType?: CheckinType): Promise; - /** - * Checks out the file from a document library. - */ - checkout(): Promise; - /** - * 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. - */ - continueUpload(uploadId: string, fileOffset: number, b: Blob): Promise; - /** - * 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? - */ - copyTo(url: string, shouldOverWrite?: boolean): Promise; - /** - * Delete this file. - * - * @param eTag Value used in the IF-Match header, by default "*" - */ - delete(eTag?: string): Promise; - /** - * 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. - */ - deny(comment?: string): Promise; - /** - * 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. - */ - finishUpload(uploadId: string, fileOffset: number, fragment: Blob): Promise; - /** - * 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. - */ - getLimitedWebPartManager(scope?: WebPartsPersonalizationScope): Queryable; - /** - * 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. - */ - moveTo(url: string, moveOperations?: MoveOperations): Promise; - /** - * Opens the file as a stream. - * - */ - openBinaryStream(): Queryable; - /** - * Submits the file for content approval with the specified comment. - * - * @param comment The comment for the published file. Its length must be <= 1023. - */ - publish(comment?: string): Promise; - /** - * Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item. - * - * @returns The GUID of the recycled file. - */ - recycle(): Promise; - /** - * Uploads a binary file. - * - * @data The file contents. - */ - saveBinaryStream(data: Blob): Promise; - /** - * 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. - */ - startUpload(uploadId: string, fragment: Blob): Promise; - /** - * Reverts an existing checkout for the file. - * - */ - undoCheckout(): Promise; - /** - * Removes the file from content approval or unpublish a major version. - * - * @param comment The comment for the unpublish operation. Its length must be <= 1023. - */ - unpublish(comment?: string): Promise; - } - /** - * Describes a collection of Version objects - * - */ - export class Versions extends QueryableCollection { - /** - * Creates a new instance of the File class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a version by id - * - * @param versionId The id of the version to retrieve - */ - getById(versionId: number): Version; - /** - * Deletes all the file version objects in the collection. - * - */ - deleteAll(): Promise; - /** - * Deletes the specified version of the file. - * - * @param versionId The ID of the file version to delete. - */ - deleteById(versionId: number): Promise; - /** - * 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 - */ - deleteByLabel(label: string): Promise; - /** - * 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 - */ - restoreByLabel(label: string): Promise; - } - /** - * Describes a single Version instance - * - */ - export class Version extends QueryableInstance { - /** - * Creates a new instance of the Version class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path Optional, if supplied will be appended to the supplied baseUrl - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a value that specifies the check-in comment. - * - */ - checkInComment: Queryable; - /** - * Gets a value that specifies the creation date and time for the file version. - * - */ - created: Queryable; - /** - * Gets a value that specifies the user that represents the creator of the file version. - * - */ - createdBy: Queryable; - /** - * Gets the internal identifier for the file version. - * - */ - id: Queryable; - /** - * Gets a value that specifies whether the file version is the current version. - * - */ - isCurrentVersion: Queryable; - /** - * Gets a value that specifies the size of this version of the file. - * - */ - size: Queryable; - /** - * Gets a value that specifies the relative URL of the file version based on the URL for the site or subsite. - * - */ - url: Queryable; - /** - * Gets a value that specifies the implementation specific identifier of the file. - * Uses the majorVersionNumber.minorVersionNumber format, for example: 1.2 - * - */ - versionLabel: Queryable; - /** - * Delete a specific version of a file. - * - * @param eTag Value used in the IF-Match header, by default "*" - */ - delete(eTag?: string): Promise; - } - export enum CheckinType { - Minor = 0, - Major = 1, - Overwrite = 2, - } - export interface FileAddResult { - file: File; - data: any; - } - export enum WebPartsPersonalizationScope { - User = 0, - Shared = 1, - } - export enum MoveOperations { - Overwrite = 1, - AllowBrokenThickets = 8, - } - export enum TemplateFileType { - StandardPage = 0, - WikiPage = 1, - FormPage = 2, - } -} -declare module "sharepoint/rest/folders" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - import { Files } from "sharepoint/rest/files"; - import { Item } from "sharepoint/rest/items"; - /** - * Describes a collection of Folder objects - * - */ - export class Folders extends QueryableCollection { - /** - * Creates a new instance of the Folders class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a folder by folder name - * - */ - getByName(name: string): Folder; - /** - * 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. - */ - add(url: string): Promise; - } - /** - * Describes a single Folder instance - * - */ - export class Folder extends QueryableInstance { - /** - * Creates a new instance of the Folder class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path Optional, if supplied will be appended to the supplied baseUrl - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Specifies the sequence in which content types are displayed. - * - */ - contentTypeOrder: QueryableCollection; - /** - * Gets this folder's files - * - */ - files: Files; - /** - * Gets this folder's sub folders - * - */ - folders: Folders; - /** - * Gets this folder's item count - * - */ - itemCount: Queryable; - /** - * Gets this folder's list item - * - */ - listItemAllFields: Item; - /** - * Gets the folders name - * - */ - name: Queryable; - /** - * Gets the parent folder, if available - * - */ - parentFolder: Folder; - /** - * Gets this folder's properties - * - */ - properties: QueryableInstance; - /** - * Gets this folder's server relative url - * - */ - serverRelativeUrl: Queryable; - /** - * Gets a value that specifies the content type order. - * - */ - uniqueContentTypeOrder: QueryableCollection; - /** - * Gets this folder's welcome page - */ - welcomePage: Queryable; - /** - * Delete this folder - * - * @param eTag Value used in the IF-Match header, by default "*" - */ - delete(eTag?: string): Promise; - /** - * Moves the folder to the Recycle Bin and returns the identifier of the new Recycle Bin item. - */ - recycle(): Promise; - } - export interface FolderAddResult { - folder: Folder; - data: any; - } -} -declare module "sharepoint/rest/contenttypes" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - /** - * Describes a collection of content types - * - */ - export class ContentTypes extends QueryableCollection { - /** - * Creates a new instance of the ContentTypes class - * - * @param baseUrl The url or Queryable which forms the parent of this content types collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a ContentType by content type id - */ - getById(id: string): ContentType; - } - /** - * Describes a single ContentType instance - * - */ - export class ContentType extends QueryableInstance { - /** - * Creates a new instance of the ContentType class - * - * @param baseUrl The url or Queryable which forms the parent of this content type instance - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets the description resource - */ - descriptionResource: Queryable; - /** - * Gets the column (also known as field) references in the content type. - */ - fieldLinks: Queryable; - /** - * Gets a value that specifies the collection of fields for the content type. - */ - fields: Queryable; - /** - * Gets name resource - */ - nameResource: Queryable; - /** - * Gets the parent content type of the content type. - */ - parent: Queryable; - /** - * Gets a value that specifies the collection of workflow associations for the content type. - */ - workflowAssociations: Queryable; - /** - * Gets or sets a description of the content type. - */ - description: Queryable; - /** - * Gets or sets a value that specifies the name of a custom display form template - * to use for list items that have been assigned the content type. - */ - displayFormTemplateName: Queryable; - /** - * Gets or sets a value that specifies the URL of a custom display form - * to use for list items that have been assigned the content type. - */ - displayFormUrl: Queryable; - /** - * Gets or sets a value that specifies the file path to the document template - * used for a new list item that has been assigned the content type. - */ - documentTemplate: Queryable; - /** - * Gets a value that specifies the URL of the document template assigned to the content type. - */ - documentTemplateUrl: Queryable; - /** - * Gets or sets a value that specifies the name of a custom edit form template - * to use for list items that have been assigned the content type. - */ - editFormTemplateName: Queryable; - /** - * Gets or sets a value that specifies the URL of a custom edit form - * to use for list items that have been assigned the content type. - */ - editFormUrl: Queryable; - /** - * Gets or sets a value that specifies the content type group for the content type. - */ - group: Queryable; - /** - * Gets or sets a value that specifies whether the content type is unavailable - * for creation or usage directly from a user interface. - */ - hidden: Queryable; - /** - * Gets or sets the JSLink for the content type custom form template. - * NOTE! - * The JSLink property is not supported on Survey or Events lists. - * A SharePoint calendar is an Events list. - */ - jsLink: Queryable; - /** - * Gets a value that specifies the name of the content type. - */ - name: Queryable; - /** - * Gets a value that specifies new form template name of the content type. - */ - newFormTemplateName: Queryable; - /** - * Gets a value that specifies new form url of the content type. - */ - newFormUrl: Queryable; - /** - * Gets or sets a value that specifies whether changes - * to the content type properties are denied. - */ - readOnly: Queryable; - /** - * Gets a value that specifies the XML Schema representing the content type. - */ - schemaXml: Queryable; - /** - * Gets a value that specifies a server-relative path to the content type scope of the content type. - */ - scope: Queryable; - /** - * Gets or sets whether the content type can be modified. - */ - sealed: Queryable; - /** - * A string representation of the value of the Id. - */ - stringId: Queryable; - } -} -declare module "sharepoint/rest/items" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - import { QueryableSecurable } from "sharepoint/rest/queryablesecurable"; - import { Folder } from "sharepoint/rest/folders"; - import { ContentType } from "sharepoint/rest/contenttypes"; - import { TypedHash } from "collections/collections"; - import * as Types from "sharepoint/rest/types"; - /** - * Describes a collection of Item objects - * - */ - export class Items extends QueryableCollection { - /** - * Creates a new instance of the Items class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets an Item by id - * - * @param id The integer id of the item to retrieve - */ - getById(id: number): Item; - /** - * 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 - */ - skip(skip: number): QueryableCollection; - /** - * Gets a collection designed to aid in paging through data - * - */ - getPaged(): Promise>; - /** - * Adds a new item to the collection - * - * @param properties The new items's properties - */ - add(properties?: TypedHash): Promise; - } - /** - * Descrines a single Item instance - * - */ - export class Item extends QueryableSecurable { - /** - * Creates a new instance of the Items class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets the set of attachments for this item - * - */ - attachmentFiles: QueryableCollection; - /** - * Gets the content type for this item - * - */ - contentType: ContentType; - /** - * Gets the effective base permissions for the item - * - */ - effectiveBasePermissions: Queryable; - /** - * Gets the effective base permissions for the item in a UI context - * - */ - effectiveBasePermissionsForUI: Queryable; - /** - * Gets the field values for this list item in their HTML representation - * - */ - fieldValuesAsHTML: QueryableInstance; - /** - * Gets the field values for this list item in their text representation - * - */ - fieldValuesAsText: QueryableInstance; - /** - * Gets the field values for this list item for use in editing controls - * - */ - fieldValuesForEdit: QueryableInstance; - /** - * Gets the folder associated with this list item (if this item represents a folder) - * - */ - folder: Folder; - /** - * 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 "*" - */ - update(properties: TypedHash, eTag?: string): Promise; - /** - * Delete this item - * - * @param eTag Value used in the IF-Match header, by default "*" - */ - delete(eTag?: string): Promise; - /** - * Moves the list item to the Recycle Bin and returns the identifier of the new Recycle Bin item. - */ - recycle(): Promise; - /** - * 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 - */ - getWopiFrameUrl(action?: number): Promise; - /** - * 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. - */ - validateUpdateListItem(formValues: Types.ListItemFormUpdateValue[], newDocumentUpdate?: boolean): Promise; - } - export interface ItemAddResult { - item: Item; - data: any; - } - export interface ItemUpdateResult { - item: Item; - data: any; - } - /** - * Provides paging functionality for list items - */ - export class PagedItemCollection { - /** - * Contains the results of the query - */ - results: T; - /** - * The url to the next set of results - */ - private nextUrl; - /** - * If true there are more results available in the set, otherwise there are not - */ - hasNext: boolean; - /** - * Creats a new instance of the PagedItemCollection class from the response - * - * @param r Response instance from which this collection will be created - * - */ - static fromResponse(r: Response): Promise>; - /** - * Gets the next set of results, or resolves to null if no results are available - */ - getNext(): Promise>; - } -} -declare module "sharepoint/rest/views" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - import { TypedHash } from "collections/collections"; - /** - * Describes the views available in the current context - * - */ - export class Views extends QueryableCollection { - /** - * Creates a new instance of the Views class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable); - /** - * Gets a view by guid id - * - * @param id The GUID id of the view - */ - getById(id: string): View; - /** - * Gets a view by title (case-sensitive) - * - * @param title The case-sensitive title of the view - */ - getByTitle(title: string): View; - /** - * 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 - */ - add(title: string, personalView?: boolean, additionalSettings?: TypedHash): Promise; - } - /** - * Describes a single View instance - * - */ - export class View extends QueryableInstance { - /** - * Creates a new instance of the View class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - fields: ViewFields; - /** - * Updates this view intance with the supplied properties - * - * @param properties A plain object hash of values to update for the view - */ - update(properties: TypedHash): Promise; - /** - * Delete this view - * - */ - delete(): Promise; - /** - * Returns the list view as HTML. - * - */ - renderAsHtml(): Promise; - } - export class ViewFields extends QueryableCollection { - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a value that specifies the XML schema that represents the collection. - */ - getSchemaXml(): Promise; - /** - * 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. - */ - add(fieldTitleOrInternalName: string): Promise; - /** - * 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. - */ - move(fieldInternalName: string, index: number): Promise; - /** - * Removes all the fields from the collection. - */ - removeAll(): Promise; - /** - * 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. - */ - remove(fieldInternalName: string): Promise; - } - export interface ViewAddResult { - view: View; - data: any; - } - export interface ViewUpdateResult { - view: View; - data: any; - } -} -declare module "sharepoint/rest/fields" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - import { TypedHash } from "collections/collections"; - import * as Types from "sharepoint/rest/types"; - /** - * Describes a collection of Field objects - * - */ - export class Fields extends QueryableCollection { - /** - * Creates a new instance of the Fields class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a field from the collection by title - * - * @param title The case-sensitive title of the field - */ - getByTitle(title: string): Field; - /** - * Gets a field from the collection by using internal name or title - * - * @param name The case-sensitive internal name or title of the field - */ - getByInternalNameOrTitle(name: string): Field; - /** - * Gets a list from the collection by guid id - * - * @param title The Id of the list - */ - getById(id: string): Field; - /** - * Creates a field based on the specified schema - */ - createFieldAsXml(xml: string | Types.XmlSchemaFieldCreationInformation): Promise; - /** - * Adds a new list 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) - */ - add(title: string, fieldType: string, properties?: TypedHash): Promise; - /** - * 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) - */ - addText(title: string, maxLength?: number, properties?: TypedHash): Promise; - /** - * 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) - */ - addCalculated(title: string, formula: string, dateFormat: Types.DateTimeFieldFormatType, outputType?: Types.FieldTypes, properties?: TypedHash): Promise; - /** - * 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 properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx) - */ - addDateTime(title: string, displayFormat?: Types.DateTimeFieldFormatType, calendarType?: Types.CalendarType, friendlyDisplayFormat?: number, properties?: TypedHash): Promise; - /** - * 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) - */ - addNumber(title: string, minValue?: number, maxValue?: number, properties?: TypedHash): Promise; - /** - * 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) - */ - addCurrency(title: string, minValue?: number, maxValue?: number, currencyLocalId?: number, properties?: TypedHash): Promise; - /** - * 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) - * - */ - addMultilineText(title: string, numberOfLines?: number, richText?: boolean, restrictedMode?: boolean, appendOnly?: boolean, allowHyperlink?: boolean, properties?: TypedHash): Promise; - /** - * Adds a new SP.FieldUrl to the collection - * - * @param title The field title - */ - addUrl(title: string, displayFormat?: Types.UrlFieldFormatType, properties?: TypedHash): Promise; - } - /** - * Describes a single of Field instance - * - */ - export class Field extends QueryableInstance { - /** - * Creates a new instance of the Field class - * - * @param baseUrl The url or Queryable which forms the parent of this field instance - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a value that specifies whether the field can be deleted. - */ - canBeDeleted: Queryable; - /** - * Gets a value that specifies the default value for the field. - */ - defaultValue: Queryable; - /** - * Gets a value that specifies the description of the field. - */ - description: Queryable; - /** - * Gets a value that specifies the reading order of the field. - */ - direction: Queryable; - /** - * Gets a value that specifies whether to require unique field values in a list or library column. - */ - enforceUniqueValues: Queryable; - /** - * Gets the name of the entity property for the list item entity that uses this field. - */ - entityPropertyName: Queryable; - /** - * Gets a value that specifies whether list items in the list can be filtered by the field value. - */ - filterable: Queryable; - /** - * Gets a Boolean value that indicates whether the field derives from a base field type. - */ - fromBaseType: Queryable; - /** - * Gets a value that specifies the field group. - */ - group: Queryable; - /** - * Gets a value that specifies whether the field is hidden in list views and list forms. - */ - hidden: Queryable; - /** - * Gets a value that specifies the field identifier. - */ - id: Queryable; - /** - * Gets a Boolean value that specifies whether the field is indexed. - */ - indexed: Queryable; - /** - * Gets a value that specifies the field internal name. - */ - internalName: Queryable; - /** - * Gets the name of an external JS file containing any client rendering logic for fields of this type. - */ - jsLink: Queryable; - /** - * Gets a value that specifies whether the value of the field is read-only. - */ - readOnlyField: Queryable; - /** - * Gets a value that specifies whether the field requires a value. - */ - required: Queryable; - /** - * Gets a value that specifies the XML schema that defines the field. - */ - schemaXml: Queryable; - /** - * Gets a value that specifies the server-relative URL of the list or the site to which the field belongs. - */ - scope: Queryable; - /** - * Gets a value that specifies whether properties on the field cannot be changed and whether the field cannot be deleted. - */ - sealed: Queryable; - /** - * Gets a value that specifies whether list items in the list can be sorted by the field value. - */ - sortable: Queryable; - /** - * Gets a value that specifies a customizable identifier of the field. - */ - staticName: Queryable; - /** - * Gets value that specifies the display name of the field. - */ - title: Queryable; - /** - * Gets a value that specifies the type of the field. Represents a FieldType value. - * See FieldType in the .NET client object model reference for a list of field type values. - */ - fieldTypeKind: Queryable; - /** - * Gets a value that specifies the type of the field. - */ - typeAsString: Queryable; - /** - * Gets a value that specifies the display name for the type of the field. - */ - typeDisplayName: Queryable; - /** - * Gets a value that specifies the description for the type of the field. - */ - typeShortDescription: Queryable; - /** - * Gets a value that specifies the data validation criteria for the value of the field. - */ - validationFormula: Queryable; - /** - * Gets a value that specifies the error message returned when data validation fails for the field. - */ - validationMessage: Queryable; - /** - * 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 - */ - update(properties: TypedHash, fieldType?: string): Promise; - /** - * Delete this fields - * - */ - delete(): Promise; - /** - * Sets the value of the ShowInDisplayForm property for this field. - */ - setShowInDisplayForm(show: boolean): Promise; - /** - * Sets the value of the ShowInEditForm property for this field. - */ - setShowInEditForm(show: boolean): Promise; - /** - * Sets the value of the ShowInNewForm property for this field. - */ - setShowInNewForm(show: boolean): Promise; - } - export interface FieldAddResult { - data: any; - field: Field; - } - export interface FieldUpdateResult { - data: any; - field: Field; - } -} -declare module "sharepoint/rest/forms" { - import { Queryable, QueryableCollection, QueryableInstance } from "sharepoint/rest/queryable"; - /** - * Describes a collection of Field objects - * - */ - export class Forms extends QueryableCollection { - /** - * Creates a new instance of the Fields class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a form by id - * - * @param id The guid id of the item to retrieve - */ - getById(id: string): Form; - } - /** - * Describes a single of Form instance - * - */ - export class Form extends QueryableInstance { - /** - * Creates a new instance of the Form class - * - * @param baseUrl The url or Queryable which is the parent of this form instance - */ - constructor(baseUrl: string | Queryable, path?: string); - } -} -declare module "sharepoint/rest/usercustomactions" { - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import { TypedHash } from "collections/collections"; - export class UserCustomActions extends QueryableCollection { - constructor(baseUrl: string | Queryable, path?: string); - /** - * Returns the custom action with the specified identifier. - * - * @param id The GUID ID of the user custom action to get. - */ - getById(id: string): UserCustomAction; - /** - * Create a custom action - * - * @param creationInfo The information which defines the new custom action - * - */ - add(properties: TypedHash): Promise; - /** - * Deletes all custom actions in the collection. - * - */ - clear(): Promise; - } - export class UserCustomAction extends QueryableInstance { - constructor(baseUrl: string | Queryable, path?: string); - update(properties: TypedHash): Promise; - } - export interface UserCustomActionAddResult { - data: any; - action: UserCustomAction; - } - export interface UserCustomActionUpdateResult { - data: any; - action: UserCustomAction; - } -} -declare module "sharepoint/rest/lists" { - import { Items } from "sharepoint/rest/items"; - import { Views, View } from "sharepoint/rest/views"; - import { ContentTypes } from "sharepoint/rest/contenttypes"; - import { Fields } from "sharepoint/rest/fields"; - import { Forms } from "sharepoint/rest/forms"; - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import { QueryableSecurable } from "sharepoint/rest/queryablesecurable"; - import { TypedHash } from "collections/collections"; - import { ControlMode, RenderListData, ChangeQuery, CamlQuery, ChangeLogitemQuery, ListFormData } from "sharepoint/rest/types"; - import { UserCustomActions } from "sharepoint/rest/usercustomactions"; - /** - * Describes a collection of List objects - * - */ - export class Lists extends QueryableCollection { - /** - * Creates a new instance of the Lists class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets a list from the collection by title - * - * @param title The title of the list - */ - getByTitle(title: string): List; - /** - * Gets a list from the collection by guid id - * - * @param title The Id of the list - */ - getById(id: string): List; - /** - * 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 - */ - add(title: string, description?: string, template?: number, enableContentTypes?: boolean, additionalSettings?: TypedHash): Promise; - /** - * Ensures that the specified list exists in the collection (note: settings are not updated if the list exists, - * 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 - */ - ensure(title: string, description?: string, template?: number, enableContentTypes?: boolean, additionalSettings?: TypedHash): Promise; - /** - * Gets a list that is the default asset location for images or other files, which the users upload to their wiki pages. - */ - ensureSiteAssetsLibrary(): Promise; - /** - * Gets a list that is the default location for wiki pages. - */ - ensureSitePagesLibrary(): Promise; - } - /** - * Describes a single List instance - * - */ - export class List extends QueryableSecurable { - /** - * Creates a new instance of the Lists class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - * @param path Optional, if supplied will be appended to the supplied baseUrl - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets the content types in this list - * - */ - contentTypes: ContentTypes; - /** - * Gets the items in this list - * - */ - items: Items; - /** - * Gets the views in this list - * - */ - views: Views; - /** - * Gets the fields in this list - * - */ - fields: Fields; - /** - * Gets the forms in this list - * - */ - forms: Forms; - /** - * Gets the default view of this list - * - */ - defaultView: QueryableInstance; - /** - * Get all custom actions on a site collection - * - */ - userCustomActions: UserCustomActions; - /** - * Gets the effective base permissions of this list - * - */ - effectiveBasePermissions: Queryable; - /** - * Gets the event receivers attached to this list - * - */ - eventReceivers: QueryableCollection; - /** - * Gets the related fields of this list - * - */ - relatedFields: Queryable; - /** - * Gets the IRM settings for this list - * - */ - informationRightsManagementSettings: Queryable; - /** - * Gets a view by view guid id - * - */ - getView(viewId: string): View; - /** - * 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 "*" - */ - update(properties: TypedHash, eTag?: string): Promise; - /** - * Delete this list - * - * @param eTag Value used in the IF-Match header, by default "*" - */ - delete(eTag?: string): Promise; - /** - * Returns the collection of changes from the change log that have occurred within the list, based on the specified query. - */ - getChanges(query: ChangeQuery): Promise; - /** - * 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 - */ - getItemsByCAMLQuery(query: CamlQuery, ...expands: string[]): Promise; - /** - * See: https://msdn.microsoft.com/en-us/library/office/dn292554.aspx - */ - getListItemChangesSinceToken(query: ChangeLogitemQuery): Promise; - /** - * Moves the list to the Recycle Bin and returns the identifier of the new Recycle Bin item. - */ - recycle(): Promise; - /** - * Renders list data based on the view xml provided - */ - renderListData(viewXml: string): Promise; - /** - * Gets the field values and field schema attributes for a list item. - */ - renderListFormData(itemId: number, formId: string, mode: ControlMode): Promise; - /** - * Reserves a list item ID for idempotent list item creation. - */ - reserveListItemId(): Promise; - } - export interface ListAddResult { - list: List; - data: any; - } - export interface ListUpdateResult { - list: List; - data: any; - } - export interface ListEnsureResult { - list: List; - created: boolean; - data: any; - } -} -declare module "sharepoint/rest/quicklaunch" { - import { Queryable } from "sharepoint/rest/queryable"; - /** - * Describes the quick launch navigation - * - */ - export class QuickLaunch extends Queryable { - /** - * Creates a new instance of the Lists class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable); - } -} -declare module "sharepoint/rest/topnavigationbar" { - import { Queryable, QueryableInstance } from "sharepoint/rest/queryable"; - /** - * Describes the top navigation on the site - * - */ - export class TopNavigationBar extends QueryableInstance { - /** - * Creates a new instance of the SiteUsers class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable); - } -} -declare module "sharepoint/rest/navigation" { - import { Queryable } from "sharepoint/rest/queryable"; - import { QuickLaunch } from "sharepoint/rest/quicklaunch"; - import { TopNavigationBar } from "sharepoint/rest/topnavigationbar"; - /** - * Exposes the navigation components - * - */ - export class Navigation extends Queryable { - /** - * Creates a new instance of the Lists class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable); - /** - * Gets the quicklaunch navigation for the current context - * - */ - quicklaunch: QuickLaunch; - /** - * Gets the top bar navigation navigation for the current context - * - */ - topNavigationBar: TopNavigationBar; - } -} -declare module "sharepoint/rest/webs" { - import { Queryable, QueryableCollection } from "sharepoint/rest/queryable"; - import { QueryableSecurable } from "sharepoint/rest/queryablesecurable"; - import { Lists } from "sharepoint/rest/lists"; - import { Fields } from "sharepoint/rest/fields"; - import { Navigation } from "sharepoint/rest/navigation"; - import { SiteGroups } from "sharepoint/rest/sitegroups"; - import { ContentTypes } from "sharepoint/rest/contenttypes"; - import { Folders, Folder } from "sharepoint/rest/folders"; - import { RoleDefinitions } from "sharepoint/rest/roles"; - import { File } from "sharepoint/rest/files"; - import { TypedHash } from "collections/collections"; - import * as Types from "sharepoint/rest/types"; - import { List } from "sharepoint/rest/lists"; - import { SiteUsers, SiteUser } from "sharepoint/rest/siteusers"; - import { UserCustomActions } from "sharepoint/rest/usercustomactions"; - export class Webs extends QueryableCollection { - constructor(baseUrl: string | Queryable, webPath?: string); - /** - * 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 web web's description - * @param template The web's template - * @param language The language code to use for this web - * @param inheritPermissions If true permissions will be inherited from the partent web - * @param additionalSettings Will be passed as part of the web creation body - */ - add(title: string, url: string, description?: string, template?: string, language?: number, inheritPermissions?: boolean, additionalSettings?: TypedHash): Promise; - } - /** - * Describes a web - * - */ - export class Web extends QueryableSecurable { - constructor(baseUrl: string | Queryable, path?: string); - webs: Webs; - /** - * Get the content types available in this web - * - */ - contentTypes: ContentTypes; - /** - * Get the lists in this web - * - */ - lists: Lists; - /** - * Gets the fields in this web - * - */ - fields: Fields; - /** - * Gets the available fields in this web - * - */ - availablefields: Fields; - /** - * Get the navigation options in this web - * - */ - navigation: Navigation; - /** - * Gets the site users - * - */ - siteUsers: SiteUsers; - /** - * Gets the site groups - * - */ - siteGroups: SiteGroups; - /** - * Get the folders in this web - * - */ - folders: Folders; - /** - * Get all custom actions on a site - * - */ - userCustomActions: UserCustomActions; - /** - * Gets the collection of RoleDefinition resources. - * - */ - roleDefinitions: RoleDefinitions; - /** - * Get a folder by server relative url - * - * @param folderRelativeUrl the server relative path to the folder (including /sites/ if applicable) - */ - getFolderByServerRelativeUrl(folderRelativeUrl: string): Folder; - /** - * Get a file by server relative url - * - * @param fileRelativeUrl the server relative path to the file (including /sites/ if applicable) - */ - getFileByServerRelativeUrl(fileRelativeUrl: string): File; - /** - * Updates this web intance with the supplied properties - * - * @param properties A plain object hash of values to update for the web - */ - update(properties: TypedHash): Promise; - /** - * Delete this web - * - */ - delete(): Promise; - /** - * Applies the theme specified by the contents of each of the files specified in the arguments to the site. - * - * @param colorPaletteUrl Server-relative URL of the color palette file. - * @param fontSchemeUrl Server-relative URL of the font scheme. - * @param backgroundImageUrl Server-relative URL of the background image. - * @param shareGenerated true to store the generated theme files in the root site, or false to store them in this site. - */ - applyTheme(colorPaletteUrl: string, fontSchemeUrl: string, backgroundImageUrl: string, shareGenerated: boolean): Promise; - /** - * 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 - */ - applyWebTemplate(template: string): Promise; - /** - * Returns whether the current user has the given set of permissions. - * - * @param perms The high and low permission range. - */ - doesUserHavePermissions(perms: Types.BasePermissions): Promise; - /** - * Checks whether the specified login name belongs to a valid user in the site. If the user doesn't exist, adds the user to the site. - * - * @param loginName The login name of the user (ex: i:0#.f|membership|user@domain.onmicrosoft.com) - */ - ensureUser(loginName: string): Promise; - /** - * Returns a collection of site templates available for the site. - * - * @param language The LCID of the site templates to get. - * @param true to include language-neutral site templates; otherwise false - */ - availableWebTemplates(language?: number, includeCrossLanugage?: boolean): QueryableCollection; - /** - * 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 - */ - getCatalog(type: number): Promise; - /** - * Returns the collection of changes from the change log that have occurred within the list, based on the specified query. - */ - getChanges(query: Types.ChangeQuery): Promise; - /** - * Gets the custom list templates for the site. - * - */ - customListTemplate: QueryableCollection; - /** - * Returns the user corresponding to the specified member identifier for the current site. - * - * @param id The ID of the user. - */ - getUserById(id: number): SiteUser; - /** - * 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. - * @param progId The ProgID of the application that was used to create the file, in the form OLEServerName.ObjectName - */ - mapToIcon(filename: string, size?: number, progId?: string): Promise; - } - export interface WebAddResult { - data: any; - web: Web; - } - export interface WebUpdateResult { - data: any; - web: Web; - } - export interface GetCatalogResult { - data: any; - list: List; - } -} -declare module "configuration/providers/spListConfigurationProvider" { - import { IConfigurationProvider } from "configuration/configuration"; - import { TypedHash } from "collections/collections"; - import { default as CachingConfigurationProvider } from "configuration/providers/cachingConfigurationProvider"; - import { Web } from "sharepoint/rest/webs"; - /** - * A configuration provider which loads configuration values from a SharePoint list - * - */ - export default class SPListConfigurationProvider implements IConfigurationProvider { - private sourceWeb; - private sourceListTitle; - /** - * Creates a new SharePoint list based configuration provider - * @constructor - * @param {string} webUrl Url of the SharePoint site, where the configuration list is located - * @param {string} listTitle Title of the SharePoint list, which contains the configuration settings (optional, default = "config") - */ - constructor(sourceWeb: Web, sourceListTitle?: string); - /** - * Gets the url of the SharePoint site, where the configuration list is located - * - * @return {string} Url address of the site - */ - web: Web; - /** - * Gets the title of the SharePoint list, which contains the configuration settings - * - * @return {string} List title - */ - listTitle: string; - /** - * Loads the configuration values from the SharePoint list - * - * @return {Promise>} Promise of loaded configuration values - */ - getConfiguration(): Promise>; - /** - * Wraps the current provider in a cache enabled provider - * - * @return {CachingConfigurationProvider} Caching providers which wraps the current provider - */ - asCaching(): CachingConfigurationProvider; - } -} -declare module "configuration/providers/providers" { - import { default as cachingConfigurationProvider } from "configuration/providers/cachingConfigurationProvider"; - import { default as spListConfigurationProvider } from "configuration/providers/spListConfigurationProvider"; - export let CachingConfigurationProvider: typeof cachingConfigurationProvider; - export let SPListConfigurationProvider: typeof spListConfigurationProvider; -} -declare module "configuration/configuration" { - import * as Collections from "collections/collections"; - import * as providers from "configuration/providers/providers"; - /** - * Interface for configuration providers - * - */ - export interface IConfigurationProvider { - /** - * Gets the configuration from the provider - */ - getConfiguration(): Promise>; - } - /** - * Class used to manage the current application settings - * - */ - export class Settings { - /** - * Set of pre-defined providers which are available from this library - */ - Providers: typeof providers; - /** - * The settings currently stored in this instance - */ - private _settings; - /** - * Creates a new instance of the settings class - * - * @constructor - */ - constructor(); - /** - * Adds a new single setting, or overwrites a previous setting with the same key - * - * @param {string} key The key used to store this setting - * @param {string} value The setting value to store - */ - add(key: string, value: string): void; - /** - * Adds a JSON value to the collection as a string, you must use getJSON to rehydrate the object when read - * - * @param {string} key The key used to store this setting - * @param {any} value The setting value to store - */ - addJSON(key: string, value: any): void; - /** - * Applies the supplied hash to the setting collection overwriting any existing value, or created new values - * - * @param {Collections.TypedHash} hash The set of values to add - */ - apply(hash: Collections.TypedHash): Promise; - /** - * Loads configuration settings into the collection from the supplied provider and returns a Promise - * - * @param {IConfigurationProvider} provider The provider from which we will load the settings - */ - load(provider: IConfigurationProvider): Promise; - /** - * Gets a value from the configuration - * - * @param {string} key The key whose value we want to return. Returns null if the key does not exist - * @return {string} string value from the configuration - */ - get(key: string): string; - /** - * Gets a JSON value, rehydrating the stored string to the original object - * - * @param {string} key The key whose value we want to return. Returns null if the key does not exist - * @return {any} object from the configuration - */ - getJSON(key: string): any; - } -} -declare module "sharepoint/rest/search" { - import { Queryable, QueryableInstance } from "sharepoint/rest/queryable"; - /** - * Describes the SearchQuery interface - */ - export interface SearchQuery { - /** - * A string that contains the text for the search query. - */ - Querytext: string; - /** - * A string that contains the text that replaces the query text, as part of a query transform. - */ - QueryTemplate?: string; - /** - * A Boolean value that specifies whether the result tables that are returned for - * the result block are mixed with the result tables that are returned for the original query. - */ - EnableInterleaving?: Boolean; - /** - * A Boolean value that specifies whether stemming is enabled. - */ - EnableStemming?: Boolean; - /** - * A Boolean value that specifies whether duplicate items are removed from the results. - */ - TrimDuplicates?: Boolean; - /** - * A Boolean value that specifies whether the exact terms in the search query are used to find matches, or if nicknames are used also. - */ - EnableNicknames?: Boolean; - /** - * A Boolean value that specifies whether the query uses the FAST Query Language (FQL). - */ - EnableFql?: Boolean; - /** - * A Boolean value that specifies whether the phonetic forms of the query terms are used to find matches. - */ - EnablePhonetic?: Boolean; - /** - * A Boolean value that specifies whether to perform result type processing for the query. - */ - BypassResultTypes?: Boolean; - /** - * A Boolean value that specifies whether to return best bet results for the query. - * This parameter is used only when EnableQueryRules is set to true, otherwise it is ignored. - */ - ProcessBestBets?: Boolean; - /** - * A Boolean value that specifies whether to enable query rules for the query. - */ - EnableQueryRules?: Boolean; - /** - * A Boolean value that specifies whether to sort search results. - */ - EnableSorting?: Boolean; - /** - * Specifies whether to return block rank log information in the BlockRankLog property of the interleaved result table. - * A block rank log contains the textual information on the block score and the documents that were de-duplicated. - */ - GenerateBlockRankLog?: Boolean; - /** - * The result source ID to use for executing the search query. - */ - SourceId?: string; - /** - * The ID of the ranking model to use for the query. - */ - RankingModelId?: string; - /** - * The first row that is included in the search results that are returned. - * You use this parameter when you want to implement paging for search results. - */ - StartRow?: Number; - /** - * The maximum number of rows overall that are returned in the search results. - * Compared to RowsPerPage, RowLimit is the maximum number of rows returned overall. - */ - RowLimit?: Number; - /** - * The maximum number of rows to return per page. - * Compared to RowLimit, RowsPerPage refers to the maximum number of rows to return per page, - * and is used primarily when you want to implement paging for search results. - */ - RowsPerPage?: Number; - /** - * The managed properties to return in the search results. - */ - SelectProperties?: string[]; - /** - * The locale ID (LCID) for the query. - */ - Culture?: Number; - /** - * The set of refinement filters used when issuing a refinement query (FQL) - */ - RefinementFilters?: string[]; - /** - * The set of refiners to return in a search result. - */ - Refiners?: string[]; - /** - * The additional query terms to append to the query. - */ - HiddenConstraints?: string; - /** - * The list of properties by which the search results are ordered. - */ - SortList?: Sort[]; - /** - * The amount of time in milliseconds before the query request times out. - */ - Timeout?: Number; - /** - * The properties to highlight in the search result summary when the property value matches the search terms entered by the user. - */ - HithighlightedProperties?: string[]; - /** - * The type of the client that issued the query. - */ - ClientType?: string; - /** - * The GUID for the user who submitted the search query. - */ - PersonalizationData?: string; - /** - * The URL for the search results page. - */ - ResultsURL?: string; - /** - * Custom tags that identify the query. You can specify multiple query tags - */ - QueryTag?: string[]; - /** - * A Boolean value that specifies whether to return personal favorites with the search results. - */ - ProcessPersonalFavorites?: Boolean; - /** - * The location of the queryparametertemplate.xml file. This file is used to enable anonymous users to make Search REST queries. - */ - QueryTemplatePropertiesUrl?: string; - /** - * Special rules for reordering search results. - * These rules can specify that documents matching certain conditions are ranked higher or lower in the results. - * This property applies only when search results are sorted based on rank. - */ - ReorderingRules?: ReorderingRule[]; - /** - * The number of properties to show hit highlighting for in the search results. - */ - HitHighlightedMultivaluePropertyLimit?: Number; - /** - * A Boolean value that specifies whether the hit highlighted properties can be ordered. - */ - EnableOrderingHitHighlightedProperty?: Boolean; - /** - * The managed properties that are used to determine how to collapse individual search results. - * Results are collapsed into one or a specified number of results if they match any of the individual collapse specifications. - * In a collapse specification, results are collapsed if their properties match all individual properties in the collapse specification. - */ - CollapseSpecification?: String; - /** - * The locale identifier (LCID) of the user interface - */ - UIlanguage?: Number; - /** - * The preferred number of characters to display in the hit-highlighted summary generated for a search result. - */ - DesiredSnippetLength?: Number; - /** - * The maximum number of characters to display in the hit-highlighted summary generated for a search result. - */ - MaxSnippetLength?: Number; - /** - * The number of characters to display in the result summary for a search result. - */ - SummaryLength?: Number; - } - /** - * Describes the search API - * - */ - export class Search extends QueryableInstance { - /** - * Creates a new instance of the Search class - * - * @param baseUrl The url for the search context - * @param query The SearchQuery object to execute - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * ....... - * @returns Promise - */ - execute(query: SearchQuery): Promise; - } - /** - * Describes the SearchResults class, which returns the formatted and raw version of the query response - */ - export class SearchResults { - PrimarySearchResults: Object; - RawSearchResults: Object; - RowCount: Number; - TotalRows: Number; - TotalRowsIncludingDuplicates: Number; - ElapsedTime: Number; - /** - * Creates a new instance of the SearchResult class - * - */ - constructor(rawResponse: any); - /** - * Formats a search results array - * - * @param rawResults The array to process - */ - protected formatSearchResults(rawResults: Array | any): SearchResult[]; - } - /** - * Describes the SearchResult class - */ - export class SearchResult { - /** - * Creates a new instance of the SearchResult class - * - */ - constructor(rawItem: Array | any); - } - /** - * Defines how search results are sorted. - */ - export interface Sort { - /** - * The name for a property by which the search results are ordered. - */ - Property: string; - /** - * The direction in which search results are ordered. - */ - Direction: SortDirection; - } - /** - * defines the SortDirection enum - */ - export enum SortDirection { - Ascending = 0, - Descending = 1, - FQLFormula = 2, - } - /** - * Defines how ReorderingRule interface, used for reordering results - */ - export interface ReorderingRule { - /** - * The value to match on - */ - MatchValue: string; - /** - * The rank boosting - */ - Boost: Number; - /** - * The rank boosting - */ - MatchType: ReorderingRuleMatchType; - } - /** - * defines the ReorderingRuleMatchType enum - */ - export enum ReorderingRuleMatchType { - ResultContainsKeyword = 0, - TitleContainsKeyword = 1, - TitleMatchesKeyword = 2, - UrlStartsWith = 3, - UrlExactlyMatches = 4, - ContentTypeIs = 5, - FileExtensionMatches = 6, - ResultHasTag = 7, - ManualCondition = 8, - } - /** - * Defines how search results are sorted. - */ - export interface QueryProperty { - } - /** - * Specifies the type value for the property - */ - export enum QueryPropertyValueType { - None = 0, - StringType = 1, - Int32TYpe = 2, - BooleanType = 3, - StringArrayType = 4, - UnSupportedType = 5, - } -} -declare module "sharepoint/rest/site" { - import { Queryable, QueryableInstance } from "sharepoint/rest/queryable"; - import { Web } from "sharepoint/rest/webs"; - import { UserCustomActions } from "sharepoint/rest/usercustomactions"; - import { ContextInfo, DocumentLibraryInformation } from "sharepoint/rest/types"; - /** - * Describes a site collection - * - */ - export class Site extends QueryableInstance { - /** - * Creates a new instance of the RoleAssignments class - * - * @param baseUrl The url or Queryable which forms the parent of this fields collection - */ - constructor(baseUrl: string | Queryable, path?: string); - /** - * Gets the root web of the site collection - * - */ - rootWeb: Web; - /** - * Get all custom actions on a site collection - * - */ - userCustomActions: UserCustomActions; - /** - * Gets the context information for the site. - */ - getContextInfo(): Promise; - /** - * 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 - */ - getDocumentLibraries(absoluteWebUrl: string): Promise; - /** - * Gets the site URL from a page URL. - * - * @param absolutePageUrl The absolute url of the page - */ - getWebUrlFromPageUrl(absolutePageUrl: string): Promise; - } -} -declare module "utils/files" { - /** - * Reads a blob as text - * - * @param blob The data to read - */ - export function readBlobAsText(blob: Blob): Promise; - /** - * Reads a blob into an array buffer - * - * @param blob The data to read - */ - export function readBlobAsArrayBuffer(blob: Blob): Promise; -} -declare module "sharepoint/rest/userprofiles" { - import { Queryable, QueryableInstance, QueryableCollection } from "sharepoint/rest/queryable"; - import * as Types from "sharepoint/rest/types"; - export class UserProfileQuery extends QueryableInstance { - private profileLoader; - constructor(baseUrl: string | Queryable, path?: string); - /** - * The URL of the edit profile page for the current user. - */ - editProfileLink: Promise; - /** - * A Boolean value that indicates whether the current user's People I'm Following list is public. - */ - isMyPeopleListPublic: Promise; - /** - * A Boolean value that indicates whether the current user's People I'm Following list is public. - * - * @param loginName The account name of the user - */ - amIFollowedBy(loginName: string): Promise; - /** - * Checks whether the current user is following the specified user. - * - * @param loginName The account name of the user - */ - amIFollowing(loginName: string): Promise; - /** - * Gets tags that the user is following. - * - * @param maxCount The maximum number of tags to get. - */ - getFollowedTags(maxCount?: number): Promise; - /** - * Gets the people who are following the specified user. - * - * @param loginName The account name of the user. - */ - getFollowersFor(loginName: string): Promise; - /** - * Gets the people who are following the current user. - * - */ - myFollowers: QueryableCollection; - /** - * Gets user properties for the current user. - * - */ - myProperties: QueryableInstance; - /** - * Gets the people who the specified user is following. - * - * @param loginName The account name of the user. - */ - getPeopleFollowedBy(loginName: string): Promise; - /** - * Gets user properties for the specified user. - * - * @param loginName The account name of the user. - */ - getPropertiesFor(loginName: string): Promise; - /** - * Gets the most popular tags. - * - */ - trendingTags: Promise; - /** - * 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. - */ - getUserProfilePropertyFor(loginName: string, propertyName: string): Promise; - /** - * Removes the specified user from the user's list of suggested people to follow. - * - * @param loginName The account name of the user. - */ - hideSuggestion(loginName: string): Promise; - /** - * Checks whether the first user is following the second user. - * - * @param follower The account name of the user who might be following followee. - * @param followee The account name of the user who might be followed. - */ - isFollowing(follower: string, followee: string): Promise; - /** - * Uploads and sets the user profile picture - * - * @param profilePicSource Blob data representing the user's picture - */ - setMyProfilePic(profilePicSource: Blob): Promise; - /** - * 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 - */ - createPersonalSiteEnqueueBulk(...emails: string[]): Promise; - /** - * Gets the user profile of the site owner. - * - */ - ownerUserProfile: Promise; - /** - * Gets the user profile that corresponds to the current user. - */ - userProfile: Promise; - /** - * 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 if non-interactively (client) initiated request - */ - createPersonalSite(interactiveRequest?: boolean): Promise; - /** - * Sets the privacy settings for this profile. - * - * @param share true to make all social data public; false to make all social data private. - */ - shareAllSocialData(share: any): Promise; - } -} -declare module "sharepoint/rest/rest" { - import { SearchQuery, SearchResult } from "sharepoint/rest/search"; - import { Site } from "sharepoint/rest/site"; - import { Web } from "sharepoint/rest/webs"; - import { UserProfileQuery } from "sharepoint/rest/userprofiles"; - import { ODataBatch } from "sharepoint/rest/odata"; - /** - * Root of the SharePoint REST module - */ - export class Rest { - /** - * Executes a search against this web context - * - * @param query The SearchQuery definition - */ - search(query: string | SearchQuery): Promise; - /** - * Begins a site collection scoped REST request - * - */ - site: Site; - /** - * Begins a web scoped REST request - * - */ - web: Web; - /** - * Access to user profile methods - * - */ - profiles: UserProfileQuery; - /** - * Creates a new batch object for use with the Queryable.addToBatch method - * - */ - createBatch(): ODataBatch; - /** - * Begins a cross-domain, host site scoped REST request, for use in add-in webs - * - * @param addInWebUrl The absolute url of the add-in web - * @param hostWebUrl The absolute url of the host web - */ - crossDomainSite(addInWebUrl: string, hostWebUrl: string): Site; - /** - * Begins a cross-domain, host web scoped REST request, for use in add-in webs - * - * @param addInWebUrl The absolute url of the add-in web - * @param hostWebUrl The absolute url of the host web - */ - crossDomainWeb(addInWebUrl: string, hostWebUrl: string): Web; - /** - * Implements the creation of cross domain REST urls - * - * @param factory The constructor of the object to create Site | Web - * @param addInWebUrl The absolute url of the add-in web - * @param hostWebUrl The absolute url of the host web - * @param urlPart String part to append to the url "site" | "web" - */ - private _cdImpl(factory, addInWebUrl, hostWebUrl, urlPart); - } -} -declare module "pnp" { - import { Util } from "utils/util"; - import { PnPClientStorage } from "utils/storage"; - import { Settings } from "configuration/configuration"; - import { Logger } from "utils/logging"; - import { Rest } from "sharepoint/rest/rest"; - import { LibraryConfiguration } from "configuration/pnplibconfig"; - /** - * Root class of the Patterns and Practices namespace, provides an entry point to the library - */ - /** - * Utility methods - */ - export const util: typeof Util; - /** - * Provides access to the REST interface - */ - export const sp: Rest; - /** - * Provides access to local and session storage - */ - export const storage: PnPClientStorage; - /** - * Global configuration instance to which providers can be added - */ - export const config: Settings; - /** - * Global logging instance to which subscribers can be registered and messages written - */ - export const log: typeof Logger; - /** - * Allows for the configuration of the library - */ - export const setup: (config: LibraryConfiguration) => void; - let Def: { - config: Settings; - log: typeof Logger; - setup: (config: LibraryConfiguration) => void; - sp: Rest; - storage: PnPClientStorage; - util: typeof Util; - }; - export default Def; -} -declare module "net/nodefetchclientbrowser" { - import { HttpClientImpl } from "net/httpclient"; - /** - * This module is substituted for the NodeFetchClient.ts during the packaging process. This helps to reduce the pnp.js file size by - * not including all of the node dependencies - */ - export class NodeFetchClient implements HttpClientImpl { - siteUrl: string; - private _clientId; - private _clientSecret; - private _realm; - constructor(siteUrl: string, _clientId: string, _clientSecret: string, _realm?: string); - /** - * Always throws an error that NodeFetchClient is not supported for use in the browser - */ - fetch(url: string, options: any): Promise; - } -} -declare module "types/locale" { - export enum Locale { - AfrikaansSouthAfrica = 1078, - AlbanianAlbania = 1052, - Alsatian = 1156, - AmharicEthiopia = 1118, - ArabicSaudiArabia = 1025, - ArabicAlgeria = 5121, - ArabicBahrain = 15361, - ArabicEgypt = 3073, - ArabicIraq = 2049, - ArabicJordan = 11265, - ArabicKuwait = 13313, - ArabicLebanon = 12289, - ArabicLibya = 4097, - ArabicMorocco = 6145, - ArabicOman = 8193, - ArabicQatar = 16385, - ArabicSyria = 10241, - ArabicTunisia = 7169, - ArabicUAE = 14337, - ArabicYemen = 9217, - ArmenianArmenia = 1067, - Assamese = 1101, - AzeriCyrillic = 2092, - AzeriLatin = 1068, - Bashkir = 1133, - Basque = 1069, - Belarusian = 1059, - BengaliIndia = 1093, - BengaliBangladesh = 2117, - BosnianBosniaHerzegovina = 5146, - Breton = 1150, - Bulgarian = 1026, - Burmese = 1109, - Catalan = 1027, - CherokeeUnitedStates = 1116, - ChinesePeoplesRepublicofChina = 2052, - ChineseSingapore = 4100, - ChineseTaiwan = 1028, - ChineseHongKongSAR = 3076, - ChineseMacaoSAR = 5124, - Corsican = 1155, - Croatian = 1050, - CroatianBosniaHerzegovina = 4122, - Czech = 1029, - Danish = 1030, - Dari = 1164, - Divehi = 1125, - DutchNetherlands = 1043, - DutchBelgium = 2067, - Edo = 1126, - EnglishUnitedStates = 1033, - EnglishUnitedKingdom = 2057, - EnglishAustralia = 3081, - EnglishBelize = 10249, - EnglishCanada = 4105, - EnglishCaribbean = 9225, - EnglishHongKongSAR = 15369, - EnglishIndia = 16393, - EnglishIndonesia = 14345, - EnglishIreland = 6153, - EnglishJamaica = 8201, - EnglishMalaysia = 17417, - EnglishNewZealand = 5129, - EnglishPhilippines = 13321, - EnglishSingapore = 18441, - EnglishSouthAfrica = 7177, - EnglishTrinidad = 11273, - EnglishZimbabwe = 12297, - Estonian = 1061, - Faroese = 1080, - Farsi = 1065, - Filipino = 1124, - Finnish = 1035, - FrenchFrance = 1036, - FrenchBelgium = 2060, - FrenchCameroon = 11276, - FrenchCanada = 3084, - FrenchDemocraticRepofCongo = 9228, - FrenchCotedIvoire = 12300, - FrenchHaiti = 15372, - FrenchLuxembourg = 5132, - FrenchMali = 13324, - FrenchMonaco = 6156, - FrenchMorocco = 14348, - FrenchNorthAfrica = 58380, - FrenchReunion = 8204, - FrenchSenegal = 10252, - FrenchSwitzerland = 4108, - FrenchWestIndies = 7180, - FrisianNetherlands = 1122, - FulfuldeNigeria = 1127, - FYROMacedonian = 1071, - Galician = 1110, - Georgian = 1079, - GermanGermany = 1031, - GermanAustria = 3079, - GermanLiechtenstein = 5127, - GermanLuxembourg = 4103, - GermanSwitzerland = 2055, - Greek = 1032, - Greenlandic = 1135, - GuaraniParaguay = 1140, - Gujarati = 1095, - HausaNigeria = 1128, - HawaiianUnitedStates = 1141, - Hebrew = 1037, - Hindi = 1081, - Hungarian = 1038, - IbibioNigeria = 1129, - Icelandic = 1039, - IgboNigeria = 1136, - Indonesian = 1057, - Inuktitut = 1117, - Irish = 2108, - ItalianItaly = 1040, - ItalianSwitzerland = 2064, - Japanese = 1041, - Kiche = 1158, - Kannada = 1099, - KanuriNigeria = 1137, - Kashmiri = 2144, - KashmiriArabic = 1120, - Kazakh = 1087, - Khmer = 1107, - Kinyarwanda = 1159, - Konkani = 1111, - Korean = 1042, - KyrgyzCyrillic = 1088, - Lao = 1108, - Latin = 1142, - Latvian = 1062, - Lithuanian = 1063, - Luxembourgish = 1134, - MalayMalaysia = 1086, - MalayBruneiDarussalam = 2110, - Malayalam = 1100, - Maltese = 1082, - Manipuri = 1112, - MaoriNewZealand = 1153, - Mapudungun = 1146, - Marathi = 1102, - Mohawk = 1148, - MongolianCyrillic = 1104, - MongolianMongolian = 2128, - Nepali = 1121, - NepaliIndia = 2145, - NorwegianBokmål = 1044, - NorwegianNynorsk = 2068, - Occitan = 1154, - Oriya = 1096, - Oromo = 1138, - Papiamentu = 1145, - Pashto = 1123, - Polish = 1045, - PortugueseBrazil = 1046, - PortuguesePortugal = 2070, - Punjabi = 1094, - PunjabiPakistan = 2118, - QuechaBolivia = 1131, - QuechaEcuador = 2155, - QuechaPeru = 3179, - RhaetoRomanic = 1047, - Romanian = 1048, - RomanianMoldava = 2072, - Russian = 1049, - RussianMoldava = 2073, - SamiLappish = 1083, - Sanskrit = 1103, - ScottishGaelic = 1084, - Sepedi = 1132, - SerbianCyrillic = 3098, - SerbianLatin = 2074, - SindhiIndia = 1113, - SindhiPakistan = 2137, - SinhaleseSriLanka = 1115, - Slovak = 1051, - Slovenian = 1060, - Somali = 1143, - Sorbian = 1070, - SpanishSpainModernSort = 3082, - SpanishSpainTraditionalSort = 1034, - SpanishArgentina = 11274, - SpanishBolivia = 16394, - SpanishChile = 13322, - SpanishColombia = 9226, - SpanishCostaRica = 5130, - SpanishDominicanRepublic = 7178, - SpanishEcuador = 12298, - SpanishElSalvador = 17418, - SpanishGuatemala = 4106, - SpanishHonduras = 18442, - SpanishLatinAmerica = 22538, - SpanishMexico = 2058, - SpanishNicaragua = 19466, - SpanishPanama = 6154, - SpanishParaguay = 15370, - SpanishPeru = 10250, - SpanishPuertoRico = 20490, - SpanishUnitedStates = 21514, - SpanishUruguay = 14346, - SpanishVenezuela = 8202, - Sutu = 1072, - Swahili = 1089, - Swedish = 1053, - SwedishFinland = 2077, - Syriac = 1114, - Tajik = 1064, - TamazightArabic = 1119, - TamazightLatin = 2143, - Tamil = 1097, - Tatar = 1092, - Telugu = 1098, - Thai = 1054, - TibetanBhutan = 2129, - TibetanPeoplesRepublicofChina = 1105, - TigrignaEritrea = 2163, - TigrignaEthiopia = 1139, - Tsonga = 1073, - Tswana = 1074, - Turkish = 1055, - Turkmen = 1090, - UighurChina = 1152, - Ukrainian = 1058, - Urdu = 1056, - UrduIndia = 2080, - UzbekCyrillic = 2115, - UzbekLatin = 1091, - Venda = 1075, - Vietnamese = 1066, - Welsh = 1106, - Wolof = 1160, - Xhosa = 1076, - Yakut = 1157, - Yi = 1144, - Yiddish = 1085, - Yoruba = 1130, - Zulu = 1077, - HIDHumanInterfaceDevice = 1279, - } -} -declare module "sharepoint/provisioning/provisioningstep" { - /** - * Describes a ProvisioningStep - */ - export class ProvisioningStep { - private name; - private index; - private objects; - private parameters; - private handler; - /** - * Executes the ProvisioningStep function - * - * @param dependentPromise The promise the ProvisioningStep is dependent on - */ - execute(dependentPromise?: any): any; - /** - * Creates a new instance of the ProvisioningStep class - */ - constructor(name: string, index: number, objects: any, parameters: any, handler: any); - } -} -declare module "sharepoint/provisioning/util" { - export class Util { - /** - * Make URL relative to host - * - * @param url The URL to make relative - */ - static getRelativeUrl(url: string): string; - /** - * Replaces URL tokens in a string - */ - static replaceUrlTokens(url: string): string; - static encodePropertyKey(propKey: any): string; - } -} -declare module "sharepoint/provisioning/objecthandlers/objecthandlerbase" { - import { HttpClient } from "net/httpclient"; - /** - * Describes the Object Handler Base - */ - export class ObjectHandlerBase { - httpClient: HttpClient; - private name; - /** - * Creates a new instance of the ObjectHandlerBase class - */ - constructor(name: string); - /** - * Provisioning objects - */ - ProvisionObjects(objects: any, parameters?: any): Promise<{}>; - /** - * Writes to Logger when scope has started - */ - scope_started(): void; - /** - * Writes to Logger when scope has stopped - */ - scope_ended(): void; - } -} -declare module "sharepoint/provisioning/schema/inavigationnode" { - export interface INavigationNode { - Title: string; - Url: string; - Children: Array; - } -} -declare module "sharepoint/provisioning/schema/inavigation" { - import { INavigationNode } from "sharepoint/provisioning/schema/inavigationnode"; - export interface INavigation { - UseShared: boolean; - QuickLaunch: Array; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectnavigation" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { INavigation } from "sharepoint/provisioning/schema/inavigation"; - /** - * Describes the Navigation Object Handler - */ - export class ObjectNavigation extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectNavigation class - */ - constructor(); - /** - * Provision Navigation nodes - * - * @param object The navigation settings and nodes to provision - */ - ProvisionObjects(object: INavigation): Promise<{}>; - /** - * Retrieves the node with the given title from a collection of SP.NavigationNode - */ - private getNodeFromCollectionByTitle(nodeCollection, title); - private ConfigureQuickLaunch(nodes, clientContext, httpClient, navigation); - } -} -declare module "sharepoint/provisioning/schema/IPropertyBagEntry" { - export interface IPropertyBagEntry { - Key: string; - Value: string; - Indexed: boolean; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectpropertybagentries" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { IPropertyBagEntry } from "sharepoint/provisioning/schema/IPropertyBagEntry"; - /** - * Describes the Property Bag Entries Object Handler - */ - export class ObjectPropertyBagEntries extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectPropertyBagEntries class - */ - constructor(); - /** - * Provision Property Bag Entries - * - * @param entries The entries to provision - */ - ProvisionObjects(entries: Array): Promise<{}>; - } -} -declare module "sharepoint/provisioning/schema/IFeature" { - export interface IFeature { - ID: string; - Deactivate: boolean; - Description: string; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectfeatures" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { IFeature } from "sharepoint/provisioning/schema/IFeature"; - /** - * Describes the Features Object Handler - */ - export class ObjectFeatures extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectFeatures class - */ - constructor(); - /** - * Provisioning features - * - * @paramm features The features to provision - */ - ProvisionObjects(features: Array): Promise<{}>; - } -} -declare module "sharepoint/provisioning/schema/IWebSettings" { - export interface IWebSettings { - WelcomePage: string; - AlternateCssUrl: string; - SaveSiteAsTemplateEnabled: boolean; - MasterUrl: string; - CustomMasterUrl: string; - RecycleBinEnabled: boolean; - TreeViewEnabled: boolean; - QuickLaunchEnabled: boolean; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectwebsettings" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { IWebSettings } from "sharepoint/provisioning/schema/IWebSettings"; - /** - * Describes the Web Settings Object Handler - */ - export class ObjectWebSettings extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectWebSettings class - */ - constructor(); - /** - * Provision Web Settings - * - * @param object The Web Settings to provision - */ - ProvisionObjects(object: IWebSettings): Promise<{}>; - } -} -declare module "sharepoint/provisioning/schema/IComposedLook" { - export interface IComposedLook { - ColorPaletteUrl: string; - FontSchemeUrl: string; - BackgroundImageUrl: string; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectcomposedlook" { - import { IComposedLook } from "sharepoint/provisioning/schema/IComposedLook"; - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - /** - * Describes the Composed Look Object Handler - */ - export class ObjectComposedLook extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectComposedLook class - */ - constructor(); - /** - * Provisioning Composed Look - * - * @param object The Composed Look to provision - */ - ProvisionObjects(object: IComposedLook): Promise<{}>; - } -} -declare module "sharepoint/provisioning/schema/ICustomAction" { - export interface ICustomAction { - CommandUIExtension: any; - Description: string; - Group: string; - ImageUrl: string; - Location: string; - Name: string; - RegistrationId: string; - RegistrationType: any; - Rights: any; - ScriptBlock: string; - ScriptSrc: string; - Sequence: number; - Title: string; - Url: string; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectcustomactions" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { ICustomAction } from "sharepoint/provisioning/schema/ICustomAction"; - /** - * Describes the Custom Actions Object Handler - */ - export class ObjectCustomActions extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectCustomActions class - */ - constructor(); - /** - * Provisioning Custom Actions - * - * @param customactions The Custom Actions to provision - */ - ProvisionObjects(customactions: Array): Promise<{}>; - } -} -declare module "sharepoint/provisioning/schema/IContents" { - export interface IContents { - Xml: string; - FileUrl: string; - } -} -declare module "sharepoint/provisioning/schema/IWebPart" { - import { IContents } from "sharepoint/provisioning/schema/IContents"; - export interface IWebPart { - Title: string; - Order: number; - Zone: string; - Row: number; - Column: number; - Contents: IContents; - } -} -declare module "sharepoint/provisioning/schema/IHiddenView" { - export interface IHiddenView { - List: string; - Url: string; - Paged: boolean; - Query: string; - RowLimit: number; - Scope: number; - ViewFields: Array; - } -} -declare module "sharepoint/provisioning/schema/IFile" { - import { IWebPart } from "sharepoint/provisioning/schema/IWebPart"; - import { IHiddenView } from "sharepoint/provisioning/schema/IHiddenView"; - export interface IFile { - Overwrite: boolean; - Dest: string; - Src: string; - Properties: Object; - RemoveExistingWebParts: boolean; - WebParts: Array; - Views: Array; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectfiles" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { IFile } from "sharepoint/provisioning/schema/IFile"; - /** - * Describes the Files Object Handler - */ - export class ObjectFiles extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectFiles class - */ - constructor(); - /** - * Provisioning Files - * - * @param objects The files to provisiion - */ - ProvisionObjects(objects: Array): Promise<{}>; - private RemoveWebPartsFromFileIfSpecified(clientContext, limitedWebPartManager, shouldRemoveExisting); - private GetWebPartXml(webParts); - private AddWebPartsToWebPartPage(dest, src, webParts, shouldRemoveExisting); - private ApplyFileProperties(dest, fileProperties); - private GetViewFromCollectionByUrl(viewCollection, url); - private ModifyHiddenViews(objects); - private GetFolderFromFilePath(filePath); - private GetFilenameFromFilePath(filePath); - } -} -declare module "sharepoint/provisioning/sequencer/sequencer" { - /** - * Descibes a Sequencer - */ - export class Sequencer { - private functions; - private parameter; - private scope; - /** - * Creates a new instance of the Sequencer class, and declare private variables - */ - constructor(functions: Array, parameter: any, scope: any); - /** - * Executes the functions in sequence using DeferredObject - */ - execute(progressFunction?: (s: Sequencer, index: number, functions: any[]) => void): Promise; - } -} -declare module "sharepoint/provisioning/schema/IFolder" { - export interface IFolder { - Name: string; - DefaultValues: Object; - } -} -declare module "sharepoint/provisioning/schema/IListInstanceFieldRef" { - export interface IListInstanceFieldRef { - Name: string; - } -} -declare module "sharepoint/provisioning/schema/IField" { - export interface IField { - ShowInDisplayForm: boolean; - ShowInEditForm: boolean; - ShowInNewForm: boolean; - CanBeDeleted: boolean; - DefaultValue: string; - Description: string; - EnforceUniqueValues: boolean; - Direction: string; - EntityPropertyName: string; - FieldTypeKind: any; - Filterable: boolean; - Group: string; - Hidden: boolean; - ID: string; - Indexed: boolean; - InternalName: string; - JsLink: string; - ReadOnlyField: boolean; - Required: boolean; - SchemaXml: string; - StaticName: string; - Title: string; - TypeAsString: string; - TypeDisplayName: string; - TypeShortDescription: string; - ValidationFormula: string; - ValidationMessage: string; - Type: string; - Formula: string; - } -} -declare module "sharepoint/provisioning/schema/IView" { - export interface IView { - Title: string; - Paged: boolean; - PersonalView: boolean; - Query: string; - RowLimit: number; - Scope: number; - SetAsDefaultView: boolean; - ViewFields: Array; - ViewTypeKind: string; - } -} -declare module "sharepoint/provisioning/schema/IRoleAssignment" { - export interface IRoleAssignment { - Principal: string; - RoleDefinition: any; - } -} -declare module "sharepoint/provisioning/schema/ISecurity" { - import { IRoleAssignment } from "sharepoint/provisioning/schema/IRoleAssignment"; - export interface ISecurity { - BreakRoleInheritance: boolean; - CopyRoleAssignments: boolean; - ClearSubscopes: boolean; - RoleAssignments: Array; - } -} -declare module "sharepoint/provisioning/schema/IContentTypeBinding" { - export interface IContentTypeBinding { - ContentTypeId: string; - } -} -declare module "sharepoint/provisioning/schema/IListInstance" { - import { IFolder } from "sharepoint/provisioning/schema/IFolder"; - import { IListInstanceFieldRef } from "sharepoint/provisioning/schema/IListInstanceFieldRef"; - import { IField } from "sharepoint/provisioning/schema/IField"; - import { IView } from "sharepoint/provisioning/schema/IView"; - import { ISecurity } from "sharepoint/provisioning/schema/ISecurity"; - import { IContentTypeBinding } from "sharepoint/provisioning/schema/IContentTypeBinding"; - export interface IListInstance { - Title: string; - Url: string; - Description: string; - DocumentTemplate: string; - OnQuickLaunch: boolean; - TemplateType: number; - EnableVersioning: boolean; - EnableMinorVersions: boolean; - EnableModeration: boolean; - EnableFolderCreation: boolean; - EnableAttachments: boolean; - RemoveExistingContentTypes: boolean; - RemoveExistingViews: boolean; - NoCrawl: boolean; - DefaultDisplayFormUrl: string; - DefaultEditFormUrl: string; - DefaultNewFormUrl: string; - DraftVersionVisibility: string; - ImageUrl: string; - Hidden: boolean; - ForceCheckout: boolean; - ContentTypeBindings: Array; - FieldRefs: Array; - Fields: Array; - Folders: Array; - Views: Array; - DataRows: Array; - Security: ISecurity; - } -} -declare module "sharepoint/provisioning/objecthandlers/objectlists" { - import { ObjectHandlerBase } from "sharepoint/provisioning/objecthandlers/objecthandlerbase"; - import { IListInstance } from "sharepoint/provisioning/schema/IListInstance"; - /** - * Describes the Lists Object Handler - */ - export class ObjectLists extends ObjectHandlerBase { - /** - * Creates a new instance of the ObjectLists class - */ - constructor(); - /** - * Provision Lists - * - * @param objects The lists to provision - */ - ProvisionObjects(objects: Array): Promise<{}>; - private EnsureLocationBasedMetadataDefaultsReceiver(clientContext, list); - private CreateFolders(params); - private ApplyContentTypeBindings(params); - private ApplyListInstanceFieldRefs(params); - private ApplyFields(params); - private ApplyLookupFields(params); - private GetFieldXmlAttr(fieldXml, attr); - private GetFieldXml(field, lists, list); - private ApplyListSecurity(params); - private CreateViews(params); - private InsertDataRows(params); - } -} -declare module "sharepoint/provisioning/schema/ISiteSchema" { - import { IListInstance } from "sharepoint/provisioning/schema/IListInstance"; - import { ICustomAction } from "sharepoint/provisioning/schema/ICustomAction"; - import { IFeature } from "sharepoint/provisioning/schema/IFeature"; - import { IFile } from "sharepoint/provisioning/schema/IFile"; - import { INavigation } from "sharepoint/provisioning/schema/inavigation"; - import { IComposedLook } from "sharepoint/provisioning/schema/IComposedLook"; - import { IWebSettings } from "sharepoint/provisioning/schema/IWebSettings"; - export interface SiteSchema { - Lists: Array; - Files: Array; - Navigation: INavigation; - CustomActions: Array; - ComposedLook: IComposedLook; - PropertyBagEntries: Object; - Parameters: Object; - WebSettings: IWebSettings; - Features: Array; - } -} -declare module "sharepoint/provisioning/provisioning" { - /** - * Root class of Provisioning - */ - export class Provisioning { - private handlers; - private httpClient; - private startTime; - private queueItems; - /** - * Creates a new instance of the Provisioning class - */ - constructor(); - /** - * Applies a JSON template to the current web - * - * @param path URL to the template file - */ - applyTemplate(path: string): Promise; - /** - * Starts the provisioning - * - * @param json The parsed template in JSON format - * @param queue Array of Object Handlers to run - */ - private start(json, queue); - } -} -declare module "sharepoint/provisioning/schema/IContentType" { - export interface IContentType { - Name: string; - } -} diff --git a/dist/pnp.js b/dist/pnp.js deleted file mode 100644 index 99c1dcb8..00000000 --- a/dist/pnp.js +++ /dev/null @@ -1,4763 +0,0 @@ -/** - * sp-pnp-js v1.0.4 - A reusable JavaScript library targeting SharePoint client-side development. - * MIT (https://github.com/OfficeDev/PnP-JS-Core/blob/master/LICENSE) - * Copyright (c) 2016 Microsoft - * docs: http://officedev.github.io/PnP-JS-Core - * source: https://github.com/OfficeDev/PnP-JS-Core - * bugs: https://github.com/OfficeDev/PnP-JS-Core/issues - */ -(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.$pnp = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o -1) { - this.values[index] = o; - } - else { - this.keys.push(key); - this.values.push(o); - } - }; - Dictionary.prototype.merge = function (source) { - if (util_1.Util.isFunction(source["getKeys"])) { - var sourceAsDictionary = source; - var keys = sourceAsDictionary.getKeys(); - var l = keys.length; - for (var i = 0; i < l; i++) { - this.add(keys[i], sourceAsDictionary.get(keys[i])); - } - } - else { - var sourceAsHash = source; - for (var key in sourceAsHash) { - if (sourceAsHash.hasOwnProperty(key)) { - this.add(key, source[key]); - } - } - } - }; - Dictionary.prototype.remove = function (key) { - var index = this.keys.indexOf(key); - if (index < 0) { - return null; - } - var val = this.values[index]; - this.keys.splice(index, 1); - this.values.splice(index, 1); - return val; - }; - Dictionary.prototype.getKeys = function () { - return this.keys; - }; - Dictionary.prototype.getValues = function () { - return this.values; - }; - Dictionary.prototype.clear = function () { - this.keys = []; - this.values = []; - }; - Dictionary.prototype.count = function () { - return this.keys.length; - }; - return Dictionary; -}()); -exports.Dictionary = Dictionary; - -},{"../utils/util":41}],2:[function(require,module,exports){ -"use strict"; -var Collections = require("../collections/collections"); -var providers = require("./providers/providers"); -var Settings = (function () { - function Settings() { - this.Providers = providers; - this._settings = new Collections.Dictionary(); - } - Settings.prototype.add = function (key, value) { - this._settings.add(key, value); - }; - Settings.prototype.addJSON = function (key, value) { - this._settings.add(key, JSON.stringify(value)); - }; - Settings.prototype.apply = function (hash) { - var _this = this; - return new Promise(function (resolve, reject) { - try { - _this._settings.merge(hash); - resolve(); - } - catch (e) { - reject(e); - } - }); - }; - Settings.prototype.load = function (provider) { - var _this = this; - return new Promise(function (resolve, reject) { - provider.getConfiguration().then(function (value) { - _this._settings.merge(value); - resolve(); - }).catch(function (reason) { - reject(reason); - }); - }); - }; - Settings.prototype.get = function (key) { - return this._settings.get(key); - }; - Settings.prototype.getJSON = function (key) { - var o = this.get(key); - if (typeof o === "undefined" || o === null) { - return o; - } - return JSON.parse(o); - }; - return Settings; -}()); -exports.Settings = Settings; - -},{"../collections/collections":1,"./providers/providers":5}],3:[function(require,module,exports){ -(function (global){ -"use strict"; -var RuntimeConfigImpl = (function () { - function RuntimeConfigImpl() { - this._headers = null; - this._defaultCachingStore = "session"; - this._defaultCachingTimeoutSeconds = 30; - this._globalCacheDisable = false; - this._useSPRequestExecutor = false; - } - RuntimeConfigImpl.prototype.set = function (config) { - if (config.hasOwnProperty("headers")) { - this._headers = config.headers; - } - if (config.hasOwnProperty("globalCacheDisable")) { - this._globalCacheDisable = config.globalCacheDisable; - } - if (config.hasOwnProperty("defaultCachingStore")) { - this._defaultCachingStore = config.defaultCachingStore; - } - if (config.hasOwnProperty("defaultCachingTimeoutSeconds")) { - this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds; - } - if (config.hasOwnProperty("useSPRequestExecutor")) { - this._useSPRequestExecutor = config.useSPRequestExecutor; - } - if (config.hasOwnProperty("nodeClientOptions")) { - this._useNodeClient = true; - this._useSPRequestExecutor = false; - this._nodeClientData = config.nodeClientOptions; - global._spPageContextInfo = { - webAbsoluteUrl: config.nodeClientOptions.siteUrl, - }; - } - }; - Object.defineProperty(RuntimeConfigImpl.prototype, "headers", { - get: function () { - return this._headers; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingStore", { - get: function () { - return this._defaultCachingStore; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "defaultCachingTimeoutSeconds", { - get: function () { - return this._defaultCachingTimeoutSeconds; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "globalCacheDisable", { - get: function () { - return this._globalCacheDisable; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "useSPRequestExecutor", { - get: function () { - return this._useSPRequestExecutor; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "useNodeFetchClient", { - get: function () { - return this._useNodeClient; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RuntimeConfigImpl.prototype, "nodeRequestOptions", { - get: function () { - return this._nodeClientData; - }, - enumerable: true, - configurable: true - }); - return RuntimeConfigImpl; -}()); -exports.RuntimeConfigImpl = RuntimeConfigImpl; -var _runtimeConfig = new RuntimeConfigImpl(); -exports.RuntimeConfig = _runtimeConfig; -function setRuntimeConfig(config) { - _runtimeConfig.set(config); -} -exports.setRuntimeConfig = setRuntimeConfig; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],4:[function(require,module,exports){ -"use strict"; -var storage = require("../../utils/storage"); -var CachingConfigurationProvider = (function () { - function CachingConfigurationProvider(wrappedProvider, cacheKey, cacheStore) { - this.wrappedProvider = wrappedProvider; - this.store = (cacheStore) ? cacheStore : this.selectPnPCache(); - this.cacheKey = "_configcache_" + cacheKey; - } - CachingConfigurationProvider.prototype.getWrappedProvider = function () { - return this.wrappedProvider; - }; - CachingConfigurationProvider.prototype.getConfiguration = function () { - var _this = this; - if ((!this.store) || (!this.store.enabled)) { - return this.wrappedProvider.getConfiguration(); - } - var cachedConfig = this.store.get(this.cacheKey); - if (cachedConfig) { - return new Promise(function (resolve, reject) { - resolve(cachedConfig); - }); - } - var providerPromise = this.wrappedProvider.getConfiguration(); - providerPromise.then(function (providedConfig) { - _this.store.put(_this.cacheKey, providedConfig); - }); - return providerPromise; - }; - CachingConfigurationProvider.prototype.selectPnPCache = function () { - var pnpCache = new storage.PnPClientStorage(); - if ((pnpCache.local) && (pnpCache.local.enabled)) { - return pnpCache.local; - } - if ((pnpCache.session) && (pnpCache.session.enabled)) { - return pnpCache.session; - } - throw new Error("Cannot create a caching configuration provider since cache is not available."); - }; - return CachingConfigurationProvider; -}()); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = CachingConfigurationProvider; - -},{"../../utils/storage":40}],5:[function(require,module,exports){ -"use strict"; -var cachingConfigurationProvider_1 = require("./cachingConfigurationProvider"); -var spListConfigurationProvider_1 = require("./spListConfigurationProvider"); -exports.CachingConfigurationProvider = cachingConfigurationProvider_1.default; -exports.SPListConfigurationProvider = spListConfigurationProvider_1.default; - -},{"./cachingConfigurationProvider":4,"./spListConfigurationProvider":6}],6:[function(require,module,exports){ -"use strict"; -var cachingConfigurationProvider_1 = require("./cachingConfigurationProvider"); -var SPListConfigurationProvider = (function () { - function SPListConfigurationProvider(sourceWeb, sourceListTitle) { - if (sourceListTitle === void 0) { sourceListTitle = "config"; } - this.sourceWeb = sourceWeb; - this.sourceListTitle = sourceListTitle; - } - Object.defineProperty(SPListConfigurationProvider.prototype, "web", { - get: function () { - return this.sourceWeb; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(SPListConfigurationProvider.prototype, "listTitle", { - get: function () { - return this.sourceListTitle; - }, - enumerable: true, - configurable: true - }); - SPListConfigurationProvider.prototype.getConfiguration = function () { - return this.web.lists.getByTitle(this.listTitle).items.select("Title", "Value") - .getAs().then(function (data) { - var configuration = {}; - data.forEach(function (i) { - configuration[i.Title] = i.Value; - }); - return configuration; - }); - }; - SPListConfigurationProvider.prototype.asCaching = function () { - var cacheKey = "splist_" + this.web.toUrl() + "+" + this.listTitle; - return new cachingConfigurationProvider_1.default(this, cacheKey); - }; - return SPListConfigurationProvider; -}()); -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = SPListConfigurationProvider; - -},{"./cachingConfigurationProvider":4}],7:[function(require,module,exports){ -"use strict"; -var collections_1 = require("../collections/collections"); -var util_1 = require("../utils/util"); -var odata_1 = require("../sharepoint/rest/odata"); -var CachedDigest = (function () { - function CachedDigest() { - } - return CachedDigest; -}()); -exports.CachedDigest = CachedDigest; -var DigestCache = (function () { - function DigestCache(_httpClient, _digests) { - if (_digests === void 0) { _digests = new collections_1.Dictionary(); } - this._httpClient = _httpClient; - this._digests = _digests; - } - DigestCache.prototype.getDigest = function (webUrl) { - var self = this; - var cachedDigest = this._digests.get(webUrl); - if (cachedDigest !== null) { - var now = new Date(); - if (now < cachedDigest.expiration) { - return Promise.resolve(cachedDigest.value); - } - } - var url = util_1.Util.combinePaths(webUrl, "/_api/contextinfo"); - return self._httpClient.fetchRaw(url, { - cache: "no-cache", - credentials: "same-origin", - headers: { - "Accept": "application/json;odata=verbose", - "Content-type": "application/json;odata=verbose;charset=utf-8", - }, - method: "POST", - }).then(function (response) { - var parser = new odata_1.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; - self._digests.add(webUrl, newCachedDigest); - return newCachedDigest.value; - }); - }; - DigestCache.prototype.clear = function () { - this._digests.clear(); - }; - return DigestCache; -}()); -exports.DigestCache = DigestCache; - -},{"../collections/collections":1,"../sharepoint/rest/odata":22,"../utils/util":41}],8:[function(require,module,exports){ -(function (global){ -"use strict"; -var FetchClient = (function () { - function FetchClient() { - } - FetchClient.prototype.fetch = function (url, options) { - return global.fetch(url, options); - }; - return FetchClient; -}()); -exports.FetchClient = FetchClient; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}],9:[function(require,module,exports){ -"use strict"; -var fetchclient_1 = require("./fetchclient"); -var digestcache_1 = require("./digestcache"); -var util_1 = require("../utils/util"); -var pnplibconfig_1 = require("../configuration/pnplibconfig"); -var sprequestexecutorclient_1 = require("./sprequestexecutorclient"); -var nodefetchclient_1 = require("./nodefetchclient"); -var HttpClient = (function () { - function HttpClient() { - this._impl = this.getFetchImpl(); - this._digestCache = new digestcache_1.DigestCache(this); - } - HttpClient.prototype.fetch = function (url, options) { - if (options === void 0) { options = {}; } - var self = this; - var opts = util_1.Util.extend(options, { cache: "no-cache", credentials: "same-origin" }, true); - var headers = new Headers(); - this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers); - this.mergeHeaders(headers, options.headers); - 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:1.0.4"); - } - opts = util_1.Util.extend(opts, { headers: headers }); - if (opts.method && opts.method.toUpperCase() !== "GET") { - if (!headers.has("X-RequestDigest")) { - var index = url.indexOf("_api/"); - if (index < 0) { - throw new Error("Unable to determine API url"); - } - var webUrl = url.substr(0, index); - return this._digestCache.getDigest(webUrl) - .then(function (digest) { - headers.append("X-RequestDigest", digest); - return self.fetchRaw(url, opts); - }); - } - } - return self.fetchRaw(url, opts); - }; - HttpClient.prototype.fetchRaw = function (url, options) { - var _this = this; - if (options === void 0) { options = {}; } - var rawHeaders = new Headers(); - this.mergeHeaders(rawHeaders, options.headers); - options = util_1.Util.extend(options, { headers: rawHeaders }); - var retry = function (ctx) { - _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) { - var delay = ctx.delay; - if (response.status !== 429 && response.status !== 503) { - ctx.reject(response); - } - ctx.delay *= 2; - ctx.attempts++; - if (ctx.retryCount <= ctx.attempts) { - ctx.reject(response); - } - setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay); - }); - }; - return new Promise(function (resolve, reject) { - var retryContext = { - attempts: 0, - delay: 100, - reject: reject, - resolve: resolve, - retryCount: 7, - }; - retry.call(_this, retryContext); - }); - }; - HttpClient.prototype.get = function (url, options) { - if (options === void 0) { options = {}; } - var opts = util_1.Util.extend(options, { method: "GET" }); - return this.fetch(url, opts); - }; - HttpClient.prototype.post = function (url, options) { - if (options === void 0) { options = {}; } - var opts = util_1.Util.extend(options, { method: "POST" }); - return this.fetch(url, opts); - }; - HttpClient.prototype.getFetchImpl = function () { - if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) { - return new sprequestexecutorclient_1.SPRequestExecutorClient(); - } - else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) { - var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions; - return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret); - } - else { - return new fetchclient_1.FetchClient(); - } - }; - HttpClient.prototype.mergeHeaders = function (target, source) { - if (typeof source !== "undefined" && source !== null) { - var temp = new Request("", { headers: source }); - temp.headers.forEach(function (value, name) { - target.append(name, value); - }); - } - }; - return HttpClient; -}()); -exports.HttpClient = HttpClient; - -},{"../configuration/pnplibconfig":3,"../utils/util":41,"./digestcache":7,"./fetchclient":8,"./nodefetchclient":10,"./sprequestexecutorclient":11}],10:[function(require,module,exports){ -"use strict"; -var NodeFetchClient = (function () { - function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) { - if (_realm === void 0) { _realm = ""; } - this.siteUrl = siteUrl; - this._clientId = _clientId; - this._clientSecret = _clientSecret; - this._realm = _realm; - } - NodeFetchClient.prototype.fetch = function (url, options) { - throw new Error("Using NodeFetchClient in the browser is not supported."); - }; - return NodeFetchClient; -}()); -exports.NodeFetchClient = NodeFetchClient; - -},{}],11:[function(require,module,exports){ -"use strict"; -var util_1 = require("../utils/util"); -var SPRequestExecutorClient = (function () { - function SPRequestExecutorClient() { - this.convertToResponse = function (spResponse) { - var responseHeaders = new Headers(); - for (var h in spResponse.headers) { - if (spResponse.headers[h]) { - responseHeaders.append(h, spResponse.headers[h]); - } - } - return new Response(spResponse.body, { - headers: responseHeaders, - status: spResponse.statusCode, - statusText: spResponse.statusText, - }); - }; - } - SPRequestExecutorClient.prototype.fetch = function (url, options) { - var _this = this; - if (typeof SP === "undefined" || typeof SP.RequestExecutor === "undefined") { - throw new Error("SP.RequestExecutor is undefined. " + - "Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library."); - } - var addinWebUrl = url.substring(0, url.indexOf("/_api")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp; - if (options.headers && options.headers instanceof Headers) { - iterator = options.headers.entries(); - temp = iterator.next(); - while (!temp.done) { - headers[temp.value[0]] = temp.value[1]; - temp = iterator.next(); - } - } - else { - headers = options.headers; - } - return new Promise(function (resolve, reject) { - var requestOptions = { - error: function (error) { - reject(_this.convertToResponse(error)); - }, - headers: headers, - method: options.method, - success: function (response) { - resolve(_this.convertToResponse(response)); - }, - url: url, - }; - if (options.body) { - util_1.Util.extend(requestOptions, { body: options.body }); - } - else { - util_1.Util.extend(requestOptions, { binaryStringRequestBody: true }); - } - executor.executeAsync(requestOptions); - }); - }; - return SPRequestExecutorClient; -}()); -exports.SPRequestExecutorClient = SPRequestExecutorClient; - -},{"../utils/util":41}],12:[function(require,module,exports){ -"use strict"; -var util_1 = require("./utils/util"); -var storage_1 = require("./utils/storage"); -var configuration_1 = require("./configuration/configuration"); -var logging_1 = require("./utils/logging"); -var rest_1 = require("./sharepoint/rest/rest"); -var pnplibconfig_1 = require("./configuration/pnplibconfig"); -exports.util = util_1.Util; -exports.sp = new rest_1.Rest(); -exports.storage = new storage_1.PnPClientStorage(); -exports.config = new configuration_1.Settings(); -exports.log = logging_1.Logger; -exports.setup = pnplibconfig_1.setRuntimeConfig; -var Def = { - config: exports.config, - log: exports.log, - setup: exports.setup, - sp: exports.sp, - storage: exports.storage, - util: exports.util, -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.default = Def; - -},{"./configuration/configuration":2,"./configuration/pnplibconfig":3,"./sharepoint/rest/rest":26,"./utils/logging":39,"./utils/storage":40,"./utils/util":41}],13:[function(require,module,exports){ -"use strict"; -var storage_1 = require("../../utils/storage"); -var util_1 = require("../../utils/util"); -var pnplibconfig_1 = require("../../configuration/pnplibconfig"); -var CachingOptions = (function () { - function CachingOptions(key) { - this.key = key; - this.expiration = util_1.Util.dateAdd(new Date(), "second", pnplibconfig_1.RuntimeConfig.defaultCachingTimeoutSeconds); - this.storeName = pnplibconfig_1.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 storage_1.PnPClientStorage(); - return CachingOptions; -}()); -exports.CachingOptions = CachingOptions; -var CachingParserWrapper = (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 (data) { - if (_this._cacheOptions.store !== null) { - _this._cacheOptions.store.put(_this._cacheOptions.key, data, _this._cacheOptions.expiration); - } - return data; - }); - }; - return CachingParserWrapper; -}()); -exports.CachingParserWrapper = CachingParserWrapper; - -},{"../../configuration/pnplibconfig":3,"../../utils/storage":40,"../../utils/util":41}],14:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var ContentTypes = (function (_super) { - __extends(ContentTypes, _super); - function ContentTypes(baseUrl, path) { - if (path === void 0) { path = "contenttypes"; } - _super.call(this, baseUrl, path); - } - ContentTypes.prototype.getById = function (id) { - var ct = new ContentType(this); - ct.concat("('" + id + "')"); - return ct; - }; - return ContentTypes; -}(queryable_1.QueryableCollection)); -exports.ContentTypes = ContentTypes; -var ContentType = (function (_super) { - __extends(ContentType, _super); - function ContentType(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(ContentType.prototype, "descriptionResource", { - get: function () { - return new queryable_1.Queryable(this, "descriptionResource"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "fieldLinks", { - get: function () { - return new queryable_1.Queryable(this, "fieldLinks"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "fields", { - get: function () { - return new queryable_1.Queryable(this, "fields"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "nameResource", { - get: function () { - return new queryable_1.Queryable(this, "nameResource"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "parent", { - get: function () { - return new queryable_1.Queryable(this, "parent"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "workflowAssociations", { - get: function () { - return new queryable_1.Queryable(this, "workflowAssociations"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "description", { - get: function () { - return new queryable_1.Queryable(this, "description"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "displayFormTemplateName", { - get: function () { - return new queryable_1.Queryable(this, "displayFormTemplateName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "displayFormUrl", { - get: function () { - return new queryable_1.Queryable(this, "displayFormUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "documentTemplate", { - get: function () { - return new queryable_1.Queryable(this, "documentTemplate"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "documentTemplateUrl", { - get: function () { - return new queryable_1.Queryable(this, "documentTemplateUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "editFormTemplateName", { - get: function () { - return new queryable_1.Queryable(this, "editFormTemplateName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "editFormUrl", { - get: function () { - return new queryable_1.Queryable(this, "editFormUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "group", { - get: function () { - return new queryable_1.Queryable(this, "group"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "hidden", { - get: function () { - return new queryable_1.Queryable(this, "hidden"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "jsLink", { - get: function () { - return new queryable_1.Queryable(this, "jsLink"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "name", { - get: function () { - return new queryable_1.Queryable(this, "name"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "newFormTemplateName", { - get: function () { - return new queryable_1.Queryable(this, "newFormTemplateName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "newFormUrl", { - get: function () { - return new queryable_1.Queryable(this, "newFormUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "readOnly", { - get: function () { - return new queryable_1.Queryable(this, "readOnly"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "schemaXml", { - get: function () { - return new queryable_1.Queryable(this, "schemaXml"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "scope", { - get: function () { - return new queryable_1.Queryable(this, "scope"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "sealed", { - get: function () { - return new queryable_1.Queryable(this, "sealed"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ContentType.prototype, "stringId", { - get: function () { - return new queryable_1.Queryable(this, "stringId"); - }, - enumerable: true, - configurable: true - }); - return ContentType; -}(queryable_1.QueryableInstance)); -exports.ContentType = ContentType; - -},{"./queryable":23}],15:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var util_1 = require("../../utils/util"); -var Types = require("./types"); -var Fields = (function (_super) { - __extends(Fields, _super); - function Fields(baseUrl, path) { - if (path === void 0) { path = "fields"; } - _super.call(this, baseUrl, path); - } - Fields.prototype.getByTitle = function (title) { - return new Field(this, "getByTitle('" + title + "')"); - }; - Fields.prototype.getByInternalNameOrTitle = function (name) { - return new Field(this, "getByInternalNameOrTitle('" + name + "')"); - }; - Fields.prototype.getById = function (id) { - var f = new Field(this); - f.concat("('" + id + "')"); - return f; - }; - Fields.prototype.createFieldAsXml = function (xml) { - var _this = this; - var info; - if (typeof xml === "string") { - info = { SchemaXml: xml }; - } - else { - info = xml; - } - var postBody = JSON.stringify({ - "parameters": util_1.Util.extend({ - "__metadata": { - "type": "SP.XmlSchemaFieldCreationInformation", - }, - }, info), - }); - var q = new Fields(this, "createfieldasxml"); - return q.postAs({ body: postBody }).then(function (data) { - return { - data: data, - field: _this.getById(data.Id), - }; - }); - }; - Fields.prototype.add = function (title, fieldType, properties) { - var _this = this; - if (properties === void 0) { properties = {}; } - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": fieldType }, - "Title": title, - }, properties)); - return this.postAs({ body: postBody }).then(function (data) { - return { - data: data, - field: _this.getById(data.Id), - }; - }); - }; - Fields.prototype.addText = function (title, maxLength, properties) { - if (maxLength === void 0) { maxLength = 255; } - var props = { - FieldTypeKind: 2, - }; - return this.add(title, "SP.FieldText", util_1.Util.extend(props, properties)); - }; - Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) { - if (outputType === void 0) { outputType = Types.FieldTypes.Text; } - var props = { - DateFormat: dateFormat, - FieldTypeKind: 17, - Formula: formula, - OutputType: outputType, - }; - return this.add(title, "SP.FieldCalculated", util_1.Util.extend(props, properties)); - }; - Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) { - if (displayFormat === void 0) { displayFormat = Types.DateTimeFieldFormatType.DateOnly; } - if (calendarType === void 0) { calendarType = Types.CalendarType.Gregorian; } - if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = 0; } - var props = { - DateTimeCalendarType: calendarType, - DisplayFormat: displayFormat, - FieldTypeKind: 4, - FriendlyDisplayFormat: friendlyDisplayFormat, - }; - return this.add(title, "SP.FieldDateTime", util_1.Util.extend(props, properties)); - }; - Fields.prototype.addNumber = function (title, minValue, maxValue, properties) { - var props = { FieldTypeKind: 9 }; - if (typeof minValue !== "undefined") { - props = util_1.Util.extend({ MinimumValue: minValue }, props); - } - if (typeof maxValue !== "undefined") { - props = util_1.Util.extend({ MaximumValue: maxValue }, props); - } - return this.add(title, "SP.FieldNumber", util_1.Util.extend(props, properties)); - }; - Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) { - if (currencyLocalId === void 0) { currencyLocalId = 1033; } - var props = { - CurrencyLocaleId: currencyLocalId, - FieldTypeKind: 10, - }; - if (typeof minValue !== "undefined") { - props = util_1.Util.extend({ MinimumValue: minValue }, props); - } - if (typeof maxValue !== "undefined") { - props = util_1.Util.extend({ MaximumValue: maxValue }, props); - } - return this.add(title, "SP.FieldCurrency", util_1.Util.extend(props, properties)); - }; - 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", util_1.Util.extend(props, properties)); - }; - Fields.prototype.addUrl = function (title, displayFormat, properties) { - if (displayFormat === void 0) { displayFormat = Types.UrlFieldFormatType.Hyperlink; } - var props = { - DisplayFormat: displayFormat, - FieldTypeKind: 11, - }; - return this.add(title, "SP.FieldUrl", util_1.Util.extend(props, properties)); - }; - return Fields; -}(queryable_1.QueryableCollection)); -exports.Fields = Fields; -var Field = (function (_super) { - __extends(Field, _super); - function Field(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(Field.prototype, "canBeDeleted", { - get: function () { - return new queryable_1.Queryable(this, "canBeDeleted"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "defaultValue", { - get: function () { - return new queryable_1.Queryable(this, "defaultValue"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "description", { - get: function () { - return new queryable_1.Queryable(this, "description"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "direction", { - get: function () { - return new queryable_1.Queryable(this, "direction"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "enforceUniqueValues", { - get: function () { - return new queryable_1.Queryable(this, "enforceUniqueValues"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "entityPropertyName", { - get: function () { - return new queryable_1.Queryable(this, "entityPropertyName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "filterable", { - get: function () { - return new queryable_1.Queryable(this, "filterable"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "fromBaseType", { - get: function () { - return new queryable_1.Queryable(this, "fromBaseType"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "group", { - get: function () { - return new queryable_1.Queryable(this, "group"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "hidden", { - get: function () { - return new queryable_1.Queryable(this, "hidden"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "id", { - get: function () { - return new queryable_1.Queryable(this, "id"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "indexed", { - get: function () { - return new queryable_1.Queryable(this, "indexed"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "internalName", { - get: function () { - return new queryable_1.Queryable(this, "internalName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "jsLink", { - get: function () { - return new queryable_1.Queryable(this, "jsLink"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "readOnlyField", { - get: function () { - return new queryable_1.Queryable(this, "readOnlyField"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "required", { - get: function () { - return new queryable_1.Queryable(this, "required"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "schemaXml", { - get: function () { - return new queryable_1.Queryable(this, "schemaXml"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "scope", { - get: function () { - return new queryable_1.Queryable(this, "scope"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "sealed", { - get: function () { - return new queryable_1.Queryable(this, "sealed"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "sortable", { - get: function () { - return new queryable_1.Queryable(this, "sortable"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "staticName", { - get: function () { - return new queryable_1.Queryable(this, "staticName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "title", { - get: function () { - return new queryable_1.Queryable(this, "title"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "fieldTypeKind", { - get: function () { - return new queryable_1.Queryable(this, "fieldTypeKind"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "typeAsString", { - get: function () { - return new queryable_1.Queryable(this, "typeAsString"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "typeDisplayName", { - get: function () { - return new queryable_1.Queryable(this, "typeDisplayName"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "typeShortDescription", { - get: function () { - return new queryable_1.Queryable(this, "typeShortDescription"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "validationFormula", { - get: function () { - return new queryable_1.Queryable(this, "validationFormula"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Field.prototype, "validationMessage", { - get: function () { - return new queryable_1.Queryable(this, "validationMessage"); - }, - enumerable: true, - configurable: true - }); - Field.prototype.update = function (properties, fieldType) { - var _this = this; - if (fieldType === void 0) { fieldType = "SP.Field"; } - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": fieldType }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - data: data, - field: _this, - }; - }); - }; - Field.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - Field.prototype.setShowInDisplayForm = function (show) { - var q = new Field(this, "setshowindisplayform(" + show + ")"); - return q.post(); - }; - Field.prototype.setShowInEditForm = function (show) { - var q = new Field(this, "setshowineditform(" + show + ")"); - return q.post(); - }; - Field.prototype.setShowInNewForm = function (show) { - var q = new Field(this, "setshowinnewform(" + show + ")"); - return q.post(); - }; - return Field; -}(queryable_1.QueryableInstance)); -exports.Field = Field; - -},{"../../utils/util":41,"./queryable":23,"./types":33}],16:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var items_1 = require("./items"); -var Files = (function (_super) { - __extends(Files, _super); - function Files(baseUrl, path) { - if (path === void 0) { path = "files"; } - _super.call(this, baseUrl, path); - } - Files.prototype.getByName = function (name) { - var f = new File(this); - f.concat("('" + name + "')"); - return f; - }; - Files.prototype.add = function (url, content, shouldOverWrite) { - var _this = this; - if (shouldOverWrite === void 0) { shouldOverWrite = true; } - return new Files(this, "add(overwrite=" + shouldOverWrite + ",url='" + url + "')") - .post({ body: content }).then(function (response) { - return { - data: response, - file: _this.getByName(url), - }; - }); - }; - Files.prototype.addTemplateFile = function (fileUrl, templateFileType) { - var _this = this; - return new Files(this, "addTemplateFile(urloffile='" + fileUrl + "',templatefiletype=" + templateFileType + ")") - .post().then(function (response) { - return { - data: response, - file: _this.getByName(fileUrl), - }; - }); - }; - return Files; -}(queryable_1.QueryableCollection)); -exports.Files = Files; -var File = (function (_super) { - __extends(File, _super); - function File(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(File.prototype, "author", { - get: function () { - return new queryable_1.Queryable(this, "author"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "checkedOutByUser", { - get: function () { - return new queryable_1.Queryable(this, "checkedOutByUser"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "checkInComment", { - get: function () { - return new queryable_1.Queryable(this, "checkInComment"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "checkOutType", { - get: function () { - return new queryable_1.Queryable(this, "checkOutType"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "contentTag", { - get: function () { - return new queryable_1.Queryable(this, "contentTag"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "customizedPageStatus", { - get: function () { - return new queryable_1.Queryable(this, "customizedPageStatus"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "eTag", { - get: function () { - return new queryable_1.Queryable(this, "eTag"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "exists", { - get: function () { - return new queryable_1.Queryable(this, "exists"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "length", { - get: function () { - return new queryable_1.Queryable(this, "length"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "level", { - get: function () { - return new queryable_1.Queryable(this, "level"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "listItemAllFields", { - get: function () { - return new items_1.Item(this, "listItemAllFields"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "lockedByUser", { - get: function () { - return new queryable_1.Queryable(this, "lockedByUser"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "majorVersion", { - get: function () { - return new queryable_1.Queryable(this, "majorVersion"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "minorVersion", { - get: function () { - return new queryable_1.Queryable(this, "minorVersion"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "modifiedBy", { - get: function () { - return new queryable_1.Queryable(this, "modifiedBy"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "name", { - get: function () { - return new queryable_1.Queryable(this, "name"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "serverRelativeUrl", { - get: function () { - return new queryable_1.Queryable(this, "serverRelativeUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "timeCreated", { - get: function () { - return new queryable_1.Queryable(this, "timeCreated"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "timeLastModified", { - get: function () { - return new queryable_1.Queryable(this, "timeLastModified"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "title", { - get: function () { - return new queryable_1.Queryable(this, "title"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "uiVersion", { - get: function () { - return new queryable_1.Queryable(this, "uiVersion"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "uiVersionLabel", { - get: function () { - return new queryable_1.Queryable(this, "uiVersionLabel"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "versions", { - get: function () { - return new Versions(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(File.prototype, "value", { - get: function () { - return new queryable_1.Queryable(this, "$value"); - }, - enumerable: true, - configurable: true - }); - File.prototype.approve = function (comment) { - return new File(this, "approve(comment='" + comment + "')").post(); - }; - File.prototype.cancelUpload = function (uploadId) { - return new File(this, "cancelUpload(uploadId=guid'" + uploadId + "')").post(); - }; - File.prototype.checkin = function (comment, checkinType) { - if (comment === void 0) { comment = ""; } - if (checkinType === void 0) { checkinType = CheckinType.Major; } - return new File(this, "checkin(comment='" + comment + "',checkintype=" + checkinType + ")").post(); - }; - File.prototype.checkout = function () { - return new File(this, "checkout").post(); - }; - File.prototype.continueUpload = function (uploadId, fileOffset, b) { - return new File(this, "continueUpload(uploadId=guid'" + uploadId + "',fileOffset=" + fileOffset + ")").postAs({ body: b }); - }; - File.prototype.copyTo = function (url, shouldOverWrite) { - if (shouldOverWrite === void 0) { shouldOverWrite = true; } - return new File(this, "copyTo(strnewurl='" + url + "',boverwrite=" + shouldOverWrite + ")").post(); - }; - File.prototype.delete = function (eTag) { - if (eTag === void 0) { eTag = "*"; } - return new File(this).post({ - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "DELETE", - }, - }); - }; - File.prototype.deny = function (comment) { - if (comment === void 0) { comment = ""; } - return new File(this, "deny(comment='" + comment + "')").post(); - }; - File.prototype.finishUpload = function (uploadId, fileOffset, fragment) { - return new File(this, "finishUpload(uploadId=guid'" + uploadId + "',fileOffset=" + fileOffset + ")") - .postAs({ body: fragment }).then(function (response) { - return { - data: response, - file: new File(response.ServerRelativeUrl), - }; - }); - }; - File.prototype.getLimitedWebPartManager = function (scope) { - if (scope === void 0) { scope = WebPartsPersonalizationScope.User; } - return new queryable_1.Queryable(this, "getLimitedWebPartManager(scope=" + scope + ")"); - }; - File.prototype.moveTo = function (url, moveOperations) { - if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; } - return new File(this, "moveTo(newurl='" + url + "',flags=" + moveOperations + ")").post(); - }; - File.prototype.openBinaryStream = function () { - return new queryable_1.Queryable(this, "openBinaryStream"); - }; - File.prototype.publish = function (comment) { - if (comment === void 0) { comment = ""; } - return new File(this, "publish(comment='" + comment + "')").post(); - }; - File.prototype.recycle = function () { - return new File(this, "recycle").post(); - }; - File.prototype.saveBinaryStream = function (data) { - return new File(this, "saveBinary").post({ body: data }); - }; - File.prototype.startUpload = function (uploadId, fragment) { - return new File(this, "startUpload(uploadId=guid'" + uploadId + "')").postAs({ body: fragment }); - }; - File.prototype.undoCheckout = function () { - return new File(this, "undoCheckout").post(); - }; - File.prototype.unpublish = function (comment) { - if (comment === void 0) { comment = ""; } - return new File(this, "unpublish(comment='" + comment + "')").post(); - }; - return File; -}(queryable_1.QueryableInstance)); -exports.File = File; -var Versions = (function (_super) { - __extends(Versions, _super); - function Versions(baseUrl, path) { - if (path === void 0) { path = "versions"; } - _super.call(this, baseUrl, path); - } - Versions.prototype.getById = function (versionId) { - var v = new Version(this); - v.concat("(" + versionId + ")"); - return v; - }; - Versions.prototype.deleteAll = function () { - return new Versions(this, "deleteAll").post(); - }; - Versions.prototype.deleteById = function (versionId) { - return new Versions(this, "deleteById(vid=" + versionId + ")").post(); - }; - Versions.prototype.deleteByLabel = function (label) { - return new Versions(this, "deleteByLabel(versionlabel='" + label + "')").post(); - }; - Versions.prototype.restoreByLabel = function (label) { - return new Versions(this, "restoreByLabel(versionlabel='" + label + "')").post(); - }; - return Versions; -}(queryable_1.QueryableCollection)); -exports.Versions = Versions; -var Version = (function (_super) { - __extends(Version, _super); - function Version(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(Version.prototype, "checkInComment", { - get: function () { - return new queryable_1.Queryable(this, "checkInComment"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "created", { - get: function () { - return new queryable_1.Queryable(this, "created"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "createdBy", { - get: function () { - return new queryable_1.Queryable(this, "createdBy"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "id", { - get: function () { - return new queryable_1.Queryable(this, "id"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "isCurrentVersion", { - get: function () { - return new queryable_1.Queryable(this, "isCurrentVersion"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "size", { - get: function () { - return new queryable_1.Queryable(this, "size"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "url", { - get: function () { - return new queryable_1.Queryable(this, "url"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Version.prototype, "versionLabel", { - get: function () { - return new queryable_1.Queryable(this, "versionLabel"); - }, - enumerable: true, - configurable: true - }); - Version.prototype.delete = function (eTag) { - if (eTag === void 0) { eTag = "*"; } - return this.post({ - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "DELETE", - }, - }); - }; - return Version; -}(queryable_1.QueryableInstance)); -exports.Version = Version; -(function (CheckinType) { - CheckinType[CheckinType["Minor"] = 0] = "Minor"; - CheckinType[CheckinType["Major"] = 1] = "Major"; - CheckinType[CheckinType["Overwrite"] = 2] = "Overwrite"; -})(exports.CheckinType || (exports.CheckinType = {})); -var CheckinType = exports.CheckinType; -(function (WebPartsPersonalizationScope) { - WebPartsPersonalizationScope[WebPartsPersonalizationScope["User"] = 0] = "User"; - WebPartsPersonalizationScope[WebPartsPersonalizationScope["Shared"] = 1] = "Shared"; -})(exports.WebPartsPersonalizationScope || (exports.WebPartsPersonalizationScope = {})); -var WebPartsPersonalizationScope = exports.WebPartsPersonalizationScope; -(function (MoveOperations) { - MoveOperations[MoveOperations["Overwrite"] = 1] = "Overwrite"; - MoveOperations[MoveOperations["AllowBrokenThickets"] = 8] = "AllowBrokenThickets"; -})(exports.MoveOperations || (exports.MoveOperations = {})); -var MoveOperations = exports.MoveOperations; -(function (TemplateFileType) { - TemplateFileType[TemplateFileType["StandardPage"] = 0] = "StandardPage"; - TemplateFileType[TemplateFileType["WikiPage"] = 1] = "WikiPage"; - TemplateFileType[TemplateFileType["FormPage"] = 2] = "FormPage"; -})(exports.TemplateFileType || (exports.TemplateFileType = {})); -var TemplateFileType = exports.TemplateFileType; - -},{"./items":19,"./queryable":23}],17:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var files_1 = require("./files"); -var items_1 = require("./items"); -var Folders = (function (_super) { - __extends(Folders, _super); - function Folders(baseUrl, path) { - if (path === void 0) { path = "folders"; } - _super.call(this, baseUrl, path); - } - Folders.prototype.getByName = function (name) { - var f = new Folder(this); - f.concat("('" + name + "')"); - return f; - }; - Folders.prototype.add = function (url) { - var _this = this; - return new Folders(this, "add('" + url + "')").post().then(function (response) { - return { - data: response, - folder: _this.getByName(url), - }; - }); - }; - return Folders; -}(queryable_1.QueryableCollection)); -exports.Folders = Folders; -var Folder = (function (_super) { - __extends(Folder, _super); - function Folder(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(Folder.prototype, "contentTypeOrder", { - get: function () { - return new queryable_1.QueryableCollection(this, "contentTypeOrder"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "files", { - get: function () { - return new files_1.Files(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "folders", { - get: function () { - return new Folders(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "itemCount", { - get: function () { - return new queryable_1.Queryable(this, "itemCount"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "listItemAllFields", { - get: function () { - return new items_1.Item(this, "listItemAllFields"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "name", { - get: function () { - return new queryable_1.Queryable(this, "name"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "parentFolder", { - get: function () { - return new Folder(this, "parentFolder"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "properties", { - get: function () { - return new queryable_1.QueryableInstance(this, "properties"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "serverRelativeUrl", { - get: function () { - return new queryable_1.Queryable(this, "serverRelativeUrl"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "uniqueContentTypeOrder", { - get: function () { - return new queryable_1.QueryableCollection(this, "uniqueContentTypeOrder"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Folder.prototype, "welcomePage", { - get: function () { - return new queryable_1.Queryable(this, "welcomePage"); - }, - enumerable: true, - configurable: true - }); - Folder.prototype.delete = function (eTag) { - if (eTag === void 0) { eTag = "*"; } - return new Folder(this).post({ - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "DELETE", - }, - }); - }; - Folder.prototype.recycle = function () { - return new Folder(this, "recycle").post(); - }; - return Folder; -}(queryable_1.QueryableInstance)); -exports.Folder = Folder; - -},{"./files":16,"./items":19,"./queryable":23}],18:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var Forms = (function (_super) { - __extends(Forms, _super); - function Forms(baseUrl, path) { - if (path === void 0) { path = "forms"; } - _super.call(this, baseUrl, path); - } - Forms.prototype.getById = function (id) { - var i = new Form(this); - i.concat("('" + id + "')"); - return i; - }; - return Forms; -}(queryable_1.QueryableCollection)); -exports.Forms = Forms; -var Form = (function (_super) { - __extends(Form, _super); - function Form(baseUrl, path) { - _super.call(this, baseUrl, path); - } - return Form; -}(queryable_1.QueryableInstance)); -exports.Form = Form; - -},{"./queryable":23}],19:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var queryablesecurable_1 = require("./queryablesecurable"); -var folders_1 = require("./folders"); -var contenttypes_1 = require("./contenttypes"); -var util_1 = require("../../utils/util"); -var odata_1 = require("./odata"); -var Items = (function (_super) { - __extends(Items, _super); - function Items(baseUrl, path) { - if (path === void 0) { path = "items"; } - _super.call(this, baseUrl, path); - } - Items.prototype.getById = function (id) { - var i = new Item(this); - i.concat("(" + id + ")"); - return i; - }; - Items.prototype.skip = function (skip) { - this._query.add("$skiptoken", encodeURIComponent("Paged=TRUE&p_ID=" + skip)); - return this; - }; - Items.prototype.getPaged = function () { - return this.getAs(new PagedItemCollectionParser()); - }; - Items.prototype.add = function (properties) { - var _this = this; - if (properties === void 0) { properties = {}; } - this.addBatchDependency(); - var parentList = this.getParent(queryable_1.QueryableInstance); - return parentList.select("ListItemEntityTypeFullName").getAs().then(function (d) { - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": d.ListItemEntityTypeFullName }, - }, properties)); - var promise = _this.postAs({ body: postBody }).then(function (data) { - return { - data: data, - item: _this.getById(data.Id), - }; - }); - _this.clearBatchDependency(); - return promise; - }); - }; - return Items; -}(queryable_1.QueryableCollection)); -exports.Items = Items; -var PagedItemCollectionParser = (function (_super) { - __extends(PagedItemCollectionParser, _super); - function PagedItemCollectionParser() { - _super.apply(this, arguments); - } - PagedItemCollectionParser.prototype.parse = function (r) { - return PagedItemCollection.fromResponse(r); - }; - return PagedItemCollectionParser; -}(odata_1.ODataParserBase)); -var Item = (function (_super) { - __extends(Item, _super); - function Item(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(Item.prototype, "attachmentFiles", { - get: function () { - return new queryable_1.QueryableCollection(this, "AttachmentFiles"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "contentType", { - get: function () { - return new contenttypes_1.ContentType(this, "ContentType"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "effectiveBasePermissions", { - get: function () { - return new queryable_1.Queryable(this, "EffectiveBasePermissions"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "effectiveBasePermissionsForUI", { - get: function () { - return new queryable_1.Queryable(this, "EffectiveBasePermissionsForUI"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "fieldValuesAsHTML", { - get: function () { - return new queryable_1.QueryableInstance(this, "FieldValuesAsHTML"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "fieldValuesAsText", { - get: function () { - return new queryable_1.QueryableInstance(this, "FieldValuesAsText"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "fieldValuesForEdit", { - get: function () { - return new queryable_1.QueryableInstance(this, "FieldValuesForEdit"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Item.prototype, "folder", { - get: function () { - return new folders_1.Folder(this, "Folder"); - }, - enumerable: true, - configurable: true - }); - Item.prototype.update = function (properties, eTag) { - var _this = this; - if (eTag === void 0) { eTag = "*"; } - this.addBatchDependency(); - var parentList = this.getParent(queryable_1.QueryableInstance, this.parentUrl.substr(0, this.parentUrl.lastIndexOf("/"))); - return parentList.select("ListItemEntityTypeFullName").getAs().then(function (d) { - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": d.ListItemEntityTypeFullName }, - }, properties)); - var promise = _this.post({ - body: postBody, - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - data: data, - item: _this, - }; - }); - _this.clearBatchDependency(); - return promise; - }); - }; - Item.prototype.delete = function (eTag) { - if (eTag === void 0) { eTag = "*"; } - return this.post({ - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "DELETE", - }, - }); - }; - Item.prototype.recycle = function () { - var i = new Item(this, "recycle"); - return i.post(); - }; - Item.prototype.getWopiFrameUrl = function (action) { - if (action === void 0) { action = 0; } - var i = new Item(this, "getWOPIFrameUrl(@action)"); - i._query.add("@action", action); - return i.post().then(function (data) { - return data.GetWOPIFrameUrl; - }); - }; - Item.prototype.validateUpdateListItem = function (formValues, newDocumentUpdate) { - if (newDocumentUpdate === void 0) { newDocumentUpdate = false; } - var postBody = JSON.stringify({ "formValues": formValues, bNewDocumentUpdate: newDocumentUpdate }); - var item = new Item(this, "validateupdatelistitem"); - return item.post({ body: postBody }); - }; - return Item; -}(queryablesecurable_1.QueryableSecurable)); -exports.Item = Item; -var PagedItemCollection = (function () { - function PagedItemCollection() { - } - Object.defineProperty(PagedItemCollection.prototype, "hasNext", { - get: function () { - return typeof this.nextUrl === "string" && this.nextUrl.length > 0; - }, - enumerable: true, - configurable: true - }); - PagedItemCollection.fromResponse = function (r) { - return r.json().then(function (d) { - var col = new PagedItemCollection(); - col.nextUrl = d["odata.nextLink"]; - col.results = d.value; - return col; - }); - }; - PagedItemCollection.prototype.getNext = function () { - if (this.hasNext) { - var items = new Items(this.nextUrl, null); - return items.getPaged(); - } - return new Promise(function (r) { return r(null); }); - }; - return PagedItemCollection; -}()); -exports.PagedItemCollection = PagedItemCollection; - -},{"../../utils/util":41,"./contenttypes":14,"./folders":17,"./odata":22,"./queryable":23,"./queryablesecurable":24}],20:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var items_1 = require("./items"); -var views_1 = require("./views"); -var contenttypes_1 = require("./contenttypes"); -var fields_1 = require("./fields"); -var forms_1 = require("./forms"); -var queryable_1 = require("./queryable"); -var queryablesecurable_1 = require("./queryablesecurable"); -var util_1 = require("../../utils/util"); -var usercustomactions_1 = require("./usercustomactions"); -var odata_1 = require("./odata"); -var Lists = (function (_super) { - __extends(Lists, _super); - function Lists(baseUrl, path) { - if (path === void 0) { path = "lists"; } - _super.call(this, baseUrl, path); - } - Lists.prototype.getByTitle = function (title) { - return new List(this, "getByTitle('" + title + "')"); - }; - Lists.prototype.getById = function (id) { - var list = new List(this); - list.concat("('" + id + "')"); - return list; - }; - 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 postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.List" }, - "AllowContentTypes": enableContentTypes, - "BaseTemplate": template, - "ContentTypesEnabled": enableContentTypes, - "Description": description, - "Title": title, - }, additionalSettings)); - return this.post({ body: postBody }).then(function (data) { - return { data: data, list: _this.getByTitle(title) }; - }); - }; - 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 new Error("The ensure method is not supported as part of a batch."); - } - return new Promise(function (resolve, reject) { - var list = _this.getByTitle(title); - list.get().then(function (d) { return resolve({ created: false, data: d, list: list }); }).catch(function () { - _this.add(title, description, template, enableContentTypes, additionalSettings).then(function (r) { - resolve({ created: true, data: r.data, list: _this.getByTitle(title) }); - }); - }).catch(function (e) { return reject(e); }); - }); - }; - Lists.prototype.ensureSiteAssetsLibrary = function () { - var q = new Lists(this, "ensuresiteassetslibrary"); - return q.post().then(function (json) { - return new List(odata_1.extractOdataId(json)); - }); - }; - Lists.prototype.ensureSitePagesLibrary = function () { - var q = new Lists(this, "ensuresitepageslibrary"); - return q.post().then(function (json) { - return new List(odata_1.extractOdataId(json)); - }); - }; - return Lists; -}(queryable_1.QueryableCollection)); -exports.Lists = Lists; -var List = (function (_super) { - __extends(List, _super); - function List(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(List.prototype, "contentTypes", { - get: function () { - return new contenttypes_1.ContentTypes(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "items", { - get: function () { - return new items_1.Items(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "views", { - get: function () { - return new views_1.Views(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "fields", { - get: function () { - return new fields_1.Fields(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "forms", { - get: function () { - return new forms_1.Forms(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "defaultView", { - get: function () { - return new queryable_1.QueryableInstance(this, "DefaultView"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "userCustomActions", { - get: function () { - return new usercustomactions_1.UserCustomActions(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "effectiveBasePermissions", { - get: function () { - return new queryable_1.Queryable(this, "EffectiveBasePermissions"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "eventReceivers", { - get: function () { - return new queryable_1.QueryableCollection(this, "EventReceivers"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "relatedFields", { - get: function () { - return new queryable_1.Queryable(this, "getRelatedFields"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(List.prototype, "informationRightsManagementSettings", { - get: function () { - return new queryable_1.Queryable(this, "InformationRightsManagementSettings"); - }, - enumerable: true, - configurable: true - }); - List.prototype.getView = function (viewId) { - return new views_1.View(this, "getView('" + viewId + "')"); - }; - List.prototype.update = function (properties, eTag) { - var _this = this; - if (eTag === void 0) { eTag = "*"; } - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.List" }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - var retList = _this; - if (properties.hasOwnProperty("Title")) { - retList = _this.getParent(List, _this.parentUrl, "getByTitle('" + properties["Title"] + "')"); - } - return { - data: data, - list: retList, - }; - }); - }; - List.prototype.delete = function (eTag) { - if (eTag === void 0) { eTag = "*"; } - return this.post({ - headers: { - "IF-Match": eTag, - "X-HTTP-Method": "DELETE", - }, - }); - }; - List.prototype.getChanges = function (query) { - var postBody = JSON.stringify({ "query": util_1.Util.extend({ "__metadata": { "type": "SP.ChangeQuery" } }, query) }); - var q = new List(this, "getchanges"); - return q.post({ body: postBody }); - }; - List.prototype.getItemsByCAMLQuery = function (query) { - var expands = []; - for (var _i = 1; _i < arguments.length; _i++) { - expands[_i - 1] = arguments[_i]; - } - var postBody = JSON.stringify({ "query": util_1.Util.extend({ "__metadata": { "type": "SP.CamlQuery" } }, query) }); - var q = new List(this, "getitems"); - q = q.expand.apply(q, expands); - return q.post({ body: postBody }); - }; - List.prototype.getListItemChangesSinceToken = function (query) { - var postBody = JSON.stringify({ "query": util_1.Util.extend({ "__metadata": { "type": "SP.ChangeLogItemQuery" } }, query) }); - var q = new List(this, "getlistitemchangessincetoken"); - return q.post({ body: postBody }, { parse: function (r) { return r.text(); } }); - }; - List.prototype.recycle = function () { - this.append("recycle"); - return this.post().then(function (data) { - if (data.hasOwnProperty("Recycle")) { - return data.Recycle; - } - else { - return data; - } - }); - }; - List.prototype.renderListData = function (viewXml) { - var q = new List(this, "renderlistdata(@viewXml)"); - q.query.add("@viewXml", "'" + viewXml + "'"); - return q.post().then(function (data) { - data = JSON.parse(data); - if (data.hasOwnProperty("RenderListData")) { - return data.RenderListData; - } - else { - return data; - } - }); - }; - List.prototype.renderListFormData = function (itemId, formId, mode) { - var q = new List(this, "renderlistformdata(itemid=" + itemId + ", formid='" + formId + "', mode=" + mode + ")"); - return q.post().then(function (data) { - data = JSON.parse(data); - if (data.hasOwnProperty("ListData")) { - return data.ListData; - } - else { - return data; - } - }); - }; - List.prototype.reserveListItemId = function () { - var q = new List(this, "reservelistitemid"); - return q.post().then(function (data) { - if (data.hasOwnProperty("ReserveListItemId")) { - return data.ReserveListItemId; - } - else { - return data; - } - }); - }; - return List; -}(queryablesecurable_1.QueryableSecurable)); -exports.List = List; - -},{"../../utils/util":41,"./contenttypes":14,"./fields":15,"./forms":18,"./items":19,"./odata":22,"./queryable":23,"./queryablesecurable":24,"./usercustomactions":34,"./views":36}],21:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var quicklaunch_1 = require("./quicklaunch"); -var topnavigationbar_1 = require("./topnavigationbar"); -var Navigation = (function (_super) { - __extends(Navigation, _super); - function Navigation(baseUrl) { - _super.call(this, baseUrl, "navigation"); - } - Object.defineProperty(Navigation.prototype, "quicklaunch", { - get: function () { - return new quicklaunch_1.QuickLaunch(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Navigation.prototype, "topNavigationBar", { - get: function () { - return new topnavigationbar_1.TopNavigationBar(this); - }, - enumerable: true, - configurable: true - }); - return Navigation; -}(queryable_1.Queryable)); -exports.Navigation = Navigation; - -},{"./queryable":23,"./quicklaunch":25,"./topnavigationbar":32}],22:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../../utils/util"); -var logging_1 = require("../../utils/logging"); -var httpclient_1 = require("../../net/httpclient"); -var pnplibconfig_1 = require("../../configuration/pnplibconfig"); -function extractOdataId(candidate) { - if (candidate.hasOwnProperty("odata.id")) { - return candidate["odata.id"]; - } - else if (candidate.hasOwnProperty("__metadata") && candidate.__metadata.hasOwnProperty("id")) { - return candidate.__metadata.id; - } - else { - logging_1.Logger.log({ - data: candidate, - level: logging_1.Logger.LogLevel.Error, - message: "Could not extract odata id in object, you may be using nometadata. Object data logged to logger.", - }); - throw new Error("Could not extract odata id in object, you may be using nometadata. Object data logged to logger."); - } -} -exports.extractOdataId = extractOdataId; -var ODataParserBase = (function () { - function ODataParserBase() { - } - ODataParserBase.prototype.parse = function (r) { - return r.json().then(function (json) { - var result = json; - if (json.hasOwnProperty("d")) { - if (json.d.hasOwnProperty("results")) { - result = json.d.results; - } - else { - result = json.d; - } - } - else if (json.hasOwnProperty("value")) { - result = json.value; - } - return result; - }); - }; - return ODataParserBase; -}()); -exports.ODataParserBase = ODataParserBase; -var ODataDefaultParser = (function (_super) { - __extends(ODataDefaultParser, _super); - function ODataDefaultParser() { - _super.apply(this, arguments); - } - return ODataDefaultParser; -}(ODataParserBase)); -exports.ODataDefaultParser = ODataDefaultParser; -var ODataRawParserImpl = (function () { - function ODataRawParserImpl() { - } - ODataRawParserImpl.prototype.parse = function (r) { - return r.json(); - }; - return ODataRawParserImpl; -}()); -exports.ODataRawParserImpl = ODataRawParserImpl; -var ODataValueParserImpl = (function (_super) { - __extends(ODataValueParserImpl, _super); - function ODataValueParserImpl() { - _super.apply(this, arguments); - } - ODataValueParserImpl.prototype.parse = function (r) { - return _super.prototype.parse.call(this, r).then(function (d) { return d; }); - }; - return ODataValueParserImpl; -}(ODataParserBase)); -var ODataEntityParserImpl = (function (_super) { - __extends(ODataEntityParserImpl, _super); - function ODataEntityParserImpl(factory) { - _super.call(this); - this.factory = factory; - } - ODataEntityParserImpl.prototype.parse = function (r) { - var _this = this; - return _super.prototype.parse.call(this, r).then(function (d) { - var o = new _this.factory(getEntityUrl(d), null); - return util_1.Util.extend(o, d); - }); - }; - return ODataEntityParserImpl; -}(ODataParserBase)); -var ODataEntityArrayParserImpl = (function (_super) { - __extends(ODataEntityArrayParserImpl, _super); - function ODataEntityArrayParserImpl(factory) { - _super.call(this); - this.factory = factory; - } - ODataEntityArrayParserImpl.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(getEntityUrl(v), null); - return util_1.Util.extend(o, v); - }); - }); - }; - return ODataEntityArrayParserImpl; -}(ODataParserBase)); -function getEntityUrl(entity) { - if (entity.hasOwnProperty("__metadata")) { - return entity.__metadata.uri; - } - else if (entity.hasOwnProperty("odata.editLink")) { - return util_1.Util.combinePaths("_api", entity["odata.editLink"]); - } - else { - logging_1.Logger.write("No uri information found in ODataEntity parsing, chaining will fail for this object.", logging_1.Logger.LogLevel.Warning); - return ""; - } -} -exports.ODataRaw = new ODataRawParserImpl(); -function ODataValue() { - return new ODataValueParserImpl(); -} -exports.ODataValue = ODataValue; -function ODataEntity(factory) { - return new ODataEntityParserImpl(factory); -} -exports.ODataEntity = ODataEntity; -function ODataEntityArray(factory) { - return new ODataEntityArrayParserImpl(factory); -} -exports.ODataEntityArray = ODataEntityArray; -var ODataBatch = (function () { - function ODataBatch(_batchId) { - if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); } - this._batchId = _batchId; - this._requests = []; - this._batchDepCount = 0; - } - ODataBatch.prototype.add = function (url, method, options, parser) { - var info = { - 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._requests.push(info); - return p; - }; - ODataBatch.prototype.incrementBatchDep = function () { - this._batchDepCount++; - }; - ODataBatch.prototype.decrementBatchDep = function () { - this._batchDepCount--; - }; - ODataBatch.prototype.execute = function () { - var _this = this; - return new Promise(function (resolve, reject) { - if (_this._batchDepCount > 0) { - setTimeout(function () { return _this.execute(); }, 100); - } - else { - _this.executeImpl().then(function () { return resolve(); }).catch(reject); - } - }); - }; - ODataBatch.prototype.executeImpl = function () { - var _this = this; - if (this._requests.length < 1) { - return new Promise(function (r) { return r(); }); - } - var batchBody = []; - var currentChangeSetId = ""; - this._requests.forEach(function (reqInfo, index) { - if (reqInfo.method === "GET") { - if (currentChangeSetId.length > 0) { - batchBody.push("--changeset_" + currentChangeSetId + "--\n\n"); - currentChangeSetId = ""; - } - batchBody.push("--batch_" + _this._batchId + "\n"); - } - else { - if (currentChangeSetId.length < 1) { - currentChangeSetId = util_1.Util.getGUID(); - batchBody.push("--batch_" + _this._batchId + "\n"); - batchBody.push("Content-Type: multipart/mixed; boundary=\"changeset_" + currentChangeSetId + "\"\n\n"); - } - batchBody.push("--changeset_" + currentChangeSetId + "\n"); - } - batchBody.push("Content-Type: application/http\n"); - batchBody.push("Content-Transfer-Encoding: binary\n\n"); - var headers = { - "Accept": "application/json;", - }; - if (reqInfo.method !== "GET") { - var method = reqInfo.method; - if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers["X-HTTP-Method"] !== typeof undefined) { - method = reqInfo.options.headers["X-HTTP-Method"]; - delete reqInfo.options.headers["X-HTTP-Method"]; - } - batchBody.push(method + " " + reqInfo.url + " HTTP/1.1\n"); - headers = util_1.Util.extend(headers, { "Content-Type": "application/json;odata=verbose;charset=utf-8" }); - } - else { - batchBody.push(reqInfo.method + " " + reqInfo.url + " HTTP/1.1\n"); - } - if (typeof pnplibconfig_1.RuntimeConfig.headers !== "undefined") { - headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers); - } - if (reqInfo.options && reqInfo.options.headers) { - headers = util_1.Util.extend(headers, reqInfo.options.headers); - } - for (var name_1 in headers) { - if (headers.hasOwnProperty(name_1)) { - batchBody.push(name_1 + ": " + headers[name_1] + "\n"); - } - } - batchBody.push("\n"); - if (reqInfo.options.body) { - batchBody.push(reqInfo.options.body + "\n\n"); - } - }); - if (currentChangeSetId.length > 0) { - batchBody.push("--changeset_" + currentChangeSetId + "--\n\n"); - currentChangeSetId = ""; - } - batchBody.push("--batch_" + this._batchId + "--\n"); - var batchHeaders = { - "Content-Type": "multipart/mixed; boundary=batch_" + this._batchId, - }; - var batchOptions = { - "body": batchBody.join(""), - "headers": batchHeaders, - }; - var client = new httpclient_1.HttpClient(); - return client.post(util_1.Util.makeUrlAbsolute("/_api/$batch"), batchOptions) - .then(function (r) { return r.text(); }) - .then(this._parseResponse) - .then(function (responses) { - if (responses.length !== _this._requests.length) { - throw new Error("Could not properly parse responses to match requests in batch."); - } - var resolutions = []; - for (var i = 0; i < responses.length; i++) { - var request = _this._requests[i]; - var response = responses[i]; - if (!response.ok) { - request.reject(new Error(response.statusText)); - } - resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject)); - } - return Promise.all(resolutions); - }); - }; - ODataBatch.prototype._parseResponse = function (body) { - return new Promise(function (resolve, reject) { - var responses = []; - var header = "--batchresponse_"; - 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 new 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 new 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": - var response = void 0; - if (status === 204) { - response = new Response(); - } - else { - response = new Response(line, { status: status, statusText: statusText }); - } - responses.push(response); - state = "batch"; - break; - } - } - if (state !== "status") { - reject(new Error("Unexpected end of input")); - } - resolve(responses); - }); - }; - return ODataBatch; -}()); -exports.ODataBatch = ODataBatch; - -},{"../../configuration/pnplibconfig":3,"../../net/httpclient":9,"../../utils/logging":39,"../../utils/util":41}],23:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var util_1 = require("../../utils/util"); -var collections_1 = require("../../collections/collections"); -var httpclient_1 = require("../../net/httpclient"); -var odata_1 = require("./odata"); -var caching_1 = require("./caching"); -var pnplibconfig_1 = require("../../configuration/pnplibconfig"); -var Queryable = (function () { - function Queryable(baseUrl, path) { - this._query = new collections_1.Dictionary(); - this._batch = null; - if (typeof baseUrl === "string") { - var urlStr = baseUrl; - if (urlStr.lastIndexOf("/") < 0) { - this._parentUrl = urlStr; - this._url = util_1.Util.combinePaths(urlStr, path); - } - else if (urlStr.lastIndexOf("/") > urlStr.lastIndexOf("(")) { - var index = urlStr.lastIndexOf("/"); - this._parentUrl = urlStr.slice(0, index); - path = util_1.Util.combinePaths(urlStr.slice(index), path); - this._url = util_1.Util.combinePaths(this._parentUrl, path); - } - else { - var index = urlStr.lastIndexOf("("); - this._parentUrl = urlStr.slice(0, index); - this._url = util_1.Util.combinePaths(urlStr, path); - } - } - else { - var q = baseUrl; - this._parentUrl = q._url; - if (!this.hasBatch && q.hasBatch) { - this._batch = q._batch; - } - var target = q._query.get("@target"); - if (target !== null) { - this._query.add("@target", target); - } - this._url = util_1.Util.combinePaths(this._parentUrl, path); - } - } - Queryable.prototype.concat = function (pathPart) { - this._url += pathPart; - }; - Queryable.prototype.append = function (pathPart) { - this._url = util_1.Util.combinePaths(this._url, pathPart); - }; - Queryable.prototype.addBatchDependency = function () { - if (this._batch !== null) { - this._batch.incrementBatchDep(); - } - }; - Queryable.prototype.clearBatchDependency = function () { - if (this._batch !== null) { - this._batch.decrementBatchDep(); - } - }; - Object.defineProperty(Queryable.prototype, "hasBatch", { - get: function () { - return this._batch !== null; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Queryable.prototype, "parentUrl", { - get: function () { - return this._parentUrl; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Queryable.prototype, "query", { - get: function () { - return this._query; - }, - enumerable: true, - configurable: true - }); - Queryable.prototype.inBatch = function (batch) { - if (this._batch !== null) { - throw new Error("This query is already part of a batch."); - } - this._batch = batch; - return this; - }; - Queryable.prototype.usingCaching = function (options) { - if (!pnplibconfig_1.RuntimeConfig.globalCacheDisable) { - this._useCaching = true; - this._cachingOptions = options; - } - return this; - }; - Queryable.prototype.toUrl = function () { - return util_1.Util.makeUrlAbsolute(this._url); - }; - Queryable.prototype.toUrlAndQuery = function () { - var _this = this; - var url = this.toUrl(); - if (this._query.count() > 0) { - url += "?"; - var keys = this._query.getKeys(); - url += keys.map(function (key, ix, arr) { return (key + "=" + _this._query.get(key)); }).join("&"); - } - return url; - }; - Queryable.prototype.get = function (parser, getOptions) { - if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); } - if (getOptions === void 0) { getOptions = {}; } - return this.getImpl(getOptions, parser); - }; - Queryable.prototype.getAs = function (parser, getOptions) { - if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); } - if (getOptions === void 0) { getOptions = {}; } - return this.getImpl(getOptions, parser); - }; - Queryable.prototype.post = function (postOptions, parser) { - if (postOptions === void 0) { postOptions = {}; } - if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); } - return this.postImpl(postOptions, parser); - }; - Queryable.prototype.postAs = function (postOptions, parser) { - if (postOptions === void 0) { postOptions = {}; } - if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); } - return this.postImpl(postOptions, parser); - }; - Queryable.prototype.getParent = function (factory, baseUrl, path) { - if (baseUrl === void 0) { baseUrl = this.parentUrl; } - var parent = new factory(baseUrl, path); - var target = this.query.get("@target"); - if (target !== null) { - parent.query.add("@target", target); - } - return parent; - }; - Queryable.prototype.getImpl = function (getOptions, parser) { - if (getOptions === void 0) { getOptions = {}; } - if (this._useCaching) { - var options = new caching_1.CachingOptions(this.toUrlAndQuery().toLowerCase()); - if (typeof this._cachingOptions !== "undefined") { - options = util_1.Util.extend(options, this._cachingOptions); - } - if (options.store !== null) { - var data_1 = options.store.get(options.key); - if (data_1 !== null) { - return new Promise(function (resolve) { return resolve(data_1); }); - } - } - parser = new caching_1.CachingParserWrapper(parser, options); - } - if (this._batch === null) { - var client = new httpclient_1.HttpClient(); - return client.get(this.toUrlAndQuery(), getOptions).then(function (response) { - if (!response.ok) { - throw "Error making GET request: " + response.statusText; - } - return parser.parse(response); - }); - } - else { - return this._batch.add(this.toUrlAndQuery(), "GET", {}, parser); - } - }; - Queryable.prototype.postImpl = function (postOptions, parser) { - if (this._batch === null) { - var client = new httpclient_1.HttpClient(); - return client.post(this.toUrlAndQuery(), postOptions).then(function (response) { - if (!response.ok) { - throw "Error making POST request: " + response.statusText; - } - if ((response.headers.has("Content-Length") && parseFloat(response.headers.get("Content-Length")) === 0) - || response.status === 204) { - return new Promise(function (resolve, reject) { resolve({}); }); - } - return parser.parse(response); - }); - } - else { - return this._batch.add(this.toUrlAndQuery(), "POST", postOptions, parser); - } - }; - return Queryable; -}()); -exports.Queryable = Queryable; -var QueryableCollection = (function (_super) { - __extends(QueryableCollection, _super); - function QueryableCollection() { - _super.apply(this, arguments); - } - QueryableCollection.prototype.filter = function (filter) { - this._query.add("$filter", filter); - return this; - }; - QueryableCollection.prototype.select = function () { - var selects = []; - for (var _i = 0; _i < arguments.length; _i++) { - selects[_i - 0] = arguments[_i]; - } - this._query.add("$select", selects.join(",")); - return this; - }; - QueryableCollection.prototype.expand = function () { - var expands = []; - for (var _i = 0; _i < arguments.length; _i++) { - expands[_i - 0] = arguments[_i]; - } - this._query.add("$expand", expands.join(",")); - return this; - }; - QueryableCollection.prototype.orderBy = function (orderBy, ascending) { - if (ascending === void 0) { ascending = false; } - var keys = this._query.getKeys(); - var query = []; - var asc = ascending ? " asc" : ""; - for (var i = 0; i < keys.length; i++) { - if (keys[i] === "$orderby") { - query.push(this._query.get("$orderby")); - break; - } - } - query.push("" + orderBy + asc); - this._query.add("$orderby", query.join(",")); - return this; - }; - QueryableCollection.prototype.skip = function (skip) { - this._query.add("$skip", skip.toString()); - return this; - }; - QueryableCollection.prototype.top = function (top) { - this._query.add("$top", top.toString()); - return this; - }; - return QueryableCollection; -}(Queryable)); -exports.QueryableCollection = QueryableCollection; -var QueryableInstance = (function (_super) { - __extends(QueryableInstance, _super); - function QueryableInstance() { - _super.apply(this, arguments); - } - QueryableInstance.prototype.select = function () { - var selects = []; - for (var _i = 0; _i < arguments.length; _i++) { - selects[_i - 0] = arguments[_i]; - } - this._query.add("$select", selects.join(",")); - return this; - }; - QueryableInstance.prototype.expand = function () { - var expands = []; - for (var _i = 0; _i < arguments.length; _i++) { - expands[_i - 0] = arguments[_i]; - } - this._query.add("$expand", expands.join(",")); - return this; - }; - return QueryableInstance; -}(Queryable)); -exports.QueryableInstance = QueryableInstance; - -},{"../../collections/collections":1,"../../configuration/pnplibconfig":3,"../../net/httpclient":9,"../../utils/util":41,"./caching":13,"./odata":22}],24:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var roles_1 = require("./roles"); -var queryable_1 = require("./queryable"); -var QueryableSecurable = (function (_super) { - __extends(QueryableSecurable, _super); - function QueryableSecurable() { - _super.apply(this, arguments); - } - Object.defineProperty(QueryableSecurable.prototype, "roleAssignments", { - get: function () { - return new roles_1.RoleAssignments(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(QueryableSecurable.prototype, "firstUniqueAncestorSecurableObject", { - get: function () { - this.append("FirstUniqueAncestorSecurableObject"); - return new queryable_1.QueryableInstance(this); - }, - enumerable: true, - configurable: true - }); - QueryableSecurable.prototype.getUserEffectivePermissions = function (loginName) { - this.append("getUserEffectivePermissions(@user)"); - this._query.add("@user", "'" + encodeURIComponent(loginName) + "'"); - return new queryable_1.Queryable(this); - }; - QueryableSecurable.prototype.breakRoleInheritance = function (copyRoleAssignments, clearSubscopes) { - if (copyRoleAssignments === void 0) { copyRoleAssignments = false; } - if (clearSubscopes === void 0) { clearSubscopes = false; } - var Breaker = (function (_super) { - __extends(Breaker, _super); - function Breaker(baseUrl, copy, clear) { - _super.call(this, baseUrl, "breakroleinheritance(copyroleassignments=" + copy + ", clearsubscopes=" + clear + ")"); - } - Breaker.prototype.break = function () { - return this.post(); - }; - return Breaker; - }(queryable_1.Queryable)); - var b = new Breaker(this, copyRoleAssignments, clearSubscopes); - return b.break(); - }; - QueryableSecurable.prototype.resetRoleInheritance = function () { - var Resetter = (function (_super) { - __extends(Resetter, _super); - function Resetter(baseUrl) { - _super.call(this, baseUrl, "resetroleinheritance"); - } - Resetter.prototype.reset = function () { - return this.post(); - }; - return Resetter; - }(queryable_1.Queryable)); - var r = new Resetter(this); - return r.reset(); - }; - return QueryableSecurable; -}(queryable_1.QueryableInstance)); -exports.QueryableSecurable = QueryableSecurable; - -},{"./queryable":23,"./roles":27}],25:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var QuickLaunch = (function (_super) { - __extends(QuickLaunch, _super); - function QuickLaunch(baseUrl) { - _super.call(this, baseUrl, "QuickLaunch"); - } - return QuickLaunch; -}(queryable_1.Queryable)); -exports.QuickLaunch = QuickLaunch; - -},{"./queryable":23}],26:[function(require,module,exports){ -"use strict"; -var search_1 = require("./search"); -var site_1 = require("./site"); -var webs_1 = require("./webs"); -var util_1 = require("../../utils/util"); -var userprofiles_1 = require("./userprofiles"); -var odata_1 = require("./odata"); -var Rest = (function () { - function Rest() { - } - Rest.prototype.search = function (query) { - var finalQuery; - if (typeof query === "string") { - finalQuery = { Querytext: query }; - } - else { - finalQuery = query; - } - return new search_1.Search("").execute(finalQuery); - }; - Object.defineProperty(Rest.prototype, "site", { - get: function () { - return new site_1.Site(""); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rest.prototype, "web", { - get: function () { - return new webs_1.Web(""); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Rest.prototype, "profiles", { - get: function () { - return new userprofiles_1.UserProfileQuery(""); - }, - enumerable: true, - configurable: true - }); - Rest.prototype.createBatch = function () { - return new odata_1.ODataBatch(); - }; - Rest.prototype.crossDomainSite = function (addInWebUrl, hostWebUrl) { - return this._cdImpl(site_1.Site, addInWebUrl, hostWebUrl, "site"); - }; - Rest.prototype.crossDomainWeb = function (addInWebUrl, hostWebUrl) { - return this._cdImpl(webs_1.Web, addInWebUrl, hostWebUrl, "web"); - }; - Rest.prototype._cdImpl = function (factory, addInWebUrl, hostWebUrl, urlPart) { - if (!util_1.Util.isUrlAbsolute(addInWebUrl)) { - throw "The addInWebUrl parameter must be an absolute url."; - } - if (!util_1.Util.isUrlAbsolute(hostWebUrl)) { - throw "The hostWebUrl parameter must be an absolute url."; - } - var url = util_1.Util.combinePaths(addInWebUrl, "_api/SP.AppContextSite(@target)"); - var instance = new factory(url, urlPart); - instance.query.add("@target", "'" + encodeURIComponent(hostWebUrl) + "'"); - return instance; - }; - return Rest; -}()); -exports.Rest = Rest; - -},{"../../utils/util":41,"./odata":22,"./search":28,"./site":29,"./userprofiles":35,"./webs":37}],27:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var sitegroups_1 = require("./sitegroups"); -var util_1 = require("../../utils/util"); -var RoleAssignments = (function (_super) { - __extends(RoleAssignments, _super); - function RoleAssignments(baseUrl, path) { - if (path === void 0) { path = "roleassignments"; } - _super.call(this, baseUrl, path); - } - RoleAssignments.prototype.add = function (principalId, roleDefId) { - var a = new RoleAssignments(this, "addroleassignment(principalid=" + principalId + ", roledefid=" + roleDefId + ")"); - return a.post(); - }; - RoleAssignments.prototype.remove = function (principalId, roleDefId) { - var a = new RoleAssignments(this, "removeroleassignment(principalid=" + principalId + ", roledefid=" + roleDefId + ")"); - return a.post(); - }; - RoleAssignments.prototype.getById = function (id) { - var ra = new RoleAssignment(this); - ra.concat("(" + id + ")"); - return ra; - }; - return RoleAssignments; -}(queryable_1.QueryableCollection)); -exports.RoleAssignments = RoleAssignments; -var RoleAssignment = (function (_super) { - __extends(RoleAssignment, _super); - function RoleAssignment(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(RoleAssignment.prototype, "groups", { - get: function () { - return new sitegroups_1.SiteGroups(this, "groups"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(RoleAssignment.prototype, "bindings", { - get: function () { - return new RoleDefinitionBindings(this); - }, - enumerable: true, - configurable: true - }); - RoleAssignment.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - return RoleAssignment; -}(queryable_1.QueryableInstance)); -exports.RoleAssignment = RoleAssignment; -var RoleDefinitions = (function (_super) { - __extends(RoleDefinitions, _super); - function RoleDefinitions(baseUrl, path) { - if (path === void 0) { path = "roledefinitions"; } - _super.call(this, baseUrl, path); - } - RoleDefinitions.prototype.getById = function (id) { - return new RoleDefinition(this, "getById(" + id + ")"); - }; - RoleDefinitions.prototype.getByName = function (name) { - return new RoleDefinition(this, "getbyname('" + name + "')"); - }; - RoleDefinitions.prototype.getByType = function (roleTypeKind) { - return new RoleDefinition(this, "getbytype(" + roleTypeKind + ")"); - }; - RoleDefinitions.prototype.add = function (name, description, order, basePermissions) { - var _this = this; - var postBody = JSON.stringify({ - BasePermissions: util_1.Util.extend({ __metadata: { type: "SP.BasePermissions" } }, basePermissions), - Description: description, - Name: name, - Order: order, - __metadata: { "type": "SP.RoleDefinition" }, - }); - return this.post({ body: postBody }).then(function (data) { - return { - data: data, - definition: _this.getById(data.Id), - }; - }); - }; - return RoleDefinitions; -}(queryable_1.QueryableCollection)); -exports.RoleDefinitions = RoleDefinitions; -var RoleDefinition = (function (_super) { - __extends(RoleDefinition, _super); - function RoleDefinition(baseUrl, path) { - _super.call(this, baseUrl, path); - } - RoleDefinition.prototype.update = function (properties) { - var _this = this; - if (typeof properties.hasOwnProperty("BasePermissions")) { - properties["BasePermissions"] = util_1.Util.extend({ __metadata: { type: "SP.BasePermissions" } }, properties["BasePermissions"]); - } - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.RoleDefinition" }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - var retDef = _this; - if (properties.hasOwnProperty("Name")) { - var parent_1 = _this.getParent(RoleDefinitions, _this.parentUrl, ""); - retDef = parent_1.getByName(properties["Name"]); - } - return { - data: data, - definition: retDef, - }; - }); - }; - RoleDefinition.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - return RoleDefinition; -}(queryable_1.QueryableInstance)); -exports.RoleDefinition = RoleDefinition; -var RoleDefinitionBindings = (function (_super) { - __extends(RoleDefinitionBindings, _super); - function RoleDefinitionBindings(baseUrl, path) { - if (path === void 0) { path = "roledefinitionbindings"; } - _super.call(this, baseUrl, path); - } - return RoleDefinitionBindings; -}(queryable_1.QueryableCollection)); -exports.RoleDefinitionBindings = RoleDefinitionBindings; - -},{"../../utils/util":41,"./queryable":23,"./sitegroups":30}],28:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var Search = (function (_super) { - __extends(Search, _super); - function Search(baseUrl, path) { - if (path === void 0) { path = "_api/search/postquery"; } - _super.call(this, baseUrl, path); - } - Search.prototype.execute = function (query) { - var formattedBody; - formattedBody = query; - if (formattedBody.SelectProperties) { - formattedBody.SelectProperties = { results: query.SelectProperties }; - } - if (formattedBody.RefinementFilters) { - formattedBody.RefinementFilters = { results: query.RefinementFilters }; - } - if (formattedBody.Refiners) { - formattedBody.Refiners = { results: query.Refiners }; - } - if (formattedBody.SortList) { - formattedBody.SortList = { results: query.SortList }; - } - if (formattedBody.HithighlightedProperties) { - formattedBody.HithighlightedProperties = { results: query.HithighlightedProperties }; - } - if (formattedBody.ReorderingRules) { - formattedBody.ReorderingRules = { results: query.ReorderingRules }; - } - var postBody = JSON.stringify({ request: formattedBody }); - return this.post({ body: postBody }).then(function (data) { - return new SearchResults(data); - }); - }; - return Search; -}(queryable_1.QueryableInstance)); -exports.Search = Search; -var SearchResults = (function () { - function SearchResults(rawResponse) { - var response = rawResponse.postquery ? rawResponse.postquery : rawResponse; - this.PrimarySearchResults = this.formatSearchResults(response.PrimaryQueryResult.RelevantResults.Table.Rows); - this.RawSearchResults = response; - this.ElapsedTime = response.ElapsedTime; - this.RowCount = response.PrimaryQueryResult.RelevantResults.RowCount; - this.TotalRows = response.PrimaryQueryResult.RelevantResults.TotalRows; - this.TotalRowsIncludingDuplicates = response.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates; - } - SearchResults.prototype.formatSearchResults = function (rawResults) { - var results = new Array(), tempResults = rawResults.results ? rawResults.results : rawResults; - for (var _i = 0, tempResults_1 = tempResults; _i < tempResults_1.length; _i++) { - var i = tempResults_1[_i]; - results.push(new SearchResult(i.Cells)); - } - return results; - }; - return SearchResults; -}()); -exports.SearchResults = SearchResults; -var SearchResult = (function () { - function SearchResult(rawItem) { - var item = rawItem.results ? rawItem.results : rawItem; - for (var _i = 0, item_1 = item; _i < item_1.length; _i++) { - var i = item_1[_i]; - this[i.Key] = i.Value; - } - } - return SearchResult; -}()); -exports.SearchResult = SearchResult; -(function (SortDirection) { - SortDirection[SortDirection["Ascending"] = 0] = "Ascending"; - SortDirection[SortDirection["Descending"] = 1] = "Descending"; - SortDirection[SortDirection["FQLFormula"] = 2] = "FQLFormula"; -})(exports.SortDirection || (exports.SortDirection = {})); -var SortDirection = exports.SortDirection; -(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"; -})(exports.ReorderingRuleMatchType || (exports.ReorderingRuleMatchType = {})); -var ReorderingRuleMatchType = exports.ReorderingRuleMatchType; -(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"; -})(exports.QueryPropertyValueType || (exports.QueryPropertyValueType = {})); -var QueryPropertyValueType = exports.QueryPropertyValueType; - -},{"./queryable":23}],29:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var webs_1 = require("./webs"); -var usercustomactions_1 = require("./usercustomactions"); -var Site = (function (_super) { - __extends(Site, _super); - function Site(baseUrl, path) { - if (path === void 0) { path = "_api/site"; } - _super.call(this, baseUrl, path); - } - Object.defineProperty(Site.prototype, "rootWeb", { - get: function () { - return new webs_1.Web(this, "rootweb"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Site.prototype, "userCustomActions", { - get: function () { - return new usercustomactions_1.UserCustomActions(this); - }, - enumerable: true, - configurable: true - }); - Site.prototype.getContextInfo = function () { - var q = new Site("", "_api/contextinfo"); - return q.post().then(function (data) { - if (data.hasOwnProperty("GetContextWebInformation")) { - var info = data.GetContextWebInformation; - info.SupportedSchemaVersions = info.SupportedSchemaVersions.results; - return info; - } - else { - return data; - } - }); - }; - Site.prototype.getDocumentLibraries = function (absoluteWebUrl) { - var q = new queryable_1.Queryable("", "_api/sp.web.getdocumentlibraries(@v)"); - q.query.add("@v", "'" + absoluteWebUrl + "'"); - return q.get().then(function (data) { - if (data.hasOwnProperty("GetDocumentLibraries")) { - return data.GetDocumentLibraries; - } - else { - return data; - } - }); - }; - Site.prototype.getWebUrlFromPageUrl = function (absolutePageUrl) { - var q = new queryable_1.Queryable("", "_api/sp.web.getweburlfrompageurl(@v)"); - q.query.add("@v", "'" + absolutePageUrl + "'"); - return q.get().then(function (data) { - if (data.hasOwnProperty("GetWebUrlFromPageUrl")) { - return data.GetWebUrlFromPageUrl; - } - else { - return data; - } - }); - }; - return Site; -}(queryable_1.QueryableInstance)); -exports.Site = Site; - -},{"./queryable":23,"./usercustomactions":34,"./webs":37}],30:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var siteusers_1 = require("./siteusers"); -var util_1 = require("../../utils/util"); -(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"; -})(exports.PrincipalType || (exports.PrincipalType = {})); -var PrincipalType = exports.PrincipalType; -var SiteGroups = (function (_super) { - __extends(SiteGroups, _super); - function SiteGroups(baseUrl, path) { - if (path === void 0) { path = "sitegroups"; } - _super.call(this, baseUrl, path); - } - SiteGroups.prototype.add = function (properties) { - var _this = this; - var postBody = JSON.stringify(util_1.Util.extend({ "__metadata": { "type": "SP.Group" } }, properties)); - return this.post({ body: postBody }).then(function (data) { - return { - data: data, - group: _this.getById(data.Id), - }; - }); - }; - SiteGroups.prototype.getByName = function (groupName) { - return new SiteGroup(this, "getByName('" + groupName + "')"); - }; - SiteGroups.prototype.getById = function (id) { - var sg = new SiteGroup(this); - sg.concat("(" + id + ")"); - return sg; - }; - SiteGroups.prototype.removeById = function (id) { - var g = new SiteGroups(this, "removeById('" + id + "')"); - return g.post(); - }; - SiteGroups.prototype.removeByLoginName = function (loginName) { - var g = new SiteGroups(this, "removeByLoginName('" + loginName + "')"); - return g.post(); - }; - return SiteGroups; -}(queryable_1.QueryableCollection)); -exports.SiteGroups = SiteGroups; -var SiteGroup = (function (_super) { - __extends(SiteGroup, _super); - function SiteGroup(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(SiteGroup.prototype, "users", { - get: function () { - return new siteusers_1.SiteUsers(this, "users"); - }, - enumerable: true, - configurable: true - }); - SiteGroup.prototype.update = function (properties) { - var _this = this; - var postBody = util_1.Util.extend({ "__metadata": { "type": "SP.Group" } }, properties); - return this.post({ - body: JSON.stringify(postBody), - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - var retGroup = _this; - if (properties.hasOwnProperty("Title")) { - retGroup = _this.getParent(SiteGroup, _this.parentUrl, "getByName('" + properties["Title"] + "')"); - } - return { - data: data, - group: retGroup, - }; - }); - }; - return SiteGroup; -}(queryable_1.QueryableInstance)); -exports.SiteGroup = SiteGroup; - -},{"../../utils/util":41,"./queryable":23,"./siteusers":31}],31:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var sitegroups_1 = require("./sitegroups"); -var util_1 = require("../../utils/util"); -var SiteUsers = (function (_super) { - __extends(SiteUsers, _super); - function SiteUsers(baseUrl, path) { - if (path === void 0) { path = "siteusers"; } - _super.call(this, baseUrl, path); - } - SiteUsers.prototype.getByEmail = function (email) { - return new SiteUser(this, "getByEmail('" + email + "')"); - }; - SiteUsers.prototype.getById = function (id) { - return new SiteUser(this, "getById(" + id + ")"); - }; - SiteUsers.prototype.getByLoginName = function (loginName) { - var su = new SiteUser(this); - su.concat("(@v)"); - su.query.add("@v", encodeURIComponent(loginName)); - return su; - }; - SiteUsers.prototype.removeById = function (id) { - var o = new SiteUsers(this, "removeById(" + id + ")"); - return o.post(); - }; - SiteUsers.prototype.removeByLoginName = function (loginName) { - var o = new SiteUsers(this, "removeByLoginName(@v)"); - o.query.add("@v", encodeURIComponent(loginName)); - return o.post(); - }; - SiteUsers.prototype.add = function (loginName) { - var _this = this; - var postBody = JSON.stringify({ "__metadata": { "type": "SP.User" }, LoginName: loginName }); - return this.post({ body: postBody }).then(function (data) { return _this.getByLoginName(loginName); }); - }; - return SiteUsers; -}(queryable_1.QueryableCollection)); -exports.SiteUsers = SiteUsers; -var SiteUser = (function (_super) { - __extends(SiteUser, _super); - function SiteUser(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(SiteUser.prototype, "groups", { - get: function () { - return new sitegroups_1.SiteGroups(this, "groups"); - }, - enumerable: true, - configurable: true - }); - SiteUser.prototype.update = function (properties) { - var _this = this; - var postBody = util_1.Util.extend({ "__metadata": { "type": "SP.User" } }, properties); - return this.post({ - body: JSON.stringify(postBody), - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - data: data, - user: _this, - }; - }); - }; - SiteUser.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - return SiteUser; -}(queryable_1.QueryableInstance)); -exports.SiteUser = SiteUser; - -},{"../../utils/util":41,"./queryable":23,"./sitegroups":30}],32:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var TopNavigationBar = (function (_super) { - __extends(TopNavigationBar, _super); - function TopNavigationBar(baseUrl) { - _super.call(this, baseUrl, "TopNavigationBar"); - } - return TopNavigationBar; -}(queryable_1.QueryableInstance)); -exports.TopNavigationBar = TopNavigationBar; - -},{"./queryable":23}],33:[function(require,module,exports){ -"use strict"; -(function (ControlMode) { - ControlMode[ControlMode["Display"] = 1] = "Display"; - ControlMode[ControlMode["Edit"] = 2] = "Edit"; - ControlMode[ControlMode["New"] = 3] = "New"; -})(exports.ControlMode || (exports.ControlMode = {})); -var ControlMode = exports.ControlMode; -(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"; -})(exports.FieldTypes || (exports.FieldTypes = {})); -var FieldTypes = exports.FieldTypes; -(function (DateTimeFieldFormatType) { - DateTimeFieldFormatType[DateTimeFieldFormatType["DateOnly"] = 0] = "DateOnly"; - DateTimeFieldFormatType[DateTimeFieldFormatType["DateTime"] = 1] = "DateTime"; -})(exports.DateTimeFieldFormatType || (exports.DateTimeFieldFormatType = {})); -var DateTimeFieldFormatType = exports.DateTimeFieldFormatType; -(function (AddFieldOptions) { - AddFieldOptions[AddFieldOptions["DefaultValue"] = 0] = "DefaultValue"; - AddFieldOptions[AddFieldOptions["AddToDefaultContentType"] = 1] = "AddToDefaultContentType"; - AddFieldOptions[AddFieldOptions["AddToNoContentType"] = 2] = "AddToNoContentType"; - AddFieldOptions[AddFieldOptions["AddToAllContentTypes"] = 4] = "AddToAllContentTypes"; - AddFieldOptions[AddFieldOptions["AddFieldInternalNameHint"] = 8] = "AddFieldInternalNameHint"; - AddFieldOptions[AddFieldOptions["AddFieldToDefaultView"] = 16] = "AddFieldToDefaultView"; - AddFieldOptions[AddFieldOptions["AddFieldCheckDisplayName"] = 32] = "AddFieldCheckDisplayName"; -})(exports.AddFieldOptions || (exports.AddFieldOptions = {})); -var AddFieldOptions = exports.AddFieldOptions; -(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"; -})(exports.CalendarType || (exports.CalendarType = {})); -var CalendarType = exports.CalendarType; -(function (UrlFieldFormatType) { - UrlFieldFormatType[UrlFieldFormatType["Hyperlink"] = 0] = "Hyperlink"; - UrlFieldFormatType[UrlFieldFormatType["Image"] = 1] = "Image"; -})(exports.UrlFieldFormatType || (exports.UrlFieldFormatType = {})); -var UrlFieldFormatType = exports.UrlFieldFormatType; -(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"; -})(exports.PrincipalType || (exports.PrincipalType = {})); -var PrincipalType = exports.PrincipalType; -(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"; -})(exports.PageType || (exports.PageType = {})); -var PageType = exports.PageType; - -},{}],34:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var util_1 = require("../../utils/util"); -var UserCustomActions = (function (_super) { - __extends(UserCustomActions, _super); - function UserCustomActions(baseUrl, path) { - if (path === void 0) { path = "usercustomactions"; } - _super.call(this, baseUrl, path); - } - UserCustomActions.prototype.getById = function (id) { - return new UserCustomAction(this, "(" + id + ")"); - }; - UserCustomActions.prototype.add = function (properties) { - var _this = this; - var postBody = JSON.stringify(util_1.Util.extend({ __metadata: { "type": "SP.UserCustomAction" } }, properties)); - return this.post({ body: postBody }).then(function (data) { - return { - action: _this.getById(data.Id), - data: data, - }; - }); - }; - UserCustomActions.prototype.clear = function () { - var a = new UserCustomActions(this, "clear"); - return a.post(); - }; - return UserCustomActions; -}(queryable_1.QueryableCollection)); -exports.UserCustomActions = UserCustomActions; -var UserCustomAction = (function (_super) { - __extends(UserCustomAction, _super); - function UserCustomAction(baseUrl, path) { - _super.call(this, baseUrl, path); - } - UserCustomAction.prototype.update = function (properties) { - var _this = this; - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.UserCustomAction" }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - action: _this, - data: data, - }; - }); - }; - return UserCustomAction; -}(queryable_1.QueryableInstance)); -exports.UserCustomAction = UserCustomAction; - -},{"../../utils/util":41,"./queryable":23}],35:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var FileUtil = require("../../utils/files"); -var odata_1 = require("./odata"); -var UserProfileQuery = (function (_super) { - __extends(UserProfileQuery, _super); - function UserProfileQuery(baseUrl, path) { - if (path === void 0) { path = "_api/sp.userprofiles.peoplemanager"; } - _super.call(this, baseUrl, path); - this.profileLoader = new ProfileLoader(baseUrl); - } - Object.defineProperty(UserProfileQuery.prototype, "editProfileLink", { - get: function () { - var q = new UserProfileQuery(this, "EditProfileLink"); - return q.getAs(odata_1.ODataValue()); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UserProfileQuery.prototype, "isMyPeopleListPublic", { - get: function () { - var q = new UserProfileQuery(this, "IsMyPeopleListPublic"); - return q.getAs(odata_1.ODataValue()); - }, - enumerable: true, - configurable: true - }); - UserProfileQuery.prototype.amIFollowedBy = function (loginName) { - var q = new UserProfileQuery(this, "amifollowedby(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - UserProfileQuery.prototype.amIFollowing = function (loginName) { - var q = new UserProfileQuery(this, "amifollowing(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - UserProfileQuery.prototype.getFollowedTags = function (maxCount) { - if (maxCount === void 0) { maxCount = 20; } - var q = new UserProfileQuery(this, "getfollowedtags(" + maxCount + ")"); - return q.get(); - }; - UserProfileQuery.prototype.getFollowersFor = function (loginName) { - var q = new UserProfileQuery(this, "getfollowersfor(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - Object.defineProperty(UserProfileQuery.prototype, "myFollowers", { - get: function () { - return new queryable_1.QueryableCollection(this, "getmyfollowers"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UserProfileQuery.prototype, "myProperties", { - get: function () { - return new UserProfileQuery(this, "getmyproperties"); - }, - enumerable: true, - configurable: true - }); - UserProfileQuery.prototype.getPeopleFollowedBy = function (loginName) { - var q = new UserProfileQuery(this, "getpeoplefollowedby(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - UserProfileQuery.prototype.getPropertiesFor = function (loginName) { - var q = new UserProfileQuery(this, "getpropertiesfor(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - Object.defineProperty(UserProfileQuery.prototype, "trendingTags", { - get: function () { - var q = new UserProfileQuery(this, null); - q.concat(".gettrendingtags"); - return q.get(); - }, - enumerable: true, - configurable: true - }); - UserProfileQuery.prototype.getUserProfilePropertyFor = function (loginName, propertyName) { - var q = new UserProfileQuery(this, "getuserprofilepropertyfor(accountname=@v, propertyname='" + propertyName + "')"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.get(); - }; - UserProfileQuery.prototype.hideSuggestion = function (loginName) { - var q = new UserProfileQuery(this, "hidesuggestion(@v)"); - q.query.add("@v", "'" + encodeURIComponent(loginName) + "'"); - return q.post(); - }; - UserProfileQuery.prototype.isFollowing = function (follower, followee) { - var q = new UserProfileQuery(this, null); - q.concat(".isfollowing(possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)"); - q.query.add("@v", "'" + encodeURIComponent(follower) + "'"); - q.query.add("@y", "'" + encodeURIComponent(followee) + "'"); - return q.get(); - }; - UserProfileQuery.prototype.setMyProfilePic = function (profilePicSource) { - var _this = this; - return FileUtil.readBlobAsArrayBuffer(profilePicSource).then(function (buffer) { - var request = new UserProfileQuery(_this, "setmyprofilepicture"); - return request.post({ - body: String.fromCharCode.apply(null, new Uint16Array(buffer)), - }); - }); - }; - UserProfileQuery.prototype.createPersonalSiteEnqueueBulk = function () { - var emails = []; - for (var _i = 0; _i < arguments.length; _i++) { - emails[_i - 0] = arguments[_i]; - } - return this.profileLoader.createPersonalSiteEnqueueBulk(emails); - }; - Object.defineProperty(UserProfileQuery.prototype, "ownerUserProfile", { - get: function () { - return this.profileLoader.ownerUserProfile; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(UserProfileQuery.prototype, "userProfile", { - get: function () { - return this.profileLoader.userProfile; - }, - enumerable: true, - configurable: true - }); - UserProfileQuery.prototype.createPersonalSite = function (interactiveRequest) { - if (interactiveRequest === void 0) { interactiveRequest = false; } - return this.profileLoader.createPersonalSite(interactiveRequest); - }; - UserProfileQuery.prototype.shareAllSocialData = function (share) { - return this.profileLoader.shareAllSocialData(share); - }; - return UserProfileQuery; -}(queryable_1.QueryableInstance)); -exports.UserProfileQuery = UserProfileQuery; -var ProfileLoader = (function (_super) { - __extends(ProfileLoader, _super); - function ProfileLoader(baseUrl, path) { - if (path === void 0) { path = "_api/sp.userprofiles.profileloader.getprofileloader"; } - _super.call(this, baseUrl, path); - } - ProfileLoader.prototype.createPersonalSiteEnqueueBulk = function (emails) { - var q = new ProfileLoader(this, "createpersonalsiteenqueuebulk"); - var postBody = JSON.stringify({ "emailIDs": emails }); - return q.post({ - body: postBody, - }); - }; - Object.defineProperty(ProfileLoader.prototype, "ownerUserProfile", { - get: function () { - var q = this.getParent(ProfileLoader, this.parentUrl, "_api/sp.userprofiles.profileloader.getowneruserprofile"); - return q.postAs(); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(ProfileLoader.prototype, "userProfile", { - get: function () { - var q = new ProfileLoader(this, "getuserprofile"); - return q.postAs(); - }, - enumerable: true, - configurable: true - }); - ProfileLoader.prototype.createPersonalSite = function (interactiveRequest) { - if (interactiveRequest === void 0) { interactiveRequest = false; } - var q = new ProfileLoader(this, "getuserprofile/createpersonalsiteenque(" + interactiveRequest + ")\","); - return q.post(); - }; - ProfileLoader.prototype.shareAllSocialData = function (share) { - var q = new ProfileLoader(this, "getuserprofile/shareallsocialdata(" + share + ")\","); - return q.post(); - }; - return ProfileLoader; -}(queryable_1.Queryable)); - -},{"../../utils/files":38,"./odata":22,"./queryable":23}],36:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var util_1 = require("../../utils/util"); -var Views = (function (_super) { - __extends(Views, _super); - function Views(baseUrl) { - _super.call(this, baseUrl, "views"); - } - Views.prototype.getById = function (id) { - var v = new View(this); - v.concat("('" + id + "')"); - return v; - }; - Views.prototype.getByTitle = function (title) { - return new View(this, "getByTitle('" + title + "')"); - }; - Views.prototype.add = function (title, personalView, additionalSettings) { - var _this = this; - if (personalView === void 0) { personalView = false; } - if (additionalSettings === void 0) { additionalSettings = {}; } - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.View" }, - "Title": title, - "PersonalView": personalView, - }, additionalSettings)); - return this.postAs({ body: postBody }).then(function (data) { - return { - data: data, - view: _this.getById(data.Id), - }; - }); - }; - return Views; -}(queryable_1.QueryableCollection)); -exports.Views = Views; -var View = (function (_super) { - __extends(View, _super); - function View(baseUrl, path) { - _super.call(this, baseUrl, path); - } - Object.defineProperty(View.prototype, "fields", { - get: function () { - return new ViewFields(this); - }, - enumerable: true, - configurable: true - }); - View.prototype.update = function (properties) { - var _this = this; - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.View" }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - data: data, - view: _this, - }; - }); - }; - View.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - View.prototype.renderAsHtml = function () { - var q = new queryable_1.Queryable(this, "renderashtml"); - return q.get(); - }; - return View; -}(queryable_1.QueryableInstance)); -exports.View = View; -var ViewFields = (function (_super) { - __extends(ViewFields, _super); - function ViewFields(baseUrl, path) { - if (path === void 0) { path = "viewfields"; } - _super.call(this, baseUrl, path); - } - ViewFields.prototype.getSchemaXml = function () { - var q = new queryable_1.Queryable(this, "schemaxml"); - return q.get(); - }; - ViewFields.prototype.add = function (fieldTitleOrInternalName) { - var q = new ViewFields(this, "addviewfield('" + fieldTitleOrInternalName + "')"); - return q.post(); - }; - ViewFields.prototype.move = function (fieldInternalName, index) { - var q = new ViewFields(this, "moveviewfieldto"); - var postBody = JSON.stringify({ "field": fieldInternalName, "index": index }); - return q.post({ body: postBody }); - }; - ViewFields.prototype.removeAll = function () { - var q = new ViewFields(this, "removeallviewfields"); - return q.post(); - }; - ViewFields.prototype.remove = function (fieldInternalName) { - var q = new ViewFields(this, "removeviewfield('" + fieldInternalName + "')"); - return q.post(); - }; - return ViewFields; -}(queryable_1.QueryableCollection)); -exports.ViewFields = ViewFields; - -},{"../../utils/util":41,"./queryable":23}],37:[function(require,module,exports){ -"use strict"; -var __extends = (this && this.__extends) || function (d, b) { - for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; - function __() { this.constructor = d; } - d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); -}; -var queryable_1 = require("./queryable"); -var queryablesecurable_1 = require("./queryablesecurable"); -var lists_1 = require("./lists"); -var fields_1 = require("./fields"); -var navigation_1 = require("./navigation"); -var sitegroups_1 = require("./sitegroups"); -var contenttypes_1 = require("./contenttypes"); -var folders_1 = require("./folders"); -var roles_1 = require("./roles"); -var files_1 = require("./files"); -var util_1 = require("../../utils/util"); -var lists_2 = require("./lists"); -var siteusers_1 = require("./siteusers"); -var usercustomactions_1 = require("./usercustomactions"); -var odata_1 = require("./odata"); -var Webs = (function (_super) { - __extends(Webs, _super); - function Webs(baseUrl, webPath) { - if (webPath === void 0) { webPath = "webs"; } - _super.call(this, baseUrl, webPath); - } - Webs.prototype.add = function (title, url, description, template, language, inheritPermissions, additionalSettings) { - if (description === void 0) { description = ""; } - if (template === void 0) { template = "STS"; } - if (language === void 0) { language = 1033; } - if (inheritPermissions === void 0) { inheritPermissions = true; } - if (additionalSettings === void 0) { additionalSettings = {}; } - var props = util_1.Util.extend({ - Description: description, - Language: language, - Title: title, - Url: url, - UseSamePermissionsAsParentSite: inheritPermissions, - WebTemplate: template, - }, additionalSettings); - var postBody = JSON.stringify({ - "parameters": util_1.Util.extend({ - "__metadata": { "type": "SP.WebCreationInformation" }, - }, props), - }); - var q = new Webs(this, "add"); - return q.post({ body: postBody }).then(function (data) { - return { - data: data, - web: new Web(odata_1.extractOdataId(data), ""), - }; - }); - }; - return Webs; -}(queryable_1.QueryableCollection)); -exports.Webs = Webs; -var Web = (function (_super) { - __extends(Web, _super); - function Web(baseUrl, path) { - if (path === void 0) { path = "_api/web"; } - _super.call(this, baseUrl, path); - } - Object.defineProperty(Web.prototype, "webs", { - get: function () { - return new Webs(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "contentTypes", { - get: function () { - return new contenttypes_1.ContentTypes(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "lists", { - get: function () { - return new lists_1.Lists(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "fields", { - get: function () { - return new fields_1.Fields(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "availablefields", { - get: function () { - return new fields_1.Fields(this, "availablefields"); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "navigation", { - get: function () { - return new navigation_1.Navigation(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "siteUsers", { - get: function () { - return new siteusers_1.SiteUsers(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "siteGroups", { - get: function () { - return new sitegroups_1.SiteGroups(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "folders", { - get: function () { - return new folders_1.Folders(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "userCustomActions", { - get: function () { - return new usercustomactions_1.UserCustomActions(this); - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Web.prototype, "roleDefinitions", { - get: function () { - return new roles_1.RoleDefinitions(this); - }, - enumerable: true, - configurable: true - }); - Web.prototype.getFolderByServerRelativeUrl = function (folderRelativeUrl) { - return new folders_1.Folder(this, "getFolderByServerRelativeUrl('" + folderRelativeUrl + "')"); - }; - Web.prototype.getFileByServerRelativeUrl = function (fileRelativeUrl) { - return new files_1.File(this, "getFileByServerRelativeUrl('" + fileRelativeUrl + "')"); - }; - Web.prototype.update = function (properties) { - var _this = this; - var postBody = JSON.stringify(util_1.Util.extend({ - "__metadata": { "type": "SP.Web" }, - }, properties)); - return this.post({ - body: postBody, - headers: { - "X-HTTP-Method": "MERGE", - }, - }).then(function (data) { - return { - data: data, - web: _this, - }; - }); - }; - Web.prototype.delete = function () { - return this.post({ - headers: { - "X-HTTP-Method": "DELETE", - }, - }); - }; - Web.prototype.applyTheme = function (colorPaletteUrl, fontSchemeUrl, backgroundImageUrl, shareGenerated) { - var postBody = JSON.stringify({ - backgroundImageUrl: backgroundImageUrl, - colorPaletteUrl: colorPaletteUrl, - fontSchemeUrl: fontSchemeUrl, - shareGenerated: shareGenerated, - }); - var q = new Web(this, "applytheme"); - return q.post({ body: postBody }); - }; - Web.prototype.applyWebTemplate = function (template) { - var q = new Web(this, "applywebtemplate"); - q.concat("(@t)"); - q.query.add("@t", template); - return q.post(); - }; - Web.prototype.doesUserHavePermissions = function (perms) { - var q = new Web(this, "doesuserhavepermissions"); - q.concat("(@p)"); - q.query.add("@p", JSON.stringify(perms)); - return q.get(); - }; - Web.prototype.ensureUser = function (loginName) { - var postBody = JSON.stringify({ - logonName: loginName, - }); - var q = new Web(this, "ensureuser"); - return q.post({ body: postBody }); - }; - Web.prototype.availableWebTemplates = function (language, includeCrossLanugage) { - if (language === void 0) { language = 1033; } - if (includeCrossLanugage === void 0) { includeCrossLanugage = true; } - return new queryable_1.QueryableCollection(this, "getavailablewebtemplates(lcid=" + language + ", doincludecrosslanguage=" + includeCrossLanugage + ")"); - }; - Web.prototype.getCatalog = function (type) { - var q = new Web(this, "getcatalog(" + type + ")"); - q.select("Id"); - return q.get().then(function (data) { - return new lists_2.List(odata_1.extractOdataId(data)); - }); - }; - Web.prototype.getChanges = function (query) { - var postBody = JSON.stringify({ "query": util_1.Util.extend({ "__metadata": { "type": "SP.ChangeQuery" } }, query) }); - var q = new Web(this, "getchanges"); - return q.post({ body: postBody }); - }; - Object.defineProperty(Web.prototype, "customListTemplate", { - get: function () { - return new queryable_1.QueryableCollection(this, "getcustomlisttemplates"); - }, - enumerable: true, - configurable: true - }); - Web.prototype.getUserById = function (id) { - return new siteusers_1.SiteUser(this, "getUserById(" + id + ")"); - }; - Web.prototype.mapToIcon = function (filename, size, progId) { - if (size === void 0) { size = 0; } - if (progId === void 0) { progId = ""; } - var q = new Web(this, "maptoicon(filename='" + filename + "', progid='" + progId + "', size=" + size + ")"); - return q.get(); - }; - return Web; -}(queryablesecurable_1.QueryableSecurable)); -exports.Web = Web; - -},{"../../utils/util":41,"./contenttypes":14,"./fields":15,"./files":16,"./folders":17,"./lists":20,"./navigation":21,"./odata":22,"./queryable":23,"./queryablesecurable":24,"./roles":27,"./sitegroups":30,"./siteusers":31,"./usercustomactions":34}],38:[function(require,module,exports){ -"use strict"; -function readBlobAsText(blob) { - return readBlobAs(blob, "string"); -} -exports.readBlobAsText = readBlobAsText; -function readBlobAsArrayBuffer(blob) { - return readBlobAs(blob, "buffer"); -} -exports.readBlobAsArrayBuffer = readBlobAsArrayBuffer; -function readBlobAs(blob, mode) { - return new Promise(function (resolve, reject) { - var reader = new FileReader(); - reader.onload = function (e) { - resolve(e.target.result); - }; - switch (mode) { - case "string": - reader.readAsText(blob); - break; - case "buffer": - reader.readAsArrayBuffer(blob); - break; - } - }); -} - -},{}],39:[function(require,module,exports){ -"use strict"; -var Logger = (function () { - function Logger() { - } - Object.defineProperty(Logger, "activeLogLevel", { - get: function () { - return Logger.instance.activeLogLevel; - }, - set: function (value) { - Logger.instance.activeLogLevel = value; - }, - enumerable: true, - configurable: true - }); - Object.defineProperty(Logger, "instance", { - get: function () { - if (typeof Logger._instance === "undefined" || Logger._instance === null) { - Logger._instance = new LoggerImpl(); - } - return Logger._instance; - }, - enumerable: true, - configurable: true - }); - Logger.subscribe = function () { - var listeners = []; - for (var _i = 0; _i < arguments.length; _i++) { - listeners[_i - 0] = arguments[_i]; - } - for (var i = 0; i < listeners.length; i++) { - Logger.instance.subscribe(listeners[i]); - } - }; - Logger.clearSubscribers = function () { - return Logger.instance.clearSubscribers(); - }; - Object.defineProperty(Logger, "count", { - get: function () { - return Logger.instance.count; - }, - enumerable: true, - configurable: true - }); - Logger.write = function (message, level) { - if (level === void 0) { level = Logger.LogLevel.Verbose; } - Logger.instance.log({ level: level, message: message }); - }; - Logger.log = function (entry) { - Logger.instance.log(entry); - }; - Logger.measure = function (name, f) { - return Logger.instance.measure(name, f); - }; - return Logger; -}()); -exports.Logger = Logger; -var LoggerImpl = (function () { - function LoggerImpl(activeLogLevel, subscribers) { - if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.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 = Logger.LogLevel.Verbose; } - this.log({ level: level, message: message }); - }; - LoggerImpl.prototype.log = function (entry) { - if (typeof entry === "undefined" || entry.level < this.activeLogLevel) { - return; - } - for (var i = 0; i < this.subscribers.length; i++) { - this.subscribers[i].log(entry); - } - }; - LoggerImpl.prototype.measure = function (name, f) { - console.profile(name); - try { - return f(); - } - finally { - console.profileEnd(); - } - }; - return LoggerImpl; -}()); -var Logger; -(function (Logger) { - (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"; - })(Logger.LogLevel || (Logger.LogLevel = {})); - var LogLevel = Logger.LogLevel; - var ConsoleListener = (function () { - function ConsoleListener() { - } - ConsoleListener.prototype.log = function (entry) { - var msg = this.format(entry); - switch (entry.level) { - case LogLevel.Verbose: - case LogLevel.Info: - console.log(msg); - break; - case LogLevel.Warning: - console.warn(msg); - break; - case LogLevel.Error: - console.error(msg); - break; - } - }; - ConsoleListener.prototype.format = function (entry) { - return "Message: " + entry.message + ". Data: " + JSON.stringify(entry.data); - }; - return ConsoleListener; - }()); - Logger.ConsoleListener = ConsoleListener; - var AzureInsightsListener = (function () { - function AzureInsightsListener(azureInsightsInstrumentationKey) { - this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey; - var appInsights = window["appInsights"] || function (config) { - function r(config) { - t[config] = function () { - var i = arguments; - t.queue.push(function () { t[config].apply(t, i); }); - }; - } - var t = { config: config }, u = document, e = window, o = "script", s = u.createElement(o), i, f; - for (s.src = config.url || "//az416426.vo.msecnd.net/scripts/a/ai.0.js", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = ["Event", "Exception", "Metric", "PageView", "Trace"]; i.length;) { - r("track" + i.pop()); - } - return r("setAuthenticatedUserContext"), r("clearAuthenticatedUserContext"), config.disableExceptionTracking || (i = "onerror", r("_" + i), f = e[i], e[i] = function (config, r, u, e, o) { - var s = f && f(config, r, u, e, o); - return s !== !0 && t["_" + i](config, r, u, e, o), s; - }), t; - }({ - instrumentationKey: this.azureInsightsInstrumentationKey - }); - window["appInsights"] = appInsights; - } - AzureInsightsListener.prototype.log = function (entry) { - var ai = window["appInsights"]; - var msg = this.format(entry); - if (entry.level === LogLevel.Error) { - ai.trackException(msg); - } - else { - ai.trackEvent(msg); - } - }; - AzureInsightsListener.prototype.format = function (entry) { - return "Message: " + entry.message + ". Data: " + JSON.stringify(entry.data); - }; - return AzureInsightsListener; - }()); - Logger.AzureInsightsListener = AzureInsightsListener; - var FunctionListener = (function () { - function FunctionListener(method) { - this.method = method; - } - FunctionListener.prototype.log = function (entry) { - this.method(entry); - }; - return FunctionListener; - }()); - Logger.FunctionListener = FunctionListener; -})(Logger = exports.Logger || (exports.Logger = {})); - -},{}],40:[function(require,module,exports){ -"use strict"; -var util_1 = require("./util"); -var PnPClientStorageWrapper = (function () { - function PnPClientStorageWrapper(store, defaultTimeoutMinutes) { - this.store = store; - this.defaultTimeoutMinutes = defaultTimeoutMinutes; - this.defaultTimeoutMinutes = (defaultTimeoutMinutes === void 0) ? 5 : defaultTimeoutMinutes; - this.enabled = this.test(); - } - PnPClientStorageWrapper.prototype.get = function (key) { - if (!this.enabled) { - return null; - } - var o = this.store.getItem(key); - if (o == null) { - return o; - } - var persistable = JSON.parse(o); - if (new Date(persistable.expiration) <= new Date()) { - this.delete(key); - return null; - } - else { - return persistable.value; - } - }; - PnPClientStorageWrapper.prototype.put = function (key, o, expire) { - if (this.enabled) { - this.store.setItem(key, this.createPersistable(o, expire)); - } - }; - PnPClientStorageWrapper.prototype.delete = function (key) { - if (this.enabled) { - this.store.removeItem(key); - } - }; - PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) { - var _this = this; - if (!this.enabled) { - return getter(); - } - if (!util_1.Util.isFunction(getter)) { - throw "Function expected for parameter 'getter'."; - } - return new Promise(function (resolve, reject) { - var o = _this.get(key); - if (o == null) { - getter().then(function (d) { - _this.put(key, d); - resolve(d); - }); - } - else { - resolve(o); - } - }); - }; - PnPClientStorageWrapper.prototype.test = function () { - var str = "test"; - try { - this.store.setItem(str, str); - this.store.removeItem(str); - return true; - } - catch (e) { - return false; - } - }; - PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) { - if (typeof expire === "undefined") { - expire = util_1.Util.dateAdd(new Date(), "minute", this.defaultTimeoutMinutes); - } - return JSON.stringify({ expiration: expire, value: o }); - }; - return PnPClientStorageWrapper; -}()); -exports.PnPClientStorageWrapper = PnPClientStorageWrapper; -var PnPClientStorage = (function () { - function PnPClientStorage() { - this.local = typeof localStorage !== "undefined" ? new PnPClientStorageWrapper(localStorage) : null; - this.session = typeof sessionStorage !== "undefined" ? new PnPClientStorageWrapper(sessionStorage) : null; - } - return PnPClientStorage; -}()); -exports.PnPClientStorage = PnPClientStorage; - -},{"./util":41}],41:[function(require,module,exports){ -(function (global){ -"use strict"; -var Util = (function () { - function Util() { - } - Util.getCtxCallback = function (context, method) { - var params = []; - for (var _i = 2; _i < arguments.length; _i++) { - params[_i - 2] = arguments[_i]; - } - return function () { - method.apply(context, params); - }; - }; - Util.urlParamExists = function (name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); - return regex.test(location.search); - }; - Util.getUrlParamByName = function (name) { - name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]"); - var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"); - var results = regex.exec(location.search); - return results == null ? "" : decodeURIComponent(results[1].replace(/\+/g, " ")); - }; - Util.getUrlParamBoolByName = function (name) { - var p = this.getUrlParamByName(name); - var isFalse = (p === "" || /false|0/i.test(p)); - return !isFalse; - }; - Util.stringInsert = function (target, index, s) { - if (index > 0) { - return target.substring(0, index) + s + target.substring(index, target.length); - } - return s + target; - }; - Util.dateAdd = function (date, interval, units) { - var ret = new Date(date.toLocaleString()); - 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; - }; - Util.loadStylesheet = function (path, avoidCache) { - if (avoidCache) { - path += "?" + encodeURIComponent((new Date()).getTime().toString()); - } - var head = document.getElementsByTagName("head"); - if (head.length > 0) { - var e = document.createElement("link"); - head[0].appendChild(e); - e.setAttribute("type", "text/css"); - e.setAttribute("rel", "stylesheet"); - e.setAttribute("href", path); - } - }; - Util.combinePaths = function () { - var paths = []; - for (var _i = 0; _i < arguments.length; _i++) { - paths[_i - 0] = arguments[_i]; - } - var parts = []; - for (var i = 0; i < paths.length; i++) { - if (typeof paths[i] !== "undefined" && paths[i] !== null) { - parts.push(paths[i].replace(/^[\\|\/]/, "").replace(/[\\|\/]$/, "")); - } - } - return parts.join("/").replace(/\\/, "/"); - }; - Util.getRandomString = function (chars) { - var text = ""; - var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; - for (var i = 0; i < chars; i++) { - text += possible.charAt(Math.floor(Math.random() * possible.length)); - } - return text; - }; - Util.getGUID = function () { - var d = new Date().getTime(); - 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; - }; - Util.isFunction = function (candidateFunction) { - return typeof candidateFunction === "function"; - }; - Util.isArray = function (array) { - if (Array.isArray) { - return Array.isArray(array); - } - return array && typeof array.length === "number" && array.constructor === Array; - }; - Util.stringIsNullOrEmpty = function (s) { - return typeof s === "undefined" || s === null || s === ""; - }; - Util.extend = function (target, source, noOverwrite) { - if (noOverwrite === void 0) { noOverwrite = false; } - var result = {}; - for (var id in target) { - result[id] = target[id]; - } - var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; }; - for (var id in source) { - if (check(result, id)) { - result[id] = source[id]; - } - } - return result; - }; - Util.applyMixins = function (derivedCtor) { - var baseCtors = []; - for (var _i = 1; _i < arguments.length; _i++) { - baseCtors[_i - 1] = arguments[_i]; - } - baseCtors.forEach(function (baseCtor) { - Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) { - derivedCtor.prototype[name] = baseCtor.prototype[name]; - }); - }); - }; - Util.isUrlAbsolute = function (url) { - return /^https?:\/\/|^\/\//i.test(url); - }; - Util.makeUrlAbsolute = function (url) { - if (Util.isUrlAbsolute(url)) { - return url; - } - if (typeof global._spPageContextInfo !== "undefined") { - if (global._spPageContextInfo.hasOwnProperty("webAbsoluteUrl")) { - return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url); - } - else if (global._spPageContextInfo.hasOwnProperty("webServerRelativeUrl")) { - return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url); - } - } - else { - return url; - } - }; - return Util; -}()); -exports.Util = Util; - -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) - -},{}]},{},[12])(12) -}); - - -//# sourceMappingURL=pnp.js.map diff --git a/dist/pnp.js.map b/dist/pnp.js.map deleted file mode 100644 index 18817bb7..00000000 --- a/dist/pnp.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"sources":["node_modules/browser-pack/_prelude.js","build/src/collections/collections.js","build/src/configuration/configuration.js","build/src/configuration/pnplibconfig.js","build/src/configuration/providers/cachingConfigurationProvider.js","build/src/configuration/providers/providers.js","build/src/configuration/providers/spListConfigurationProvider.js","build/src/net/digestcache.js","build/src/net/fetchclient.js","build/src/net/httpclient.js","build/src/net/nodefetchclientbrowser.js","build/src/net/sprequestexecutorclient.js","build/src/pnp.js","build/src/sharepoint/rest/caching.js","build/src/sharepoint/rest/contenttypes.js","build/src/sharepoint/rest/fields.js","build/src/sharepoint/rest/files.js","build/src/sharepoint/rest/folders.js","build/src/sharepoint/rest/forms.js","build/src/sharepoint/rest/items.js","build/src/sharepoint/rest/lists.js","build/src/sharepoint/rest/navigation.js","build/src/sharepoint/rest/odata.js","build/src/sharepoint/rest/queryable.js","build/src/sharepoint/rest/queryablesecurable.js","build/src/sharepoint/rest/quicklaunch.js","build/src/sharepoint/rest/rest.js","build/src/sharepoint/rest/roles.js","build/src/sharepoint/rest/search.js","build/src/sharepoint/rest/site.js","build/src/sharepoint/rest/sitegroups.js","build/src/sharepoint/rest/siteusers.js","build/src/sharepoint/rest/topnavigationbar.js","build/src/sharepoint/rest/types.js","build/src/sharepoint/rest/usercustomactions.js","build/src/sharepoint/rest/userprofiles.js","build/src/sharepoint/rest/views.js","build/src/sharepoint/rest/webs.js","build/src/utils/files.js","build/src/utils/logging.js","build/src/utils/storage.js","build/src/utils/util.js"],"names":[],"mappings":";;;;;;;;AAAA;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AClDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AC5FA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC1CA;AACA;AACA;AACA;AACA;AACA;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACtDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9ZA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC7BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9MA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC5QA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AClEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/IA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACrEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACfA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACxGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACtLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjHA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACzLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrFA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"pnp.js","sourcesContent":["(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o -1) {\n this.values[index] = o;\n }\n else {\n this.keys.push(key);\n this.values.push(o);\n }\n };\n Dictionary.prototype.merge = function (source) {\n if (util_1.Util.isFunction(source[\"getKeys\"])) {\n var sourceAsDictionary = source;\n var keys = sourceAsDictionary.getKeys();\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n this.add(keys[i], sourceAsDictionary.get(keys[i]));\n }\n }\n else {\n var sourceAsHash = source;\n for (var key in sourceAsHash) {\n if (sourceAsHash.hasOwnProperty(key)) {\n this.add(key, source[key]);\n }\n }\n }\n };\n Dictionary.prototype.remove = function (key) {\n var index = this.keys.indexOf(key);\n if (index < 0) {\n return null;\n }\n var val = this.values[index];\n this.keys.splice(index, 1);\n this.values.splice(index, 1);\n return val;\n };\n Dictionary.prototype.getKeys = function () {\n return this.keys;\n };\n Dictionary.prototype.getValues = function () {\n return this.values;\n };\n Dictionary.prototype.clear = function () {\n this.keys = [];\n this.values = [];\n };\n Dictionary.prototype.count = function () {\n return this.keys.length;\n };\n return Dictionary;\n}());\nexports.Dictionary = Dictionary;\n","\"use strict\";\nvar Collections = require(\"../collections/collections\");\nvar providers = require(\"./providers/providers\");\nvar Settings = (function () {\n function Settings() {\n this.Providers = providers;\n this._settings = new Collections.Dictionary();\n }\n Settings.prototype.add = function (key, value) {\n this._settings.add(key, value);\n };\n Settings.prototype.addJSON = function (key, value) {\n this._settings.add(key, JSON.stringify(value));\n };\n Settings.prototype.apply = function (hash) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n try {\n _this._settings.merge(hash);\n resolve();\n }\n catch (e) {\n reject(e);\n }\n });\n };\n Settings.prototype.load = function (provider) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n provider.getConfiguration().then(function (value) {\n _this._settings.merge(value);\n resolve();\n }).catch(function (reason) {\n reject(reason);\n });\n });\n };\n Settings.prototype.get = function (key) {\n return this._settings.get(key);\n };\n Settings.prototype.getJSON = function (key) {\n var o = this.get(key);\n if (typeof o === \"undefined\" || o === null) {\n return o;\n }\n return JSON.parse(o);\n };\n return Settings;\n}());\nexports.Settings = Settings;\n","\"use strict\";\nvar RuntimeConfigImpl = (function () {\n function RuntimeConfigImpl() {\n this._headers = null;\n this._defaultCachingStore = \"session\";\n this._defaultCachingTimeoutSeconds = 30;\n this._globalCacheDisable = false;\n this._useSPRequestExecutor = false;\n }\n RuntimeConfigImpl.prototype.set = function (config) {\n if (config.hasOwnProperty(\"headers\")) {\n this._headers = config.headers;\n }\n if (config.hasOwnProperty(\"globalCacheDisable\")) {\n this._globalCacheDisable = config.globalCacheDisable;\n }\n if (config.hasOwnProperty(\"defaultCachingStore\")) {\n this._defaultCachingStore = config.defaultCachingStore;\n }\n if (config.hasOwnProperty(\"defaultCachingTimeoutSeconds\")) {\n this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds;\n }\n if (config.hasOwnProperty(\"useSPRequestExecutor\")) {\n this._useSPRequestExecutor = config.useSPRequestExecutor;\n }\n if (config.hasOwnProperty(\"nodeClientOptions\")) {\n this._useNodeClient = true;\n this._useSPRequestExecutor = false;\n this._nodeClientData = config.nodeClientOptions;\n global._spPageContextInfo = {\n webAbsoluteUrl: config.nodeClientOptions.siteUrl,\n };\n }\n };\n Object.defineProperty(RuntimeConfigImpl.prototype, \"headers\", {\n get: function () {\n return this._headers;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingStore\", {\n get: function () {\n return this._defaultCachingStore;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingTimeoutSeconds\", {\n get: function () {\n return this._defaultCachingTimeoutSeconds;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"globalCacheDisable\", {\n get: function () {\n return this._globalCacheDisable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useSPRequestExecutor\", {\n get: function () {\n return this._useSPRequestExecutor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useNodeFetchClient\", {\n get: function () {\n return this._useNodeClient;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"nodeRequestOptions\", {\n get: function () {\n return this._nodeClientData;\n },\n enumerable: true,\n configurable: true\n });\n return RuntimeConfigImpl;\n}());\nexports.RuntimeConfigImpl = RuntimeConfigImpl;\nvar _runtimeConfig = new RuntimeConfigImpl();\nexports.RuntimeConfig = _runtimeConfig;\nfunction setRuntimeConfig(config) {\n _runtimeConfig.set(config);\n}\nexports.setRuntimeConfig = setRuntimeConfig;\n","\"use strict\";\nvar storage = require(\"../../utils/storage\");\nvar CachingConfigurationProvider = (function () {\n function CachingConfigurationProvider(wrappedProvider, cacheKey, cacheStore) {\n this.wrappedProvider = wrappedProvider;\n this.store = (cacheStore) ? cacheStore : this.selectPnPCache();\n this.cacheKey = \"_configcache_\" + cacheKey;\n }\n CachingConfigurationProvider.prototype.getWrappedProvider = function () {\n return this.wrappedProvider;\n };\n CachingConfigurationProvider.prototype.getConfiguration = function () {\n var _this = this;\n if ((!this.store) || (!this.store.enabled)) {\n return this.wrappedProvider.getConfiguration();\n }\n var cachedConfig = this.store.get(this.cacheKey);\n if (cachedConfig) {\n return new Promise(function (resolve, reject) {\n resolve(cachedConfig);\n });\n }\n var providerPromise = this.wrappedProvider.getConfiguration();\n providerPromise.then(function (providedConfig) {\n _this.store.put(_this.cacheKey, providedConfig);\n });\n return providerPromise;\n };\n CachingConfigurationProvider.prototype.selectPnPCache = function () {\n var pnpCache = new storage.PnPClientStorage();\n if ((pnpCache.local) && (pnpCache.local.enabled)) {\n return pnpCache.local;\n }\n if ((pnpCache.session) && (pnpCache.session.enabled)) {\n return pnpCache.session;\n }\n throw new Error(\"Cannot create a caching configuration provider since cache is not available.\");\n };\n return CachingConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = CachingConfigurationProvider;\n","\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar spListConfigurationProvider_1 = require(\"./spListConfigurationProvider\");\nexports.CachingConfigurationProvider = cachingConfigurationProvider_1.default;\nexports.SPListConfigurationProvider = spListConfigurationProvider_1.default;\n","\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar SPListConfigurationProvider = (function () {\n function SPListConfigurationProvider(sourceWeb, sourceListTitle) {\n if (sourceListTitle === void 0) { sourceListTitle = \"config\"; }\n this.sourceWeb = sourceWeb;\n this.sourceListTitle = sourceListTitle;\n }\n Object.defineProperty(SPListConfigurationProvider.prototype, \"web\", {\n get: function () {\n return this.sourceWeb;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SPListConfigurationProvider.prototype, \"listTitle\", {\n get: function () {\n return this.sourceListTitle;\n },\n enumerable: true,\n configurable: true\n });\n SPListConfigurationProvider.prototype.getConfiguration = function () {\n return this.web.lists.getByTitle(this.listTitle).items.select(\"Title\", \"Value\")\n .getAs().then(function (data) {\n var configuration = {};\n data.forEach(function (i) {\n configuration[i.Title] = i.Value;\n });\n return configuration;\n });\n };\n SPListConfigurationProvider.prototype.asCaching = function () {\n var cacheKey = \"splist_\" + this.web.toUrl() + \"+\" + this.listTitle;\n return new cachingConfigurationProvider_1.default(this, cacheKey);\n };\n return SPListConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = SPListConfigurationProvider;\n","\"use strict\";\nvar collections_1 = require(\"../collections/collections\");\nvar util_1 = require(\"../utils/util\");\nvar odata_1 = require(\"../sharepoint/rest/odata\");\nvar CachedDigest = (function () {\n function CachedDigest() {\n }\n return CachedDigest;\n}());\nexports.CachedDigest = CachedDigest;\nvar DigestCache = (function () {\n function DigestCache(_httpClient, _digests) {\n if (_digests === void 0) { _digests = new collections_1.Dictionary(); }\n this._httpClient = _httpClient;\n this._digests = _digests;\n }\n DigestCache.prototype.getDigest = function (webUrl) {\n var self = this;\n var cachedDigest = this._digests.get(webUrl);\n if (cachedDigest !== null) {\n var now = new Date();\n if (now < cachedDigest.expiration) {\n return Promise.resolve(cachedDigest.value);\n }\n }\n var url = util_1.Util.combinePaths(webUrl, \"/_api/contextinfo\");\n return self._httpClient.fetchRaw(url, {\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Accept\": \"application/json;odata=verbose\",\n \"Content-type\": \"application/json;odata=verbose;charset=utf-8\",\n },\n method: \"POST\",\n }).then(function (response) {\n var parser = new odata_1.ODataDefaultParser();\n return parser.parse(response).then(function (d) { return d.GetContextWebInformation; });\n }).then(function (data) {\n var newCachedDigest = new CachedDigest();\n newCachedDigest.value = data.FormDigestValue;\n var seconds = data.FormDigestTimeoutSeconds;\n var expiration = new Date();\n expiration.setTime(expiration.getTime() + 1000 * seconds);\n newCachedDigest.expiration = expiration;\n self._digests.add(webUrl, newCachedDigest);\n return newCachedDigest.value;\n });\n };\n DigestCache.prototype.clear = function () {\n this._digests.clear();\n };\n return DigestCache;\n}());\nexports.DigestCache = DigestCache;\n","\"use strict\";\nvar FetchClient = (function () {\n function FetchClient() {\n }\n FetchClient.prototype.fetch = function (url, options) {\n return global.fetch(url, options);\n };\n return FetchClient;\n}());\nexports.FetchClient = FetchClient;\n","\"use strict\";\nvar fetchclient_1 = require(\"./fetchclient\");\nvar digestcache_1 = require(\"./digestcache\");\nvar util_1 = require(\"../utils/util\");\nvar pnplibconfig_1 = require(\"../configuration/pnplibconfig\");\nvar sprequestexecutorclient_1 = require(\"./sprequestexecutorclient\");\nvar nodefetchclient_1 = require(\"./nodefetchclient\");\nvar HttpClient = (function () {\n function HttpClient() {\n this._impl = this.getFetchImpl();\n this._digestCache = new digestcache_1.DigestCache(this);\n }\n HttpClient.prototype.fetch = function (url, options) {\n if (options === void 0) { options = {}; }\n var self = this;\n var opts = util_1.Util.extend(options, { cache: \"no-cache\", credentials: \"same-origin\" }, true);\n var headers = new Headers();\n this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers);\n this.mergeHeaders(headers, options.headers);\n if (!headers.has(\"Accept\")) {\n headers.append(\"Accept\", \"application/json\");\n }\n if (!headers.has(\"Content-Type\")) {\n headers.append(\"Content-Type\", \"application/json;odata=verbose;charset=utf-8\");\n }\n if (!headers.has(\"X-ClientService-ClientTag\")) {\n headers.append(\"X-ClientService-ClientTag\", \"PnPCoreJS:1.0.4\");\n }\n opts = util_1.Util.extend(opts, { headers: headers });\n if (opts.method && opts.method.toUpperCase() !== \"GET\") {\n if (!headers.has(\"X-RequestDigest\")) {\n var index = url.indexOf(\"_api/\");\n if (index < 0) {\n throw new Error(\"Unable to determine API url\");\n }\n var webUrl = url.substr(0, index);\n return this._digestCache.getDigest(webUrl)\n .then(function (digest) {\n headers.append(\"X-RequestDigest\", digest);\n return self.fetchRaw(url, opts);\n });\n }\n }\n return self.fetchRaw(url, opts);\n };\n HttpClient.prototype.fetchRaw = function (url, options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n var rawHeaders = new Headers();\n this.mergeHeaders(rawHeaders, options.headers);\n options = util_1.Util.extend(options, { headers: rawHeaders });\n var retry = function (ctx) {\n _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {\n var delay = ctx.delay;\n if (response.status !== 429 && response.status !== 503) {\n ctx.reject(response);\n }\n ctx.delay *= 2;\n ctx.attempts++;\n if (ctx.retryCount <= ctx.attempts) {\n ctx.reject(response);\n }\n setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay);\n });\n };\n return new Promise(function (resolve, reject) {\n var retryContext = {\n attempts: 0,\n delay: 100,\n reject: reject,\n resolve: resolve,\n retryCount: 7,\n };\n retry.call(_this, retryContext);\n });\n };\n HttpClient.prototype.get = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"GET\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.post = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"POST\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.getFetchImpl = function () {\n if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) {\n return new sprequestexecutorclient_1.SPRequestExecutorClient();\n }\n else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) {\n var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions;\n return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret);\n }\n else {\n return new fetchclient_1.FetchClient();\n }\n };\n HttpClient.prototype.mergeHeaders = function (target, source) {\n if (typeof source !== \"undefined\" && source !== null) {\n var temp = new Request(\"\", { headers: source });\n temp.headers.forEach(function (value, name) {\n target.append(name, value);\n });\n }\n };\n return HttpClient;\n}());\nexports.HttpClient = HttpClient;\n","\"use strict\";\nvar NodeFetchClient = (function () {\n function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) {\n if (_realm === void 0) { _realm = \"\"; }\n this.siteUrl = siteUrl;\n this._clientId = _clientId;\n this._clientSecret = _clientSecret;\n this._realm = _realm;\n }\n NodeFetchClient.prototype.fetch = function (url, options) {\n throw new Error(\"Using NodeFetchClient in the browser is not supported.\");\n };\n return NodeFetchClient;\n}());\nexports.NodeFetchClient = NodeFetchClient;\n","\"use strict\";\nvar util_1 = require(\"../utils/util\");\nvar SPRequestExecutorClient = (function () {\n function SPRequestExecutorClient() {\n this.convertToResponse = function (spResponse) {\n var responseHeaders = new Headers();\n for (var h in spResponse.headers) {\n if (spResponse.headers[h]) {\n responseHeaders.append(h, spResponse.headers[h]);\n }\n }\n return new Response(spResponse.body, {\n headers: responseHeaders,\n status: spResponse.statusCode,\n statusText: spResponse.statusText,\n });\n };\n }\n SPRequestExecutorClient.prototype.fetch = function (url, options) {\n var _this = this;\n if (typeof SP === \"undefined\" || typeof SP.RequestExecutor === \"undefined\") {\n throw new Error(\"SP.RequestExecutor is undefined. \" +\n \"Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library.\");\n }\n var addinWebUrl = url.substring(0, url.indexOf(\"/_api\")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp;\n if (options.headers && options.headers instanceof Headers) {\n iterator = options.headers.entries();\n temp = iterator.next();\n while (!temp.done) {\n headers[temp.value[0]] = temp.value[1];\n temp = iterator.next();\n }\n }\n else {\n headers = options.headers;\n }\n return new Promise(function (resolve, reject) {\n var requestOptions = {\n error: function (error) {\n reject(_this.convertToResponse(error));\n },\n headers: headers,\n method: options.method,\n success: function (response) {\n resolve(_this.convertToResponse(response));\n },\n url: url,\n };\n if (options.body) {\n util_1.Util.extend(requestOptions, { body: options.body });\n }\n else {\n util_1.Util.extend(requestOptions, { binaryStringRequestBody: true });\n }\n executor.executeAsync(requestOptions);\n });\n };\n return SPRequestExecutorClient;\n}());\nexports.SPRequestExecutorClient = SPRequestExecutorClient;\n","\"use strict\";\nvar util_1 = require(\"./utils/util\");\nvar storage_1 = require(\"./utils/storage\");\nvar configuration_1 = require(\"./configuration/configuration\");\nvar logging_1 = require(\"./utils/logging\");\nvar rest_1 = require(\"./sharepoint/rest/rest\");\nvar pnplibconfig_1 = require(\"./configuration/pnplibconfig\");\nexports.util = util_1.Util;\nexports.sp = new rest_1.Rest();\nexports.storage = new storage_1.PnPClientStorage();\nexports.config = new configuration_1.Settings();\nexports.log = logging_1.Logger;\nexports.setup = pnplibconfig_1.setRuntimeConfig;\nvar Def = {\n config: exports.config,\n log: exports.log,\n setup: exports.setup,\n sp: exports.sp,\n storage: exports.storage,\n util: exports.util,\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = Def;\n","\"use strict\";\nvar storage_1 = require(\"../../utils/storage\");\nvar util_1 = require(\"../../utils/util\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar CachingOptions = (function () {\n function CachingOptions(key) {\n this.key = key;\n this.expiration = util_1.Util.dateAdd(new Date(), \"second\", pnplibconfig_1.RuntimeConfig.defaultCachingTimeoutSeconds);\n this.storeName = pnplibconfig_1.RuntimeConfig.defaultCachingStore;\n }\n Object.defineProperty(CachingOptions.prototype, \"store\", {\n get: function () {\n if (this.storeName === \"local\") {\n return CachingOptions.storage.local;\n }\n else {\n return CachingOptions.storage.session;\n }\n },\n enumerable: true,\n configurable: true\n });\n CachingOptions.storage = new storage_1.PnPClientStorage();\n return CachingOptions;\n}());\nexports.CachingOptions = CachingOptions;\nvar CachingParserWrapper = (function () {\n function CachingParserWrapper(_parser, _cacheOptions) {\n this._parser = _parser;\n this._cacheOptions = _cacheOptions;\n }\n CachingParserWrapper.prototype.parse = function (response) {\n var _this = this;\n return this._parser.parse(response).then(function (data) {\n if (_this._cacheOptions.store !== null) {\n _this._cacheOptions.store.put(_this._cacheOptions.key, data, _this._cacheOptions.expiration);\n }\n return data;\n });\n };\n return CachingParserWrapper;\n}());\nexports.CachingParserWrapper = CachingParserWrapper;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar ContentTypes = (function (_super) {\n __extends(ContentTypes, _super);\n function ContentTypes(baseUrl, path) {\n if (path === void 0) { path = \"contenttypes\"; }\n _super.call(this, baseUrl, path);\n }\n ContentTypes.prototype.getById = function (id) {\n var ct = new ContentType(this);\n ct.concat(\"('\" + id + \"')\");\n return ct;\n };\n return ContentTypes;\n}(queryable_1.QueryableCollection));\nexports.ContentTypes = ContentTypes;\nvar ContentType = (function (_super) {\n __extends(ContentType, _super);\n function ContentType(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(ContentType.prototype, \"descriptionResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"descriptionResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fieldLinks\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldLinks\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"nameResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"nameResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"parent\", {\n get: function () {\n return new queryable_1.Queryable(this, \"parent\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"workflowAssociations\", {\n get: function () {\n return new queryable_1.Queryable(this, \"workflowAssociations\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplate\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplate\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplateUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplateUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"readOnly\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnly\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"stringId\", {\n get: function () {\n return new queryable_1.Queryable(this, \"stringId\");\n },\n enumerable: true,\n configurable: true\n });\n return ContentType;\n}(queryable_1.QueryableInstance));\nexports.ContentType = ContentType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Types = require(\"./types\");\nvar Fields = (function (_super) {\n __extends(Fields, _super);\n function Fields(baseUrl, path) {\n if (path === void 0) { path = \"fields\"; }\n _super.call(this, baseUrl, path);\n }\n Fields.prototype.getByTitle = function (title) {\n return new Field(this, \"getByTitle('\" + title + \"')\");\n };\n Fields.prototype.getByInternalNameOrTitle = function (name) {\n return new Field(this, \"getByInternalNameOrTitle('\" + name + \"')\");\n };\n Fields.prototype.getById = function (id) {\n var f = new Field(this);\n f.concat(\"('\" + id + \"')\");\n return f;\n };\n Fields.prototype.createFieldAsXml = function (xml) {\n var _this = this;\n var info;\n if (typeof xml === \"string\") {\n info = { SchemaXml: xml };\n }\n else {\n info = xml;\n }\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": {\n \"type\": \"SP.XmlSchemaFieldCreationInformation\",\n },\n }, info),\n });\n var q = new Fields(this, \"createfieldasxml\");\n return q.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.add = function (title, fieldType, properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n \"Title\": title,\n }, properties));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.addText = function (title, maxLength, properties) {\n if (maxLength === void 0) { maxLength = 255; }\n var props = {\n FieldTypeKind: 2,\n };\n return this.add(title, \"SP.FieldText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) {\n if (outputType === void 0) { outputType = Types.FieldTypes.Text; }\n var props = {\n DateFormat: dateFormat,\n FieldTypeKind: 17,\n Formula: formula,\n OutputType: outputType,\n };\n return this.add(title, \"SP.FieldCalculated\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.DateTimeFieldFormatType.DateOnly; }\n if (calendarType === void 0) { calendarType = Types.CalendarType.Gregorian; }\n if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = 0; }\n var props = {\n DateTimeCalendarType: calendarType,\n DisplayFormat: displayFormat,\n FieldTypeKind: 4,\n FriendlyDisplayFormat: friendlyDisplayFormat,\n };\n return this.add(title, \"SP.FieldDateTime\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addNumber = function (title, minValue, maxValue, properties) {\n var props = { FieldTypeKind: 9 };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldNumber\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) {\n if (currencyLocalId === void 0) { currencyLocalId = 1033; }\n var props = {\n CurrencyLocaleId: currencyLocalId,\n FieldTypeKind: 10,\n };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldCurrency\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addMultilineText = function (title, numberOfLines, richText, restrictedMode, appendOnly, allowHyperlink, properties) {\n if (numberOfLines === void 0) { numberOfLines = 6; }\n if (richText === void 0) { richText = true; }\n if (restrictedMode === void 0) { restrictedMode = false; }\n if (appendOnly === void 0) { appendOnly = false; }\n if (allowHyperlink === void 0) { allowHyperlink = true; }\n var props = {\n AllowHyperlink: allowHyperlink,\n AppendOnly: appendOnly,\n FieldTypeKind: 3,\n NumberOfLines: numberOfLines,\n RestrictedMode: restrictedMode,\n RichText: richText,\n };\n return this.add(title, \"SP.FieldMultiLineText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addUrl = function (title, displayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.UrlFieldFormatType.Hyperlink; }\n var props = {\n DisplayFormat: displayFormat,\n FieldTypeKind: 11,\n };\n return this.add(title, \"SP.FieldUrl\", util_1.Util.extend(props, properties));\n };\n return Fields;\n}(queryable_1.QueryableCollection));\nexports.Fields = Fields;\nvar Field = (function (_super) {\n __extends(Field, _super);\n function Field(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Field.prototype, \"canBeDeleted\", {\n get: function () {\n return new queryable_1.Queryable(this, \"canBeDeleted\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"defaultValue\", {\n get: function () {\n return new queryable_1.Queryable(this, \"defaultValue\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"direction\", {\n get: function () {\n return new queryable_1.Queryable(this, \"direction\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"enforceUniqueValues\", {\n get: function () {\n return new queryable_1.Queryable(this, \"enforceUniqueValues\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"entityPropertyName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"entityPropertyName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"filterable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"filterable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fromBaseType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fromBaseType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"indexed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"indexed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"internalName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"internalName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"readOnlyField\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnlyField\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"required\", {\n get: function () {\n return new queryable_1.Queryable(this, \"required\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sortable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sortable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"staticName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"staticName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fieldTypeKind\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldTypeKind\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeAsString\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeAsString\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeDisplayName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeDisplayName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeShortDescription\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeShortDescription\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationFormula\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationFormula\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationMessage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationMessage\");\n },\n enumerable: true,\n configurable: true\n });\n Field.prototype.update = function (properties, fieldType) {\n var _this = this;\n if (fieldType === void 0) { fieldType = \"SP.Field\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n field: _this,\n };\n });\n };\n Field.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Field.prototype.setShowInDisplayForm = function (show) {\n var q = new Field(this, \"setshowindisplayform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInEditForm = function (show) {\n var q = new Field(this, \"setshowineditform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInNewForm = function (show) {\n var q = new Field(this, \"setshowinnewform(\" + show + \")\");\n return q.post();\n };\n return Field;\n}(queryable_1.QueryableInstance));\nexports.Field = Field;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar items_1 = require(\"./items\");\nvar Files = (function (_super) {\n __extends(Files, _super);\n function Files(baseUrl, path) {\n if (path === void 0) { path = \"files\"; }\n _super.call(this, baseUrl, path);\n }\n Files.prototype.getByName = function (name) {\n var f = new File(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Files.prototype.add = function (url, content, shouldOverWrite) {\n var _this = this;\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new Files(this, \"add(overwrite=\" + shouldOverWrite + \",url='\" + url + \"')\")\n .post({ body: content }).then(function (response) {\n return {\n data: response,\n file: _this.getByName(url),\n };\n });\n };\n Files.prototype.addTemplateFile = function (fileUrl, templateFileType) {\n var _this = this;\n return new Files(this, \"addTemplateFile(urloffile='\" + fileUrl + \"',templatefiletype=\" + templateFileType + \")\")\n .post().then(function (response) {\n return {\n data: response,\n file: _this.getByName(fileUrl),\n };\n });\n };\n return Files;\n}(queryable_1.QueryableCollection));\nexports.Files = Files;\nvar File = (function (_super) {\n __extends(File, _super);\n function File(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(File.prototype, \"author\", {\n get: function () {\n return new queryable_1.Queryable(this, \"author\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkedOutByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkedOutByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkOutType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkOutType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"contentTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"contentTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"customizedPageStatus\", {\n get: function () {\n return new queryable_1.Queryable(this, \"customizedPageStatus\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"eTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"eTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"exists\", {\n get: function () {\n return new queryable_1.Queryable(this, \"exists\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"length\", {\n get: function () {\n return new queryable_1.Queryable(this, \"length\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"level\", {\n get: function () {\n return new queryable_1.Queryable(this, \"level\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"lockedByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"lockedByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"majorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"majorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"minorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"minorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"modifiedBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"modifiedBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeCreated\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeCreated\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeLastModified\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeLastModified\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"versions\", {\n get: function () {\n return new Versions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"value\", {\n get: function () {\n return new queryable_1.Queryable(this, \"$value\");\n },\n enumerable: true,\n configurable: true\n });\n File.prototype.approve = function (comment) {\n return new File(this, \"approve(comment='\" + comment + \"')\").post();\n };\n File.prototype.cancelUpload = function (uploadId) {\n return new File(this, \"cancelUpload(uploadId=guid'\" + uploadId + \"')\").post();\n };\n File.prototype.checkin = function (comment, checkinType) {\n if (comment === void 0) { comment = \"\"; }\n if (checkinType === void 0) { checkinType = CheckinType.Major; }\n return new File(this, \"checkin(comment='\" + comment + \"',checkintype=\" + checkinType + \")\").post();\n };\n File.prototype.checkout = function () {\n return new File(this, \"checkout\").post();\n };\n File.prototype.continueUpload = function (uploadId, fileOffset, b) {\n return new File(this, \"continueUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\").postAs({ body: b });\n };\n File.prototype.copyTo = function (url, shouldOverWrite) {\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new File(this, \"copyTo(strnewurl='\" + url + \"',boverwrite=\" + shouldOverWrite + \")\").post();\n };\n File.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new File(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n File.prototype.deny = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"deny(comment='\" + comment + \"')\").post();\n };\n File.prototype.finishUpload = function (uploadId, fileOffset, fragment) {\n return new File(this, \"finishUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\")\n .postAs({ body: fragment }).then(function (response) {\n return {\n data: response,\n file: new File(response.ServerRelativeUrl),\n };\n });\n };\n File.prototype.getLimitedWebPartManager = function (scope) {\n if (scope === void 0) { scope = WebPartsPersonalizationScope.User; }\n return new queryable_1.Queryable(this, \"getLimitedWebPartManager(scope=\" + scope + \")\");\n };\n File.prototype.moveTo = function (url, moveOperations) {\n if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; }\n return new File(this, \"moveTo(newurl='\" + url + \"',flags=\" + moveOperations + \")\").post();\n };\n File.prototype.openBinaryStream = function () {\n return new queryable_1.Queryable(this, \"openBinaryStream\");\n };\n File.prototype.publish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"publish(comment='\" + comment + \"')\").post();\n };\n File.prototype.recycle = function () {\n return new File(this, \"recycle\").post();\n };\n File.prototype.saveBinaryStream = function (data) {\n return new File(this, \"saveBinary\").post({ body: data });\n };\n File.prototype.startUpload = function (uploadId, fragment) {\n return new File(this, \"startUpload(uploadId=guid'\" + uploadId + \"')\").postAs({ body: fragment });\n };\n File.prototype.undoCheckout = function () {\n return new File(this, \"undoCheckout\").post();\n };\n File.prototype.unpublish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"unpublish(comment='\" + comment + \"')\").post();\n };\n return File;\n}(queryable_1.QueryableInstance));\nexports.File = File;\nvar Versions = (function (_super) {\n __extends(Versions, _super);\n function Versions(baseUrl, path) {\n if (path === void 0) { path = \"versions\"; }\n _super.call(this, baseUrl, path);\n }\n Versions.prototype.getById = function (versionId) {\n var v = new Version(this);\n v.concat(\"(\" + versionId + \")\");\n return v;\n };\n Versions.prototype.deleteAll = function () {\n return new Versions(this, \"deleteAll\").post();\n };\n Versions.prototype.deleteById = function (versionId) {\n return new Versions(this, \"deleteById(vid=\" + versionId + \")\").post();\n };\n Versions.prototype.deleteByLabel = function (label) {\n return new Versions(this, \"deleteByLabel(versionlabel='\" + label + \"')\").post();\n };\n Versions.prototype.restoreByLabel = function (label) {\n return new Versions(this, \"restoreByLabel(versionlabel='\" + label + \"')\").post();\n };\n return Versions;\n}(queryable_1.QueryableCollection));\nexports.Versions = Versions;\nvar Version = (function (_super) {\n __extends(Version, _super);\n function Version(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Version.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"created\", {\n get: function () {\n return new queryable_1.Queryable(this, \"created\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"createdBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"createdBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"isCurrentVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"isCurrentVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"size\", {\n get: function () {\n return new queryable_1.Queryable(this, \"size\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"url\", {\n get: function () {\n return new queryable_1.Queryable(this, \"url\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"versionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"versionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Version.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return Version;\n}(queryable_1.QueryableInstance));\nexports.Version = Version;\n(function (CheckinType) {\n CheckinType[CheckinType[\"Minor\"] = 0] = \"Minor\";\n CheckinType[CheckinType[\"Major\"] = 1] = \"Major\";\n CheckinType[CheckinType[\"Overwrite\"] = 2] = \"Overwrite\";\n})(exports.CheckinType || (exports.CheckinType = {}));\nvar CheckinType = exports.CheckinType;\n(function (WebPartsPersonalizationScope) {\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"User\"] = 0] = \"User\";\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"Shared\"] = 1] = \"Shared\";\n})(exports.WebPartsPersonalizationScope || (exports.WebPartsPersonalizationScope = {}));\nvar WebPartsPersonalizationScope = exports.WebPartsPersonalizationScope;\n(function (MoveOperations) {\n MoveOperations[MoveOperations[\"Overwrite\"] = 1] = \"Overwrite\";\n MoveOperations[MoveOperations[\"AllowBrokenThickets\"] = 8] = \"AllowBrokenThickets\";\n})(exports.MoveOperations || (exports.MoveOperations = {}));\nvar MoveOperations = exports.MoveOperations;\n(function (TemplateFileType) {\n TemplateFileType[TemplateFileType[\"StandardPage\"] = 0] = \"StandardPage\";\n TemplateFileType[TemplateFileType[\"WikiPage\"] = 1] = \"WikiPage\";\n TemplateFileType[TemplateFileType[\"FormPage\"] = 2] = \"FormPage\";\n})(exports.TemplateFileType || (exports.TemplateFileType = {}));\nvar TemplateFileType = exports.TemplateFileType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar files_1 = require(\"./files\");\nvar items_1 = require(\"./items\");\nvar Folders = (function (_super) {\n __extends(Folders, _super);\n function Folders(baseUrl, path) {\n if (path === void 0) { path = \"folders\"; }\n _super.call(this, baseUrl, path);\n }\n Folders.prototype.getByName = function (name) {\n var f = new Folder(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Folders.prototype.add = function (url) {\n var _this = this;\n return new Folders(this, \"add('\" + url + \"')\").post().then(function (response) {\n return {\n data: response,\n folder: _this.getByName(url),\n };\n });\n };\n return Folders;\n}(queryable_1.QueryableCollection));\nexports.Folders = Folders;\nvar Folder = (function (_super) {\n __extends(Folder, _super);\n function Folder(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Folder.prototype, \"contentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"contentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"files\", {\n get: function () {\n return new files_1.Files(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"folders\", {\n get: function () {\n return new Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"itemCount\", {\n get: function () {\n return new queryable_1.Queryable(this, \"itemCount\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"parentFolder\", {\n get: function () {\n return new Folder(this, \"parentFolder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"properties\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"properties\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"uniqueContentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"uniqueContentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"welcomePage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"welcomePage\");\n },\n enumerable: true,\n configurable: true\n });\n Folder.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new Folder(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Folder.prototype.recycle = function () {\n return new Folder(this, \"recycle\").post();\n };\n return Folder;\n}(queryable_1.QueryableInstance));\nexports.Folder = Folder;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Forms = (function (_super) {\n __extends(Forms, _super);\n function Forms(baseUrl, path) {\n if (path === void 0) { path = \"forms\"; }\n _super.call(this, baseUrl, path);\n }\n Forms.prototype.getById = function (id) {\n var i = new Form(this);\n i.concat(\"('\" + id + \"')\");\n return i;\n };\n return Forms;\n}(queryable_1.QueryableCollection));\nexports.Forms = Forms;\nvar Form = (function (_super) {\n __extends(Form, _super);\n function Form(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n return Form;\n}(queryable_1.QueryableInstance));\nexports.Form = Form;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar folders_1 = require(\"./folders\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar util_1 = require(\"../../utils/util\");\nvar odata_1 = require(\"./odata\");\nvar Items = (function (_super) {\n __extends(Items, _super);\n function Items(baseUrl, path) {\n if (path === void 0) { path = \"items\"; }\n _super.call(this, baseUrl, path);\n }\n Items.prototype.getById = function (id) {\n var i = new Item(this);\n i.concat(\"(\" + id + \")\");\n return i;\n };\n Items.prototype.skip = function (skip) {\n this._query.add(\"$skiptoken\", encodeURIComponent(\"Paged=TRUE&p_ID=\" + skip));\n return this;\n };\n Items.prototype.getPaged = function () {\n return this.getAs(new PagedItemCollectionParser());\n };\n Items.prototype.add = function (properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance);\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n item: _this.getById(data.Id),\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n return Items;\n}(queryable_1.QueryableCollection));\nexports.Items = Items;\nvar PagedItemCollectionParser = (function (_super) {\n __extends(PagedItemCollectionParser, _super);\n function PagedItemCollectionParser() {\n _super.apply(this, arguments);\n }\n PagedItemCollectionParser.prototype.parse = function (r) {\n return PagedItemCollection.fromResponse(r);\n };\n return PagedItemCollectionParser;\n}(odata_1.ODataParserBase));\nvar Item = (function (_super) {\n __extends(Item, _super);\n function Item(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Item.prototype, \"attachmentFiles\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"AttachmentFiles\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"contentType\", {\n get: function () {\n return new contenttypes_1.ContentType(this, \"ContentType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissionsForUI\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissionsForUI\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsHTML\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsHTML\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsText\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsText\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesForEdit\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesForEdit\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"folder\", {\n get: function () {\n return new folders_1.Folder(this, \"Folder\");\n },\n enumerable: true,\n configurable: true\n });\n Item.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance, this.parentUrl.substr(0, this.parentUrl.lastIndexOf(\"/\")));\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n item: _this,\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n Item.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Item.prototype.recycle = function () {\n var i = new Item(this, \"recycle\");\n return i.post();\n };\n Item.prototype.getWopiFrameUrl = function (action) {\n if (action === void 0) { action = 0; }\n var i = new Item(this, \"getWOPIFrameUrl(@action)\");\n i._query.add(\"@action\", action);\n return i.post().then(function (data) {\n return data.GetWOPIFrameUrl;\n });\n };\n Item.prototype.validateUpdateListItem = function (formValues, newDocumentUpdate) {\n if (newDocumentUpdate === void 0) { newDocumentUpdate = false; }\n var postBody = JSON.stringify({ \"formValues\": formValues, bNewDocumentUpdate: newDocumentUpdate });\n var item = new Item(this, \"validateupdatelistitem\");\n return item.post({ body: postBody });\n };\n return Item;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Item = Item;\nvar PagedItemCollection = (function () {\n function PagedItemCollection() {\n }\n Object.defineProperty(PagedItemCollection.prototype, \"hasNext\", {\n get: function () {\n return typeof this.nextUrl === \"string\" && this.nextUrl.length > 0;\n },\n enumerable: true,\n configurable: true\n });\n PagedItemCollection.fromResponse = function (r) {\n return r.json().then(function (d) {\n var col = new PagedItemCollection();\n col.nextUrl = d[\"odata.nextLink\"];\n col.results = d.value;\n return col;\n });\n };\n PagedItemCollection.prototype.getNext = function () {\n if (this.hasNext) {\n var items = new Items(this.nextUrl, null);\n return items.getPaged();\n }\n return new Promise(function (r) { return r(null); });\n };\n return PagedItemCollection;\n}());\nexports.PagedItemCollection = PagedItemCollection;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar items_1 = require(\"./items\");\nvar views_1 = require(\"./views\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar fields_1 = require(\"./fields\");\nvar forms_1 = require(\"./forms\");\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar util_1 = require(\"../../utils/util\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Lists = (function (_super) {\n __extends(Lists, _super);\n function Lists(baseUrl, path) {\n if (path === void 0) { path = \"lists\"; }\n _super.call(this, baseUrl, path);\n }\n Lists.prototype.getByTitle = function (title) {\n return new List(this, \"getByTitle('\" + title + \"')\");\n };\n Lists.prototype.getById = function (id) {\n var list = new List(this);\n list.concat(\"('\" + id + \"')\");\n return list;\n };\n Lists.prototype.add = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n \"AllowContentTypes\": enableContentTypes,\n \"BaseTemplate\": template,\n \"ContentTypesEnabled\": enableContentTypes,\n \"Description\": description,\n \"Title\": title,\n }, additionalSettings));\n return this.post({ body: postBody }).then(function (data) {\n return { data: data, list: _this.getByTitle(title) };\n });\n };\n Lists.prototype.ensure = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n if (this.hasBatch) {\n throw new Error(\"The ensure method is not supported as part of a batch.\");\n }\n return new Promise(function (resolve, reject) {\n var list = _this.getByTitle(title);\n list.get().then(function (d) { return resolve({ created: false, data: d, list: list }); }).catch(function () {\n _this.add(title, description, template, enableContentTypes, additionalSettings).then(function (r) {\n resolve({ created: true, data: r.data, list: _this.getByTitle(title) });\n });\n }).catch(function (e) { return reject(e); });\n });\n };\n Lists.prototype.ensureSiteAssetsLibrary = function () {\n var q = new Lists(this, \"ensuresiteassetslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n Lists.prototype.ensureSitePagesLibrary = function () {\n var q = new Lists(this, \"ensuresitepageslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n return Lists;\n}(queryable_1.QueryableCollection));\nexports.Lists = Lists;\nvar List = (function (_super) {\n __extends(List, _super);\n function List(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(List.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"items\", {\n get: function () {\n return new items_1.Items(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"views\", {\n get: function () {\n return new views_1.Views(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"forms\", {\n get: function () {\n return new forms_1.Forms(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"defaultView\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"DefaultView\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"eventReceivers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"EventReceivers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"relatedFields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"getRelatedFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"informationRightsManagementSettings\", {\n get: function () {\n return new queryable_1.Queryable(this, \"InformationRightsManagementSettings\");\n },\n enumerable: true,\n configurable: true\n });\n List.prototype.getView = function (viewId) {\n return new views_1.View(this, \"getView('\" + viewId + \"')\");\n };\n List.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retList = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retList = _this.getParent(List, _this.parentUrl, \"getByTitle('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n list: retList,\n };\n });\n };\n List.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n List.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new List(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n List.prototype.getItemsByCAMLQuery = function (query) {\n var expands = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n expands[_i - 1] = arguments[_i];\n }\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.CamlQuery\" } }, query) });\n var q = new List(this, \"getitems\");\n q = q.expand.apply(q, expands);\n return q.post({ body: postBody });\n };\n List.prototype.getListItemChangesSinceToken = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeLogItemQuery\" } }, query) });\n var q = new List(this, \"getlistitemchangessincetoken\");\n return q.post({ body: postBody }, { parse: function (r) { return r.text(); } });\n };\n List.prototype.recycle = function () {\n this.append(\"recycle\");\n return this.post().then(function (data) {\n if (data.hasOwnProperty(\"Recycle\")) {\n return data.Recycle;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListData = function (viewXml) {\n var q = new List(this, \"renderlistdata(@viewXml)\");\n q.query.add(\"@viewXml\", \"'\" + viewXml + \"'\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"RenderListData\")) {\n return data.RenderListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListFormData = function (itemId, formId, mode) {\n var q = new List(this, \"renderlistformdata(itemid=\" + itemId + \", formid='\" + formId + \"', mode=\" + mode + \")\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"ListData\")) {\n return data.ListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.reserveListItemId = function () {\n var q = new List(this, \"reservelistitemid\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"ReserveListItemId\")) {\n return data.ReserveListItemId;\n }\n else {\n return data;\n }\n });\n };\n return List;\n}(queryablesecurable_1.QueryableSecurable));\nexports.List = List;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar quicklaunch_1 = require(\"./quicklaunch\");\nvar topnavigationbar_1 = require(\"./topnavigationbar\");\nvar Navigation = (function (_super) {\n __extends(Navigation, _super);\n function Navigation(baseUrl) {\n _super.call(this, baseUrl, \"navigation\");\n }\n Object.defineProperty(Navigation.prototype, \"quicklaunch\", {\n get: function () {\n return new quicklaunch_1.QuickLaunch(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Navigation.prototype, \"topNavigationBar\", {\n get: function () {\n return new topnavigationbar_1.TopNavigationBar(this);\n },\n enumerable: true,\n configurable: true\n });\n return Navigation;\n}(queryable_1.Queryable));\nexports.Navigation = Navigation;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar logging_1 = require(\"../../utils/logging\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nfunction extractOdataId(candidate) {\n if (candidate.hasOwnProperty(\"odata.id\")) {\n return candidate[\"odata.id\"];\n }\n else if (candidate.hasOwnProperty(\"__metadata\") && candidate.__metadata.hasOwnProperty(\"id\")) {\n return candidate.__metadata.id;\n }\n else {\n logging_1.Logger.log({\n data: candidate,\n level: logging_1.Logger.LogLevel.Error,\n message: \"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\",\n });\n throw new Error(\"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\");\n }\n}\nexports.extractOdataId = extractOdataId;\nvar ODataParserBase = (function () {\n function ODataParserBase() {\n }\n ODataParserBase.prototype.parse = function (r) {\n return r.json().then(function (json) {\n var result = json;\n if (json.hasOwnProperty(\"d\")) {\n if (json.d.hasOwnProperty(\"results\")) {\n result = json.d.results;\n }\n else {\n result = json.d;\n }\n }\n else if (json.hasOwnProperty(\"value\")) {\n result = json.value;\n }\n return result;\n });\n };\n return ODataParserBase;\n}());\nexports.ODataParserBase = ODataParserBase;\nvar ODataDefaultParser = (function (_super) {\n __extends(ODataDefaultParser, _super);\n function ODataDefaultParser() {\n _super.apply(this, arguments);\n }\n return ODataDefaultParser;\n}(ODataParserBase));\nexports.ODataDefaultParser = ODataDefaultParser;\nvar ODataRawParserImpl = (function () {\n function ODataRawParserImpl() {\n }\n ODataRawParserImpl.prototype.parse = function (r) {\n return r.json();\n };\n return ODataRawParserImpl;\n}());\nexports.ODataRawParserImpl = ODataRawParserImpl;\nvar ODataValueParserImpl = (function (_super) {\n __extends(ODataValueParserImpl, _super);\n function ODataValueParserImpl() {\n _super.apply(this, arguments);\n }\n ODataValueParserImpl.prototype.parse = function (r) {\n return _super.prototype.parse.call(this, r).then(function (d) { return d; });\n };\n return ODataValueParserImpl;\n}(ODataParserBase));\nvar ODataEntityParserImpl = (function (_super) {\n __extends(ODataEntityParserImpl, _super);\n function ODataEntityParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n var o = new _this.factory(getEntityUrl(d), null);\n return util_1.Util.extend(o, d);\n });\n };\n return ODataEntityParserImpl;\n}(ODataParserBase));\nvar ODataEntityArrayParserImpl = (function (_super) {\n __extends(ODataEntityArrayParserImpl, _super);\n function ODataEntityArrayParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityArrayParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n return d.map(function (v) {\n var o = new _this.factory(getEntityUrl(v), null);\n return util_1.Util.extend(o, v);\n });\n });\n };\n return ODataEntityArrayParserImpl;\n}(ODataParserBase));\nfunction getEntityUrl(entity) {\n if (entity.hasOwnProperty(\"__metadata\")) {\n return entity.__metadata.uri;\n }\n else if (entity.hasOwnProperty(\"odata.editLink\")) {\n return util_1.Util.combinePaths(\"_api\", entity[\"odata.editLink\"]);\n }\n else {\n logging_1.Logger.write(\"No uri information found in ODataEntity parsing, chaining will fail for this object.\", logging_1.Logger.LogLevel.Warning);\n return \"\";\n }\n}\nexports.ODataRaw = new ODataRawParserImpl();\nfunction ODataValue() {\n return new ODataValueParserImpl();\n}\nexports.ODataValue = ODataValue;\nfunction ODataEntity(factory) {\n return new ODataEntityParserImpl(factory);\n}\nexports.ODataEntity = ODataEntity;\nfunction ODataEntityArray(factory) {\n return new ODataEntityArrayParserImpl(factory);\n}\nexports.ODataEntityArray = ODataEntityArray;\nvar ODataBatch = (function () {\n function ODataBatch(_batchId) {\n if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); }\n this._batchId = _batchId;\n this._requests = [];\n this._batchDepCount = 0;\n }\n ODataBatch.prototype.add = function (url, method, options, parser) {\n var info = {\n method: method.toUpperCase(),\n options: options,\n parser: parser,\n reject: null,\n resolve: null,\n url: url,\n };\n var p = new Promise(function (resolve, reject) {\n info.resolve = resolve;\n info.reject = reject;\n });\n this._requests.push(info);\n return p;\n };\n ODataBatch.prototype.incrementBatchDep = function () {\n this._batchDepCount++;\n };\n ODataBatch.prototype.decrementBatchDep = function () {\n this._batchDepCount--;\n };\n ODataBatch.prototype.execute = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (_this._batchDepCount > 0) {\n setTimeout(function () { return _this.execute(); }, 100);\n }\n else {\n _this.executeImpl().then(function () { return resolve(); }).catch(reject);\n }\n });\n };\n ODataBatch.prototype.executeImpl = function () {\n var _this = this;\n if (this._requests.length < 1) {\n return new Promise(function (r) { return r(); });\n }\n var batchBody = [];\n var currentChangeSetId = \"\";\n this._requests.forEach(function (reqInfo, index) {\n if (reqInfo.method === \"GET\") {\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n }\n else {\n if (currentChangeSetId.length < 1) {\n currentChangeSetId = util_1.Util.getGUID();\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n batchBody.push(\"Content-Type: multipart/mixed; boundary=\\\"changeset_\" + currentChangeSetId + \"\\\"\\n\\n\");\n }\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"\\n\");\n }\n batchBody.push(\"Content-Type: application/http\\n\");\n batchBody.push(\"Content-Transfer-Encoding: binary\\n\\n\");\n var headers = {\n \"Accept\": \"application/json;\",\n };\n if (reqInfo.method !== \"GET\") {\n var method = reqInfo.method;\n if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers[\"X-HTTP-Method\"] !== typeof undefined) {\n method = reqInfo.options.headers[\"X-HTTP-Method\"];\n delete reqInfo.options.headers[\"X-HTTP-Method\"];\n }\n batchBody.push(method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n headers = util_1.Util.extend(headers, { \"Content-Type\": \"application/json;odata=verbose;charset=utf-8\" });\n }\n else {\n batchBody.push(reqInfo.method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n }\n if (typeof pnplibconfig_1.RuntimeConfig.headers !== \"undefined\") {\n headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers);\n }\n if (reqInfo.options && reqInfo.options.headers) {\n headers = util_1.Util.extend(headers, reqInfo.options.headers);\n }\n for (var name_1 in headers) {\n if (headers.hasOwnProperty(name_1)) {\n batchBody.push(name_1 + \": \" + headers[name_1] + \"\\n\");\n }\n }\n batchBody.push(\"\\n\");\n if (reqInfo.options.body) {\n batchBody.push(reqInfo.options.body + \"\\n\\n\");\n }\n });\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + this._batchId + \"--\\n\");\n var batchHeaders = {\n \"Content-Type\": \"multipart/mixed; boundary=batch_\" + this._batchId,\n };\n var batchOptions = {\n \"body\": batchBody.join(\"\"),\n \"headers\": batchHeaders,\n };\n var client = new httpclient_1.HttpClient();\n return client.post(util_1.Util.makeUrlAbsolute(\"/_api/$batch\"), batchOptions)\n .then(function (r) { return r.text(); })\n .then(this._parseResponse)\n .then(function (responses) {\n if (responses.length !== _this._requests.length) {\n throw new Error(\"Could not properly parse responses to match requests in batch.\");\n }\n var resolutions = [];\n for (var i = 0; i < responses.length; i++) {\n var request = _this._requests[i];\n var response = responses[i];\n if (!response.ok) {\n request.reject(new Error(response.statusText));\n }\n resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject));\n }\n return Promise.all(resolutions);\n });\n };\n ODataBatch.prototype._parseResponse = function (body) {\n return new Promise(function (resolve, reject) {\n var responses = [];\n var header = \"--batchresponse_\";\n var statusRegExp = new RegExp(\"^HTTP/[0-9.]+ +([0-9]+) +(.*)\", \"i\");\n var lines = body.split(\"\\n\");\n var state = \"batch\";\n var status;\n var statusText;\n for (var i = 0; i < lines.length; ++i) {\n var line = lines[i];\n switch (state) {\n case \"batch\":\n if (line.substr(0, header.length) === header) {\n state = \"batchHeaders\";\n }\n else {\n if (line.trim() !== \"\") {\n throw new Error(\"Invalid response, line \" + i);\n }\n }\n break;\n case \"batchHeaders\":\n if (line.trim() === \"\") {\n state = \"status\";\n }\n break;\n case \"status\":\n var parts = statusRegExp.exec(line);\n if (parts.length !== 3) {\n throw new Error(\"Invalid status, line \" + i);\n }\n status = parseInt(parts[1], 10);\n statusText = parts[2];\n state = \"statusHeaders\";\n break;\n case \"statusHeaders\":\n if (line.trim() === \"\") {\n state = \"body\";\n }\n break;\n case \"body\":\n var response = void 0;\n if (status === 204) {\n response = new Response();\n }\n else {\n response = new Response(line, { status: status, statusText: statusText });\n }\n responses.push(response);\n state = \"batch\";\n break;\n }\n }\n if (state !== \"status\") {\n reject(new Error(\"Unexpected end of input\"));\n }\n resolve(responses);\n });\n };\n return ODataBatch;\n}());\nexports.ODataBatch = ODataBatch;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar collections_1 = require(\"../../collections/collections\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar odata_1 = require(\"./odata\");\nvar caching_1 = require(\"./caching\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar Queryable = (function () {\n function Queryable(baseUrl, path) {\n this._query = new collections_1.Dictionary();\n this._batch = null;\n if (typeof baseUrl === \"string\") {\n var urlStr = baseUrl;\n if (urlStr.lastIndexOf(\"/\") < 0) {\n this._parentUrl = urlStr;\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n else if (urlStr.lastIndexOf(\"/\") > urlStr.lastIndexOf(\"(\")) {\n var index = urlStr.lastIndexOf(\"/\");\n this._parentUrl = urlStr.slice(0, index);\n path = util_1.Util.combinePaths(urlStr.slice(index), path);\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n else {\n var index = urlStr.lastIndexOf(\"(\");\n this._parentUrl = urlStr.slice(0, index);\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n }\n else {\n var q = baseUrl;\n this._parentUrl = q._url;\n if (!this.hasBatch && q.hasBatch) {\n this._batch = q._batch;\n }\n var target = q._query.get(\"@target\");\n if (target !== null) {\n this._query.add(\"@target\", target);\n }\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n }\n Queryable.prototype.concat = function (pathPart) {\n this._url += pathPart;\n };\n Queryable.prototype.append = function (pathPart) {\n this._url = util_1.Util.combinePaths(this._url, pathPart);\n };\n Queryable.prototype.addBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.incrementBatchDep();\n }\n };\n Queryable.prototype.clearBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.decrementBatchDep();\n }\n };\n Object.defineProperty(Queryable.prototype, \"hasBatch\", {\n get: function () {\n return this._batch !== null;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"parentUrl\", {\n get: function () {\n return this._parentUrl;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"query\", {\n get: function () {\n return this._query;\n },\n enumerable: true,\n configurable: true\n });\n Queryable.prototype.inBatch = function (batch) {\n if (this._batch !== null) {\n throw new Error(\"This query is already part of a batch.\");\n }\n this._batch = batch;\n return this;\n };\n Queryable.prototype.usingCaching = function (options) {\n if (!pnplibconfig_1.RuntimeConfig.globalCacheDisable) {\n this._useCaching = true;\n this._cachingOptions = options;\n }\n return this;\n };\n Queryable.prototype.toUrl = function () {\n return util_1.Util.makeUrlAbsolute(this._url);\n };\n Queryable.prototype.toUrlAndQuery = function () {\n var _this = this;\n var url = this.toUrl();\n if (this._query.count() > 0) {\n url += \"?\";\n var keys = this._query.getKeys();\n url += keys.map(function (key, ix, arr) { return (key + \"=\" + _this._query.get(key)); }).join(\"&\");\n }\n return url;\n };\n Queryable.prototype.get = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.getAs = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.post = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.postAs = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.getParent = function (factory, baseUrl, path) {\n if (baseUrl === void 0) { baseUrl = this.parentUrl; }\n var parent = new factory(baseUrl, path);\n var target = this.query.get(\"@target\");\n if (target !== null) {\n parent.query.add(\"@target\", target);\n }\n return parent;\n };\n Queryable.prototype.getImpl = function (getOptions, parser) {\n if (getOptions === void 0) { getOptions = {}; }\n if (this._useCaching) {\n var options = new caching_1.CachingOptions(this.toUrlAndQuery().toLowerCase());\n if (typeof this._cachingOptions !== \"undefined\") {\n options = util_1.Util.extend(options, this._cachingOptions);\n }\n if (options.store !== null) {\n var data_1 = options.store.get(options.key);\n if (data_1 !== null) {\n return new Promise(function (resolve) { return resolve(data_1); });\n }\n }\n parser = new caching_1.CachingParserWrapper(parser, options);\n }\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.get(this.toUrlAndQuery(), getOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making GET request: \" + response.statusText;\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"GET\", {}, parser);\n }\n };\n Queryable.prototype.postImpl = function (postOptions, parser) {\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.post(this.toUrlAndQuery(), postOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making POST request: \" + response.statusText;\n }\n if ((response.headers.has(\"Content-Length\") && parseFloat(response.headers.get(\"Content-Length\")) === 0)\n || response.status === 204) {\n return new Promise(function (resolve, reject) { resolve({}); });\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"POST\", postOptions, parser);\n }\n };\n return Queryable;\n}());\nexports.Queryable = Queryable;\nvar QueryableCollection = (function (_super) {\n __extends(QueryableCollection, _super);\n function QueryableCollection() {\n _super.apply(this, arguments);\n }\n QueryableCollection.prototype.filter = function (filter) {\n this._query.add(\"$filter\", filter);\n return this;\n };\n QueryableCollection.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.orderBy = function (orderBy, ascending) {\n if (ascending === void 0) { ascending = false; }\n var keys = this._query.getKeys();\n var query = [];\n var asc = ascending ? \" asc\" : \"\";\n for (var i = 0; i < keys.length; i++) {\n if (keys[i] === \"$orderby\") {\n query.push(this._query.get(\"$orderby\"));\n break;\n }\n }\n query.push(\"\" + orderBy + asc);\n this._query.add(\"$orderby\", query.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.skip = function (skip) {\n this._query.add(\"$skip\", skip.toString());\n return this;\n };\n QueryableCollection.prototype.top = function (top) {\n this._query.add(\"$top\", top.toString());\n return this;\n };\n return QueryableCollection;\n}(Queryable));\nexports.QueryableCollection = QueryableCollection;\nvar QueryableInstance = (function (_super) {\n __extends(QueryableInstance, _super);\n function QueryableInstance() {\n _super.apply(this, arguments);\n }\n QueryableInstance.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableInstance.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n return QueryableInstance;\n}(Queryable));\nexports.QueryableInstance = QueryableInstance;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar roles_1 = require(\"./roles\");\nvar queryable_1 = require(\"./queryable\");\nvar QueryableSecurable = (function (_super) {\n __extends(QueryableSecurable, _super);\n function QueryableSecurable() {\n _super.apply(this, arguments);\n }\n Object.defineProperty(QueryableSecurable.prototype, \"roleAssignments\", {\n get: function () {\n return new roles_1.RoleAssignments(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(QueryableSecurable.prototype, \"firstUniqueAncestorSecurableObject\", {\n get: function () {\n this.append(\"FirstUniqueAncestorSecurableObject\");\n return new queryable_1.QueryableInstance(this);\n },\n enumerable: true,\n configurable: true\n });\n QueryableSecurable.prototype.getUserEffectivePermissions = function (loginName) {\n this.append(\"getUserEffectivePermissions(@user)\");\n this._query.add(\"@user\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return new queryable_1.Queryable(this);\n };\n QueryableSecurable.prototype.breakRoleInheritance = function (copyRoleAssignments, clearSubscopes) {\n if (copyRoleAssignments === void 0) { copyRoleAssignments = false; }\n if (clearSubscopes === void 0) { clearSubscopes = false; }\n var Breaker = (function (_super) {\n __extends(Breaker, _super);\n function Breaker(baseUrl, copy, clear) {\n _super.call(this, baseUrl, \"breakroleinheritance(copyroleassignments=\" + copy + \", clearsubscopes=\" + clear + \")\");\n }\n Breaker.prototype.break = function () {\n return this.post();\n };\n return Breaker;\n }(queryable_1.Queryable));\n var b = new Breaker(this, copyRoleAssignments, clearSubscopes);\n return b.break();\n };\n QueryableSecurable.prototype.resetRoleInheritance = function () {\n var Resetter = (function (_super) {\n __extends(Resetter, _super);\n function Resetter(baseUrl) {\n _super.call(this, baseUrl, \"resetroleinheritance\");\n }\n Resetter.prototype.reset = function () {\n return this.post();\n };\n return Resetter;\n }(queryable_1.Queryable));\n var r = new Resetter(this);\n return r.reset();\n };\n return QueryableSecurable;\n}(queryable_1.QueryableInstance));\nexports.QueryableSecurable = QueryableSecurable;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar QuickLaunch = (function (_super) {\n __extends(QuickLaunch, _super);\n function QuickLaunch(baseUrl) {\n _super.call(this, baseUrl, \"QuickLaunch\");\n }\n return QuickLaunch;\n}(queryable_1.Queryable));\nexports.QuickLaunch = QuickLaunch;\n","\"use strict\";\nvar search_1 = require(\"./search\");\nvar site_1 = require(\"./site\");\nvar webs_1 = require(\"./webs\");\nvar util_1 = require(\"../../utils/util\");\nvar userprofiles_1 = require(\"./userprofiles\");\nvar odata_1 = require(\"./odata\");\nvar Rest = (function () {\n function Rest() {\n }\n Rest.prototype.search = function (query) {\n var finalQuery;\n if (typeof query === \"string\") {\n finalQuery = { Querytext: query };\n }\n else {\n finalQuery = query;\n }\n return new search_1.Search(\"\").execute(finalQuery);\n };\n Object.defineProperty(Rest.prototype, \"site\", {\n get: function () {\n return new site_1.Site(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"web\", {\n get: function () {\n return new webs_1.Web(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"profiles\", {\n get: function () {\n return new userprofiles_1.UserProfileQuery(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Rest.prototype.createBatch = function () {\n return new odata_1.ODataBatch();\n };\n Rest.prototype.crossDomainSite = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(site_1.Site, addInWebUrl, hostWebUrl, \"site\");\n };\n Rest.prototype.crossDomainWeb = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(webs_1.Web, addInWebUrl, hostWebUrl, \"web\");\n };\n Rest.prototype._cdImpl = function (factory, addInWebUrl, hostWebUrl, urlPart) {\n if (!util_1.Util.isUrlAbsolute(addInWebUrl)) {\n throw \"The addInWebUrl parameter must be an absolute url.\";\n }\n if (!util_1.Util.isUrlAbsolute(hostWebUrl)) {\n throw \"The hostWebUrl parameter must be an absolute url.\";\n }\n var url = util_1.Util.combinePaths(addInWebUrl, \"_api/SP.AppContextSite(@target)\");\n var instance = new factory(url, urlPart);\n instance.query.add(\"@target\", \"'\" + encodeURIComponent(hostWebUrl) + \"'\");\n return instance;\n };\n return Rest;\n}());\nexports.Rest = Rest;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar RoleAssignments = (function (_super) {\n __extends(RoleAssignments, _super);\n function RoleAssignments(baseUrl, path) {\n if (path === void 0) { path = \"roleassignments\"; }\n _super.call(this, baseUrl, path);\n }\n RoleAssignments.prototype.add = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"addroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.remove = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"removeroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.getById = function (id) {\n var ra = new RoleAssignment(this);\n ra.concat(\"(\" + id + \")\");\n return ra;\n };\n return RoleAssignments;\n}(queryable_1.QueryableCollection));\nexports.RoleAssignments = RoleAssignments;\nvar RoleAssignment = (function (_super) {\n __extends(RoleAssignment, _super);\n function RoleAssignment(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(RoleAssignment.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoleAssignment.prototype, \"bindings\", {\n get: function () {\n return new RoleDefinitionBindings(this);\n },\n enumerable: true,\n configurable: true\n });\n RoleAssignment.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleAssignment;\n}(queryable_1.QueryableInstance));\nexports.RoleAssignment = RoleAssignment;\nvar RoleDefinitions = (function (_super) {\n __extends(RoleDefinitions, _super);\n function RoleDefinitions(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitions\"; }\n _super.call(this, baseUrl, path);\n }\n RoleDefinitions.prototype.getById = function (id) {\n return new RoleDefinition(this, \"getById(\" + id + \")\");\n };\n RoleDefinitions.prototype.getByName = function (name) {\n return new RoleDefinition(this, \"getbyname('\" + name + \"')\");\n };\n RoleDefinitions.prototype.getByType = function (roleTypeKind) {\n return new RoleDefinition(this, \"getbytype(\" + roleTypeKind + \")\");\n };\n RoleDefinitions.prototype.add = function (name, description, order, basePermissions) {\n var _this = this;\n var postBody = JSON.stringify({\n BasePermissions: util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, basePermissions),\n Description: description,\n Name: name,\n Order: order,\n __metadata: { \"type\": \"SP.RoleDefinition\" },\n });\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n definition: _this.getById(data.Id),\n };\n });\n };\n return RoleDefinitions;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitions = RoleDefinitions;\nvar RoleDefinition = (function (_super) {\n __extends(RoleDefinition, _super);\n function RoleDefinition(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n RoleDefinition.prototype.update = function (properties) {\n var _this = this;\n if (typeof properties.hasOwnProperty(\"BasePermissions\")) {\n properties[\"BasePermissions\"] = util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, properties[\"BasePermissions\"]);\n }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.RoleDefinition\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retDef = _this;\n if (properties.hasOwnProperty(\"Name\")) {\n var parent_1 = _this.getParent(RoleDefinitions, _this.parentUrl, \"\");\n retDef = parent_1.getByName(properties[\"Name\"]);\n }\n return {\n data: data,\n definition: retDef,\n };\n });\n };\n RoleDefinition.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleDefinition;\n}(queryable_1.QueryableInstance));\nexports.RoleDefinition = RoleDefinition;\nvar RoleDefinitionBindings = (function (_super) {\n __extends(RoleDefinitionBindings, _super);\n function RoleDefinitionBindings(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitionbindings\"; }\n _super.call(this, baseUrl, path);\n }\n return RoleDefinitionBindings;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitionBindings = RoleDefinitionBindings;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Search = (function (_super) {\n __extends(Search, _super);\n function Search(baseUrl, path) {\n if (path === void 0) { path = \"_api/search/postquery\"; }\n _super.call(this, baseUrl, path);\n }\n Search.prototype.execute = function (query) {\n var formattedBody;\n formattedBody = query;\n if (formattedBody.SelectProperties) {\n formattedBody.SelectProperties = { results: query.SelectProperties };\n }\n if (formattedBody.RefinementFilters) {\n formattedBody.RefinementFilters = { results: query.RefinementFilters };\n }\n if (formattedBody.Refiners) {\n formattedBody.Refiners = { results: query.Refiners };\n }\n if (formattedBody.SortList) {\n formattedBody.SortList = { results: query.SortList };\n }\n if (formattedBody.HithighlightedProperties) {\n formattedBody.HithighlightedProperties = { results: query.HithighlightedProperties };\n }\n if (formattedBody.ReorderingRules) {\n formattedBody.ReorderingRules = { results: query.ReorderingRules };\n }\n var postBody = JSON.stringify({ request: formattedBody });\n return this.post({ body: postBody }).then(function (data) {\n return new SearchResults(data);\n });\n };\n return Search;\n}(queryable_1.QueryableInstance));\nexports.Search = Search;\nvar SearchResults = (function () {\n function SearchResults(rawResponse) {\n var response = rawResponse.postquery ? rawResponse.postquery : rawResponse;\n this.PrimarySearchResults = this.formatSearchResults(response.PrimaryQueryResult.RelevantResults.Table.Rows);\n this.RawSearchResults = response;\n this.ElapsedTime = response.ElapsedTime;\n this.RowCount = response.PrimaryQueryResult.RelevantResults.RowCount;\n this.TotalRows = response.PrimaryQueryResult.RelevantResults.TotalRows;\n this.TotalRowsIncludingDuplicates = response.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates;\n }\n SearchResults.prototype.formatSearchResults = function (rawResults) {\n var results = new Array(), tempResults = rawResults.results ? rawResults.results : rawResults;\n for (var _i = 0, tempResults_1 = tempResults; _i < tempResults_1.length; _i++) {\n var i = tempResults_1[_i];\n results.push(new SearchResult(i.Cells));\n }\n return results;\n };\n return SearchResults;\n}());\nexports.SearchResults = SearchResults;\nvar SearchResult = (function () {\n function SearchResult(rawItem) {\n var item = rawItem.results ? rawItem.results : rawItem;\n for (var _i = 0, item_1 = item; _i < item_1.length; _i++) {\n var i = item_1[_i];\n this[i.Key] = i.Value;\n }\n }\n return SearchResult;\n}());\nexports.SearchResult = SearchResult;\n(function (SortDirection) {\n SortDirection[SortDirection[\"Ascending\"] = 0] = \"Ascending\";\n SortDirection[SortDirection[\"Descending\"] = 1] = \"Descending\";\n SortDirection[SortDirection[\"FQLFormula\"] = 2] = \"FQLFormula\";\n})(exports.SortDirection || (exports.SortDirection = {}));\nvar SortDirection = exports.SortDirection;\n(function (ReorderingRuleMatchType) {\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultContainsKeyword\"] = 0] = \"ResultContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleContainsKeyword\"] = 1] = \"TitleContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleMatchesKeyword\"] = 2] = \"TitleMatchesKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlStartsWith\"] = 3] = \"UrlStartsWith\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlExactlyMatches\"] = 4] = \"UrlExactlyMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ContentTypeIs\"] = 5] = \"ContentTypeIs\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"FileExtensionMatches\"] = 6] = \"FileExtensionMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultHasTag\"] = 7] = \"ResultHasTag\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ManualCondition\"] = 8] = \"ManualCondition\";\n})(exports.ReorderingRuleMatchType || (exports.ReorderingRuleMatchType = {}));\nvar ReorderingRuleMatchType = exports.ReorderingRuleMatchType;\n(function (QueryPropertyValueType) {\n QueryPropertyValueType[QueryPropertyValueType[\"None\"] = 0] = \"None\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringType\"] = 1] = \"StringType\";\n QueryPropertyValueType[QueryPropertyValueType[\"Int32TYpe\"] = 2] = \"Int32TYpe\";\n QueryPropertyValueType[QueryPropertyValueType[\"BooleanType\"] = 3] = \"BooleanType\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringArrayType\"] = 4] = \"StringArrayType\";\n QueryPropertyValueType[QueryPropertyValueType[\"UnSupportedType\"] = 5] = \"UnSupportedType\";\n})(exports.QueryPropertyValueType || (exports.QueryPropertyValueType = {}));\nvar QueryPropertyValueType = exports.QueryPropertyValueType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar webs_1 = require(\"./webs\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar Site = (function (_super) {\n __extends(Site, _super);\n function Site(baseUrl, path) {\n if (path === void 0) { path = \"_api/site\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Site.prototype, \"rootWeb\", {\n get: function () {\n return new webs_1.Web(this, \"rootweb\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Site.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Site.prototype.getContextInfo = function () {\n var q = new Site(\"\", \"_api/contextinfo\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"GetContextWebInformation\")) {\n var info = data.GetContextWebInformation;\n info.SupportedSchemaVersions = info.SupportedSchemaVersions.results;\n return info;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getDocumentLibraries = function (absoluteWebUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getdocumentlibraries(@v)\");\n q.query.add(\"@v\", \"'\" + absoluteWebUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetDocumentLibraries\")) {\n return data.GetDocumentLibraries;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getWebUrlFromPageUrl = function (absolutePageUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getweburlfrompageurl(@v)\");\n q.query.add(\"@v\", \"'\" + absolutePageUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetWebUrlFromPageUrl\")) {\n return data.GetWebUrlFromPageUrl;\n }\n else {\n return data;\n }\n });\n };\n return Site;\n}(queryable_1.QueryableInstance));\nexports.Site = Site;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar siteusers_1 = require(\"./siteusers\");\nvar util_1 = require(\"../../utils/util\");\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\nvar SiteGroups = (function (_super) {\n __extends(SiteGroups, _super);\n function SiteGroups(baseUrl, path) {\n if (path === void 0) { path = \"sitegroups\"; }\n _super.call(this, baseUrl, path);\n }\n SiteGroups.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n group: _this.getById(data.Id),\n };\n });\n };\n SiteGroups.prototype.getByName = function (groupName) {\n return new SiteGroup(this, \"getByName('\" + groupName + \"')\");\n };\n SiteGroups.prototype.getById = function (id) {\n var sg = new SiteGroup(this);\n sg.concat(\"(\" + id + \")\");\n return sg;\n };\n SiteGroups.prototype.removeById = function (id) {\n var g = new SiteGroups(this, \"removeById('\" + id + \"')\");\n return g.post();\n };\n SiteGroups.prototype.removeByLoginName = function (loginName) {\n var g = new SiteGroups(this, \"removeByLoginName('\" + loginName + \"')\");\n return g.post();\n };\n return SiteGroups;\n}(queryable_1.QueryableCollection));\nexports.SiteGroups = SiteGroups;\nvar SiteGroup = (function (_super) {\n __extends(SiteGroup, _super);\n function SiteGroup(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteGroup.prototype, \"users\", {\n get: function () {\n return new siteusers_1.SiteUsers(this, \"users\");\n },\n enumerable: true,\n configurable: true\n });\n SiteGroup.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retGroup = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retGroup = _this.getParent(SiteGroup, _this.parentUrl, \"getByName('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n group: retGroup,\n };\n });\n };\n return SiteGroup;\n}(queryable_1.QueryableInstance));\nexports.SiteGroup = SiteGroup;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar SiteUsers = (function (_super) {\n __extends(SiteUsers, _super);\n function SiteUsers(baseUrl, path) {\n if (path === void 0) { path = \"siteusers\"; }\n _super.call(this, baseUrl, path);\n }\n SiteUsers.prototype.getByEmail = function (email) {\n return new SiteUser(this, \"getByEmail('\" + email + \"')\");\n };\n SiteUsers.prototype.getById = function (id) {\n return new SiteUser(this, \"getById(\" + id + \")\");\n };\n SiteUsers.prototype.getByLoginName = function (loginName) {\n var su = new SiteUser(this);\n su.concat(\"(@v)\");\n su.query.add(\"@v\", encodeURIComponent(loginName));\n return su;\n };\n SiteUsers.prototype.removeById = function (id) {\n var o = new SiteUsers(this, \"removeById(\" + id + \")\");\n return o.post();\n };\n SiteUsers.prototype.removeByLoginName = function (loginName) {\n var o = new SiteUsers(this, \"removeByLoginName(@v)\");\n o.query.add(\"@v\", encodeURIComponent(loginName));\n return o.post();\n };\n SiteUsers.prototype.add = function (loginName) {\n var _this = this;\n var postBody = JSON.stringify({ \"__metadata\": { \"type\": \"SP.User\" }, LoginName: loginName });\n return this.post({ body: postBody }).then(function (data) { return _this.getByLoginName(loginName); });\n };\n return SiteUsers;\n}(queryable_1.QueryableCollection));\nexports.SiteUsers = SiteUsers;\nvar SiteUser = (function (_super) {\n __extends(SiteUser, _super);\n function SiteUser(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteUser.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n SiteUser.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.User\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n user: _this,\n };\n });\n };\n SiteUser.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return SiteUser;\n}(queryable_1.QueryableInstance));\nexports.SiteUser = SiteUser;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar TopNavigationBar = (function (_super) {\n __extends(TopNavigationBar, _super);\n function TopNavigationBar(baseUrl) {\n _super.call(this, baseUrl, \"TopNavigationBar\");\n }\n return TopNavigationBar;\n}(queryable_1.QueryableInstance));\nexports.TopNavigationBar = TopNavigationBar;\n","\"use strict\";\n(function (ControlMode) {\n ControlMode[ControlMode[\"Display\"] = 1] = \"Display\";\n ControlMode[ControlMode[\"Edit\"] = 2] = \"Edit\";\n ControlMode[ControlMode[\"New\"] = 3] = \"New\";\n})(exports.ControlMode || (exports.ControlMode = {}));\nvar ControlMode = exports.ControlMode;\n(function (FieldTypes) {\n FieldTypes[FieldTypes[\"Invalid\"] = 0] = \"Invalid\";\n FieldTypes[FieldTypes[\"Integer\"] = 1] = \"Integer\";\n FieldTypes[FieldTypes[\"Text\"] = 2] = \"Text\";\n FieldTypes[FieldTypes[\"Note\"] = 3] = \"Note\";\n FieldTypes[FieldTypes[\"DateTime\"] = 4] = \"DateTime\";\n FieldTypes[FieldTypes[\"Counter\"] = 5] = \"Counter\";\n FieldTypes[FieldTypes[\"Choice\"] = 6] = \"Choice\";\n FieldTypes[FieldTypes[\"Lookup\"] = 7] = \"Lookup\";\n FieldTypes[FieldTypes[\"Boolean\"] = 8] = \"Boolean\";\n FieldTypes[FieldTypes[\"Number\"] = 9] = \"Number\";\n FieldTypes[FieldTypes[\"Currency\"] = 10] = \"Currency\";\n FieldTypes[FieldTypes[\"URL\"] = 11] = \"URL\";\n FieldTypes[FieldTypes[\"Computed\"] = 12] = \"Computed\";\n FieldTypes[FieldTypes[\"Threading\"] = 13] = \"Threading\";\n FieldTypes[FieldTypes[\"Guid\"] = 14] = \"Guid\";\n FieldTypes[FieldTypes[\"MultiChoice\"] = 15] = \"MultiChoice\";\n FieldTypes[FieldTypes[\"GridChoice\"] = 16] = \"GridChoice\";\n FieldTypes[FieldTypes[\"Calculated\"] = 17] = \"Calculated\";\n FieldTypes[FieldTypes[\"File\"] = 18] = \"File\";\n FieldTypes[FieldTypes[\"Attachments\"] = 19] = \"Attachments\";\n FieldTypes[FieldTypes[\"User\"] = 20] = \"User\";\n FieldTypes[FieldTypes[\"Recurrence\"] = 21] = \"Recurrence\";\n FieldTypes[FieldTypes[\"CrossProjectLink\"] = 22] = \"CrossProjectLink\";\n FieldTypes[FieldTypes[\"ModStat\"] = 23] = \"ModStat\";\n FieldTypes[FieldTypes[\"Error\"] = 24] = \"Error\";\n FieldTypes[FieldTypes[\"ContentTypeId\"] = 25] = \"ContentTypeId\";\n FieldTypes[FieldTypes[\"PageSeparator\"] = 26] = \"PageSeparator\";\n FieldTypes[FieldTypes[\"ThreadIndex\"] = 27] = \"ThreadIndex\";\n FieldTypes[FieldTypes[\"WorkflowStatus\"] = 28] = \"WorkflowStatus\";\n FieldTypes[FieldTypes[\"AllDayEvent\"] = 29] = \"AllDayEvent\";\n FieldTypes[FieldTypes[\"WorkflowEventType\"] = 30] = \"WorkflowEventType\";\n})(exports.FieldTypes || (exports.FieldTypes = {}));\nvar FieldTypes = exports.FieldTypes;\n(function (DateTimeFieldFormatType) {\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateOnly\"] = 0] = \"DateOnly\";\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateTime\"] = 1] = \"DateTime\";\n})(exports.DateTimeFieldFormatType || (exports.DateTimeFieldFormatType = {}));\nvar DateTimeFieldFormatType = exports.DateTimeFieldFormatType;\n(function (AddFieldOptions) {\n AddFieldOptions[AddFieldOptions[\"DefaultValue\"] = 0] = \"DefaultValue\";\n AddFieldOptions[AddFieldOptions[\"AddToDefaultContentType\"] = 1] = \"AddToDefaultContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToNoContentType\"] = 2] = \"AddToNoContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToAllContentTypes\"] = 4] = \"AddToAllContentTypes\";\n AddFieldOptions[AddFieldOptions[\"AddFieldInternalNameHint\"] = 8] = \"AddFieldInternalNameHint\";\n AddFieldOptions[AddFieldOptions[\"AddFieldToDefaultView\"] = 16] = \"AddFieldToDefaultView\";\n AddFieldOptions[AddFieldOptions[\"AddFieldCheckDisplayName\"] = 32] = \"AddFieldCheckDisplayName\";\n})(exports.AddFieldOptions || (exports.AddFieldOptions = {}));\nvar AddFieldOptions = exports.AddFieldOptions;\n(function (CalendarType) {\n CalendarType[CalendarType[\"Gregorian\"] = 1] = \"Gregorian\";\n CalendarType[CalendarType[\"Japan\"] = 3] = \"Japan\";\n CalendarType[CalendarType[\"Taiwan\"] = 4] = \"Taiwan\";\n CalendarType[CalendarType[\"Korea\"] = 5] = \"Korea\";\n CalendarType[CalendarType[\"Hijri\"] = 6] = \"Hijri\";\n CalendarType[CalendarType[\"Thai\"] = 7] = \"Thai\";\n CalendarType[CalendarType[\"Hebrew\"] = 8] = \"Hebrew\";\n CalendarType[CalendarType[\"GregorianMEFrench\"] = 9] = \"GregorianMEFrench\";\n CalendarType[CalendarType[\"GregorianArabic\"] = 10] = \"GregorianArabic\";\n CalendarType[CalendarType[\"GregorianXLITEnglish\"] = 11] = \"GregorianXLITEnglish\";\n CalendarType[CalendarType[\"GregorianXLITFrench\"] = 12] = \"GregorianXLITFrench\";\n CalendarType[CalendarType[\"KoreaJapanLunar\"] = 14] = \"KoreaJapanLunar\";\n CalendarType[CalendarType[\"ChineseLunar\"] = 15] = \"ChineseLunar\";\n CalendarType[CalendarType[\"SakaEra\"] = 16] = \"SakaEra\";\n CalendarType[CalendarType[\"UmAlQura\"] = 23] = \"UmAlQura\";\n})(exports.CalendarType || (exports.CalendarType = {}));\nvar CalendarType = exports.CalendarType;\n(function (UrlFieldFormatType) {\n UrlFieldFormatType[UrlFieldFormatType[\"Hyperlink\"] = 0] = \"Hyperlink\";\n UrlFieldFormatType[UrlFieldFormatType[\"Image\"] = 1] = \"Image\";\n})(exports.UrlFieldFormatType || (exports.UrlFieldFormatType = {}));\nvar UrlFieldFormatType = exports.UrlFieldFormatType;\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\n(function (PageType) {\n PageType[PageType[\"Invalid\"] = -1] = \"Invalid\";\n PageType[PageType[\"DefaultView\"] = 0] = \"DefaultView\";\n PageType[PageType[\"NormalView\"] = 1] = \"NormalView\";\n PageType[PageType[\"DialogView\"] = 2] = \"DialogView\";\n PageType[PageType[\"View\"] = 3] = \"View\";\n PageType[PageType[\"DisplayForm\"] = 4] = \"DisplayForm\";\n PageType[PageType[\"DisplayFormDialog\"] = 5] = \"DisplayFormDialog\";\n PageType[PageType[\"EditForm\"] = 6] = \"EditForm\";\n PageType[PageType[\"EditFormDialog\"] = 7] = \"EditFormDialog\";\n PageType[PageType[\"NewForm\"] = 8] = \"NewForm\";\n PageType[PageType[\"NewFormDialog\"] = 9] = \"NewFormDialog\";\n PageType[PageType[\"SolutionForm\"] = 10] = \"SolutionForm\";\n PageType[PageType[\"PAGE_MAXITEMS\"] = 11] = \"PAGE_MAXITEMS\";\n})(exports.PageType || (exports.PageType = {}));\nvar PageType = exports.PageType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar UserCustomActions = (function (_super) {\n __extends(UserCustomActions, _super);\n function UserCustomActions(baseUrl, path) {\n if (path === void 0) { path = \"usercustomactions\"; }\n _super.call(this, baseUrl, path);\n }\n UserCustomActions.prototype.getById = function (id) {\n return new UserCustomAction(this, \"(\" + id + \")\");\n };\n UserCustomActions.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ __metadata: { \"type\": \"SP.UserCustomAction\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n action: _this.getById(data.Id),\n data: data,\n };\n });\n };\n UserCustomActions.prototype.clear = function () {\n var a = new UserCustomActions(this, \"clear\");\n return a.post();\n };\n return UserCustomActions;\n}(queryable_1.QueryableCollection));\nexports.UserCustomActions = UserCustomActions;\nvar UserCustomAction = (function (_super) {\n __extends(UserCustomAction, _super);\n function UserCustomAction(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n UserCustomAction.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.UserCustomAction\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n action: _this,\n data: data,\n };\n });\n };\n return UserCustomAction;\n}(queryable_1.QueryableInstance));\nexports.UserCustomAction = UserCustomAction;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar FileUtil = require(\"../../utils/files\");\nvar odata_1 = require(\"./odata\");\nvar UserProfileQuery = (function (_super) {\n __extends(UserProfileQuery, _super);\n function UserProfileQuery(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.peoplemanager\"; }\n _super.call(this, baseUrl, path);\n this.profileLoader = new ProfileLoader(baseUrl);\n }\n Object.defineProperty(UserProfileQuery.prototype, \"editProfileLink\", {\n get: function () {\n var q = new UserProfileQuery(this, \"EditProfileLink\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"isMyPeopleListPublic\", {\n get: function () {\n var q = new UserProfileQuery(this, \"IsMyPeopleListPublic\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.amIFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.amIFollowing = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowing(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowedTags = function (maxCount) {\n if (maxCount === void 0) { maxCount = 20; }\n var q = new UserProfileQuery(this, \"getfollowedtags(\" + maxCount + \")\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowersFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getfollowersfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"myFollowers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getmyfollowers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"myProperties\", {\n get: function () {\n return new UserProfileQuery(this, \"getmyproperties\");\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getPeopleFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"getpeoplefollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getPropertiesFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getpropertiesfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"trendingTags\", {\n get: function () {\n var q = new UserProfileQuery(this, null);\n q.concat(\".gettrendingtags\");\n return q.get();\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getUserProfilePropertyFor = function (loginName, propertyName) {\n var q = new UserProfileQuery(this, \"getuserprofilepropertyfor(accountname=@v, propertyname='\" + propertyName + \"')\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.hideSuggestion = function (loginName) {\n var q = new UserProfileQuery(this, \"hidesuggestion(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.post();\n };\n UserProfileQuery.prototype.isFollowing = function (follower, followee) {\n var q = new UserProfileQuery(this, null);\n q.concat(\".isfollowing(possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(follower) + \"'\");\n q.query.add(\"@y\", \"'\" + encodeURIComponent(followee) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.setMyProfilePic = function (profilePicSource) {\n var _this = this;\n return FileUtil.readBlobAsArrayBuffer(profilePicSource).then(function (buffer) {\n var request = new UserProfileQuery(_this, \"setmyprofilepicture\");\n return request.post({\n body: String.fromCharCode.apply(null, new Uint16Array(buffer)),\n });\n });\n };\n UserProfileQuery.prototype.createPersonalSiteEnqueueBulk = function () {\n var emails = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n emails[_i - 0] = arguments[_i];\n }\n return this.profileLoader.createPersonalSiteEnqueueBulk(emails);\n };\n Object.defineProperty(UserProfileQuery.prototype, \"ownerUserProfile\", {\n get: function () {\n return this.profileLoader.ownerUserProfile;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"userProfile\", {\n get: function () {\n return this.profileLoader.userProfile;\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n return this.profileLoader.createPersonalSite(interactiveRequest);\n };\n UserProfileQuery.prototype.shareAllSocialData = function (share) {\n return this.profileLoader.shareAllSocialData(share);\n };\n return UserProfileQuery;\n}(queryable_1.QueryableInstance));\nexports.UserProfileQuery = UserProfileQuery;\nvar ProfileLoader = (function (_super) {\n __extends(ProfileLoader, _super);\n function ProfileLoader(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.profileloader.getprofileloader\"; }\n _super.call(this, baseUrl, path);\n }\n ProfileLoader.prototype.createPersonalSiteEnqueueBulk = function (emails) {\n var q = new ProfileLoader(this, \"createpersonalsiteenqueuebulk\");\n var postBody = JSON.stringify({ \"emailIDs\": emails });\n return q.post({\n body: postBody,\n });\n };\n Object.defineProperty(ProfileLoader.prototype, \"ownerUserProfile\", {\n get: function () {\n var q = this.getParent(ProfileLoader, this.parentUrl, \"_api/sp.userprofiles.profileloader.getowneruserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ProfileLoader.prototype, \"userProfile\", {\n get: function () {\n var q = new ProfileLoader(this, \"getuserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n ProfileLoader.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n var q = new ProfileLoader(this, \"getuserprofile/createpersonalsiteenque(\" + interactiveRequest + \")\\\",\");\n return q.post();\n };\n ProfileLoader.prototype.shareAllSocialData = function (share) {\n var q = new ProfileLoader(this, \"getuserprofile/shareallsocialdata(\" + share + \")\\\",\");\n return q.post();\n };\n return ProfileLoader;\n}(queryable_1.Queryable));\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Views = (function (_super) {\n __extends(Views, _super);\n function Views(baseUrl) {\n _super.call(this, baseUrl, \"views\");\n }\n Views.prototype.getById = function (id) {\n var v = new View(this);\n v.concat(\"('\" + id + \"')\");\n return v;\n };\n Views.prototype.getByTitle = function (title) {\n return new View(this, \"getByTitle('\" + title + \"')\");\n };\n Views.prototype.add = function (title, personalView, additionalSettings) {\n var _this = this;\n if (personalView === void 0) { personalView = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n \"Title\": title,\n \"PersonalView\": personalView,\n }, additionalSettings));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n view: _this.getById(data.Id),\n };\n });\n };\n return Views;\n}(queryable_1.QueryableCollection));\nexports.Views = Views;\nvar View = (function (_super) {\n __extends(View, _super);\n function View(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(View.prototype, \"fields\", {\n get: function () {\n return new ViewFields(this);\n },\n enumerable: true,\n configurable: true\n });\n View.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n view: _this,\n };\n });\n };\n View.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n View.prototype.renderAsHtml = function () {\n var q = new queryable_1.Queryable(this, \"renderashtml\");\n return q.get();\n };\n return View;\n}(queryable_1.QueryableInstance));\nexports.View = View;\nvar ViewFields = (function (_super) {\n __extends(ViewFields, _super);\n function ViewFields(baseUrl, path) {\n if (path === void 0) { path = \"viewfields\"; }\n _super.call(this, baseUrl, path);\n }\n ViewFields.prototype.getSchemaXml = function () {\n var q = new queryable_1.Queryable(this, \"schemaxml\");\n return q.get();\n };\n ViewFields.prototype.add = function (fieldTitleOrInternalName) {\n var q = new ViewFields(this, \"addviewfield('\" + fieldTitleOrInternalName + \"')\");\n return q.post();\n };\n ViewFields.prototype.move = function (fieldInternalName, index) {\n var q = new ViewFields(this, \"moveviewfieldto\");\n var postBody = JSON.stringify({ \"field\": fieldInternalName, \"index\": index });\n return q.post({ body: postBody });\n };\n ViewFields.prototype.removeAll = function () {\n var q = new ViewFields(this, \"removeallviewfields\");\n return q.post();\n };\n ViewFields.prototype.remove = function (fieldInternalName) {\n var q = new ViewFields(this, \"removeviewfield('\" + fieldInternalName + \"')\");\n return q.post();\n };\n return ViewFields;\n}(queryable_1.QueryableCollection));\nexports.ViewFields = ViewFields;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar lists_1 = require(\"./lists\");\nvar fields_1 = require(\"./fields\");\nvar navigation_1 = require(\"./navigation\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar folders_1 = require(\"./folders\");\nvar roles_1 = require(\"./roles\");\nvar files_1 = require(\"./files\");\nvar util_1 = require(\"../../utils/util\");\nvar lists_2 = require(\"./lists\");\nvar siteusers_1 = require(\"./siteusers\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Webs = (function (_super) {\n __extends(Webs, _super);\n function Webs(baseUrl, webPath) {\n if (webPath === void 0) { webPath = \"webs\"; }\n _super.call(this, baseUrl, webPath);\n }\n Webs.prototype.add = function (title, url, description, template, language, inheritPermissions, additionalSettings) {\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = \"STS\"; }\n if (language === void 0) { language = 1033; }\n if (inheritPermissions === void 0) { inheritPermissions = true; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var props = util_1.Util.extend({\n Description: description,\n Language: language,\n Title: title,\n Url: url,\n UseSamePermissionsAsParentSite: inheritPermissions,\n WebTemplate: template,\n }, additionalSettings);\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.WebCreationInformation\" },\n }, props),\n });\n var q = new Webs(this, \"add\");\n return q.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n web: new Web(odata_1.extractOdataId(data), \"\"),\n };\n });\n };\n return Webs;\n}(queryable_1.QueryableCollection));\nexports.Webs = Webs;\nvar Web = (function (_super) {\n __extends(Web, _super);\n function Web(baseUrl, path) {\n if (path === void 0) { path = \"_api/web\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Web.prototype, \"webs\", {\n get: function () {\n return new Webs(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"lists\", {\n get: function () {\n return new lists_1.Lists(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"availablefields\", {\n get: function () {\n return new fields_1.Fields(this, \"availablefields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"navigation\", {\n get: function () {\n return new navigation_1.Navigation(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteUsers\", {\n get: function () {\n return new siteusers_1.SiteUsers(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteGroups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"folders\", {\n get: function () {\n return new folders_1.Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"roleDefinitions\", {\n get: function () {\n return new roles_1.RoleDefinitions(this);\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getFolderByServerRelativeUrl = function (folderRelativeUrl) {\n return new folders_1.Folder(this, \"getFolderByServerRelativeUrl('\" + folderRelativeUrl + \"')\");\n };\n Web.prototype.getFileByServerRelativeUrl = function (fileRelativeUrl) {\n return new files_1.File(this, \"getFileByServerRelativeUrl('\" + fileRelativeUrl + \"')\");\n };\n Web.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.Web\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n web: _this,\n };\n });\n };\n Web.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Web.prototype.applyTheme = function (colorPaletteUrl, fontSchemeUrl, backgroundImageUrl, shareGenerated) {\n var postBody = JSON.stringify({\n backgroundImageUrl: backgroundImageUrl,\n colorPaletteUrl: colorPaletteUrl,\n fontSchemeUrl: fontSchemeUrl,\n shareGenerated: shareGenerated,\n });\n var q = new Web(this, \"applytheme\");\n return q.post({ body: postBody });\n };\n Web.prototype.applyWebTemplate = function (template) {\n var q = new Web(this, \"applywebtemplate\");\n q.concat(\"(@t)\");\n q.query.add(\"@t\", template);\n return q.post();\n };\n Web.prototype.doesUserHavePermissions = function (perms) {\n var q = new Web(this, \"doesuserhavepermissions\");\n q.concat(\"(@p)\");\n q.query.add(\"@p\", JSON.stringify(perms));\n return q.get();\n };\n Web.prototype.ensureUser = function (loginName) {\n var postBody = JSON.stringify({\n logonName: loginName,\n });\n var q = new Web(this, \"ensureuser\");\n return q.post({ body: postBody });\n };\n Web.prototype.availableWebTemplates = function (language, includeCrossLanugage) {\n if (language === void 0) { language = 1033; }\n if (includeCrossLanugage === void 0) { includeCrossLanugage = true; }\n return new queryable_1.QueryableCollection(this, \"getavailablewebtemplates(lcid=\" + language + \", doincludecrosslanguage=\" + includeCrossLanugage + \")\");\n };\n Web.prototype.getCatalog = function (type) {\n var q = new Web(this, \"getcatalog(\" + type + \")\");\n q.select(\"Id\");\n return q.get().then(function (data) {\n return new lists_2.List(odata_1.extractOdataId(data));\n });\n };\n Web.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new Web(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n Object.defineProperty(Web.prototype, \"customListTemplate\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getcustomlisttemplates\");\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getUserById = function (id) {\n return new siteusers_1.SiteUser(this, \"getUserById(\" + id + \")\");\n };\n Web.prototype.mapToIcon = function (filename, size, progId) {\n if (size === void 0) { size = 0; }\n if (progId === void 0) { progId = \"\"; }\n var q = new Web(this, \"maptoicon(filename='\" + filename + \"', progid='\" + progId + \"', size=\" + size + \")\");\n return q.get();\n };\n return Web;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Web = Web;\n","\"use strict\";\nfunction readBlobAsText(blob) {\n return readBlobAs(blob, \"string\");\n}\nexports.readBlobAsText = readBlobAsText;\nfunction readBlobAsArrayBuffer(blob) {\n return readBlobAs(blob, \"buffer\");\n}\nexports.readBlobAsArrayBuffer = readBlobAsArrayBuffer;\nfunction readBlobAs(blob, mode) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.onload = function (e) {\n resolve(e.target.result);\n };\n switch (mode) {\n case \"string\":\n reader.readAsText(blob);\n break;\n case \"buffer\":\n reader.readAsArrayBuffer(blob);\n break;\n }\n });\n}\n","\"use strict\";\nvar Logger = (function () {\n function Logger() {\n }\n Object.defineProperty(Logger, \"activeLogLevel\", {\n get: function () {\n return Logger.instance.activeLogLevel;\n },\n set: function (value) {\n Logger.instance.activeLogLevel = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Logger, \"instance\", {\n get: function () {\n if (typeof Logger._instance === \"undefined\" || Logger._instance === null) {\n Logger._instance = new LoggerImpl();\n }\n return Logger._instance;\n },\n enumerable: true,\n configurable: true\n });\n Logger.subscribe = function () {\n var listeners = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n listeners[_i - 0] = arguments[_i];\n }\n for (var i = 0; i < listeners.length; i++) {\n Logger.instance.subscribe(listeners[i]);\n }\n };\n Logger.clearSubscribers = function () {\n return Logger.instance.clearSubscribers();\n };\n Object.defineProperty(Logger, \"count\", {\n get: function () {\n return Logger.instance.count;\n },\n enumerable: true,\n configurable: true\n });\n Logger.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n Logger.instance.log({ level: level, message: message });\n };\n Logger.log = function (entry) {\n Logger.instance.log(entry);\n };\n Logger.measure = function (name, f) {\n return Logger.instance.measure(name, f);\n };\n return Logger;\n}());\nexports.Logger = Logger;\nvar LoggerImpl = (function () {\n function LoggerImpl(activeLogLevel, subscribers) {\n if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.Warning; }\n if (subscribers === void 0) { subscribers = []; }\n this.activeLogLevel = activeLogLevel;\n this.subscribers = subscribers;\n }\n LoggerImpl.prototype.subscribe = function (listener) {\n this.subscribers.push(listener);\n };\n LoggerImpl.prototype.clearSubscribers = function () {\n var s = this.subscribers.slice(0);\n this.subscribers.length = 0;\n return s;\n };\n Object.defineProperty(LoggerImpl.prototype, \"count\", {\n get: function () {\n return this.subscribers.length;\n },\n enumerable: true,\n configurable: true\n });\n LoggerImpl.prototype.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n this.log({ level: level, message: message });\n };\n LoggerImpl.prototype.log = function (entry) {\n if (typeof entry === \"undefined\" || entry.level < this.activeLogLevel) {\n return;\n }\n for (var i = 0; i < this.subscribers.length; i++) {\n this.subscribers[i].log(entry);\n }\n };\n LoggerImpl.prototype.measure = function (name, f) {\n console.profile(name);\n try {\n return f();\n }\n finally {\n console.profileEnd();\n }\n };\n return LoggerImpl;\n}());\nvar Logger;\n(function (Logger) {\n (function (LogLevel) {\n LogLevel[LogLevel[\"Verbose\"] = 0] = \"Verbose\";\n LogLevel[LogLevel[\"Info\"] = 1] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 2] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n LogLevel[LogLevel[\"Off\"] = 99] = \"Off\";\n })(Logger.LogLevel || (Logger.LogLevel = {}));\n var LogLevel = Logger.LogLevel;\n var ConsoleListener = (function () {\n function ConsoleListener() {\n }\n ConsoleListener.prototype.log = function (entry) {\n var msg = this.format(entry);\n switch (entry.level) {\n case LogLevel.Verbose:\n case LogLevel.Info:\n console.log(msg);\n break;\n case LogLevel.Warning:\n console.warn(msg);\n break;\n case LogLevel.Error:\n console.error(msg);\n break;\n }\n };\n ConsoleListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return ConsoleListener;\n }());\n Logger.ConsoleListener = ConsoleListener;\n var AzureInsightsListener = (function () {\n function AzureInsightsListener(azureInsightsInstrumentationKey) {\n this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey;\n var appInsights = window[\"appInsights\"] || function (config) {\n function r(config) {\n t[config] = function () {\n var i = arguments;\n t.queue.push(function () { t[config].apply(t, i); });\n };\n }\n var t = { config: config }, u = document, e = window, o = \"script\", s = u.createElement(o), i, f;\n for (s.src = config.url || \"//az416426.vo.msecnd.net/scripts/a/ai.0.js\", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = [\"Event\", \"Exception\", \"Metric\", \"PageView\", \"Trace\"]; i.length;) {\n r(\"track\" + i.pop());\n }\n return r(\"setAuthenticatedUserContext\"), r(\"clearAuthenticatedUserContext\"), config.disableExceptionTracking || (i = \"onerror\", r(\"_\" + i), f = e[i], e[i] = function (config, r, u, e, o) {\n var s = f && f(config, r, u, e, o);\n return s !== !0 && t[\"_\" + i](config, r, u, e, o), s;\n }), t;\n }({\n instrumentationKey: this.azureInsightsInstrumentationKey\n });\n window[\"appInsights\"] = appInsights;\n }\n AzureInsightsListener.prototype.log = function (entry) {\n var ai = window[\"appInsights\"];\n var msg = this.format(entry);\n if (entry.level === LogLevel.Error) {\n ai.trackException(msg);\n }\n else {\n ai.trackEvent(msg);\n }\n };\n AzureInsightsListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return AzureInsightsListener;\n }());\n Logger.AzureInsightsListener = AzureInsightsListener;\n var FunctionListener = (function () {\n function FunctionListener(method) {\n this.method = method;\n }\n FunctionListener.prototype.log = function (entry) {\n this.method(entry);\n };\n return FunctionListener;\n }());\n Logger.FunctionListener = FunctionListener;\n})(Logger = exports.Logger || (exports.Logger = {}));\n","\"use strict\";\nvar util_1 = require(\"./util\");\nvar PnPClientStorageWrapper = (function () {\n function PnPClientStorageWrapper(store, defaultTimeoutMinutes) {\n this.store = store;\n this.defaultTimeoutMinutes = defaultTimeoutMinutes;\n this.defaultTimeoutMinutes = (defaultTimeoutMinutes === void 0) ? 5 : defaultTimeoutMinutes;\n this.enabled = this.test();\n }\n PnPClientStorageWrapper.prototype.get = function (key) {\n if (!this.enabled) {\n return null;\n }\n var o = this.store.getItem(key);\n if (o == null) {\n return o;\n }\n var persistable = JSON.parse(o);\n if (new Date(persistable.expiration) <= new Date()) {\n this.delete(key);\n return null;\n }\n else {\n return persistable.value;\n }\n };\n PnPClientStorageWrapper.prototype.put = function (key, o, expire) {\n if (this.enabled) {\n this.store.setItem(key, this.createPersistable(o, expire));\n }\n };\n PnPClientStorageWrapper.prototype.delete = function (key) {\n if (this.enabled) {\n this.store.removeItem(key);\n }\n };\n PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {\n var _this = this;\n if (!this.enabled) {\n return getter();\n }\n if (!util_1.Util.isFunction(getter)) {\n throw \"Function expected for parameter 'getter'.\";\n }\n return new Promise(function (resolve, reject) {\n var o = _this.get(key);\n if (o == null) {\n getter().then(function (d) {\n _this.put(key, d);\n resolve(d);\n });\n }\n else {\n resolve(o);\n }\n });\n };\n PnPClientStorageWrapper.prototype.test = function () {\n var str = \"test\";\n try {\n this.store.setItem(str, str);\n this.store.removeItem(str);\n return true;\n }\n catch (e) {\n return false;\n }\n };\n PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) {\n if (typeof expire === \"undefined\") {\n expire = util_1.Util.dateAdd(new Date(), \"minute\", this.defaultTimeoutMinutes);\n }\n return JSON.stringify({ expiration: expire, value: o });\n };\n return PnPClientStorageWrapper;\n}());\nexports.PnPClientStorageWrapper = PnPClientStorageWrapper;\nvar PnPClientStorage = (function () {\n function PnPClientStorage() {\n this.local = typeof localStorage !== \"undefined\" ? new PnPClientStorageWrapper(localStorage) : null;\n this.session = typeof sessionStorage !== \"undefined\" ? new PnPClientStorageWrapper(sessionStorage) : null;\n }\n return PnPClientStorage;\n}());\nexports.PnPClientStorage = PnPClientStorage;\n","\"use strict\";\nvar Util = (function () {\n function Util() {\n }\n Util.getCtxCallback = function (context, method) {\n var params = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n params[_i - 2] = arguments[_i];\n }\n return function () {\n method.apply(context, params);\n };\n };\n Util.urlParamExists = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n return regex.test(location.search);\n };\n Util.getUrlParamByName = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n var results = regex.exec(location.search);\n return results == null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n };\n Util.getUrlParamBoolByName = function (name) {\n var p = this.getUrlParamByName(name);\n var isFalse = (p === \"\" || /false|0/i.test(p));\n return !isFalse;\n };\n Util.stringInsert = function (target, index, s) {\n if (index > 0) {\n return target.substring(0, index) + s + target.substring(index, target.length);\n }\n return s + target;\n };\n Util.dateAdd = function (date, interval, units) {\n var ret = new Date(date.toLocaleString());\n switch (interval.toLowerCase()) {\n case \"year\":\n ret.setFullYear(ret.getFullYear() + units);\n break;\n case \"quarter\":\n ret.setMonth(ret.getMonth() + 3 * units);\n break;\n case \"month\":\n ret.setMonth(ret.getMonth() + units);\n break;\n case \"week\":\n ret.setDate(ret.getDate() + 7 * units);\n break;\n case \"day\":\n ret.setDate(ret.getDate() + units);\n break;\n case \"hour\":\n ret.setTime(ret.getTime() + units * 3600000);\n break;\n case \"minute\":\n ret.setTime(ret.getTime() + units * 60000);\n break;\n case \"second\":\n ret.setTime(ret.getTime() + units * 1000);\n break;\n default:\n ret = undefined;\n break;\n }\n return ret;\n };\n Util.loadStylesheet = function (path, avoidCache) {\n if (avoidCache) {\n path += \"?\" + encodeURIComponent((new Date()).getTime().toString());\n }\n var head = document.getElementsByTagName(\"head\");\n if (head.length > 0) {\n var e = document.createElement(\"link\");\n head[0].appendChild(e);\n e.setAttribute(\"type\", \"text/css\");\n e.setAttribute(\"rel\", \"stylesheet\");\n e.setAttribute(\"href\", path);\n }\n };\n Util.combinePaths = function () {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i - 0] = arguments[_i];\n }\n var parts = [];\n for (var i = 0; i < paths.length; i++) {\n if (typeof paths[i] !== \"undefined\" && paths[i] !== null) {\n parts.push(paths[i].replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"));\n }\n }\n return parts.join(\"/\").replace(/\\\\/, \"/\");\n };\n Util.getRandomString = function (chars) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < chars; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n };\n Util.getGUID = function () {\n var d = new Date().getTime();\n var guid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3 | 0x8)).toString(16);\n });\n return guid;\n };\n Util.isFunction = function (candidateFunction) {\n return typeof candidateFunction === \"function\";\n };\n Util.isArray = function (array) {\n if (Array.isArray) {\n return Array.isArray(array);\n }\n return array && typeof array.length === \"number\" && array.constructor === Array;\n };\n Util.stringIsNullOrEmpty = function (s) {\n return typeof s === \"undefined\" || s === null || s === \"\";\n };\n Util.extend = function (target, source, noOverwrite) {\n if (noOverwrite === void 0) { noOverwrite = false; }\n var result = {};\n for (var id in target) {\n result[id] = target[id];\n }\n var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; };\n for (var id in source) {\n if (check(result, id)) {\n result[id] = source[id];\n }\n }\n return result;\n };\n Util.applyMixins = function (derivedCtor) {\n var baseCtors = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n baseCtors[_i - 1] = arguments[_i];\n }\n baseCtors.forEach(function (baseCtor) {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {\n derivedCtor.prototype[name] = baseCtor.prototype[name];\n });\n });\n };\n Util.isUrlAbsolute = function (url) {\n return /^https?:\\/\\/|^\\/\\//i.test(url);\n };\n Util.makeUrlAbsolute = function (url) {\n if (Util.isUrlAbsolute(url)) {\n return url;\n }\n if (typeof global._spPageContextInfo !== \"undefined\") {\n if (global._spPageContextInfo.hasOwnProperty(\"webAbsoluteUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url);\n }\n else if (global._spPageContextInfo.hasOwnProperty(\"webServerRelativeUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url);\n }\n }\n else {\n return url;\n }\n };\n return Util;\n}());\nexports.Util = Util;\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/dist/pnp.min.js b/dist/pnp.min.js deleted file mode 100644 index dfcc46b0..00000000 --- a/dist/pnp.min.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * sp-pnp-js v1.0.4 - A reusable JavaScript library targeting SharePoint client-side development. - * MIT (https://github.com/OfficeDev/PnP-JS-Core/blob/master/LICENSE) - * Copyright (c) 2016 Microsoft - * docs: http://officedev.github.io/PnP-JS-Core - * source: https://github.com/OfficeDev/PnP-JS-Core - * bugs: https://github.com/OfficeDev/PnP-JS-Core/issues - */ -!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var t;t="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,t.$pnp=e()}}(function(){return function e(t,n,r){function o(a,u){if(!n[a]){if(!t[a]){var s="function"==typeof require&&require;if(!u&&s)return s(a,!0);if(i)return i(a,!0);var c=new Error("Cannot find module '"+a+"'");throw c.code="MODULE_NOT_FOUND",c}var l=n[a]={exports:{}};t[a][0].call(l.exports,function(e){var n=t[a][1][e];return o(n?n:e)},l,l.exports,e,t,n,r)}return n[a].exports}for(var i="function"==typeof require&&require,a=0;a-1?this.values[n]=t:(this.keys.push(e),this.values.push(t))},e.prototype.merge=function(e){if(r.Util.isFunction(e.getKeys))for(var t=e,n=t.getKeys(),o=n.length,i=0;i0},enumerable:!0,configurable:!0}),e.fromResponse=function(t){return t.json().then(function(t){var n=new e;return n.nextUrl=t["odata.nextLink"],n.results=t.value,n})},e.prototype.getNext=function(){if(this.hasNext){var e=new l(this.nextUrl,null);return e.getPaged()}return new Promise(function(e){return e(null)})},e}();n.PagedItemCollection=d},{"../../utils/util":41,"./contenttypes":14,"./folders":17,"./odata":22,"./queryable":23,"./queryablesecurable":24}],20:[function(e,t,n){"use strict";var r=this&&this.__extends||function(e,t){function n(){this.constructor=e}for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r]);e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)},o=e("./items"),i=e("./views"),a=e("./contenttypes"),u=e("./fields"),s=e("./forms"),c=e("./queryable"),l=e("./queryablesecurable"),p=e("../../utils/util"),f=e("./usercustomactions"),d=e("./odata"),y=function(e){function t(t,n){void 0===n&&(n="lists"),e.call(this,t,n)}return r(t,e),t.prototype.getByTitle=function(e){return new h(this,"getByTitle('"+e+"')")},t.prototype.getById=function(e){var t=new h(this);return t.concat("('"+e+"')"),t},t.prototype.add=function(e,t,n,r,o){var i=this;void 0===t&&(t=""),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===o&&(o={});var a=JSON.stringify(p.Util.extend({__metadata:{type:"SP.List"},AllowContentTypes:r,BaseTemplate:n,ContentTypesEnabled:r,Description:t,Title:e},o));return this.post({body:a}).then(function(t){return{data:t,list:i.getByTitle(e)}})},t.prototype.ensure=function(e,t,n,r,o){var i=this;if(void 0===t&&(t=""),void 0===n&&(n=100),void 0===r&&(r=!1),void 0===o&&(o={}),this.hasBatch)throw new Error("The ensure method is not supported as part of a batch.");return new Promise(function(a,u){var s=i.getByTitle(e);s.get().then(function(e){return a({created:!1,data:e,list:s})})["catch"](function(){i.add(e,t,n,r,o).then(function(t){a({created:!0,data:t.data,list:i.getByTitle(e)})})})["catch"](function(e){return u(e)})})},t.prototype.ensureSiteAssetsLibrary=function(){var e=new t(this,"ensuresiteassetslibrary");return e.post().then(function(e){return new h(d.extractOdataId(e))})},t.prototype.ensureSitePagesLibrary=function(){var e=new t(this,"ensuresitepageslibrary");return e.post().then(function(e){return new h(d.extractOdataId(e))})},t}(c.QueryableCollection);n.Lists=y;var h=function(e){function t(t,n){e.call(this,t,n)}return r(t,e),Object.defineProperty(t.prototype,"contentTypes",{get:function(){return new a.ContentTypes(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"items",{get:function(){return new o.Items(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"views",{get:function(){return new i.Views(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fields",{get:function(){return new u.Fields(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"forms",{get:function(){return new s.Forms(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"defaultView",{get:function(){return new c.QueryableInstance(this,"DefaultView")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"userCustomActions",{get:function(){return new f.UserCustomActions(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"effectiveBasePermissions",{get:function(){return new c.Queryable(this,"EffectiveBasePermissions")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"eventReceivers",{get:function(){return new c.QueryableCollection(this,"EventReceivers")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"relatedFields",{get:function(){return new c.Queryable(this,"getRelatedFields")},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"informationRightsManagementSettings",{get:function(){return new c.Queryable(this,"InformationRightsManagementSettings")},enumerable:!0,configurable:!0}),t.prototype.getView=function(e){return new i.View(this,"getView('"+e+"')")},t.prototype.update=function(e,n){var r=this;void 0===n&&(n="*");var o=JSON.stringify(p.Util.extend({__metadata:{type:"SP.List"}},e));return this.post({body:o,headers:{"IF-Match":n,"X-HTTP-Method":"MERGE"}}).then(function(n){var o=r;return e.hasOwnProperty("Title")&&(o=r.getParent(t,r.parentUrl,"getByTitle('"+e.Title+"')")),{data:n,list:o}})},t.prototype["delete"]=function(e){return void 0===e&&(e="*"),this.post({headers:{"IF-Match":e,"X-HTTP-Method":"DELETE"}})},t.prototype.getChanges=function(e){var n=JSON.stringify({query:p.Util.extend({__metadata:{type:"SP.ChangeQuery"}},e)}),r=new t(this,"getchanges");return r.post({body:n})},t.prototype.getItemsByCAMLQuery=function(e){for(var n=[],r=1;r0?setTimeout(function(){return e.execute()},100):e.executeImpl().then(function(){return t()})["catch"](n)})},e.prototype.executeImpl=function(){var e=this;if(this._requests.length<1)return new Promise(function(e){return e()});var t=[],n="";this._requests.forEach(function(r,o){"GET"===r.method?(n.length>0&&(t.push("--changeset_"+n+"--\n\n"),n=""),t.push("--batch_"+e._batchId+"\n")):(n.length<1&&(n=c.Util.getGUID(),t.push("--batch_"+e._batchId+"\n"),t.push('Content-Type: multipart/mixed; boundary="changeset_'+n+'"\n\n')),t.push("--changeset_"+n+"\n")),t.push("Content-Type: application/http\n"),t.push("Content-Transfer-Encoding: binary\n\n");var i={Accept:"application/json;"};if("GET"!==r.method){var a=r.method;r.options&&r.options.headers&&"undefined"!==r.options.headers["X-HTTP-Method"]&&(a=r.options.headers["X-HTTP-Method"],delete r.options.headers["X-HTTP-Method"]),t.push(a+" "+r.url+" HTTP/1.1\n"),i=c.Util.extend(i,{"Content-Type":"application/json;odata=verbose;charset=utf-8"})}else t.push(r.method+" "+r.url+" HTTP/1.1\n");"undefined"!=typeof f.RuntimeConfig.headers&&(i=c.Util.extend(i,f.RuntimeConfig.headers)),r.options&&r.options.headers&&(i=c.Util.extend(i,r.options.headers));for(var u in i)i.hasOwnProperty(u)&&t.push(u+": "+i[u]+"\n");t.push("\n"),r.options.body&&t.push(r.options.body+"\n\n")}),n.length>0&&(t.push("--changeset_"+n+"--\n\n"),n=""),t.push("--batch_"+this._batchId+"--\n");var r={"Content-Type":"multipart/mixed; boundary=batch_"+this._batchId},o={body:t.join(""),headers:r},i=new p.HttpClient;return i.post(c.Util.makeUrlAbsolute("/_api/$batch"),o).then(function(e){return e.text()}).then(this._parseResponse).then(function(t){if(t.length!==e._requests.length)throw new Error("Could not properly parse responses to match requests in batch.");for(var n=[],r=0;rn.lastIndexOf("(")){var r=n.lastIndexOf("/");this._parentUrl=n.slice(0,r),t=o.Util.combinePaths(n.slice(r),t),this._url=o.Util.combinePaths(this._parentUrl,t)}else{var r=n.lastIndexOf("(");this._parentUrl=n.slice(0,r),this._url=o.Util.combinePaths(n,t)}}else{var a=e;this._parentUrl=a._url,!this.hasBatch&&a.hasBatch&&(this._batch=a._batch);var u=a._query.get("@target");null!==u&&this._query.add("@target",u),this._url=o.Util.combinePaths(this._parentUrl,t)}}return e.prototype.concat=function(e){this._url+=e},e.prototype.append=function(e){this._url=o.Util.combinePaths(this._url,e)},e.prototype.addBatchDependency=function(){null!==this._batch&&this._batch.incrementBatchDep()},e.prototype.clearBatchDependency=function(){null!==this._batch&&this._batch.decrementBatchDep()},Object.defineProperty(e.prototype,"hasBatch",{get:function(){return null!==this._batch},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parentUrl",{get:function(){return this._parentUrl},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"query",{get:function(){return this._query},enumerable:!0,configurable:!0}),e.prototype.inBatch=function(e){if(null!==this._batch)throw new Error("This query is already part of a batch.");return this._batch=e,this},e.prototype.usingCaching=function(e){return c.RuntimeConfig.globalCacheDisable||(this._useCaching=!0,this._cachingOptions=e),this},e.prototype.toUrl=function(){return o.Util.makeUrlAbsolute(this._url)},e.prototype.toUrlAndQuery=function(){var e=this,t=this.toUrl();if(this._query.count()>0){t+="?";var n=this._query.getKeys();t+=n.map(function(t,n,r){return t+"="+e._query.get(t)}).join("&")}return t},e.prototype.get=function(e,t){return void 0===e&&(e=new u.ODataDefaultParser),void 0===t&&(t={}),this.getImpl(t,e)},e.prototype.getAs=function(e,t){return void 0===e&&(e=new u.ODataDefaultParser),void 0===t&&(t={}),this.getImpl(t,e)},e.prototype.post=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new u.ODataDefaultParser),this.postImpl(e,t)},e.prototype.postAs=function(e,t){return void 0===e&&(e={}),void 0===t&&(t=new u.ODataDefaultParser),this.postImpl(e,t)},e.prototype.getParent=function(e,t,n){void 0===t&&(t=this.parentUrl);var r=new e(t,n),o=this.query.get("@target");return null!==o&&r.query.add("@target",o),r},e.prototype.getImpl=function(e,t){if(void 0===e&&(e={}),this._useCaching){var n=new s.CachingOptions(this.toUrlAndQuery().toLowerCase());if("undefined"!=typeof this._cachingOptions&&(n=o.Util.extend(n,this._cachingOptions)),null!==n.store){var r=n.store.get(n.key);if(null!==r)return new Promise(function(e){return e(r)})}t=new s.CachingParserWrapper(t,n)}if(null===this._batch){var i=new a.HttpClient;return i.get(this.toUrlAndQuery(),e).then(function(e){if(!e.ok)throw"Error making GET request: "+e.statusText;return t.parse(e)})}return this._batch.add(this.toUrlAndQuery(),"GET",{},t)},e.prototype.postImpl=function(e,t){if(null===this._batch){var n=new a.HttpClient;return n.post(this.toUrlAndQuery(),e).then(function(e){if(!e.ok)throw"Error making POST request: "+e.statusText;return e.headers.has("Content-Length")&&0===parseFloat(e.headers.get("Content-Length"))||204===e.status?new Promise(function(e,t){e({})}):t.parse(e)})}return this._batch.add(this.toUrlAndQuery(),"POST",e,t)},e}();n.Queryable=l;var p=function(e){function t(){e.apply(this,arguments)}return r(t,e),t.prototype.filter=function(e){return this._query.add("$filter",e),this},t.prototype.select=function(){for(var e=[],t=0;t0?e.substring(0,t)+n+e.substring(t,e.length):n+e},t.dateAdd=function(e,t,n){var r=new Date(e.toLocaleString());switch(t.toLowerCase()){case"year":r.setFullYear(r.getFullYear()+n);break;case"quarter":r.setMonth(r.getMonth()+3*n);break;case"month":r.setMonth(r.getMonth()+n);break;case"week":r.setDate(r.getDate()+7*n);break;case"day":r.setDate(r.getDate()+n);break;case"hour":r.setTime(r.getTime()+36e5*n);break;case"minute":r.setTime(r.getTime()+6e4*n);break;case"second":r.setTime(r.getTime()+1e3*n);break;default:r=void 0}return r},t.loadStylesheet=function(e,t){t&&(e+="?"+encodeURIComponent((new Date).getTime().toString()));var n=document.getElementsByTagName("head");if(n.length>0){var r=document.createElement("link");n[0].appendChild(r),r.setAttribute("type","text/css"),r.setAttribute("rel","stylesheet"),r.setAttribute("href",e)}},t.combinePaths=function(){for(var e=[],t=0;t -1) {\n this.values[index] = o;\n }\n else {\n this.keys.push(key);\n this.values.push(o);\n }\n };\n Dictionary.prototype.merge = function (source) {\n if (util_1.Util.isFunction(source[\"getKeys\"])) {\n var sourceAsDictionary = source;\n var keys = sourceAsDictionary.getKeys();\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n this.add(keys[i], sourceAsDictionary.get(keys[i]));\n }\n }\n else {\n var sourceAsHash = source;\n for (var key in sourceAsHash) {\n if (sourceAsHash.hasOwnProperty(key)) {\n this.add(key, source[key]);\n }\n }\n }\n };\n Dictionary.prototype.remove = function (key) {\n var index = this.keys.indexOf(key);\n if (index < 0) {\n return null;\n }\n var val = this.values[index];\n this.keys.splice(index, 1);\n this.values.splice(index, 1);\n return val;\n };\n Dictionary.prototype.getKeys = function () {\n return this.keys;\n };\n Dictionary.prototype.getValues = function () {\n return this.values;\n };\n Dictionary.prototype.clear = function () {\n this.keys = [];\n this.values = [];\n };\n Dictionary.prototype.count = function () {\n return this.keys.length;\n };\n return Dictionary;\n}());\nexports.Dictionary = Dictionary;\n","(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.$pnp = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require==\"function\"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error(\"Cannot find module '\"+o+\"'\");throw f.code=\"MODULE_NOT_FOUND\",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require==\"function\"&&require;for(var o=0;o -1) {\n this.values[index] = o;\n }\n else {\n this.keys.push(key);\n this.values.push(o);\n }\n };\n Dictionary.prototype.merge = function (source) {\n if (util_1.Util.isFunction(source[\"getKeys\"])) {\n var sourceAsDictionary = source;\n var keys = sourceAsDictionary.getKeys();\n var l = keys.length;\n for (var i = 0; i < l; i++) {\n this.add(keys[i], sourceAsDictionary.get(keys[i]));\n }\n }\n else {\n var sourceAsHash = source;\n for (var key in sourceAsHash) {\n if (sourceAsHash.hasOwnProperty(key)) {\n this.add(key, source[key]);\n }\n }\n }\n };\n Dictionary.prototype.remove = function (key) {\n var index = this.keys.indexOf(key);\n if (index < 0) {\n return null;\n }\n var val = this.values[index];\n this.keys.splice(index, 1);\n this.values.splice(index, 1);\n return val;\n };\n Dictionary.prototype.getKeys = function () {\n return this.keys;\n };\n Dictionary.prototype.getValues = function () {\n return this.values;\n };\n Dictionary.prototype.clear = function () {\n this.keys = [];\n this.values = [];\n };\n Dictionary.prototype.count = function () {\n return this.keys.length;\n };\n return Dictionary;\n}());\nexports.Dictionary = Dictionary;\n\n},{\"../utils/util\":41}],2:[function(require,module,exports){\n\"use strict\";\nvar Collections = require(\"../collections/collections\");\nvar providers = require(\"./providers/providers\");\nvar Settings = (function () {\n function Settings() {\n this.Providers = providers;\n this._settings = new Collections.Dictionary();\n }\n Settings.prototype.add = function (key, value) {\n this._settings.add(key, value);\n };\n Settings.prototype.addJSON = function (key, value) {\n this._settings.add(key, JSON.stringify(value));\n };\n Settings.prototype.apply = function (hash) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n try {\n _this._settings.merge(hash);\n resolve();\n }\n catch (e) {\n reject(e);\n }\n });\n };\n Settings.prototype.load = function (provider) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n provider.getConfiguration().then(function (value) {\n _this._settings.merge(value);\n resolve();\n }).catch(function (reason) {\n reject(reason);\n });\n });\n };\n Settings.prototype.get = function (key) {\n return this._settings.get(key);\n };\n Settings.prototype.getJSON = function (key) {\n var o = this.get(key);\n if (typeof o === \"undefined\" || o === null) {\n return o;\n }\n return JSON.parse(o);\n };\n return Settings;\n}());\nexports.Settings = Settings;\n\n},{\"../collections/collections\":1,\"./providers/providers\":5}],3:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar RuntimeConfigImpl = (function () {\n function RuntimeConfigImpl() {\n this._headers = null;\n this._defaultCachingStore = \"session\";\n this._defaultCachingTimeoutSeconds = 30;\n this._globalCacheDisable = false;\n this._useSPRequestExecutor = false;\n }\n RuntimeConfigImpl.prototype.set = function (config) {\n if (config.hasOwnProperty(\"headers\")) {\n this._headers = config.headers;\n }\n if (config.hasOwnProperty(\"globalCacheDisable\")) {\n this._globalCacheDisable = config.globalCacheDisable;\n }\n if (config.hasOwnProperty(\"defaultCachingStore\")) {\n this._defaultCachingStore = config.defaultCachingStore;\n }\n if (config.hasOwnProperty(\"defaultCachingTimeoutSeconds\")) {\n this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds;\n }\n if (config.hasOwnProperty(\"useSPRequestExecutor\")) {\n this._useSPRequestExecutor = config.useSPRequestExecutor;\n }\n if (config.hasOwnProperty(\"nodeClientOptions\")) {\n this._useNodeClient = true;\n this._useSPRequestExecutor = false;\n this._nodeClientData = config.nodeClientOptions;\n global._spPageContextInfo = {\n webAbsoluteUrl: config.nodeClientOptions.siteUrl,\n };\n }\n };\n Object.defineProperty(RuntimeConfigImpl.prototype, \"headers\", {\n get: function () {\n return this._headers;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingStore\", {\n get: function () {\n return this._defaultCachingStore;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingTimeoutSeconds\", {\n get: function () {\n return this._defaultCachingTimeoutSeconds;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"globalCacheDisable\", {\n get: function () {\n return this._globalCacheDisable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useSPRequestExecutor\", {\n get: function () {\n return this._useSPRequestExecutor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useNodeFetchClient\", {\n get: function () {\n return this._useNodeClient;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"nodeRequestOptions\", {\n get: function () {\n return this._nodeClientData;\n },\n enumerable: true,\n configurable: true\n });\n return RuntimeConfigImpl;\n}());\nexports.RuntimeConfigImpl = RuntimeConfigImpl;\nvar _runtimeConfig = new RuntimeConfigImpl();\nexports.RuntimeConfig = _runtimeConfig;\nfunction setRuntimeConfig(config) {\n _runtimeConfig.set(config);\n}\nexports.setRuntimeConfig = setRuntimeConfig;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],4:[function(require,module,exports){\n\"use strict\";\nvar storage = require(\"../../utils/storage\");\nvar CachingConfigurationProvider = (function () {\n function CachingConfigurationProvider(wrappedProvider, cacheKey, cacheStore) {\n this.wrappedProvider = wrappedProvider;\n this.store = (cacheStore) ? cacheStore : this.selectPnPCache();\n this.cacheKey = \"_configcache_\" + cacheKey;\n }\n CachingConfigurationProvider.prototype.getWrappedProvider = function () {\n return this.wrappedProvider;\n };\n CachingConfigurationProvider.prototype.getConfiguration = function () {\n var _this = this;\n if ((!this.store) || (!this.store.enabled)) {\n return this.wrappedProvider.getConfiguration();\n }\n var cachedConfig = this.store.get(this.cacheKey);\n if (cachedConfig) {\n return new Promise(function (resolve, reject) {\n resolve(cachedConfig);\n });\n }\n var providerPromise = this.wrappedProvider.getConfiguration();\n providerPromise.then(function (providedConfig) {\n _this.store.put(_this.cacheKey, providedConfig);\n });\n return providerPromise;\n };\n CachingConfigurationProvider.prototype.selectPnPCache = function () {\n var pnpCache = new storage.PnPClientStorage();\n if ((pnpCache.local) && (pnpCache.local.enabled)) {\n return pnpCache.local;\n }\n if ((pnpCache.session) && (pnpCache.session.enabled)) {\n return pnpCache.session;\n }\n throw new Error(\"Cannot create a caching configuration provider since cache is not available.\");\n };\n return CachingConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = CachingConfigurationProvider;\n\n},{\"../../utils/storage\":40}],5:[function(require,module,exports){\n\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar spListConfigurationProvider_1 = require(\"./spListConfigurationProvider\");\nexports.CachingConfigurationProvider = cachingConfigurationProvider_1.default;\nexports.SPListConfigurationProvider = spListConfigurationProvider_1.default;\n\n},{\"./cachingConfigurationProvider\":4,\"./spListConfigurationProvider\":6}],6:[function(require,module,exports){\n\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar SPListConfigurationProvider = (function () {\n function SPListConfigurationProvider(sourceWeb, sourceListTitle) {\n if (sourceListTitle === void 0) { sourceListTitle = \"config\"; }\n this.sourceWeb = sourceWeb;\n this.sourceListTitle = sourceListTitle;\n }\n Object.defineProperty(SPListConfigurationProvider.prototype, \"web\", {\n get: function () {\n return this.sourceWeb;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SPListConfigurationProvider.prototype, \"listTitle\", {\n get: function () {\n return this.sourceListTitle;\n },\n enumerable: true,\n configurable: true\n });\n SPListConfigurationProvider.prototype.getConfiguration = function () {\n return this.web.lists.getByTitle(this.listTitle).items.select(\"Title\", \"Value\")\n .getAs().then(function (data) {\n var configuration = {};\n data.forEach(function (i) {\n configuration[i.Title] = i.Value;\n });\n return configuration;\n });\n };\n SPListConfigurationProvider.prototype.asCaching = function () {\n var cacheKey = \"splist_\" + this.web.toUrl() + \"+\" + this.listTitle;\n return new cachingConfigurationProvider_1.default(this, cacheKey);\n };\n return SPListConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = SPListConfigurationProvider;\n\n},{\"./cachingConfigurationProvider\":4}],7:[function(require,module,exports){\n\"use strict\";\nvar collections_1 = require(\"../collections/collections\");\nvar util_1 = require(\"../utils/util\");\nvar odata_1 = require(\"../sharepoint/rest/odata\");\nvar CachedDigest = (function () {\n function CachedDigest() {\n }\n return CachedDigest;\n}());\nexports.CachedDigest = CachedDigest;\nvar DigestCache = (function () {\n function DigestCache(_httpClient, _digests) {\n if (_digests === void 0) { _digests = new collections_1.Dictionary(); }\n this._httpClient = _httpClient;\n this._digests = _digests;\n }\n DigestCache.prototype.getDigest = function (webUrl) {\n var self = this;\n var cachedDigest = this._digests.get(webUrl);\n if (cachedDigest !== null) {\n var now = new Date();\n if (now < cachedDigest.expiration) {\n return Promise.resolve(cachedDigest.value);\n }\n }\n var url = util_1.Util.combinePaths(webUrl, \"/_api/contextinfo\");\n return self._httpClient.fetchRaw(url, {\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Accept\": \"application/json;odata=verbose\",\n \"Content-type\": \"application/json;odata=verbose;charset=utf-8\",\n },\n method: \"POST\",\n }).then(function (response) {\n var parser = new odata_1.ODataDefaultParser();\n return parser.parse(response).then(function (d) { return d.GetContextWebInformation; });\n }).then(function (data) {\n var newCachedDigest = new CachedDigest();\n newCachedDigest.value = data.FormDigestValue;\n var seconds = data.FormDigestTimeoutSeconds;\n var expiration = new Date();\n expiration.setTime(expiration.getTime() + 1000 * seconds);\n newCachedDigest.expiration = expiration;\n self._digests.add(webUrl, newCachedDigest);\n return newCachedDigest.value;\n });\n };\n DigestCache.prototype.clear = function () {\n this._digests.clear();\n };\n return DigestCache;\n}());\nexports.DigestCache = DigestCache;\n\n},{\"../collections/collections\":1,\"../sharepoint/rest/odata\":22,\"../utils/util\":41}],8:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar FetchClient = (function () {\n function FetchClient() {\n }\n FetchClient.prototype.fetch = function (url, options) {\n return global.fetch(url, options);\n };\n return FetchClient;\n}());\nexports.FetchClient = FetchClient;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}],9:[function(require,module,exports){\n\"use strict\";\nvar fetchclient_1 = require(\"./fetchclient\");\nvar digestcache_1 = require(\"./digestcache\");\nvar util_1 = require(\"../utils/util\");\nvar pnplibconfig_1 = require(\"../configuration/pnplibconfig\");\nvar sprequestexecutorclient_1 = require(\"./sprequestexecutorclient\");\nvar nodefetchclient_1 = require(\"./nodefetchclient\");\nvar HttpClient = (function () {\n function HttpClient() {\n this._impl = this.getFetchImpl();\n this._digestCache = new digestcache_1.DigestCache(this);\n }\n HttpClient.prototype.fetch = function (url, options) {\n if (options === void 0) { options = {}; }\n var self = this;\n var opts = util_1.Util.extend(options, { cache: \"no-cache\", credentials: \"same-origin\" }, true);\n var headers = new Headers();\n this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers);\n this.mergeHeaders(headers, options.headers);\n if (!headers.has(\"Accept\")) {\n headers.append(\"Accept\", \"application/json\");\n }\n if (!headers.has(\"Content-Type\")) {\n headers.append(\"Content-Type\", \"application/json;odata=verbose;charset=utf-8\");\n }\n if (!headers.has(\"X-ClientService-ClientTag\")) {\n headers.append(\"X-ClientService-ClientTag\", \"PnPCoreJS:1.0.4\");\n }\n opts = util_1.Util.extend(opts, { headers: headers });\n if (opts.method && opts.method.toUpperCase() !== \"GET\") {\n if (!headers.has(\"X-RequestDigest\")) {\n var index = url.indexOf(\"_api/\");\n if (index < 0) {\n throw new Error(\"Unable to determine API url\");\n }\n var webUrl = url.substr(0, index);\n return this._digestCache.getDigest(webUrl)\n .then(function (digest) {\n headers.append(\"X-RequestDigest\", digest);\n return self.fetchRaw(url, opts);\n });\n }\n }\n return self.fetchRaw(url, opts);\n };\n HttpClient.prototype.fetchRaw = function (url, options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n var rawHeaders = new Headers();\n this.mergeHeaders(rawHeaders, options.headers);\n options = util_1.Util.extend(options, { headers: rawHeaders });\n var retry = function (ctx) {\n _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {\n var delay = ctx.delay;\n if (response.status !== 429 && response.status !== 503) {\n ctx.reject(response);\n }\n ctx.delay *= 2;\n ctx.attempts++;\n if (ctx.retryCount <= ctx.attempts) {\n ctx.reject(response);\n }\n setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay);\n });\n };\n return new Promise(function (resolve, reject) {\n var retryContext = {\n attempts: 0,\n delay: 100,\n reject: reject,\n resolve: resolve,\n retryCount: 7,\n };\n retry.call(_this, retryContext);\n });\n };\n HttpClient.prototype.get = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"GET\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.post = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"POST\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.getFetchImpl = function () {\n if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) {\n return new sprequestexecutorclient_1.SPRequestExecutorClient();\n }\n else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) {\n var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions;\n return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret);\n }\n else {\n return new fetchclient_1.FetchClient();\n }\n };\n HttpClient.prototype.mergeHeaders = function (target, source) {\n if (typeof source !== \"undefined\" && source !== null) {\n var temp = new Request(\"\", { headers: source });\n temp.headers.forEach(function (value, name) {\n target.append(name, value);\n });\n }\n };\n return HttpClient;\n}());\nexports.HttpClient = HttpClient;\n\n},{\"../configuration/pnplibconfig\":3,\"../utils/util\":41,\"./digestcache\":7,\"./fetchclient\":8,\"./nodefetchclient\":10,\"./sprequestexecutorclient\":11}],10:[function(require,module,exports){\n\"use strict\";\nvar NodeFetchClient = (function () {\n function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) {\n if (_realm === void 0) { _realm = \"\"; }\n this.siteUrl = siteUrl;\n this._clientId = _clientId;\n this._clientSecret = _clientSecret;\n this._realm = _realm;\n }\n NodeFetchClient.prototype.fetch = function (url, options) {\n throw new Error(\"Using NodeFetchClient in the browser is not supported.\");\n };\n return NodeFetchClient;\n}());\nexports.NodeFetchClient = NodeFetchClient;\n\n},{}],11:[function(require,module,exports){\n\"use strict\";\nvar util_1 = require(\"../utils/util\");\nvar SPRequestExecutorClient = (function () {\n function SPRequestExecutorClient() {\n this.convertToResponse = function (spResponse) {\n var responseHeaders = new Headers();\n for (var h in spResponse.headers) {\n if (spResponse.headers[h]) {\n responseHeaders.append(h, spResponse.headers[h]);\n }\n }\n return new Response(spResponse.body, {\n headers: responseHeaders,\n status: spResponse.statusCode,\n statusText: spResponse.statusText,\n });\n };\n }\n SPRequestExecutorClient.prototype.fetch = function (url, options) {\n var _this = this;\n if (typeof SP === \"undefined\" || typeof SP.RequestExecutor === \"undefined\") {\n throw new Error(\"SP.RequestExecutor is undefined. \" +\n \"Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library.\");\n }\n var addinWebUrl = url.substring(0, url.indexOf(\"/_api\")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp;\n if (options.headers && options.headers instanceof Headers) {\n iterator = options.headers.entries();\n temp = iterator.next();\n while (!temp.done) {\n headers[temp.value[0]] = temp.value[1];\n temp = iterator.next();\n }\n }\n else {\n headers = options.headers;\n }\n return new Promise(function (resolve, reject) {\n var requestOptions = {\n error: function (error) {\n reject(_this.convertToResponse(error));\n },\n headers: headers,\n method: options.method,\n success: function (response) {\n resolve(_this.convertToResponse(response));\n },\n url: url,\n };\n if (options.body) {\n util_1.Util.extend(requestOptions, { body: options.body });\n }\n else {\n util_1.Util.extend(requestOptions, { binaryStringRequestBody: true });\n }\n executor.executeAsync(requestOptions);\n });\n };\n return SPRequestExecutorClient;\n}());\nexports.SPRequestExecutorClient = SPRequestExecutorClient;\n\n},{\"../utils/util\":41}],12:[function(require,module,exports){\n\"use strict\";\nvar util_1 = require(\"./utils/util\");\nvar storage_1 = require(\"./utils/storage\");\nvar configuration_1 = require(\"./configuration/configuration\");\nvar logging_1 = require(\"./utils/logging\");\nvar rest_1 = require(\"./sharepoint/rest/rest\");\nvar pnplibconfig_1 = require(\"./configuration/pnplibconfig\");\nexports.util = util_1.Util;\nexports.sp = new rest_1.Rest();\nexports.storage = new storage_1.PnPClientStorage();\nexports.config = new configuration_1.Settings();\nexports.log = logging_1.Logger;\nexports.setup = pnplibconfig_1.setRuntimeConfig;\nvar Def = {\n config: exports.config,\n log: exports.log,\n setup: exports.setup,\n sp: exports.sp,\n storage: exports.storage,\n util: exports.util,\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = Def;\n\n},{\"./configuration/configuration\":2,\"./configuration/pnplibconfig\":3,\"./sharepoint/rest/rest\":26,\"./utils/logging\":39,\"./utils/storage\":40,\"./utils/util\":41}],13:[function(require,module,exports){\n\"use strict\";\nvar storage_1 = require(\"../../utils/storage\");\nvar util_1 = require(\"../../utils/util\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar CachingOptions = (function () {\n function CachingOptions(key) {\n this.key = key;\n this.expiration = util_1.Util.dateAdd(new Date(), \"second\", pnplibconfig_1.RuntimeConfig.defaultCachingTimeoutSeconds);\n this.storeName = pnplibconfig_1.RuntimeConfig.defaultCachingStore;\n }\n Object.defineProperty(CachingOptions.prototype, \"store\", {\n get: function () {\n if (this.storeName === \"local\") {\n return CachingOptions.storage.local;\n }\n else {\n return CachingOptions.storage.session;\n }\n },\n enumerable: true,\n configurable: true\n });\n CachingOptions.storage = new storage_1.PnPClientStorage();\n return CachingOptions;\n}());\nexports.CachingOptions = CachingOptions;\nvar CachingParserWrapper = (function () {\n function CachingParserWrapper(_parser, _cacheOptions) {\n this._parser = _parser;\n this._cacheOptions = _cacheOptions;\n }\n CachingParserWrapper.prototype.parse = function (response) {\n var _this = this;\n return this._parser.parse(response).then(function (data) {\n if (_this._cacheOptions.store !== null) {\n _this._cacheOptions.store.put(_this._cacheOptions.key, data, _this._cacheOptions.expiration);\n }\n return data;\n });\n };\n return CachingParserWrapper;\n}());\nexports.CachingParserWrapper = CachingParserWrapper;\n\n},{\"../../configuration/pnplibconfig\":3,\"../../utils/storage\":40,\"../../utils/util\":41}],14:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar ContentTypes = (function (_super) {\n __extends(ContentTypes, _super);\n function ContentTypes(baseUrl, path) {\n if (path === void 0) { path = \"contenttypes\"; }\n _super.call(this, baseUrl, path);\n }\n ContentTypes.prototype.getById = function (id) {\n var ct = new ContentType(this);\n ct.concat(\"('\" + id + \"')\");\n return ct;\n };\n return ContentTypes;\n}(queryable_1.QueryableCollection));\nexports.ContentTypes = ContentTypes;\nvar ContentType = (function (_super) {\n __extends(ContentType, _super);\n function ContentType(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(ContentType.prototype, \"descriptionResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"descriptionResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fieldLinks\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldLinks\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"nameResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"nameResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"parent\", {\n get: function () {\n return new queryable_1.Queryable(this, \"parent\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"workflowAssociations\", {\n get: function () {\n return new queryable_1.Queryable(this, \"workflowAssociations\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplate\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplate\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplateUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplateUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"readOnly\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnly\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"stringId\", {\n get: function () {\n return new queryable_1.Queryable(this, \"stringId\");\n },\n enumerable: true,\n configurable: true\n });\n return ContentType;\n}(queryable_1.QueryableInstance));\nexports.ContentType = ContentType;\n\n},{\"./queryable\":23}],15:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Types = require(\"./types\");\nvar Fields = (function (_super) {\n __extends(Fields, _super);\n function Fields(baseUrl, path) {\n if (path === void 0) { path = \"fields\"; }\n _super.call(this, baseUrl, path);\n }\n Fields.prototype.getByTitle = function (title) {\n return new Field(this, \"getByTitle('\" + title + \"')\");\n };\n Fields.prototype.getByInternalNameOrTitle = function (name) {\n return new Field(this, \"getByInternalNameOrTitle('\" + name + \"')\");\n };\n Fields.prototype.getById = function (id) {\n var f = new Field(this);\n f.concat(\"('\" + id + \"')\");\n return f;\n };\n Fields.prototype.createFieldAsXml = function (xml) {\n var _this = this;\n var info;\n if (typeof xml === \"string\") {\n info = { SchemaXml: xml };\n }\n else {\n info = xml;\n }\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": {\n \"type\": \"SP.XmlSchemaFieldCreationInformation\",\n },\n }, info),\n });\n var q = new Fields(this, \"createfieldasxml\");\n return q.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.add = function (title, fieldType, properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n \"Title\": title,\n }, properties));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.addText = function (title, maxLength, properties) {\n if (maxLength === void 0) { maxLength = 255; }\n var props = {\n FieldTypeKind: 2,\n };\n return this.add(title, \"SP.FieldText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) {\n if (outputType === void 0) { outputType = Types.FieldTypes.Text; }\n var props = {\n DateFormat: dateFormat,\n FieldTypeKind: 17,\n Formula: formula,\n OutputType: outputType,\n };\n return this.add(title, \"SP.FieldCalculated\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.DateTimeFieldFormatType.DateOnly; }\n if (calendarType === void 0) { calendarType = Types.CalendarType.Gregorian; }\n if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = 0; }\n var props = {\n DateTimeCalendarType: calendarType,\n DisplayFormat: displayFormat,\n FieldTypeKind: 4,\n FriendlyDisplayFormat: friendlyDisplayFormat,\n };\n return this.add(title, \"SP.FieldDateTime\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addNumber = function (title, minValue, maxValue, properties) {\n var props = { FieldTypeKind: 9 };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldNumber\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) {\n if (currencyLocalId === void 0) { currencyLocalId = 1033; }\n var props = {\n CurrencyLocaleId: currencyLocalId,\n FieldTypeKind: 10,\n };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldCurrency\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addMultilineText = function (title, numberOfLines, richText, restrictedMode, appendOnly, allowHyperlink, properties) {\n if (numberOfLines === void 0) { numberOfLines = 6; }\n if (richText === void 0) { richText = true; }\n if (restrictedMode === void 0) { restrictedMode = false; }\n if (appendOnly === void 0) { appendOnly = false; }\n if (allowHyperlink === void 0) { allowHyperlink = true; }\n var props = {\n AllowHyperlink: allowHyperlink,\n AppendOnly: appendOnly,\n FieldTypeKind: 3,\n NumberOfLines: numberOfLines,\n RestrictedMode: restrictedMode,\n RichText: richText,\n };\n return this.add(title, \"SP.FieldMultiLineText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addUrl = function (title, displayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.UrlFieldFormatType.Hyperlink; }\n var props = {\n DisplayFormat: displayFormat,\n FieldTypeKind: 11,\n };\n return this.add(title, \"SP.FieldUrl\", util_1.Util.extend(props, properties));\n };\n return Fields;\n}(queryable_1.QueryableCollection));\nexports.Fields = Fields;\nvar Field = (function (_super) {\n __extends(Field, _super);\n function Field(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Field.prototype, \"canBeDeleted\", {\n get: function () {\n return new queryable_1.Queryable(this, \"canBeDeleted\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"defaultValue\", {\n get: function () {\n return new queryable_1.Queryable(this, \"defaultValue\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"direction\", {\n get: function () {\n return new queryable_1.Queryable(this, \"direction\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"enforceUniqueValues\", {\n get: function () {\n return new queryable_1.Queryable(this, \"enforceUniqueValues\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"entityPropertyName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"entityPropertyName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"filterable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"filterable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fromBaseType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fromBaseType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"indexed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"indexed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"internalName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"internalName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"readOnlyField\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnlyField\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"required\", {\n get: function () {\n return new queryable_1.Queryable(this, \"required\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sortable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sortable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"staticName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"staticName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fieldTypeKind\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldTypeKind\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeAsString\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeAsString\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeDisplayName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeDisplayName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeShortDescription\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeShortDescription\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationFormula\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationFormula\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationMessage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationMessage\");\n },\n enumerable: true,\n configurable: true\n });\n Field.prototype.update = function (properties, fieldType) {\n var _this = this;\n if (fieldType === void 0) { fieldType = \"SP.Field\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n field: _this,\n };\n });\n };\n Field.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Field.prototype.setShowInDisplayForm = function (show) {\n var q = new Field(this, \"setshowindisplayform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInEditForm = function (show) {\n var q = new Field(this, \"setshowineditform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInNewForm = function (show) {\n var q = new Field(this, \"setshowinnewform(\" + show + \")\");\n return q.post();\n };\n return Field;\n}(queryable_1.QueryableInstance));\nexports.Field = Field;\n\n},{\"../../utils/util\":41,\"./queryable\":23,\"./types\":33}],16:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar items_1 = require(\"./items\");\nvar Files = (function (_super) {\n __extends(Files, _super);\n function Files(baseUrl, path) {\n if (path === void 0) { path = \"files\"; }\n _super.call(this, baseUrl, path);\n }\n Files.prototype.getByName = function (name) {\n var f = new File(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Files.prototype.add = function (url, content, shouldOverWrite) {\n var _this = this;\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new Files(this, \"add(overwrite=\" + shouldOverWrite + \",url='\" + url + \"')\")\n .post({ body: content }).then(function (response) {\n return {\n data: response,\n file: _this.getByName(url),\n };\n });\n };\n Files.prototype.addTemplateFile = function (fileUrl, templateFileType) {\n var _this = this;\n return new Files(this, \"addTemplateFile(urloffile='\" + fileUrl + \"',templatefiletype=\" + templateFileType + \")\")\n .post().then(function (response) {\n return {\n data: response,\n file: _this.getByName(fileUrl),\n };\n });\n };\n return Files;\n}(queryable_1.QueryableCollection));\nexports.Files = Files;\nvar File = (function (_super) {\n __extends(File, _super);\n function File(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(File.prototype, \"author\", {\n get: function () {\n return new queryable_1.Queryable(this, \"author\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkedOutByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkedOutByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkOutType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkOutType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"contentTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"contentTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"customizedPageStatus\", {\n get: function () {\n return new queryable_1.Queryable(this, \"customizedPageStatus\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"eTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"eTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"exists\", {\n get: function () {\n return new queryable_1.Queryable(this, \"exists\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"length\", {\n get: function () {\n return new queryable_1.Queryable(this, \"length\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"level\", {\n get: function () {\n return new queryable_1.Queryable(this, \"level\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"lockedByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"lockedByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"majorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"majorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"minorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"minorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"modifiedBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"modifiedBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeCreated\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeCreated\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeLastModified\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeLastModified\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"versions\", {\n get: function () {\n return new Versions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"value\", {\n get: function () {\n return new queryable_1.Queryable(this, \"$value\");\n },\n enumerable: true,\n configurable: true\n });\n File.prototype.approve = function (comment) {\n return new File(this, \"approve(comment='\" + comment + \"')\").post();\n };\n File.prototype.cancelUpload = function (uploadId) {\n return new File(this, \"cancelUpload(uploadId=guid'\" + uploadId + \"')\").post();\n };\n File.prototype.checkin = function (comment, checkinType) {\n if (comment === void 0) { comment = \"\"; }\n if (checkinType === void 0) { checkinType = CheckinType.Major; }\n return new File(this, \"checkin(comment='\" + comment + \"',checkintype=\" + checkinType + \")\").post();\n };\n File.prototype.checkout = function () {\n return new File(this, \"checkout\").post();\n };\n File.prototype.continueUpload = function (uploadId, fileOffset, b) {\n return new File(this, \"continueUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\").postAs({ body: b });\n };\n File.prototype.copyTo = function (url, shouldOverWrite) {\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new File(this, \"copyTo(strnewurl='\" + url + \"',boverwrite=\" + shouldOverWrite + \")\").post();\n };\n File.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new File(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n File.prototype.deny = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"deny(comment='\" + comment + \"')\").post();\n };\n File.prototype.finishUpload = function (uploadId, fileOffset, fragment) {\n return new File(this, \"finishUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\")\n .postAs({ body: fragment }).then(function (response) {\n return {\n data: response,\n file: new File(response.ServerRelativeUrl),\n };\n });\n };\n File.prototype.getLimitedWebPartManager = function (scope) {\n if (scope === void 0) { scope = WebPartsPersonalizationScope.User; }\n return new queryable_1.Queryable(this, \"getLimitedWebPartManager(scope=\" + scope + \")\");\n };\n File.prototype.moveTo = function (url, moveOperations) {\n if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; }\n return new File(this, \"moveTo(newurl='\" + url + \"',flags=\" + moveOperations + \")\").post();\n };\n File.prototype.openBinaryStream = function () {\n return new queryable_1.Queryable(this, \"openBinaryStream\");\n };\n File.prototype.publish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"publish(comment='\" + comment + \"')\").post();\n };\n File.prototype.recycle = function () {\n return new File(this, \"recycle\").post();\n };\n File.prototype.saveBinaryStream = function (data) {\n return new File(this, \"saveBinary\").post({ body: data });\n };\n File.prototype.startUpload = function (uploadId, fragment) {\n return new File(this, \"startUpload(uploadId=guid'\" + uploadId + \"')\").postAs({ body: fragment });\n };\n File.prototype.undoCheckout = function () {\n return new File(this, \"undoCheckout\").post();\n };\n File.prototype.unpublish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"unpublish(comment='\" + comment + \"')\").post();\n };\n return File;\n}(queryable_1.QueryableInstance));\nexports.File = File;\nvar Versions = (function (_super) {\n __extends(Versions, _super);\n function Versions(baseUrl, path) {\n if (path === void 0) { path = \"versions\"; }\n _super.call(this, baseUrl, path);\n }\n Versions.prototype.getById = function (versionId) {\n var v = new Version(this);\n v.concat(\"(\" + versionId + \")\");\n return v;\n };\n Versions.prototype.deleteAll = function () {\n return new Versions(this, \"deleteAll\").post();\n };\n Versions.prototype.deleteById = function (versionId) {\n return new Versions(this, \"deleteById(vid=\" + versionId + \")\").post();\n };\n Versions.prototype.deleteByLabel = function (label) {\n return new Versions(this, \"deleteByLabel(versionlabel='\" + label + \"')\").post();\n };\n Versions.prototype.restoreByLabel = function (label) {\n return new Versions(this, \"restoreByLabel(versionlabel='\" + label + \"')\").post();\n };\n return Versions;\n}(queryable_1.QueryableCollection));\nexports.Versions = Versions;\nvar Version = (function (_super) {\n __extends(Version, _super);\n function Version(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Version.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"created\", {\n get: function () {\n return new queryable_1.Queryable(this, \"created\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"createdBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"createdBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"isCurrentVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"isCurrentVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"size\", {\n get: function () {\n return new queryable_1.Queryable(this, \"size\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"url\", {\n get: function () {\n return new queryable_1.Queryable(this, \"url\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"versionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"versionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Version.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return Version;\n}(queryable_1.QueryableInstance));\nexports.Version = Version;\n(function (CheckinType) {\n CheckinType[CheckinType[\"Minor\"] = 0] = \"Minor\";\n CheckinType[CheckinType[\"Major\"] = 1] = \"Major\";\n CheckinType[CheckinType[\"Overwrite\"] = 2] = \"Overwrite\";\n})(exports.CheckinType || (exports.CheckinType = {}));\nvar CheckinType = exports.CheckinType;\n(function (WebPartsPersonalizationScope) {\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"User\"] = 0] = \"User\";\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"Shared\"] = 1] = \"Shared\";\n})(exports.WebPartsPersonalizationScope || (exports.WebPartsPersonalizationScope = {}));\nvar WebPartsPersonalizationScope = exports.WebPartsPersonalizationScope;\n(function (MoveOperations) {\n MoveOperations[MoveOperations[\"Overwrite\"] = 1] = \"Overwrite\";\n MoveOperations[MoveOperations[\"AllowBrokenThickets\"] = 8] = \"AllowBrokenThickets\";\n})(exports.MoveOperations || (exports.MoveOperations = {}));\nvar MoveOperations = exports.MoveOperations;\n(function (TemplateFileType) {\n TemplateFileType[TemplateFileType[\"StandardPage\"] = 0] = \"StandardPage\";\n TemplateFileType[TemplateFileType[\"WikiPage\"] = 1] = \"WikiPage\";\n TemplateFileType[TemplateFileType[\"FormPage\"] = 2] = \"FormPage\";\n})(exports.TemplateFileType || (exports.TemplateFileType = {}));\nvar TemplateFileType = exports.TemplateFileType;\n\n},{\"./items\":19,\"./queryable\":23}],17:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar files_1 = require(\"./files\");\nvar items_1 = require(\"./items\");\nvar Folders = (function (_super) {\n __extends(Folders, _super);\n function Folders(baseUrl, path) {\n if (path === void 0) { path = \"folders\"; }\n _super.call(this, baseUrl, path);\n }\n Folders.prototype.getByName = function (name) {\n var f = new Folder(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Folders.prototype.add = function (url) {\n var _this = this;\n return new Folders(this, \"add('\" + url + \"')\").post().then(function (response) {\n return {\n data: response,\n folder: _this.getByName(url),\n };\n });\n };\n return Folders;\n}(queryable_1.QueryableCollection));\nexports.Folders = Folders;\nvar Folder = (function (_super) {\n __extends(Folder, _super);\n function Folder(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Folder.prototype, \"contentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"contentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"files\", {\n get: function () {\n return new files_1.Files(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"folders\", {\n get: function () {\n return new Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"itemCount\", {\n get: function () {\n return new queryable_1.Queryable(this, \"itemCount\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"parentFolder\", {\n get: function () {\n return new Folder(this, \"parentFolder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"properties\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"properties\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"uniqueContentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"uniqueContentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"welcomePage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"welcomePage\");\n },\n enumerable: true,\n configurable: true\n });\n Folder.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new Folder(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Folder.prototype.recycle = function () {\n return new Folder(this, \"recycle\").post();\n };\n return Folder;\n}(queryable_1.QueryableInstance));\nexports.Folder = Folder;\n\n},{\"./files\":16,\"./items\":19,\"./queryable\":23}],18:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Forms = (function (_super) {\n __extends(Forms, _super);\n function Forms(baseUrl, path) {\n if (path === void 0) { path = \"forms\"; }\n _super.call(this, baseUrl, path);\n }\n Forms.prototype.getById = function (id) {\n var i = new Form(this);\n i.concat(\"('\" + id + \"')\");\n return i;\n };\n return Forms;\n}(queryable_1.QueryableCollection));\nexports.Forms = Forms;\nvar Form = (function (_super) {\n __extends(Form, _super);\n function Form(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n return Form;\n}(queryable_1.QueryableInstance));\nexports.Form = Form;\n\n},{\"./queryable\":23}],19:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar folders_1 = require(\"./folders\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar util_1 = require(\"../../utils/util\");\nvar odata_1 = require(\"./odata\");\nvar Items = (function (_super) {\n __extends(Items, _super);\n function Items(baseUrl, path) {\n if (path === void 0) { path = \"items\"; }\n _super.call(this, baseUrl, path);\n }\n Items.prototype.getById = function (id) {\n var i = new Item(this);\n i.concat(\"(\" + id + \")\");\n return i;\n };\n Items.prototype.skip = function (skip) {\n this._query.add(\"$skiptoken\", encodeURIComponent(\"Paged=TRUE&p_ID=\" + skip));\n return this;\n };\n Items.prototype.getPaged = function () {\n return this.getAs(new PagedItemCollectionParser());\n };\n Items.prototype.add = function (properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance);\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n item: _this.getById(data.Id),\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n return Items;\n}(queryable_1.QueryableCollection));\nexports.Items = Items;\nvar PagedItemCollectionParser = (function (_super) {\n __extends(PagedItemCollectionParser, _super);\n function PagedItemCollectionParser() {\n _super.apply(this, arguments);\n }\n PagedItemCollectionParser.prototype.parse = function (r) {\n return PagedItemCollection.fromResponse(r);\n };\n return PagedItemCollectionParser;\n}(odata_1.ODataParserBase));\nvar Item = (function (_super) {\n __extends(Item, _super);\n function Item(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Item.prototype, \"attachmentFiles\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"AttachmentFiles\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"contentType\", {\n get: function () {\n return new contenttypes_1.ContentType(this, \"ContentType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissionsForUI\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissionsForUI\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsHTML\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsHTML\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsText\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsText\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesForEdit\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesForEdit\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"folder\", {\n get: function () {\n return new folders_1.Folder(this, \"Folder\");\n },\n enumerable: true,\n configurable: true\n });\n Item.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance, this.parentUrl.substr(0, this.parentUrl.lastIndexOf(\"/\")));\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n item: _this,\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n Item.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Item.prototype.recycle = function () {\n var i = new Item(this, \"recycle\");\n return i.post();\n };\n Item.prototype.getWopiFrameUrl = function (action) {\n if (action === void 0) { action = 0; }\n var i = new Item(this, \"getWOPIFrameUrl(@action)\");\n i._query.add(\"@action\", action);\n return i.post().then(function (data) {\n return data.GetWOPIFrameUrl;\n });\n };\n Item.prototype.validateUpdateListItem = function (formValues, newDocumentUpdate) {\n if (newDocumentUpdate === void 0) { newDocumentUpdate = false; }\n var postBody = JSON.stringify({ \"formValues\": formValues, bNewDocumentUpdate: newDocumentUpdate });\n var item = new Item(this, \"validateupdatelistitem\");\n return item.post({ body: postBody });\n };\n return Item;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Item = Item;\nvar PagedItemCollection = (function () {\n function PagedItemCollection() {\n }\n Object.defineProperty(PagedItemCollection.prototype, \"hasNext\", {\n get: function () {\n return typeof this.nextUrl === \"string\" && this.nextUrl.length > 0;\n },\n enumerable: true,\n configurable: true\n });\n PagedItemCollection.fromResponse = function (r) {\n return r.json().then(function (d) {\n var col = new PagedItemCollection();\n col.nextUrl = d[\"odata.nextLink\"];\n col.results = d.value;\n return col;\n });\n };\n PagedItemCollection.prototype.getNext = function () {\n if (this.hasNext) {\n var items = new Items(this.nextUrl, null);\n return items.getPaged();\n }\n return new Promise(function (r) { return r(null); });\n };\n return PagedItemCollection;\n}());\nexports.PagedItemCollection = PagedItemCollection;\n\n},{\"../../utils/util\":41,\"./contenttypes\":14,\"./folders\":17,\"./odata\":22,\"./queryable\":23,\"./queryablesecurable\":24}],20:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar items_1 = require(\"./items\");\nvar views_1 = require(\"./views\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar fields_1 = require(\"./fields\");\nvar forms_1 = require(\"./forms\");\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar util_1 = require(\"../../utils/util\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Lists = (function (_super) {\n __extends(Lists, _super);\n function Lists(baseUrl, path) {\n if (path === void 0) { path = \"lists\"; }\n _super.call(this, baseUrl, path);\n }\n Lists.prototype.getByTitle = function (title) {\n return new List(this, \"getByTitle('\" + title + \"')\");\n };\n Lists.prototype.getById = function (id) {\n var list = new List(this);\n list.concat(\"('\" + id + \"')\");\n return list;\n };\n Lists.prototype.add = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n \"AllowContentTypes\": enableContentTypes,\n \"BaseTemplate\": template,\n \"ContentTypesEnabled\": enableContentTypes,\n \"Description\": description,\n \"Title\": title,\n }, additionalSettings));\n return this.post({ body: postBody }).then(function (data) {\n return { data: data, list: _this.getByTitle(title) };\n });\n };\n Lists.prototype.ensure = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n if (this.hasBatch) {\n throw new Error(\"The ensure method is not supported as part of a batch.\");\n }\n return new Promise(function (resolve, reject) {\n var list = _this.getByTitle(title);\n list.get().then(function (d) { return resolve({ created: false, data: d, list: list }); }).catch(function () {\n _this.add(title, description, template, enableContentTypes, additionalSettings).then(function (r) {\n resolve({ created: true, data: r.data, list: _this.getByTitle(title) });\n });\n }).catch(function (e) { return reject(e); });\n });\n };\n Lists.prototype.ensureSiteAssetsLibrary = function () {\n var q = new Lists(this, \"ensuresiteassetslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n Lists.prototype.ensureSitePagesLibrary = function () {\n var q = new Lists(this, \"ensuresitepageslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n return Lists;\n}(queryable_1.QueryableCollection));\nexports.Lists = Lists;\nvar List = (function (_super) {\n __extends(List, _super);\n function List(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(List.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"items\", {\n get: function () {\n return new items_1.Items(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"views\", {\n get: function () {\n return new views_1.Views(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"forms\", {\n get: function () {\n return new forms_1.Forms(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"defaultView\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"DefaultView\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"eventReceivers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"EventReceivers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"relatedFields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"getRelatedFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"informationRightsManagementSettings\", {\n get: function () {\n return new queryable_1.Queryable(this, \"InformationRightsManagementSettings\");\n },\n enumerable: true,\n configurable: true\n });\n List.prototype.getView = function (viewId) {\n return new views_1.View(this, \"getView('\" + viewId + \"')\");\n };\n List.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retList = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retList = _this.getParent(List, _this.parentUrl, \"getByTitle('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n list: retList,\n };\n });\n };\n List.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n List.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new List(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n List.prototype.getItemsByCAMLQuery = function (query) {\n var expands = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n expands[_i - 1] = arguments[_i];\n }\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.CamlQuery\" } }, query) });\n var q = new List(this, \"getitems\");\n q = q.expand.apply(q, expands);\n return q.post({ body: postBody });\n };\n List.prototype.getListItemChangesSinceToken = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeLogItemQuery\" } }, query) });\n var q = new List(this, \"getlistitemchangessincetoken\");\n return q.post({ body: postBody }, { parse: function (r) { return r.text(); } });\n };\n List.prototype.recycle = function () {\n this.append(\"recycle\");\n return this.post().then(function (data) {\n if (data.hasOwnProperty(\"Recycle\")) {\n return data.Recycle;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListData = function (viewXml) {\n var q = new List(this, \"renderlistdata(@viewXml)\");\n q.query.add(\"@viewXml\", \"'\" + viewXml + \"'\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"RenderListData\")) {\n return data.RenderListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListFormData = function (itemId, formId, mode) {\n var q = new List(this, \"renderlistformdata(itemid=\" + itemId + \", formid='\" + formId + \"', mode=\" + mode + \")\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"ListData\")) {\n return data.ListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.reserveListItemId = function () {\n var q = new List(this, \"reservelistitemid\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"ReserveListItemId\")) {\n return data.ReserveListItemId;\n }\n else {\n return data;\n }\n });\n };\n return List;\n}(queryablesecurable_1.QueryableSecurable));\nexports.List = List;\n\n},{\"../../utils/util\":41,\"./contenttypes\":14,\"./fields\":15,\"./forms\":18,\"./items\":19,\"./odata\":22,\"./queryable\":23,\"./queryablesecurable\":24,\"./usercustomactions\":34,\"./views\":36}],21:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar quicklaunch_1 = require(\"./quicklaunch\");\nvar topnavigationbar_1 = require(\"./topnavigationbar\");\nvar Navigation = (function (_super) {\n __extends(Navigation, _super);\n function Navigation(baseUrl) {\n _super.call(this, baseUrl, \"navigation\");\n }\n Object.defineProperty(Navigation.prototype, \"quicklaunch\", {\n get: function () {\n return new quicklaunch_1.QuickLaunch(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Navigation.prototype, \"topNavigationBar\", {\n get: function () {\n return new topnavigationbar_1.TopNavigationBar(this);\n },\n enumerable: true,\n configurable: true\n });\n return Navigation;\n}(queryable_1.Queryable));\nexports.Navigation = Navigation;\n\n},{\"./queryable\":23,\"./quicklaunch\":25,\"./topnavigationbar\":32}],22:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar logging_1 = require(\"../../utils/logging\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nfunction extractOdataId(candidate) {\n if (candidate.hasOwnProperty(\"odata.id\")) {\n return candidate[\"odata.id\"];\n }\n else if (candidate.hasOwnProperty(\"__metadata\") && candidate.__metadata.hasOwnProperty(\"id\")) {\n return candidate.__metadata.id;\n }\n else {\n logging_1.Logger.log({\n data: candidate,\n level: logging_1.Logger.LogLevel.Error,\n message: \"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\",\n });\n throw new Error(\"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\");\n }\n}\nexports.extractOdataId = extractOdataId;\nvar ODataParserBase = (function () {\n function ODataParserBase() {\n }\n ODataParserBase.prototype.parse = function (r) {\n return r.json().then(function (json) {\n var result = json;\n if (json.hasOwnProperty(\"d\")) {\n if (json.d.hasOwnProperty(\"results\")) {\n result = json.d.results;\n }\n else {\n result = json.d;\n }\n }\n else if (json.hasOwnProperty(\"value\")) {\n result = json.value;\n }\n return result;\n });\n };\n return ODataParserBase;\n}());\nexports.ODataParserBase = ODataParserBase;\nvar ODataDefaultParser = (function (_super) {\n __extends(ODataDefaultParser, _super);\n function ODataDefaultParser() {\n _super.apply(this, arguments);\n }\n return ODataDefaultParser;\n}(ODataParserBase));\nexports.ODataDefaultParser = ODataDefaultParser;\nvar ODataRawParserImpl = (function () {\n function ODataRawParserImpl() {\n }\n ODataRawParserImpl.prototype.parse = function (r) {\n return r.json();\n };\n return ODataRawParserImpl;\n}());\nexports.ODataRawParserImpl = ODataRawParserImpl;\nvar ODataValueParserImpl = (function (_super) {\n __extends(ODataValueParserImpl, _super);\n function ODataValueParserImpl() {\n _super.apply(this, arguments);\n }\n ODataValueParserImpl.prototype.parse = function (r) {\n return _super.prototype.parse.call(this, r).then(function (d) { return d; });\n };\n return ODataValueParserImpl;\n}(ODataParserBase));\nvar ODataEntityParserImpl = (function (_super) {\n __extends(ODataEntityParserImpl, _super);\n function ODataEntityParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n var o = new _this.factory(getEntityUrl(d), null);\n return util_1.Util.extend(o, d);\n });\n };\n return ODataEntityParserImpl;\n}(ODataParserBase));\nvar ODataEntityArrayParserImpl = (function (_super) {\n __extends(ODataEntityArrayParserImpl, _super);\n function ODataEntityArrayParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityArrayParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n return d.map(function (v) {\n var o = new _this.factory(getEntityUrl(v), null);\n return util_1.Util.extend(o, v);\n });\n });\n };\n return ODataEntityArrayParserImpl;\n}(ODataParserBase));\nfunction getEntityUrl(entity) {\n if (entity.hasOwnProperty(\"__metadata\")) {\n return entity.__metadata.uri;\n }\n else if (entity.hasOwnProperty(\"odata.editLink\")) {\n return util_1.Util.combinePaths(\"_api\", entity[\"odata.editLink\"]);\n }\n else {\n logging_1.Logger.write(\"No uri information found in ODataEntity parsing, chaining will fail for this object.\", logging_1.Logger.LogLevel.Warning);\n return \"\";\n }\n}\nexports.ODataRaw = new ODataRawParserImpl();\nfunction ODataValue() {\n return new ODataValueParserImpl();\n}\nexports.ODataValue = ODataValue;\nfunction ODataEntity(factory) {\n return new ODataEntityParserImpl(factory);\n}\nexports.ODataEntity = ODataEntity;\nfunction ODataEntityArray(factory) {\n return new ODataEntityArrayParserImpl(factory);\n}\nexports.ODataEntityArray = ODataEntityArray;\nvar ODataBatch = (function () {\n function ODataBatch(_batchId) {\n if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); }\n this._batchId = _batchId;\n this._requests = [];\n this._batchDepCount = 0;\n }\n ODataBatch.prototype.add = function (url, method, options, parser) {\n var info = {\n method: method.toUpperCase(),\n options: options,\n parser: parser,\n reject: null,\n resolve: null,\n url: url,\n };\n var p = new Promise(function (resolve, reject) {\n info.resolve = resolve;\n info.reject = reject;\n });\n this._requests.push(info);\n return p;\n };\n ODataBatch.prototype.incrementBatchDep = function () {\n this._batchDepCount++;\n };\n ODataBatch.prototype.decrementBatchDep = function () {\n this._batchDepCount--;\n };\n ODataBatch.prototype.execute = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (_this._batchDepCount > 0) {\n setTimeout(function () { return _this.execute(); }, 100);\n }\n else {\n _this.executeImpl().then(function () { return resolve(); }).catch(reject);\n }\n });\n };\n ODataBatch.prototype.executeImpl = function () {\n var _this = this;\n if (this._requests.length < 1) {\n return new Promise(function (r) { return r(); });\n }\n var batchBody = [];\n var currentChangeSetId = \"\";\n this._requests.forEach(function (reqInfo, index) {\n if (reqInfo.method === \"GET\") {\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n }\n else {\n if (currentChangeSetId.length < 1) {\n currentChangeSetId = util_1.Util.getGUID();\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n batchBody.push(\"Content-Type: multipart/mixed; boundary=\\\"changeset_\" + currentChangeSetId + \"\\\"\\n\\n\");\n }\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"\\n\");\n }\n batchBody.push(\"Content-Type: application/http\\n\");\n batchBody.push(\"Content-Transfer-Encoding: binary\\n\\n\");\n var headers = {\n \"Accept\": \"application/json;\",\n };\n if (reqInfo.method !== \"GET\") {\n var method = reqInfo.method;\n if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers[\"X-HTTP-Method\"] !== typeof undefined) {\n method = reqInfo.options.headers[\"X-HTTP-Method\"];\n delete reqInfo.options.headers[\"X-HTTP-Method\"];\n }\n batchBody.push(method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n headers = util_1.Util.extend(headers, { \"Content-Type\": \"application/json;odata=verbose;charset=utf-8\" });\n }\n else {\n batchBody.push(reqInfo.method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n }\n if (typeof pnplibconfig_1.RuntimeConfig.headers !== \"undefined\") {\n headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers);\n }\n if (reqInfo.options && reqInfo.options.headers) {\n headers = util_1.Util.extend(headers, reqInfo.options.headers);\n }\n for (var name_1 in headers) {\n if (headers.hasOwnProperty(name_1)) {\n batchBody.push(name_1 + \": \" + headers[name_1] + \"\\n\");\n }\n }\n batchBody.push(\"\\n\");\n if (reqInfo.options.body) {\n batchBody.push(reqInfo.options.body + \"\\n\\n\");\n }\n });\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + this._batchId + \"--\\n\");\n var batchHeaders = {\n \"Content-Type\": \"multipart/mixed; boundary=batch_\" + this._batchId,\n };\n var batchOptions = {\n \"body\": batchBody.join(\"\"),\n \"headers\": batchHeaders,\n };\n var client = new httpclient_1.HttpClient();\n return client.post(util_1.Util.makeUrlAbsolute(\"/_api/$batch\"), batchOptions)\n .then(function (r) { return r.text(); })\n .then(this._parseResponse)\n .then(function (responses) {\n if (responses.length !== _this._requests.length) {\n throw new Error(\"Could not properly parse responses to match requests in batch.\");\n }\n var resolutions = [];\n for (var i = 0; i < responses.length; i++) {\n var request = _this._requests[i];\n var response = responses[i];\n if (!response.ok) {\n request.reject(new Error(response.statusText));\n }\n resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject));\n }\n return Promise.all(resolutions);\n });\n };\n ODataBatch.prototype._parseResponse = function (body) {\n return new Promise(function (resolve, reject) {\n var responses = [];\n var header = \"--batchresponse_\";\n var statusRegExp = new RegExp(\"^HTTP/[0-9.]+ +([0-9]+) +(.*)\", \"i\");\n var lines = body.split(\"\\n\");\n var state = \"batch\";\n var status;\n var statusText;\n for (var i = 0; i < lines.length; ++i) {\n var line = lines[i];\n switch (state) {\n case \"batch\":\n if (line.substr(0, header.length) === header) {\n state = \"batchHeaders\";\n }\n else {\n if (line.trim() !== \"\") {\n throw new Error(\"Invalid response, line \" + i);\n }\n }\n break;\n case \"batchHeaders\":\n if (line.trim() === \"\") {\n state = \"status\";\n }\n break;\n case \"status\":\n var parts = statusRegExp.exec(line);\n if (parts.length !== 3) {\n throw new Error(\"Invalid status, line \" + i);\n }\n status = parseInt(parts[1], 10);\n statusText = parts[2];\n state = \"statusHeaders\";\n break;\n case \"statusHeaders\":\n if (line.trim() === \"\") {\n state = \"body\";\n }\n break;\n case \"body\":\n var response = void 0;\n if (status === 204) {\n response = new Response();\n }\n else {\n response = new Response(line, { status: status, statusText: statusText });\n }\n responses.push(response);\n state = \"batch\";\n break;\n }\n }\n if (state !== \"status\") {\n reject(new Error(\"Unexpected end of input\"));\n }\n resolve(responses);\n });\n };\n return ODataBatch;\n}());\nexports.ODataBatch = ODataBatch;\n\n},{\"../../configuration/pnplibconfig\":3,\"../../net/httpclient\":9,\"../../utils/logging\":39,\"../../utils/util\":41}],23:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar collections_1 = require(\"../../collections/collections\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar odata_1 = require(\"./odata\");\nvar caching_1 = require(\"./caching\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar Queryable = (function () {\n function Queryable(baseUrl, path) {\n this._query = new collections_1.Dictionary();\n this._batch = null;\n if (typeof baseUrl === \"string\") {\n var urlStr = baseUrl;\n if (urlStr.lastIndexOf(\"/\") < 0) {\n this._parentUrl = urlStr;\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n else if (urlStr.lastIndexOf(\"/\") > urlStr.lastIndexOf(\"(\")) {\n var index = urlStr.lastIndexOf(\"/\");\n this._parentUrl = urlStr.slice(0, index);\n path = util_1.Util.combinePaths(urlStr.slice(index), path);\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n else {\n var index = urlStr.lastIndexOf(\"(\");\n this._parentUrl = urlStr.slice(0, index);\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n }\n else {\n var q = baseUrl;\n this._parentUrl = q._url;\n if (!this.hasBatch && q.hasBatch) {\n this._batch = q._batch;\n }\n var target = q._query.get(\"@target\");\n if (target !== null) {\n this._query.add(\"@target\", target);\n }\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n }\n Queryable.prototype.concat = function (pathPart) {\n this._url += pathPart;\n };\n Queryable.prototype.append = function (pathPart) {\n this._url = util_1.Util.combinePaths(this._url, pathPart);\n };\n Queryable.prototype.addBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.incrementBatchDep();\n }\n };\n Queryable.prototype.clearBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.decrementBatchDep();\n }\n };\n Object.defineProperty(Queryable.prototype, \"hasBatch\", {\n get: function () {\n return this._batch !== null;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"parentUrl\", {\n get: function () {\n return this._parentUrl;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"query\", {\n get: function () {\n return this._query;\n },\n enumerable: true,\n configurable: true\n });\n Queryable.prototype.inBatch = function (batch) {\n if (this._batch !== null) {\n throw new Error(\"This query is already part of a batch.\");\n }\n this._batch = batch;\n return this;\n };\n Queryable.prototype.usingCaching = function (options) {\n if (!pnplibconfig_1.RuntimeConfig.globalCacheDisable) {\n this._useCaching = true;\n this._cachingOptions = options;\n }\n return this;\n };\n Queryable.prototype.toUrl = function () {\n return util_1.Util.makeUrlAbsolute(this._url);\n };\n Queryable.prototype.toUrlAndQuery = function () {\n var _this = this;\n var url = this.toUrl();\n if (this._query.count() > 0) {\n url += \"?\";\n var keys = this._query.getKeys();\n url += keys.map(function (key, ix, arr) { return (key + \"=\" + _this._query.get(key)); }).join(\"&\");\n }\n return url;\n };\n Queryable.prototype.get = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.getAs = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.post = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.postAs = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.getParent = function (factory, baseUrl, path) {\n if (baseUrl === void 0) { baseUrl = this.parentUrl; }\n var parent = new factory(baseUrl, path);\n var target = this.query.get(\"@target\");\n if (target !== null) {\n parent.query.add(\"@target\", target);\n }\n return parent;\n };\n Queryable.prototype.getImpl = function (getOptions, parser) {\n if (getOptions === void 0) { getOptions = {}; }\n if (this._useCaching) {\n var options = new caching_1.CachingOptions(this.toUrlAndQuery().toLowerCase());\n if (typeof this._cachingOptions !== \"undefined\") {\n options = util_1.Util.extend(options, this._cachingOptions);\n }\n if (options.store !== null) {\n var data_1 = options.store.get(options.key);\n if (data_1 !== null) {\n return new Promise(function (resolve) { return resolve(data_1); });\n }\n }\n parser = new caching_1.CachingParserWrapper(parser, options);\n }\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.get(this.toUrlAndQuery(), getOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making GET request: \" + response.statusText;\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"GET\", {}, parser);\n }\n };\n Queryable.prototype.postImpl = function (postOptions, parser) {\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.post(this.toUrlAndQuery(), postOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making POST request: \" + response.statusText;\n }\n if ((response.headers.has(\"Content-Length\") && parseFloat(response.headers.get(\"Content-Length\")) === 0)\n || response.status === 204) {\n return new Promise(function (resolve, reject) { resolve({}); });\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"POST\", postOptions, parser);\n }\n };\n return Queryable;\n}());\nexports.Queryable = Queryable;\nvar QueryableCollection = (function (_super) {\n __extends(QueryableCollection, _super);\n function QueryableCollection() {\n _super.apply(this, arguments);\n }\n QueryableCollection.prototype.filter = function (filter) {\n this._query.add(\"$filter\", filter);\n return this;\n };\n QueryableCollection.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.orderBy = function (orderBy, ascending) {\n if (ascending === void 0) { ascending = false; }\n var keys = this._query.getKeys();\n var query = [];\n var asc = ascending ? \" asc\" : \"\";\n for (var i = 0; i < keys.length; i++) {\n if (keys[i] === \"$orderby\") {\n query.push(this._query.get(\"$orderby\"));\n break;\n }\n }\n query.push(\"\" + orderBy + asc);\n this._query.add(\"$orderby\", query.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.skip = function (skip) {\n this._query.add(\"$skip\", skip.toString());\n return this;\n };\n QueryableCollection.prototype.top = function (top) {\n this._query.add(\"$top\", top.toString());\n return this;\n };\n return QueryableCollection;\n}(Queryable));\nexports.QueryableCollection = QueryableCollection;\nvar QueryableInstance = (function (_super) {\n __extends(QueryableInstance, _super);\n function QueryableInstance() {\n _super.apply(this, arguments);\n }\n QueryableInstance.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableInstance.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n return QueryableInstance;\n}(Queryable));\nexports.QueryableInstance = QueryableInstance;\n\n},{\"../../collections/collections\":1,\"../../configuration/pnplibconfig\":3,\"../../net/httpclient\":9,\"../../utils/util\":41,\"./caching\":13,\"./odata\":22}],24:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar roles_1 = require(\"./roles\");\nvar queryable_1 = require(\"./queryable\");\nvar QueryableSecurable = (function (_super) {\n __extends(QueryableSecurable, _super);\n function QueryableSecurable() {\n _super.apply(this, arguments);\n }\n Object.defineProperty(QueryableSecurable.prototype, \"roleAssignments\", {\n get: function () {\n return new roles_1.RoleAssignments(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(QueryableSecurable.prototype, \"firstUniqueAncestorSecurableObject\", {\n get: function () {\n this.append(\"FirstUniqueAncestorSecurableObject\");\n return new queryable_1.QueryableInstance(this);\n },\n enumerable: true,\n configurable: true\n });\n QueryableSecurable.prototype.getUserEffectivePermissions = function (loginName) {\n this.append(\"getUserEffectivePermissions(@user)\");\n this._query.add(\"@user\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return new queryable_1.Queryable(this);\n };\n QueryableSecurable.prototype.breakRoleInheritance = function (copyRoleAssignments, clearSubscopes) {\n if (copyRoleAssignments === void 0) { copyRoleAssignments = false; }\n if (clearSubscopes === void 0) { clearSubscopes = false; }\n var Breaker = (function (_super) {\n __extends(Breaker, _super);\n function Breaker(baseUrl, copy, clear) {\n _super.call(this, baseUrl, \"breakroleinheritance(copyroleassignments=\" + copy + \", clearsubscopes=\" + clear + \")\");\n }\n Breaker.prototype.break = function () {\n return this.post();\n };\n return Breaker;\n }(queryable_1.Queryable));\n var b = new Breaker(this, copyRoleAssignments, clearSubscopes);\n return b.break();\n };\n QueryableSecurable.prototype.resetRoleInheritance = function () {\n var Resetter = (function (_super) {\n __extends(Resetter, _super);\n function Resetter(baseUrl) {\n _super.call(this, baseUrl, \"resetroleinheritance\");\n }\n Resetter.prototype.reset = function () {\n return this.post();\n };\n return Resetter;\n }(queryable_1.Queryable));\n var r = new Resetter(this);\n return r.reset();\n };\n return QueryableSecurable;\n}(queryable_1.QueryableInstance));\nexports.QueryableSecurable = QueryableSecurable;\n\n},{\"./queryable\":23,\"./roles\":27}],25:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar QuickLaunch = (function (_super) {\n __extends(QuickLaunch, _super);\n function QuickLaunch(baseUrl) {\n _super.call(this, baseUrl, \"QuickLaunch\");\n }\n return QuickLaunch;\n}(queryable_1.Queryable));\nexports.QuickLaunch = QuickLaunch;\n\n},{\"./queryable\":23}],26:[function(require,module,exports){\n\"use strict\";\nvar search_1 = require(\"./search\");\nvar site_1 = require(\"./site\");\nvar webs_1 = require(\"./webs\");\nvar util_1 = require(\"../../utils/util\");\nvar userprofiles_1 = require(\"./userprofiles\");\nvar odata_1 = require(\"./odata\");\nvar Rest = (function () {\n function Rest() {\n }\n Rest.prototype.search = function (query) {\n var finalQuery;\n if (typeof query === \"string\") {\n finalQuery = { Querytext: query };\n }\n else {\n finalQuery = query;\n }\n return new search_1.Search(\"\").execute(finalQuery);\n };\n Object.defineProperty(Rest.prototype, \"site\", {\n get: function () {\n return new site_1.Site(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"web\", {\n get: function () {\n return new webs_1.Web(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"profiles\", {\n get: function () {\n return new userprofiles_1.UserProfileQuery(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Rest.prototype.createBatch = function () {\n return new odata_1.ODataBatch();\n };\n Rest.prototype.crossDomainSite = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(site_1.Site, addInWebUrl, hostWebUrl, \"site\");\n };\n Rest.prototype.crossDomainWeb = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(webs_1.Web, addInWebUrl, hostWebUrl, \"web\");\n };\n Rest.prototype._cdImpl = function (factory, addInWebUrl, hostWebUrl, urlPart) {\n if (!util_1.Util.isUrlAbsolute(addInWebUrl)) {\n throw \"The addInWebUrl parameter must be an absolute url.\";\n }\n if (!util_1.Util.isUrlAbsolute(hostWebUrl)) {\n throw \"The hostWebUrl parameter must be an absolute url.\";\n }\n var url = util_1.Util.combinePaths(addInWebUrl, \"_api/SP.AppContextSite(@target)\");\n var instance = new factory(url, urlPart);\n instance.query.add(\"@target\", \"'\" + encodeURIComponent(hostWebUrl) + \"'\");\n return instance;\n };\n return Rest;\n}());\nexports.Rest = Rest;\n\n},{\"../../utils/util\":41,\"./odata\":22,\"./search\":28,\"./site\":29,\"./userprofiles\":35,\"./webs\":37}],27:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar RoleAssignments = (function (_super) {\n __extends(RoleAssignments, _super);\n function RoleAssignments(baseUrl, path) {\n if (path === void 0) { path = \"roleassignments\"; }\n _super.call(this, baseUrl, path);\n }\n RoleAssignments.prototype.add = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"addroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.remove = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"removeroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.getById = function (id) {\n var ra = new RoleAssignment(this);\n ra.concat(\"(\" + id + \")\");\n return ra;\n };\n return RoleAssignments;\n}(queryable_1.QueryableCollection));\nexports.RoleAssignments = RoleAssignments;\nvar RoleAssignment = (function (_super) {\n __extends(RoleAssignment, _super);\n function RoleAssignment(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(RoleAssignment.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoleAssignment.prototype, \"bindings\", {\n get: function () {\n return new RoleDefinitionBindings(this);\n },\n enumerable: true,\n configurable: true\n });\n RoleAssignment.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleAssignment;\n}(queryable_1.QueryableInstance));\nexports.RoleAssignment = RoleAssignment;\nvar RoleDefinitions = (function (_super) {\n __extends(RoleDefinitions, _super);\n function RoleDefinitions(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitions\"; }\n _super.call(this, baseUrl, path);\n }\n RoleDefinitions.prototype.getById = function (id) {\n return new RoleDefinition(this, \"getById(\" + id + \")\");\n };\n RoleDefinitions.prototype.getByName = function (name) {\n return new RoleDefinition(this, \"getbyname('\" + name + \"')\");\n };\n RoleDefinitions.prototype.getByType = function (roleTypeKind) {\n return new RoleDefinition(this, \"getbytype(\" + roleTypeKind + \")\");\n };\n RoleDefinitions.prototype.add = function (name, description, order, basePermissions) {\n var _this = this;\n var postBody = JSON.stringify({\n BasePermissions: util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, basePermissions),\n Description: description,\n Name: name,\n Order: order,\n __metadata: { \"type\": \"SP.RoleDefinition\" },\n });\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n definition: _this.getById(data.Id),\n };\n });\n };\n return RoleDefinitions;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitions = RoleDefinitions;\nvar RoleDefinition = (function (_super) {\n __extends(RoleDefinition, _super);\n function RoleDefinition(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n RoleDefinition.prototype.update = function (properties) {\n var _this = this;\n if (typeof properties.hasOwnProperty(\"BasePermissions\")) {\n properties[\"BasePermissions\"] = util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, properties[\"BasePermissions\"]);\n }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.RoleDefinition\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retDef = _this;\n if (properties.hasOwnProperty(\"Name\")) {\n var parent_1 = _this.getParent(RoleDefinitions, _this.parentUrl, \"\");\n retDef = parent_1.getByName(properties[\"Name\"]);\n }\n return {\n data: data,\n definition: retDef,\n };\n });\n };\n RoleDefinition.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleDefinition;\n}(queryable_1.QueryableInstance));\nexports.RoleDefinition = RoleDefinition;\nvar RoleDefinitionBindings = (function (_super) {\n __extends(RoleDefinitionBindings, _super);\n function RoleDefinitionBindings(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitionbindings\"; }\n _super.call(this, baseUrl, path);\n }\n return RoleDefinitionBindings;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitionBindings = RoleDefinitionBindings;\n\n},{\"../../utils/util\":41,\"./queryable\":23,\"./sitegroups\":30}],28:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Search = (function (_super) {\n __extends(Search, _super);\n function Search(baseUrl, path) {\n if (path === void 0) { path = \"_api/search/postquery\"; }\n _super.call(this, baseUrl, path);\n }\n Search.prototype.execute = function (query) {\n var formattedBody;\n formattedBody = query;\n if (formattedBody.SelectProperties) {\n formattedBody.SelectProperties = { results: query.SelectProperties };\n }\n if (formattedBody.RefinementFilters) {\n formattedBody.RefinementFilters = { results: query.RefinementFilters };\n }\n if (formattedBody.Refiners) {\n formattedBody.Refiners = { results: query.Refiners };\n }\n if (formattedBody.SortList) {\n formattedBody.SortList = { results: query.SortList };\n }\n if (formattedBody.HithighlightedProperties) {\n formattedBody.HithighlightedProperties = { results: query.HithighlightedProperties };\n }\n if (formattedBody.ReorderingRules) {\n formattedBody.ReorderingRules = { results: query.ReorderingRules };\n }\n var postBody = JSON.stringify({ request: formattedBody });\n return this.post({ body: postBody }).then(function (data) {\n return new SearchResults(data);\n });\n };\n return Search;\n}(queryable_1.QueryableInstance));\nexports.Search = Search;\nvar SearchResults = (function () {\n function SearchResults(rawResponse) {\n var response = rawResponse.postquery ? rawResponse.postquery : rawResponse;\n this.PrimarySearchResults = this.formatSearchResults(response.PrimaryQueryResult.RelevantResults.Table.Rows);\n this.RawSearchResults = response;\n this.ElapsedTime = response.ElapsedTime;\n this.RowCount = response.PrimaryQueryResult.RelevantResults.RowCount;\n this.TotalRows = response.PrimaryQueryResult.RelevantResults.TotalRows;\n this.TotalRowsIncludingDuplicates = response.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates;\n }\n SearchResults.prototype.formatSearchResults = function (rawResults) {\n var results = new Array(), tempResults = rawResults.results ? rawResults.results : rawResults;\n for (var _i = 0, tempResults_1 = tempResults; _i < tempResults_1.length; _i++) {\n var i = tempResults_1[_i];\n results.push(new SearchResult(i.Cells));\n }\n return results;\n };\n return SearchResults;\n}());\nexports.SearchResults = SearchResults;\nvar SearchResult = (function () {\n function SearchResult(rawItem) {\n var item = rawItem.results ? rawItem.results : rawItem;\n for (var _i = 0, item_1 = item; _i < item_1.length; _i++) {\n var i = item_1[_i];\n this[i.Key] = i.Value;\n }\n }\n return SearchResult;\n}());\nexports.SearchResult = SearchResult;\n(function (SortDirection) {\n SortDirection[SortDirection[\"Ascending\"] = 0] = \"Ascending\";\n SortDirection[SortDirection[\"Descending\"] = 1] = \"Descending\";\n SortDirection[SortDirection[\"FQLFormula\"] = 2] = \"FQLFormula\";\n})(exports.SortDirection || (exports.SortDirection = {}));\nvar SortDirection = exports.SortDirection;\n(function (ReorderingRuleMatchType) {\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultContainsKeyword\"] = 0] = \"ResultContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleContainsKeyword\"] = 1] = \"TitleContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleMatchesKeyword\"] = 2] = \"TitleMatchesKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlStartsWith\"] = 3] = \"UrlStartsWith\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlExactlyMatches\"] = 4] = \"UrlExactlyMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ContentTypeIs\"] = 5] = \"ContentTypeIs\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"FileExtensionMatches\"] = 6] = \"FileExtensionMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultHasTag\"] = 7] = \"ResultHasTag\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ManualCondition\"] = 8] = \"ManualCondition\";\n})(exports.ReorderingRuleMatchType || (exports.ReorderingRuleMatchType = {}));\nvar ReorderingRuleMatchType = exports.ReorderingRuleMatchType;\n(function (QueryPropertyValueType) {\n QueryPropertyValueType[QueryPropertyValueType[\"None\"] = 0] = \"None\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringType\"] = 1] = \"StringType\";\n QueryPropertyValueType[QueryPropertyValueType[\"Int32TYpe\"] = 2] = \"Int32TYpe\";\n QueryPropertyValueType[QueryPropertyValueType[\"BooleanType\"] = 3] = \"BooleanType\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringArrayType\"] = 4] = \"StringArrayType\";\n QueryPropertyValueType[QueryPropertyValueType[\"UnSupportedType\"] = 5] = \"UnSupportedType\";\n})(exports.QueryPropertyValueType || (exports.QueryPropertyValueType = {}));\nvar QueryPropertyValueType = exports.QueryPropertyValueType;\n\n},{\"./queryable\":23}],29:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar webs_1 = require(\"./webs\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar Site = (function (_super) {\n __extends(Site, _super);\n function Site(baseUrl, path) {\n if (path === void 0) { path = \"_api/site\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Site.prototype, \"rootWeb\", {\n get: function () {\n return new webs_1.Web(this, \"rootweb\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Site.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Site.prototype.getContextInfo = function () {\n var q = new Site(\"\", \"_api/contextinfo\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"GetContextWebInformation\")) {\n var info = data.GetContextWebInformation;\n info.SupportedSchemaVersions = info.SupportedSchemaVersions.results;\n return info;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getDocumentLibraries = function (absoluteWebUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getdocumentlibraries(@v)\");\n q.query.add(\"@v\", \"'\" + absoluteWebUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetDocumentLibraries\")) {\n return data.GetDocumentLibraries;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getWebUrlFromPageUrl = function (absolutePageUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getweburlfrompageurl(@v)\");\n q.query.add(\"@v\", \"'\" + absolutePageUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetWebUrlFromPageUrl\")) {\n return data.GetWebUrlFromPageUrl;\n }\n else {\n return data;\n }\n });\n };\n return Site;\n}(queryable_1.QueryableInstance));\nexports.Site = Site;\n\n},{\"./queryable\":23,\"./usercustomactions\":34,\"./webs\":37}],30:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar siteusers_1 = require(\"./siteusers\");\nvar util_1 = require(\"../../utils/util\");\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\nvar SiteGroups = (function (_super) {\n __extends(SiteGroups, _super);\n function SiteGroups(baseUrl, path) {\n if (path === void 0) { path = \"sitegroups\"; }\n _super.call(this, baseUrl, path);\n }\n SiteGroups.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n group: _this.getById(data.Id),\n };\n });\n };\n SiteGroups.prototype.getByName = function (groupName) {\n return new SiteGroup(this, \"getByName('\" + groupName + \"')\");\n };\n SiteGroups.prototype.getById = function (id) {\n var sg = new SiteGroup(this);\n sg.concat(\"(\" + id + \")\");\n return sg;\n };\n SiteGroups.prototype.removeById = function (id) {\n var g = new SiteGroups(this, \"removeById('\" + id + \"')\");\n return g.post();\n };\n SiteGroups.prototype.removeByLoginName = function (loginName) {\n var g = new SiteGroups(this, \"removeByLoginName('\" + loginName + \"')\");\n return g.post();\n };\n return SiteGroups;\n}(queryable_1.QueryableCollection));\nexports.SiteGroups = SiteGroups;\nvar SiteGroup = (function (_super) {\n __extends(SiteGroup, _super);\n function SiteGroup(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteGroup.prototype, \"users\", {\n get: function () {\n return new siteusers_1.SiteUsers(this, \"users\");\n },\n enumerable: true,\n configurable: true\n });\n SiteGroup.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retGroup = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retGroup = _this.getParent(SiteGroup, _this.parentUrl, \"getByName('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n group: retGroup,\n };\n });\n };\n return SiteGroup;\n}(queryable_1.QueryableInstance));\nexports.SiteGroup = SiteGroup;\n\n},{\"../../utils/util\":41,\"./queryable\":23,\"./siteusers\":31}],31:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar SiteUsers = (function (_super) {\n __extends(SiteUsers, _super);\n function SiteUsers(baseUrl, path) {\n if (path === void 0) { path = \"siteusers\"; }\n _super.call(this, baseUrl, path);\n }\n SiteUsers.prototype.getByEmail = function (email) {\n return new SiteUser(this, \"getByEmail('\" + email + \"')\");\n };\n SiteUsers.prototype.getById = function (id) {\n return new SiteUser(this, \"getById(\" + id + \")\");\n };\n SiteUsers.prototype.getByLoginName = function (loginName) {\n var su = new SiteUser(this);\n su.concat(\"(@v)\");\n su.query.add(\"@v\", encodeURIComponent(loginName));\n return su;\n };\n SiteUsers.prototype.removeById = function (id) {\n var o = new SiteUsers(this, \"removeById(\" + id + \")\");\n return o.post();\n };\n SiteUsers.prototype.removeByLoginName = function (loginName) {\n var o = new SiteUsers(this, \"removeByLoginName(@v)\");\n o.query.add(\"@v\", encodeURIComponent(loginName));\n return o.post();\n };\n SiteUsers.prototype.add = function (loginName) {\n var _this = this;\n var postBody = JSON.stringify({ \"__metadata\": { \"type\": \"SP.User\" }, LoginName: loginName });\n return this.post({ body: postBody }).then(function (data) { return _this.getByLoginName(loginName); });\n };\n return SiteUsers;\n}(queryable_1.QueryableCollection));\nexports.SiteUsers = SiteUsers;\nvar SiteUser = (function (_super) {\n __extends(SiteUser, _super);\n function SiteUser(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteUser.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n SiteUser.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.User\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n user: _this,\n };\n });\n };\n SiteUser.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return SiteUser;\n}(queryable_1.QueryableInstance));\nexports.SiteUser = SiteUser;\n\n},{\"../../utils/util\":41,\"./queryable\":23,\"./sitegroups\":30}],32:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar TopNavigationBar = (function (_super) {\n __extends(TopNavigationBar, _super);\n function TopNavigationBar(baseUrl) {\n _super.call(this, baseUrl, \"TopNavigationBar\");\n }\n return TopNavigationBar;\n}(queryable_1.QueryableInstance));\nexports.TopNavigationBar = TopNavigationBar;\n\n},{\"./queryable\":23}],33:[function(require,module,exports){\n\"use strict\";\n(function (ControlMode) {\n ControlMode[ControlMode[\"Display\"] = 1] = \"Display\";\n ControlMode[ControlMode[\"Edit\"] = 2] = \"Edit\";\n ControlMode[ControlMode[\"New\"] = 3] = \"New\";\n})(exports.ControlMode || (exports.ControlMode = {}));\nvar ControlMode = exports.ControlMode;\n(function (FieldTypes) {\n FieldTypes[FieldTypes[\"Invalid\"] = 0] = \"Invalid\";\n FieldTypes[FieldTypes[\"Integer\"] = 1] = \"Integer\";\n FieldTypes[FieldTypes[\"Text\"] = 2] = \"Text\";\n FieldTypes[FieldTypes[\"Note\"] = 3] = \"Note\";\n FieldTypes[FieldTypes[\"DateTime\"] = 4] = \"DateTime\";\n FieldTypes[FieldTypes[\"Counter\"] = 5] = \"Counter\";\n FieldTypes[FieldTypes[\"Choice\"] = 6] = \"Choice\";\n FieldTypes[FieldTypes[\"Lookup\"] = 7] = \"Lookup\";\n FieldTypes[FieldTypes[\"Boolean\"] = 8] = \"Boolean\";\n FieldTypes[FieldTypes[\"Number\"] = 9] = \"Number\";\n FieldTypes[FieldTypes[\"Currency\"] = 10] = \"Currency\";\n FieldTypes[FieldTypes[\"URL\"] = 11] = \"URL\";\n FieldTypes[FieldTypes[\"Computed\"] = 12] = \"Computed\";\n FieldTypes[FieldTypes[\"Threading\"] = 13] = \"Threading\";\n FieldTypes[FieldTypes[\"Guid\"] = 14] = \"Guid\";\n FieldTypes[FieldTypes[\"MultiChoice\"] = 15] = \"MultiChoice\";\n FieldTypes[FieldTypes[\"GridChoice\"] = 16] = \"GridChoice\";\n FieldTypes[FieldTypes[\"Calculated\"] = 17] = \"Calculated\";\n FieldTypes[FieldTypes[\"File\"] = 18] = \"File\";\n FieldTypes[FieldTypes[\"Attachments\"] = 19] = \"Attachments\";\n FieldTypes[FieldTypes[\"User\"] = 20] = \"User\";\n FieldTypes[FieldTypes[\"Recurrence\"] = 21] = \"Recurrence\";\n FieldTypes[FieldTypes[\"CrossProjectLink\"] = 22] = \"CrossProjectLink\";\n FieldTypes[FieldTypes[\"ModStat\"] = 23] = \"ModStat\";\n FieldTypes[FieldTypes[\"Error\"] = 24] = \"Error\";\n FieldTypes[FieldTypes[\"ContentTypeId\"] = 25] = \"ContentTypeId\";\n FieldTypes[FieldTypes[\"PageSeparator\"] = 26] = \"PageSeparator\";\n FieldTypes[FieldTypes[\"ThreadIndex\"] = 27] = \"ThreadIndex\";\n FieldTypes[FieldTypes[\"WorkflowStatus\"] = 28] = \"WorkflowStatus\";\n FieldTypes[FieldTypes[\"AllDayEvent\"] = 29] = \"AllDayEvent\";\n FieldTypes[FieldTypes[\"WorkflowEventType\"] = 30] = \"WorkflowEventType\";\n})(exports.FieldTypes || (exports.FieldTypes = {}));\nvar FieldTypes = exports.FieldTypes;\n(function (DateTimeFieldFormatType) {\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateOnly\"] = 0] = \"DateOnly\";\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateTime\"] = 1] = \"DateTime\";\n})(exports.DateTimeFieldFormatType || (exports.DateTimeFieldFormatType = {}));\nvar DateTimeFieldFormatType = exports.DateTimeFieldFormatType;\n(function (AddFieldOptions) {\n AddFieldOptions[AddFieldOptions[\"DefaultValue\"] = 0] = \"DefaultValue\";\n AddFieldOptions[AddFieldOptions[\"AddToDefaultContentType\"] = 1] = \"AddToDefaultContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToNoContentType\"] = 2] = \"AddToNoContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToAllContentTypes\"] = 4] = \"AddToAllContentTypes\";\n AddFieldOptions[AddFieldOptions[\"AddFieldInternalNameHint\"] = 8] = \"AddFieldInternalNameHint\";\n AddFieldOptions[AddFieldOptions[\"AddFieldToDefaultView\"] = 16] = \"AddFieldToDefaultView\";\n AddFieldOptions[AddFieldOptions[\"AddFieldCheckDisplayName\"] = 32] = \"AddFieldCheckDisplayName\";\n})(exports.AddFieldOptions || (exports.AddFieldOptions = {}));\nvar AddFieldOptions = exports.AddFieldOptions;\n(function (CalendarType) {\n CalendarType[CalendarType[\"Gregorian\"] = 1] = \"Gregorian\";\n CalendarType[CalendarType[\"Japan\"] = 3] = \"Japan\";\n CalendarType[CalendarType[\"Taiwan\"] = 4] = \"Taiwan\";\n CalendarType[CalendarType[\"Korea\"] = 5] = \"Korea\";\n CalendarType[CalendarType[\"Hijri\"] = 6] = \"Hijri\";\n CalendarType[CalendarType[\"Thai\"] = 7] = \"Thai\";\n CalendarType[CalendarType[\"Hebrew\"] = 8] = \"Hebrew\";\n CalendarType[CalendarType[\"GregorianMEFrench\"] = 9] = \"GregorianMEFrench\";\n CalendarType[CalendarType[\"GregorianArabic\"] = 10] = \"GregorianArabic\";\n CalendarType[CalendarType[\"GregorianXLITEnglish\"] = 11] = \"GregorianXLITEnglish\";\n CalendarType[CalendarType[\"GregorianXLITFrench\"] = 12] = \"GregorianXLITFrench\";\n CalendarType[CalendarType[\"KoreaJapanLunar\"] = 14] = \"KoreaJapanLunar\";\n CalendarType[CalendarType[\"ChineseLunar\"] = 15] = \"ChineseLunar\";\n CalendarType[CalendarType[\"SakaEra\"] = 16] = \"SakaEra\";\n CalendarType[CalendarType[\"UmAlQura\"] = 23] = \"UmAlQura\";\n})(exports.CalendarType || (exports.CalendarType = {}));\nvar CalendarType = exports.CalendarType;\n(function (UrlFieldFormatType) {\n UrlFieldFormatType[UrlFieldFormatType[\"Hyperlink\"] = 0] = \"Hyperlink\";\n UrlFieldFormatType[UrlFieldFormatType[\"Image\"] = 1] = \"Image\";\n})(exports.UrlFieldFormatType || (exports.UrlFieldFormatType = {}));\nvar UrlFieldFormatType = exports.UrlFieldFormatType;\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\n(function (PageType) {\n PageType[PageType[\"Invalid\"] = -1] = \"Invalid\";\n PageType[PageType[\"DefaultView\"] = 0] = \"DefaultView\";\n PageType[PageType[\"NormalView\"] = 1] = \"NormalView\";\n PageType[PageType[\"DialogView\"] = 2] = \"DialogView\";\n PageType[PageType[\"View\"] = 3] = \"View\";\n PageType[PageType[\"DisplayForm\"] = 4] = \"DisplayForm\";\n PageType[PageType[\"DisplayFormDialog\"] = 5] = \"DisplayFormDialog\";\n PageType[PageType[\"EditForm\"] = 6] = \"EditForm\";\n PageType[PageType[\"EditFormDialog\"] = 7] = \"EditFormDialog\";\n PageType[PageType[\"NewForm\"] = 8] = \"NewForm\";\n PageType[PageType[\"NewFormDialog\"] = 9] = \"NewFormDialog\";\n PageType[PageType[\"SolutionForm\"] = 10] = \"SolutionForm\";\n PageType[PageType[\"PAGE_MAXITEMS\"] = 11] = \"PAGE_MAXITEMS\";\n})(exports.PageType || (exports.PageType = {}));\nvar PageType = exports.PageType;\n\n},{}],34:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar UserCustomActions = (function (_super) {\n __extends(UserCustomActions, _super);\n function UserCustomActions(baseUrl, path) {\n if (path === void 0) { path = \"usercustomactions\"; }\n _super.call(this, baseUrl, path);\n }\n UserCustomActions.prototype.getById = function (id) {\n return new UserCustomAction(this, \"(\" + id + \")\");\n };\n UserCustomActions.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ __metadata: { \"type\": \"SP.UserCustomAction\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n action: _this.getById(data.Id),\n data: data,\n };\n });\n };\n UserCustomActions.prototype.clear = function () {\n var a = new UserCustomActions(this, \"clear\");\n return a.post();\n };\n return UserCustomActions;\n}(queryable_1.QueryableCollection));\nexports.UserCustomActions = UserCustomActions;\nvar UserCustomAction = (function (_super) {\n __extends(UserCustomAction, _super);\n function UserCustomAction(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n UserCustomAction.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.UserCustomAction\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n action: _this,\n data: data,\n };\n });\n };\n return UserCustomAction;\n}(queryable_1.QueryableInstance));\nexports.UserCustomAction = UserCustomAction;\n\n},{\"../../utils/util\":41,\"./queryable\":23}],35:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar FileUtil = require(\"../../utils/files\");\nvar odata_1 = require(\"./odata\");\nvar UserProfileQuery = (function (_super) {\n __extends(UserProfileQuery, _super);\n function UserProfileQuery(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.peoplemanager\"; }\n _super.call(this, baseUrl, path);\n this.profileLoader = new ProfileLoader(baseUrl);\n }\n Object.defineProperty(UserProfileQuery.prototype, \"editProfileLink\", {\n get: function () {\n var q = new UserProfileQuery(this, \"EditProfileLink\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"isMyPeopleListPublic\", {\n get: function () {\n var q = new UserProfileQuery(this, \"IsMyPeopleListPublic\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.amIFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.amIFollowing = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowing(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowedTags = function (maxCount) {\n if (maxCount === void 0) { maxCount = 20; }\n var q = new UserProfileQuery(this, \"getfollowedtags(\" + maxCount + \")\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowersFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getfollowersfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"myFollowers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getmyfollowers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"myProperties\", {\n get: function () {\n return new UserProfileQuery(this, \"getmyproperties\");\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getPeopleFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"getpeoplefollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getPropertiesFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getpropertiesfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"trendingTags\", {\n get: function () {\n var q = new UserProfileQuery(this, null);\n q.concat(\".gettrendingtags\");\n return q.get();\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getUserProfilePropertyFor = function (loginName, propertyName) {\n var q = new UserProfileQuery(this, \"getuserprofilepropertyfor(accountname=@v, propertyname='\" + propertyName + \"')\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.hideSuggestion = function (loginName) {\n var q = new UserProfileQuery(this, \"hidesuggestion(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.post();\n };\n UserProfileQuery.prototype.isFollowing = function (follower, followee) {\n var q = new UserProfileQuery(this, null);\n q.concat(\".isfollowing(possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(follower) + \"'\");\n q.query.add(\"@y\", \"'\" + encodeURIComponent(followee) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.setMyProfilePic = function (profilePicSource) {\n var _this = this;\n return FileUtil.readBlobAsArrayBuffer(profilePicSource).then(function (buffer) {\n var request = new UserProfileQuery(_this, \"setmyprofilepicture\");\n return request.post({\n body: String.fromCharCode.apply(null, new Uint16Array(buffer)),\n });\n });\n };\n UserProfileQuery.prototype.createPersonalSiteEnqueueBulk = function () {\n var emails = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n emails[_i - 0] = arguments[_i];\n }\n return this.profileLoader.createPersonalSiteEnqueueBulk(emails);\n };\n Object.defineProperty(UserProfileQuery.prototype, \"ownerUserProfile\", {\n get: function () {\n return this.profileLoader.ownerUserProfile;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"userProfile\", {\n get: function () {\n return this.profileLoader.userProfile;\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n return this.profileLoader.createPersonalSite(interactiveRequest);\n };\n UserProfileQuery.prototype.shareAllSocialData = function (share) {\n return this.profileLoader.shareAllSocialData(share);\n };\n return UserProfileQuery;\n}(queryable_1.QueryableInstance));\nexports.UserProfileQuery = UserProfileQuery;\nvar ProfileLoader = (function (_super) {\n __extends(ProfileLoader, _super);\n function ProfileLoader(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.profileloader.getprofileloader\"; }\n _super.call(this, baseUrl, path);\n }\n ProfileLoader.prototype.createPersonalSiteEnqueueBulk = function (emails) {\n var q = new ProfileLoader(this, \"createpersonalsiteenqueuebulk\");\n var postBody = JSON.stringify({ \"emailIDs\": emails });\n return q.post({\n body: postBody,\n });\n };\n Object.defineProperty(ProfileLoader.prototype, \"ownerUserProfile\", {\n get: function () {\n var q = this.getParent(ProfileLoader, this.parentUrl, \"_api/sp.userprofiles.profileloader.getowneruserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ProfileLoader.prototype, \"userProfile\", {\n get: function () {\n var q = new ProfileLoader(this, \"getuserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n ProfileLoader.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n var q = new ProfileLoader(this, \"getuserprofile/createpersonalsiteenque(\" + interactiveRequest + \")\\\",\");\n return q.post();\n };\n ProfileLoader.prototype.shareAllSocialData = function (share) {\n var q = new ProfileLoader(this, \"getuserprofile/shareallsocialdata(\" + share + \")\\\",\");\n return q.post();\n };\n return ProfileLoader;\n}(queryable_1.Queryable));\n\n},{\"../../utils/files\":38,\"./odata\":22,\"./queryable\":23}],36:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Views = (function (_super) {\n __extends(Views, _super);\n function Views(baseUrl) {\n _super.call(this, baseUrl, \"views\");\n }\n Views.prototype.getById = function (id) {\n var v = new View(this);\n v.concat(\"('\" + id + \"')\");\n return v;\n };\n Views.prototype.getByTitle = function (title) {\n return new View(this, \"getByTitle('\" + title + \"')\");\n };\n Views.prototype.add = function (title, personalView, additionalSettings) {\n var _this = this;\n if (personalView === void 0) { personalView = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n \"Title\": title,\n \"PersonalView\": personalView,\n }, additionalSettings));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n view: _this.getById(data.Id),\n };\n });\n };\n return Views;\n}(queryable_1.QueryableCollection));\nexports.Views = Views;\nvar View = (function (_super) {\n __extends(View, _super);\n function View(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(View.prototype, \"fields\", {\n get: function () {\n return new ViewFields(this);\n },\n enumerable: true,\n configurable: true\n });\n View.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n view: _this,\n };\n });\n };\n View.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n View.prototype.renderAsHtml = function () {\n var q = new queryable_1.Queryable(this, \"renderashtml\");\n return q.get();\n };\n return View;\n}(queryable_1.QueryableInstance));\nexports.View = View;\nvar ViewFields = (function (_super) {\n __extends(ViewFields, _super);\n function ViewFields(baseUrl, path) {\n if (path === void 0) { path = \"viewfields\"; }\n _super.call(this, baseUrl, path);\n }\n ViewFields.prototype.getSchemaXml = function () {\n var q = new queryable_1.Queryable(this, \"schemaxml\");\n return q.get();\n };\n ViewFields.prototype.add = function (fieldTitleOrInternalName) {\n var q = new ViewFields(this, \"addviewfield('\" + fieldTitleOrInternalName + \"')\");\n return q.post();\n };\n ViewFields.prototype.move = function (fieldInternalName, index) {\n var q = new ViewFields(this, \"moveviewfieldto\");\n var postBody = JSON.stringify({ \"field\": fieldInternalName, \"index\": index });\n return q.post({ body: postBody });\n };\n ViewFields.prototype.removeAll = function () {\n var q = new ViewFields(this, \"removeallviewfields\");\n return q.post();\n };\n ViewFields.prototype.remove = function (fieldInternalName) {\n var q = new ViewFields(this, \"removeviewfield('\" + fieldInternalName + \"')\");\n return q.post();\n };\n return ViewFields;\n}(queryable_1.QueryableCollection));\nexports.ViewFields = ViewFields;\n\n},{\"../../utils/util\":41,\"./queryable\":23}],37:[function(require,module,exports){\n\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar lists_1 = require(\"./lists\");\nvar fields_1 = require(\"./fields\");\nvar navigation_1 = require(\"./navigation\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar folders_1 = require(\"./folders\");\nvar roles_1 = require(\"./roles\");\nvar files_1 = require(\"./files\");\nvar util_1 = require(\"../../utils/util\");\nvar lists_2 = require(\"./lists\");\nvar siteusers_1 = require(\"./siteusers\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Webs = (function (_super) {\n __extends(Webs, _super);\n function Webs(baseUrl, webPath) {\n if (webPath === void 0) { webPath = \"webs\"; }\n _super.call(this, baseUrl, webPath);\n }\n Webs.prototype.add = function (title, url, description, template, language, inheritPermissions, additionalSettings) {\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = \"STS\"; }\n if (language === void 0) { language = 1033; }\n if (inheritPermissions === void 0) { inheritPermissions = true; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var props = util_1.Util.extend({\n Description: description,\n Language: language,\n Title: title,\n Url: url,\n UseSamePermissionsAsParentSite: inheritPermissions,\n WebTemplate: template,\n }, additionalSettings);\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.WebCreationInformation\" },\n }, props),\n });\n var q = new Webs(this, \"add\");\n return q.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n web: new Web(odata_1.extractOdataId(data), \"\"),\n };\n });\n };\n return Webs;\n}(queryable_1.QueryableCollection));\nexports.Webs = Webs;\nvar Web = (function (_super) {\n __extends(Web, _super);\n function Web(baseUrl, path) {\n if (path === void 0) { path = \"_api/web\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Web.prototype, \"webs\", {\n get: function () {\n return new Webs(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"lists\", {\n get: function () {\n return new lists_1.Lists(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"availablefields\", {\n get: function () {\n return new fields_1.Fields(this, \"availablefields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"navigation\", {\n get: function () {\n return new navigation_1.Navigation(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteUsers\", {\n get: function () {\n return new siteusers_1.SiteUsers(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteGroups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"folders\", {\n get: function () {\n return new folders_1.Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"roleDefinitions\", {\n get: function () {\n return new roles_1.RoleDefinitions(this);\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getFolderByServerRelativeUrl = function (folderRelativeUrl) {\n return new folders_1.Folder(this, \"getFolderByServerRelativeUrl('\" + folderRelativeUrl + \"')\");\n };\n Web.prototype.getFileByServerRelativeUrl = function (fileRelativeUrl) {\n return new files_1.File(this, \"getFileByServerRelativeUrl('\" + fileRelativeUrl + \"')\");\n };\n Web.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.Web\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n web: _this,\n };\n });\n };\n Web.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Web.prototype.applyTheme = function (colorPaletteUrl, fontSchemeUrl, backgroundImageUrl, shareGenerated) {\n var postBody = JSON.stringify({\n backgroundImageUrl: backgroundImageUrl,\n colorPaletteUrl: colorPaletteUrl,\n fontSchemeUrl: fontSchemeUrl,\n shareGenerated: shareGenerated,\n });\n var q = new Web(this, \"applytheme\");\n return q.post({ body: postBody });\n };\n Web.prototype.applyWebTemplate = function (template) {\n var q = new Web(this, \"applywebtemplate\");\n q.concat(\"(@t)\");\n q.query.add(\"@t\", template);\n return q.post();\n };\n Web.prototype.doesUserHavePermissions = function (perms) {\n var q = new Web(this, \"doesuserhavepermissions\");\n q.concat(\"(@p)\");\n q.query.add(\"@p\", JSON.stringify(perms));\n return q.get();\n };\n Web.prototype.ensureUser = function (loginName) {\n var postBody = JSON.stringify({\n logonName: loginName,\n });\n var q = new Web(this, \"ensureuser\");\n return q.post({ body: postBody });\n };\n Web.prototype.availableWebTemplates = function (language, includeCrossLanugage) {\n if (language === void 0) { language = 1033; }\n if (includeCrossLanugage === void 0) { includeCrossLanugage = true; }\n return new queryable_1.QueryableCollection(this, \"getavailablewebtemplates(lcid=\" + language + \", doincludecrosslanguage=\" + includeCrossLanugage + \")\");\n };\n Web.prototype.getCatalog = function (type) {\n var q = new Web(this, \"getcatalog(\" + type + \")\");\n q.select(\"Id\");\n return q.get().then(function (data) {\n return new lists_2.List(odata_1.extractOdataId(data));\n });\n };\n Web.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new Web(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n Object.defineProperty(Web.prototype, \"customListTemplate\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getcustomlisttemplates\");\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getUserById = function (id) {\n return new siteusers_1.SiteUser(this, \"getUserById(\" + id + \")\");\n };\n Web.prototype.mapToIcon = function (filename, size, progId) {\n if (size === void 0) { size = 0; }\n if (progId === void 0) { progId = \"\"; }\n var q = new Web(this, \"maptoicon(filename='\" + filename + \"', progid='\" + progId + \"', size=\" + size + \")\");\n return q.get();\n };\n return Web;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Web = Web;\n\n},{\"../../utils/util\":41,\"./contenttypes\":14,\"./fields\":15,\"./files\":16,\"./folders\":17,\"./lists\":20,\"./navigation\":21,\"./odata\":22,\"./queryable\":23,\"./queryablesecurable\":24,\"./roles\":27,\"./sitegroups\":30,\"./siteusers\":31,\"./usercustomactions\":34}],38:[function(require,module,exports){\n\"use strict\";\nfunction readBlobAsText(blob) {\n return readBlobAs(blob, \"string\");\n}\nexports.readBlobAsText = readBlobAsText;\nfunction readBlobAsArrayBuffer(blob) {\n return readBlobAs(blob, \"buffer\");\n}\nexports.readBlobAsArrayBuffer = readBlobAsArrayBuffer;\nfunction readBlobAs(blob, mode) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.onload = function (e) {\n resolve(e.target.result);\n };\n switch (mode) {\n case \"string\":\n reader.readAsText(blob);\n break;\n case \"buffer\":\n reader.readAsArrayBuffer(blob);\n break;\n }\n });\n}\n\n},{}],39:[function(require,module,exports){\n\"use strict\";\nvar Logger = (function () {\n function Logger() {\n }\n Object.defineProperty(Logger, \"activeLogLevel\", {\n get: function () {\n return Logger.instance.activeLogLevel;\n },\n set: function (value) {\n Logger.instance.activeLogLevel = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Logger, \"instance\", {\n get: function () {\n if (typeof Logger._instance === \"undefined\" || Logger._instance === null) {\n Logger._instance = new LoggerImpl();\n }\n return Logger._instance;\n },\n enumerable: true,\n configurable: true\n });\n Logger.subscribe = function () {\n var listeners = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n listeners[_i - 0] = arguments[_i];\n }\n for (var i = 0; i < listeners.length; i++) {\n Logger.instance.subscribe(listeners[i]);\n }\n };\n Logger.clearSubscribers = function () {\n return Logger.instance.clearSubscribers();\n };\n Object.defineProperty(Logger, \"count\", {\n get: function () {\n return Logger.instance.count;\n },\n enumerable: true,\n configurable: true\n });\n Logger.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n Logger.instance.log({ level: level, message: message });\n };\n Logger.log = function (entry) {\n Logger.instance.log(entry);\n };\n Logger.measure = function (name, f) {\n return Logger.instance.measure(name, f);\n };\n return Logger;\n}());\nexports.Logger = Logger;\nvar LoggerImpl = (function () {\n function LoggerImpl(activeLogLevel, subscribers) {\n if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.Warning; }\n if (subscribers === void 0) { subscribers = []; }\n this.activeLogLevel = activeLogLevel;\n this.subscribers = subscribers;\n }\n LoggerImpl.prototype.subscribe = function (listener) {\n this.subscribers.push(listener);\n };\n LoggerImpl.prototype.clearSubscribers = function () {\n var s = this.subscribers.slice(0);\n this.subscribers.length = 0;\n return s;\n };\n Object.defineProperty(LoggerImpl.prototype, \"count\", {\n get: function () {\n return this.subscribers.length;\n },\n enumerable: true,\n configurable: true\n });\n LoggerImpl.prototype.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n this.log({ level: level, message: message });\n };\n LoggerImpl.prototype.log = function (entry) {\n if (typeof entry === \"undefined\" || entry.level < this.activeLogLevel) {\n return;\n }\n for (var i = 0; i < this.subscribers.length; i++) {\n this.subscribers[i].log(entry);\n }\n };\n LoggerImpl.prototype.measure = function (name, f) {\n console.profile(name);\n try {\n return f();\n }\n finally {\n console.profileEnd();\n }\n };\n return LoggerImpl;\n}());\nvar Logger;\n(function (Logger) {\n (function (LogLevel) {\n LogLevel[LogLevel[\"Verbose\"] = 0] = \"Verbose\";\n LogLevel[LogLevel[\"Info\"] = 1] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 2] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n LogLevel[LogLevel[\"Off\"] = 99] = \"Off\";\n })(Logger.LogLevel || (Logger.LogLevel = {}));\n var LogLevel = Logger.LogLevel;\n var ConsoleListener = (function () {\n function ConsoleListener() {\n }\n ConsoleListener.prototype.log = function (entry) {\n var msg = this.format(entry);\n switch (entry.level) {\n case LogLevel.Verbose:\n case LogLevel.Info:\n console.log(msg);\n break;\n case LogLevel.Warning:\n console.warn(msg);\n break;\n case LogLevel.Error:\n console.error(msg);\n break;\n }\n };\n ConsoleListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return ConsoleListener;\n }());\n Logger.ConsoleListener = ConsoleListener;\n var AzureInsightsListener = (function () {\n function AzureInsightsListener(azureInsightsInstrumentationKey) {\n this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey;\n var appInsights = window[\"appInsights\"] || function (config) {\n function r(config) {\n t[config] = function () {\n var i = arguments;\n t.queue.push(function () { t[config].apply(t, i); });\n };\n }\n var t = { config: config }, u = document, e = window, o = \"script\", s = u.createElement(o), i, f;\n for (s.src = config.url || \"//az416426.vo.msecnd.net/scripts/a/ai.0.js\", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = [\"Event\", \"Exception\", \"Metric\", \"PageView\", \"Trace\"]; i.length;) {\n r(\"track\" + i.pop());\n }\n return r(\"setAuthenticatedUserContext\"), r(\"clearAuthenticatedUserContext\"), config.disableExceptionTracking || (i = \"onerror\", r(\"_\" + i), f = e[i], e[i] = function (config, r, u, e, o) {\n var s = f && f(config, r, u, e, o);\n return s !== !0 && t[\"_\" + i](config, r, u, e, o), s;\n }), t;\n }({\n instrumentationKey: this.azureInsightsInstrumentationKey\n });\n window[\"appInsights\"] = appInsights;\n }\n AzureInsightsListener.prototype.log = function (entry) {\n var ai = window[\"appInsights\"];\n var msg = this.format(entry);\n if (entry.level === LogLevel.Error) {\n ai.trackException(msg);\n }\n else {\n ai.trackEvent(msg);\n }\n };\n AzureInsightsListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return AzureInsightsListener;\n }());\n Logger.AzureInsightsListener = AzureInsightsListener;\n var FunctionListener = (function () {\n function FunctionListener(method) {\n this.method = method;\n }\n FunctionListener.prototype.log = function (entry) {\n this.method(entry);\n };\n return FunctionListener;\n }());\n Logger.FunctionListener = FunctionListener;\n})(Logger = exports.Logger || (exports.Logger = {}));\n\n},{}],40:[function(require,module,exports){\n\"use strict\";\nvar util_1 = require(\"./util\");\nvar PnPClientStorageWrapper = (function () {\n function PnPClientStorageWrapper(store, defaultTimeoutMinutes) {\n this.store = store;\n this.defaultTimeoutMinutes = defaultTimeoutMinutes;\n this.defaultTimeoutMinutes = (defaultTimeoutMinutes === void 0) ? 5 : defaultTimeoutMinutes;\n this.enabled = this.test();\n }\n PnPClientStorageWrapper.prototype.get = function (key) {\n if (!this.enabled) {\n return null;\n }\n var o = this.store.getItem(key);\n if (o == null) {\n return o;\n }\n var persistable = JSON.parse(o);\n if (new Date(persistable.expiration) <= new Date()) {\n this.delete(key);\n return null;\n }\n else {\n return persistable.value;\n }\n };\n PnPClientStorageWrapper.prototype.put = function (key, o, expire) {\n if (this.enabled) {\n this.store.setItem(key, this.createPersistable(o, expire));\n }\n };\n PnPClientStorageWrapper.prototype.delete = function (key) {\n if (this.enabled) {\n this.store.removeItem(key);\n }\n };\n PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {\n var _this = this;\n if (!this.enabled) {\n return getter();\n }\n if (!util_1.Util.isFunction(getter)) {\n throw \"Function expected for parameter 'getter'.\";\n }\n return new Promise(function (resolve, reject) {\n var o = _this.get(key);\n if (o == null) {\n getter().then(function (d) {\n _this.put(key, d);\n resolve(d);\n });\n }\n else {\n resolve(o);\n }\n });\n };\n PnPClientStorageWrapper.prototype.test = function () {\n var str = \"test\";\n try {\n this.store.setItem(str, str);\n this.store.removeItem(str);\n return true;\n }\n catch (e) {\n return false;\n }\n };\n PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) {\n if (typeof expire === \"undefined\") {\n expire = util_1.Util.dateAdd(new Date(), \"minute\", this.defaultTimeoutMinutes);\n }\n return JSON.stringify({ expiration: expire, value: o });\n };\n return PnPClientStorageWrapper;\n}());\nexports.PnPClientStorageWrapper = PnPClientStorageWrapper;\nvar PnPClientStorage = (function () {\n function PnPClientStorage() {\n this.local = typeof localStorage !== \"undefined\" ? new PnPClientStorageWrapper(localStorage) : null;\n this.session = typeof sessionStorage !== \"undefined\" ? new PnPClientStorageWrapper(sessionStorage) : null;\n }\n return PnPClientStorage;\n}());\nexports.PnPClientStorage = PnPClientStorage;\n\n},{\"./util\":41}],41:[function(require,module,exports){\n(function (global){\n\"use strict\";\nvar Util = (function () {\n function Util() {\n }\n Util.getCtxCallback = function (context, method) {\n var params = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n params[_i - 2] = arguments[_i];\n }\n return function () {\n method.apply(context, params);\n };\n };\n Util.urlParamExists = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n return regex.test(location.search);\n };\n Util.getUrlParamByName = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n var results = regex.exec(location.search);\n return results == null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n };\n Util.getUrlParamBoolByName = function (name) {\n var p = this.getUrlParamByName(name);\n var isFalse = (p === \"\" || /false|0/i.test(p));\n return !isFalse;\n };\n Util.stringInsert = function (target, index, s) {\n if (index > 0) {\n return target.substring(0, index) + s + target.substring(index, target.length);\n }\n return s + target;\n };\n Util.dateAdd = function (date, interval, units) {\n var ret = new Date(date.toLocaleString());\n switch (interval.toLowerCase()) {\n case \"year\":\n ret.setFullYear(ret.getFullYear() + units);\n break;\n case \"quarter\":\n ret.setMonth(ret.getMonth() + 3 * units);\n break;\n case \"month\":\n ret.setMonth(ret.getMonth() + units);\n break;\n case \"week\":\n ret.setDate(ret.getDate() + 7 * units);\n break;\n case \"day\":\n ret.setDate(ret.getDate() + units);\n break;\n case \"hour\":\n ret.setTime(ret.getTime() + units * 3600000);\n break;\n case \"minute\":\n ret.setTime(ret.getTime() + units * 60000);\n break;\n case \"second\":\n ret.setTime(ret.getTime() + units * 1000);\n break;\n default:\n ret = undefined;\n break;\n }\n return ret;\n };\n Util.loadStylesheet = function (path, avoidCache) {\n if (avoidCache) {\n path += \"?\" + encodeURIComponent((new Date()).getTime().toString());\n }\n var head = document.getElementsByTagName(\"head\");\n if (head.length > 0) {\n var e = document.createElement(\"link\");\n head[0].appendChild(e);\n e.setAttribute(\"type\", \"text/css\");\n e.setAttribute(\"rel\", \"stylesheet\");\n e.setAttribute(\"href\", path);\n }\n };\n Util.combinePaths = function () {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i - 0] = arguments[_i];\n }\n var parts = [];\n for (var i = 0; i < paths.length; i++) {\n if (typeof paths[i] !== \"undefined\" && paths[i] !== null) {\n parts.push(paths[i].replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"));\n }\n }\n return parts.join(\"/\").replace(/\\\\/, \"/\");\n };\n Util.getRandomString = function (chars) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < chars; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n };\n Util.getGUID = function () {\n var d = new Date().getTime();\n var guid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3 | 0x8)).toString(16);\n });\n return guid;\n };\n Util.isFunction = function (candidateFunction) {\n return typeof candidateFunction === \"function\";\n };\n Util.isArray = function (array) {\n if (Array.isArray) {\n return Array.isArray(array);\n }\n return array && typeof array.length === \"number\" && array.constructor === Array;\n };\n Util.stringIsNullOrEmpty = function (s) {\n return typeof s === \"undefined\" || s === null || s === \"\";\n };\n Util.extend = function (target, source, noOverwrite) {\n if (noOverwrite === void 0) { noOverwrite = false; }\n var result = {};\n for (var id in target) {\n result[id] = target[id];\n }\n var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; };\n for (var id in source) {\n if (check(result, id)) {\n result[id] = source[id];\n }\n }\n return result;\n };\n Util.applyMixins = function (derivedCtor) {\n var baseCtors = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n baseCtors[_i - 1] = arguments[_i];\n }\n baseCtors.forEach(function (baseCtor) {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {\n derivedCtor.prototype[name] = baseCtor.prototype[name];\n });\n });\n };\n Util.isUrlAbsolute = function (url) {\n return /^https?:\\/\\/|^\\/\\//i.test(url);\n };\n Util.makeUrlAbsolute = function (url) {\n if (Util.isUrlAbsolute(url)) {\n return url;\n }\n if (typeof global._spPageContextInfo !== \"undefined\") {\n if (global._spPageContextInfo.hasOwnProperty(\"webAbsoluteUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url);\n }\n else if (global._spPageContextInfo.hasOwnProperty(\"webServerRelativeUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url);\n }\n }\n else {\n return url;\n }\n };\n return Util;\n}());\nexports.Util = Util;\n\n}).call(this,typeof global !== \"undefined\" ? global : typeof self !== \"undefined\" ? self : typeof window !== \"undefined\" ? window : {})\n\n},{}]},{},[12])(12)\n});\n\n","\"use strict\";\nvar Collections = require(\"../collections/collections\");\nvar providers = require(\"./providers/providers\");\nvar Settings = (function () {\n function Settings() {\n this.Providers = providers;\n this._settings = new Collections.Dictionary();\n }\n Settings.prototype.add = function (key, value) {\n this._settings.add(key, value);\n };\n Settings.prototype.addJSON = function (key, value) {\n this._settings.add(key, JSON.stringify(value));\n };\n Settings.prototype.apply = function (hash) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n try {\n _this._settings.merge(hash);\n resolve();\n }\n catch (e) {\n reject(e);\n }\n });\n };\n Settings.prototype.load = function (provider) {\n var _this = this;\n return new Promise(function (resolve, reject) {\n provider.getConfiguration().then(function (value) {\n _this._settings.merge(value);\n resolve();\n }).catch(function (reason) {\n reject(reason);\n });\n });\n };\n Settings.prototype.get = function (key) {\n return this._settings.get(key);\n };\n Settings.prototype.getJSON = function (key) {\n var o = this.get(key);\n if (typeof o === \"undefined\" || o === null) {\n return o;\n }\n return JSON.parse(o);\n };\n return Settings;\n}());\nexports.Settings = Settings;\n","\"use strict\";\nvar RuntimeConfigImpl = (function () {\n function RuntimeConfigImpl() {\n this._headers = null;\n this._defaultCachingStore = \"session\";\n this._defaultCachingTimeoutSeconds = 30;\n this._globalCacheDisable = false;\n this._useSPRequestExecutor = false;\n }\n RuntimeConfigImpl.prototype.set = function (config) {\n if (config.hasOwnProperty(\"headers\")) {\n this._headers = config.headers;\n }\n if (config.hasOwnProperty(\"globalCacheDisable\")) {\n this._globalCacheDisable = config.globalCacheDisable;\n }\n if (config.hasOwnProperty(\"defaultCachingStore\")) {\n this._defaultCachingStore = config.defaultCachingStore;\n }\n if (config.hasOwnProperty(\"defaultCachingTimeoutSeconds\")) {\n this._defaultCachingTimeoutSeconds = config.defaultCachingTimeoutSeconds;\n }\n if (config.hasOwnProperty(\"useSPRequestExecutor\")) {\n this._useSPRequestExecutor = config.useSPRequestExecutor;\n }\n if (config.hasOwnProperty(\"nodeClientOptions\")) {\n this._useNodeClient = true;\n this._useSPRequestExecutor = false;\n this._nodeClientData = config.nodeClientOptions;\n global._spPageContextInfo = {\n webAbsoluteUrl: config.nodeClientOptions.siteUrl,\n };\n }\n };\n Object.defineProperty(RuntimeConfigImpl.prototype, \"headers\", {\n get: function () {\n return this._headers;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingStore\", {\n get: function () {\n return this._defaultCachingStore;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"defaultCachingTimeoutSeconds\", {\n get: function () {\n return this._defaultCachingTimeoutSeconds;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"globalCacheDisable\", {\n get: function () {\n return this._globalCacheDisable;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useSPRequestExecutor\", {\n get: function () {\n return this._useSPRequestExecutor;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"useNodeFetchClient\", {\n get: function () {\n return this._useNodeClient;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RuntimeConfigImpl.prototype, \"nodeRequestOptions\", {\n get: function () {\n return this._nodeClientData;\n },\n enumerable: true,\n configurable: true\n });\n return RuntimeConfigImpl;\n}());\nexports.RuntimeConfigImpl = RuntimeConfigImpl;\nvar _runtimeConfig = new RuntimeConfigImpl();\nexports.RuntimeConfig = _runtimeConfig;\nfunction setRuntimeConfig(config) {\n _runtimeConfig.set(config);\n}\nexports.setRuntimeConfig = setRuntimeConfig;\n","\"use strict\";\nvar storage = require(\"../../utils/storage\");\nvar CachingConfigurationProvider = (function () {\n function CachingConfigurationProvider(wrappedProvider, cacheKey, cacheStore) {\n this.wrappedProvider = wrappedProvider;\n this.store = (cacheStore) ? cacheStore : this.selectPnPCache();\n this.cacheKey = \"_configcache_\" + cacheKey;\n }\n CachingConfigurationProvider.prototype.getWrappedProvider = function () {\n return this.wrappedProvider;\n };\n CachingConfigurationProvider.prototype.getConfiguration = function () {\n var _this = this;\n if ((!this.store) || (!this.store.enabled)) {\n return this.wrappedProvider.getConfiguration();\n }\n var cachedConfig = this.store.get(this.cacheKey);\n if (cachedConfig) {\n return new Promise(function (resolve, reject) {\n resolve(cachedConfig);\n });\n }\n var providerPromise = this.wrappedProvider.getConfiguration();\n providerPromise.then(function (providedConfig) {\n _this.store.put(_this.cacheKey, providedConfig);\n });\n return providerPromise;\n };\n CachingConfigurationProvider.prototype.selectPnPCache = function () {\n var pnpCache = new storage.PnPClientStorage();\n if ((pnpCache.local) && (pnpCache.local.enabled)) {\n return pnpCache.local;\n }\n if ((pnpCache.session) && (pnpCache.session.enabled)) {\n return pnpCache.session;\n }\n throw new Error(\"Cannot create a caching configuration provider since cache is not available.\");\n };\n return CachingConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = CachingConfigurationProvider;\n","\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar spListConfigurationProvider_1 = require(\"./spListConfigurationProvider\");\nexports.CachingConfigurationProvider = cachingConfigurationProvider_1.default;\nexports.SPListConfigurationProvider = spListConfigurationProvider_1.default;\n","\"use strict\";\nvar cachingConfigurationProvider_1 = require(\"./cachingConfigurationProvider\");\nvar SPListConfigurationProvider = (function () {\n function SPListConfigurationProvider(sourceWeb, sourceListTitle) {\n if (sourceListTitle === void 0) { sourceListTitle = \"config\"; }\n this.sourceWeb = sourceWeb;\n this.sourceListTitle = sourceListTitle;\n }\n Object.defineProperty(SPListConfigurationProvider.prototype, \"web\", {\n get: function () {\n return this.sourceWeb;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(SPListConfigurationProvider.prototype, \"listTitle\", {\n get: function () {\n return this.sourceListTitle;\n },\n enumerable: true,\n configurable: true\n });\n SPListConfigurationProvider.prototype.getConfiguration = function () {\n return this.web.lists.getByTitle(this.listTitle).items.select(\"Title\", \"Value\")\n .getAs().then(function (data) {\n var configuration = {};\n data.forEach(function (i) {\n configuration[i.Title] = i.Value;\n });\n return configuration;\n });\n };\n SPListConfigurationProvider.prototype.asCaching = function () {\n var cacheKey = \"splist_\" + this.web.toUrl() + \"+\" + this.listTitle;\n return new cachingConfigurationProvider_1.default(this, cacheKey);\n };\n return SPListConfigurationProvider;\n}());\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = SPListConfigurationProvider;\n","\"use strict\";\nvar collections_1 = require(\"../collections/collections\");\nvar util_1 = require(\"../utils/util\");\nvar odata_1 = require(\"../sharepoint/rest/odata\");\nvar CachedDigest = (function () {\n function CachedDigest() {\n }\n return CachedDigest;\n}());\nexports.CachedDigest = CachedDigest;\nvar DigestCache = (function () {\n function DigestCache(_httpClient, _digests) {\n if (_digests === void 0) { _digests = new collections_1.Dictionary(); }\n this._httpClient = _httpClient;\n this._digests = _digests;\n }\n DigestCache.prototype.getDigest = function (webUrl) {\n var self = this;\n var cachedDigest = this._digests.get(webUrl);\n if (cachedDigest !== null) {\n var now = new Date();\n if (now < cachedDigest.expiration) {\n return Promise.resolve(cachedDigest.value);\n }\n }\n var url = util_1.Util.combinePaths(webUrl, \"/_api/contextinfo\");\n return self._httpClient.fetchRaw(url, {\n cache: \"no-cache\",\n credentials: \"same-origin\",\n headers: {\n \"Accept\": \"application/json;odata=verbose\",\n \"Content-type\": \"application/json;odata=verbose;charset=utf-8\",\n },\n method: \"POST\",\n }).then(function (response) {\n var parser = new odata_1.ODataDefaultParser();\n return parser.parse(response).then(function (d) { return d.GetContextWebInformation; });\n }).then(function (data) {\n var newCachedDigest = new CachedDigest();\n newCachedDigest.value = data.FormDigestValue;\n var seconds = data.FormDigestTimeoutSeconds;\n var expiration = new Date();\n expiration.setTime(expiration.getTime() + 1000 * seconds);\n newCachedDigest.expiration = expiration;\n self._digests.add(webUrl, newCachedDigest);\n return newCachedDigest.value;\n });\n };\n DigestCache.prototype.clear = function () {\n this._digests.clear();\n };\n return DigestCache;\n}());\nexports.DigestCache = DigestCache;\n","\"use strict\";\nvar FetchClient = (function () {\n function FetchClient() {\n }\n FetchClient.prototype.fetch = function (url, options) {\n return global.fetch(url, options);\n };\n return FetchClient;\n}());\nexports.FetchClient = FetchClient;\n","\"use strict\";\nvar fetchclient_1 = require(\"./fetchclient\");\nvar digestcache_1 = require(\"./digestcache\");\nvar util_1 = require(\"../utils/util\");\nvar pnplibconfig_1 = require(\"../configuration/pnplibconfig\");\nvar sprequestexecutorclient_1 = require(\"./sprequestexecutorclient\");\nvar nodefetchclient_1 = require(\"./nodefetchclient\");\nvar HttpClient = (function () {\n function HttpClient() {\n this._impl = this.getFetchImpl();\n this._digestCache = new digestcache_1.DigestCache(this);\n }\n HttpClient.prototype.fetch = function (url, options) {\n if (options === void 0) { options = {}; }\n var self = this;\n var opts = util_1.Util.extend(options, { cache: \"no-cache\", credentials: \"same-origin\" }, true);\n var headers = new Headers();\n this.mergeHeaders(headers, pnplibconfig_1.RuntimeConfig.headers);\n this.mergeHeaders(headers, options.headers);\n if (!headers.has(\"Accept\")) {\n headers.append(\"Accept\", \"application/json\");\n }\n if (!headers.has(\"Content-Type\")) {\n headers.append(\"Content-Type\", \"application/json;odata=verbose;charset=utf-8\");\n }\n if (!headers.has(\"X-ClientService-ClientTag\")) {\n headers.append(\"X-ClientService-ClientTag\", \"PnPCoreJS:1.0.4\");\n }\n opts = util_1.Util.extend(opts, { headers: headers });\n if (opts.method && opts.method.toUpperCase() !== \"GET\") {\n if (!headers.has(\"X-RequestDigest\")) {\n var index = url.indexOf(\"_api/\");\n if (index < 0) {\n throw new Error(\"Unable to determine API url\");\n }\n var webUrl = url.substr(0, index);\n return this._digestCache.getDigest(webUrl)\n .then(function (digest) {\n headers.append(\"X-RequestDigest\", digest);\n return self.fetchRaw(url, opts);\n });\n }\n }\n return self.fetchRaw(url, opts);\n };\n HttpClient.prototype.fetchRaw = function (url, options) {\n var _this = this;\n if (options === void 0) { options = {}; }\n var rawHeaders = new Headers();\n this.mergeHeaders(rawHeaders, options.headers);\n options = util_1.Util.extend(options, { headers: rawHeaders });\n var retry = function (ctx) {\n _this._impl.fetch(url, options).then(function (response) { return ctx.resolve(response); }).catch(function (response) {\n var delay = ctx.delay;\n if (response.status !== 429 && response.status !== 503) {\n ctx.reject(response);\n }\n ctx.delay *= 2;\n ctx.attempts++;\n if (ctx.retryCount <= ctx.attempts) {\n ctx.reject(response);\n }\n setTimeout(util_1.Util.getCtxCallback(_this, retry, ctx), delay);\n });\n };\n return new Promise(function (resolve, reject) {\n var retryContext = {\n attempts: 0,\n delay: 100,\n reject: reject,\n resolve: resolve,\n retryCount: 7,\n };\n retry.call(_this, retryContext);\n });\n };\n HttpClient.prototype.get = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"GET\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.post = function (url, options) {\n if (options === void 0) { options = {}; }\n var opts = util_1.Util.extend(options, { method: \"POST\" });\n return this.fetch(url, opts);\n };\n HttpClient.prototype.getFetchImpl = function () {\n if (pnplibconfig_1.RuntimeConfig.useSPRequestExecutor) {\n return new sprequestexecutorclient_1.SPRequestExecutorClient();\n }\n else if (pnplibconfig_1.RuntimeConfig.useNodeFetchClient) {\n var opts = pnplibconfig_1.RuntimeConfig.nodeRequestOptions;\n return new nodefetchclient_1.NodeFetchClient(opts.siteUrl, opts.clientId, opts.clientSecret);\n }\n else {\n return new fetchclient_1.FetchClient();\n }\n };\n HttpClient.prototype.mergeHeaders = function (target, source) {\n if (typeof source !== \"undefined\" && source !== null) {\n var temp = new Request(\"\", { headers: source });\n temp.headers.forEach(function (value, name) {\n target.append(name, value);\n });\n }\n };\n return HttpClient;\n}());\nexports.HttpClient = HttpClient;\n","\"use strict\";\nvar NodeFetchClient = (function () {\n function NodeFetchClient(siteUrl, _clientId, _clientSecret, _realm) {\n if (_realm === void 0) { _realm = \"\"; }\n this.siteUrl = siteUrl;\n this._clientId = _clientId;\n this._clientSecret = _clientSecret;\n this._realm = _realm;\n }\n NodeFetchClient.prototype.fetch = function (url, options) {\n throw new Error(\"Using NodeFetchClient in the browser is not supported.\");\n };\n return NodeFetchClient;\n}());\nexports.NodeFetchClient = NodeFetchClient;\n","\"use strict\";\nvar util_1 = require(\"../utils/util\");\nvar SPRequestExecutorClient = (function () {\n function SPRequestExecutorClient() {\n this.convertToResponse = function (spResponse) {\n var responseHeaders = new Headers();\n for (var h in spResponse.headers) {\n if (spResponse.headers[h]) {\n responseHeaders.append(h, spResponse.headers[h]);\n }\n }\n return new Response(spResponse.body, {\n headers: responseHeaders,\n status: spResponse.statusCode,\n statusText: spResponse.statusText,\n });\n };\n }\n SPRequestExecutorClient.prototype.fetch = function (url, options) {\n var _this = this;\n if (typeof SP === \"undefined\" || typeof SP.RequestExecutor === \"undefined\") {\n throw new Error(\"SP.RequestExecutor is undefined. \" +\n \"Load the SP.RequestExecutor.js library (/_layouts/15/SP.RequestExecutor.js) before loading the PnP JS Core library.\");\n }\n var addinWebUrl = url.substring(0, url.indexOf(\"/_api\")), executor = new SP.RequestExecutor(addinWebUrl), headers = {}, iterator, temp;\n if (options.headers && options.headers instanceof Headers) {\n iterator = options.headers.entries();\n temp = iterator.next();\n while (!temp.done) {\n headers[temp.value[0]] = temp.value[1];\n temp = iterator.next();\n }\n }\n else {\n headers = options.headers;\n }\n return new Promise(function (resolve, reject) {\n var requestOptions = {\n error: function (error) {\n reject(_this.convertToResponse(error));\n },\n headers: headers,\n method: options.method,\n success: function (response) {\n resolve(_this.convertToResponse(response));\n },\n url: url,\n };\n if (options.body) {\n util_1.Util.extend(requestOptions, { body: options.body });\n }\n else {\n util_1.Util.extend(requestOptions, { binaryStringRequestBody: true });\n }\n executor.executeAsync(requestOptions);\n });\n };\n return SPRequestExecutorClient;\n}());\nexports.SPRequestExecutorClient = SPRequestExecutorClient;\n","\"use strict\";\nvar util_1 = require(\"./utils/util\");\nvar storage_1 = require(\"./utils/storage\");\nvar configuration_1 = require(\"./configuration/configuration\");\nvar logging_1 = require(\"./utils/logging\");\nvar rest_1 = require(\"./sharepoint/rest/rest\");\nvar pnplibconfig_1 = require(\"./configuration/pnplibconfig\");\nexports.util = util_1.Util;\nexports.sp = new rest_1.Rest();\nexports.storage = new storage_1.PnPClientStorage();\nexports.config = new configuration_1.Settings();\nexports.log = logging_1.Logger;\nexports.setup = pnplibconfig_1.setRuntimeConfig;\nvar Def = {\n config: exports.config,\n log: exports.log,\n setup: exports.setup,\n sp: exports.sp,\n storage: exports.storage,\n util: exports.util,\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.default = Def;\n","\"use strict\";\nvar storage_1 = require(\"../../utils/storage\");\nvar util_1 = require(\"../../utils/util\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar CachingOptions = (function () {\n function CachingOptions(key) {\n this.key = key;\n this.expiration = util_1.Util.dateAdd(new Date(), \"second\", pnplibconfig_1.RuntimeConfig.defaultCachingTimeoutSeconds);\n this.storeName = pnplibconfig_1.RuntimeConfig.defaultCachingStore;\n }\n Object.defineProperty(CachingOptions.prototype, \"store\", {\n get: function () {\n if (this.storeName === \"local\") {\n return CachingOptions.storage.local;\n }\n else {\n return CachingOptions.storage.session;\n }\n },\n enumerable: true,\n configurable: true\n });\n CachingOptions.storage = new storage_1.PnPClientStorage();\n return CachingOptions;\n}());\nexports.CachingOptions = CachingOptions;\nvar CachingParserWrapper = (function () {\n function CachingParserWrapper(_parser, _cacheOptions) {\n this._parser = _parser;\n this._cacheOptions = _cacheOptions;\n }\n CachingParserWrapper.prototype.parse = function (response) {\n var _this = this;\n return this._parser.parse(response).then(function (data) {\n if (_this._cacheOptions.store !== null) {\n _this._cacheOptions.store.put(_this._cacheOptions.key, data, _this._cacheOptions.expiration);\n }\n return data;\n });\n };\n return CachingParserWrapper;\n}());\nexports.CachingParserWrapper = CachingParserWrapper;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar ContentTypes = (function (_super) {\n __extends(ContentTypes, _super);\n function ContentTypes(baseUrl, path) {\n if (path === void 0) { path = \"contenttypes\"; }\n _super.call(this, baseUrl, path);\n }\n ContentTypes.prototype.getById = function (id) {\n var ct = new ContentType(this);\n ct.concat(\"('\" + id + \"')\");\n return ct;\n };\n return ContentTypes;\n}(queryable_1.QueryableCollection));\nexports.ContentTypes = ContentTypes;\nvar ContentType = (function (_super) {\n __extends(ContentType, _super);\n function ContentType(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(ContentType.prototype, \"descriptionResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"descriptionResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fieldLinks\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldLinks\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"fields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"nameResource\", {\n get: function () {\n return new queryable_1.Queryable(this, \"nameResource\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"parent\", {\n get: function () {\n return new queryable_1.Queryable(this, \"parent\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"workflowAssociations\", {\n get: function () {\n return new queryable_1.Queryable(this, \"workflowAssociations\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"displayFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"displayFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplate\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplate\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"documentTemplateUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"documentTemplateUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"editFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"editFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormTemplateName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormTemplateName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"newFormUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"newFormUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"readOnly\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnly\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ContentType.prototype, \"stringId\", {\n get: function () {\n return new queryable_1.Queryable(this, \"stringId\");\n },\n enumerable: true,\n configurable: true\n });\n return ContentType;\n}(queryable_1.QueryableInstance));\nexports.ContentType = ContentType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Types = require(\"./types\");\nvar Fields = (function (_super) {\n __extends(Fields, _super);\n function Fields(baseUrl, path) {\n if (path === void 0) { path = \"fields\"; }\n _super.call(this, baseUrl, path);\n }\n Fields.prototype.getByTitle = function (title) {\n return new Field(this, \"getByTitle('\" + title + \"')\");\n };\n Fields.prototype.getByInternalNameOrTitle = function (name) {\n return new Field(this, \"getByInternalNameOrTitle('\" + name + \"')\");\n };\n Fields.prototype.getById = function (id) {\n var f = new Field(this);\n f.concat(\"('\" + id + \"')\");\n return f;\n };\n Fields.prototype.createFieldAsXml = function (xml) {\n var _this = this;\n var info;\n if (typeof xml === \"string\") {\n info = { SchemaXml: xml };\n }\n else {\n info = xml;\n }\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": {\n \"type\": \"SP.XmlSchemaFieldCreationInformation\",\n },\n }, info),\n });\n var q = new Fields(this, \"createfieldasxml\");\n return q.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.add = function (title, fieldType, properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n \"Title\": title,\n }, properties));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n field: _this.getById(data.Id),\n };\n });\n };\n Fields.prototype.addText = function (title, maxLength, properties) {\n if (maxLength === void 0) { maxLength = 255; }\n var props = {\n FieldTypeKind: 2,\n };\n return this.add(title, \"SP.FieldText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) {\n if (outputType === void 0) { outputType = Types.FieldTypes.Text; }\n var props = {\n DateFormat: dateFormat,\n FieldTypeKind: 17,\n Formula: formula,\n OutputType: outputType,\n };\n return this.add(title, \"SP.FieldCalculated\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.DateTimeFieldFormatType.DateOnly; }\n if (calendarType === void 0) { calendarType = Types.CalendarType.Gregorian; }\n if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = 0; }\n var props = {\n DateTimeCalendarType: calendarType,\n DisplayFormat: displayFormat,\n FieldTypeKind: 4,\n FriendlyDisplayFormat: friendlyDisplayFormat,\n };\n return this.add(title, \"SP.FieldDateTime\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addNumber = function (title, minValue, maxValue, properties) {\n var props = { FieldTypeKind: 9 };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldNumber\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) {\n if (currencyLocalId === void 0) { currencyLocalId = 1033; }\n var props = {\n CurrencyLocaleId: currencyLocalId,\n FieldTypeKind: 10,\n };\n if (typeof minValue !== \"undefined\") {\n props = util_1.Util.extend({ MinimumValue: minValue }, props);\n }\n if (typeof maxValue !== \"undefined\") {\n props = util_1.Util.extend({ MaximumValue: maxValue }, props);\n }\n return this.add(title, \"SP.FieldCurrency\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addMultilineText = function (title, numberOfLines, richText, restrictedMode, appendOnly, allowHyperlink, properties) {\n if (numberOfLines === void 0) { numberOfLines = 6; }\n if (richText === void 0) { richText = true; }\n if (restrictedMode === void 0) { restrictedMode = false; }\n if (appendOnly === void 0) { appendOnly = false; }\n if (allowHyperlink === void 0) { allowHyperlink = true; }\n var props = {\n AllowHyperlink: allowHyperlink,\n AppendOnly: appendOnly,\n FieldTypeKind: 3,\n NumberOfLines: numberOfLines,\n RestrictedMode: restrictedMode,\n RichText: richText,\n };\n return this.add(title, \"SP.FieldMultiLineText\", util_1.Util.extend(props, properties));\n };\n Fields.prototype.addUrl = function (title, displayFormat, properties) {\n if (displayFormat === void 0) { displayFormat = Types.UrlFieldFormatType.Hyperlink; }\n var props = {\n DisplayFormat: displayFormat,\n FieldTypeKind: 11,\n };\n return this.add(title, \"SP.FieldUrl\", util_1.Util.extend(props, properties));\n };\n return Fields;\n}(queryable_1.QueryableCollection));\nexports.Fields = Fields;\nvar Field = (function (_super) {\n __extends(Field, _super);\n function Field(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Field.prototype, \"canBeDeleted\", {\n get: function () {\n return new queryable_1.Queryable(this, \"canBeDeleted\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"defaultValue\", {\n get: function () {\n return new queryable_1.Queryable(this, \"defaultValue\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"description\", {\n get: function () {\n return new queryable_1.Queryable(this, \"description\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"direction\", {\n get: function () {\n return new queryable_1.Queryable(this, \"direction\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"enforceUniqueValues\", {\n get: function () {\n return new queryable_1.Queryable(this, \"enforceUniqueValues\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"entityPropertyName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"entityPropertyName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"filterable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"filterable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fromBaseType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fromBaseType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"group\", {\n get: function () {\n return new queryable_1.Queryable(this, \"group\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"hidden\", {\n get: function () {\n return new queryable_1.Queryable(this, \"hidden\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"indexed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"indexed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"internalName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"internalName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"jsLink\", {\n get: function () {\n return new queryable_1.Queryable(this, \"jsLink\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"readOnlyField\", {\n get: function () {\n return new queryable_1.Queryable(this, \"readOnlyField\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"required\", {\n get: function () {\n return new queryable_1.Queryable(this, \"required\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"schemaXml\", {\n get: function () {\n return new queryable_1.Queryable(this, \"schemaXml\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"scope\", {\n get: function () {\n return new queryable_1.Queryable(this, \"scope\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sealed\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sealed\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"sortable\", {\n get: function () {\n return new queryable_1.Queryable(this, \"sortable\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"staticName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"staticName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"fieldTypeKind\", {\n get: function () {\n return new queryable_1.Queryable(this, \"fieldTypeKind\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeAsString\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeAsString\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeDisplayName\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeDisplayName\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"typeShortDescription\", {\n get: function () {\n return new queryable_1.Queryable(this, \"typeShortDescription\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationFormula\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationFormula\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Field.prototype, \"validationMessage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"validationMessage\");\n },\n enumerable: true,\n configurable: true\n });\n Field.prototype.update = function (properties, fieldType) {\n var _this = this;\n if (fieldType === void 0) { fieldType = \"SP.Field\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": fieldType },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n field: _this,\n };\n });\n };\n Field.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Field.prototype.setShowInDisplayForm = function (show) {\n var q = new Field(this, \"setshowindisplayform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInEditForm = function (show) {\n var q = new Field(this, \"setshowineditform(\" + show + \")\");\n return q.post();\n };\n Field.prototype.setShowInNewForm = function (show) {\n var q = new Field(this, \"setshowinnewform(\" + show + \")\");\n return q.post();\n };\n return Field;\n}(queryable_1.QueryableInstance));\nexports.Field = Field;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar items_1 = require(\"./items\");\nvar Files = (function (_super) {\n __extends(Files, _super);\n function Files(baseUrl, path) {\n if (path === void 0) { path = \"files\"; }\n _super.call(this, baseUrl, path);\n }\n Files.prototype.getByName = function (name) {\n var f = new File(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Files.prototype.add = function (url, content, shouldOverWrite) {\n var _this = this;\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new Files(this, \"add(overwrite=\" + shouldOverWrite + \",url='\" + url + \"')\")\n .post({ body: content }).then(function (response) {\n return {\n data: response,\n file: _this.getByName(url),\n };\n });\n };\n Files.prototype.addTemplateFile = function (fileUrl, templateFileType) {\n var _this = this;\n return new Files(this, \"addTemplateFile(urloffile='\" + fileUrl + \"',templatefiletype=\" + templateFileType + \")\")\n .post().then(function (response) {\n return {\n data: response,\n file: _this.getByName(fileUrl),\n };\n });\n };\n return Files;\n}(queryable_1.QueryableCollection));\nexports.Files = Files;\nvar File = (function (_super) {\n __extends(File, _super);\n function File(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(File.prototype, \"author\", {\n get: function () {\n return new queryable_1.Queryable(this, \"author\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkedOutByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkedOutByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"checkOutType\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkOutType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"contentTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"contentTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"customizedPageStatus\", {\n get: function () {\n return new queryable_1.Queryable(this, \"customizedPageStatus\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"eTag\", {\n get: function () {\n return new queryable_1.Queryable(this, \"eTag\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"exists\", {\n get: function () {\n return new queryable_1.Queryable(this, \"exists\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"length\", {\n get: function () {\n return new queryable_1.Queryable(this, \"length\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"level\", {\n get: function () {\n return new queryable_1.Queryable(this, \"level\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"lockedByUser\", {\n get: function () {\n return new queryable_1.Queryable(this, \"lockedByUser\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"majorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"majorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"minorVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"minorVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"modifiedBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"modifiedBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeCreated\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeCreated\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"timeLastModified\", {\n get: function () {\n return new queryable_1.Queryable(this, \"timeLastModified\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"title\", {\n get: function () {\n return new queryable_1.Queryable(this, \"title\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"uiVersionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"uiVersionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"versions\", {\n get: function () {\n return new Versions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(File.prototype, \"value\", {\n get: function () {\n return new queryable_1.Queryable(this, \"$value\");\n },\n enumerable: true,\n configurable: true\n });\n File.prototype.approve = function (comment) {\n return new File(this, \"approve(comment='\" + comment + \"')\").post();\n };\n File.prototype.cancelUpload = function (uploadId) {\n return new File(this, \"cancelUpload(uploadId=guid'\" + uploadId + \"')\").post();\n };\n File.prototype.checkin = function (comment, checkinType) {\n if (comment === void 0) { comment = \"\"; }\n if (checkinType === void 0) { checkinType = CheckinType.Major; }\n return new File(this, \"checkin(comment='\" + comment + \"',checkintype=\" + checkinType + \")\").post();\n };\n File.prototype.checkout = function () {\n return new File(this, \"checkout\").post();\n };\n File.prototype.continueUpload = function (uploadId, fileOffset, b) {\n return new File(this, \"continueUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\").postAs({ body: b });\n };\n File.prototype.copyTo = function (url, shouldOverWrite) {\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\n return new File(this, \"copyTo(strnewurl='\" + url + \"',boverwrite=\" + shouldOverWrite + \")\").post();\n };\n File.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new File(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n File.prototype.deny = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"deny(comment='\" + comment + \"')\").post();\n };\n File.prototype.finishUpload = function (uploadId, fileOffset, fragment) {\n return new File(this, \"finishUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\")\n .postAs({ body: fragment }).then(function (response) {\n return {\n data: response,\n file: new File(response.ServerRelativeUrl),\n };\n });\n };\n File.prototype.getLimitedWebPartManager = function (scope) {\n if (scope === void 0) { scope = WebPartsPersonalizationScope.User; }\n return new queryable_1.Queryable(this, \"getLimitedWebPartManager(scope=\" + scope + \")\");\n };\n File.prototype.moveTo = function (url, moveOperations) {\n if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; }\n return new File(this, \"moveTo(newurl='\" + url + \"',flags=\" + moveOperations + \")\").post();\n };\n File.prototype.openBinaryStream = function () {\n return new queryable_1.Queryable(this, \"openBinaryStream\");\n };\n File.prototype.publish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"publish(comment='\" + comment + \"')\").post();\n };\n File.prototype.recycle = function () {\n return new File(this, \"recycle\").post();\n };\n File.prototype.saveBinaryStream = function (data) {\n return new File(this, \"saveBinary\").post({ body: data });\n };\n File.prototype.startUpload = function (uploadId, fragment) {\n return new File(this, \"startUpload(uploadId=guid'\" + uploadId + \"')\").postAs({ body: fragment });\n };\n File.prototype.undoCheckout = function () {\n return new File(this, \"undoCheckout\").post();\n };\n File.prototype.unpublish = function (comment) {\n if (comment === void 0) { comment = \"\"; }\n return new File(this, \"unpublish(comment='\" + comment + \"')\").post();\n };\n return File;\n}(queryable_1.QueryableInstance));\nexports.File = File;\nvar Versions = (function (_super) {\n __extends(Versions, _super);\n function Versions(baseUrl, path) {\n if (path === void 0) { path = \"versions\"; }\n _super.call(this, baseUrl, path);\n }\n Versions.prototype.getById = function (versionId) {\n var v = new Version(this);\n v.concat(\"(\" + versionId + \")\");\n return v;\n };\n Versions.prototype.deleteAll = function () {\n return new Versions(this, \"deleteAll\").post();\n };\n Versions.prototype.deleteById = function (versionId) {\n return new Versions(this, \"deleteById(vid=\" + versionId + \")\").post();\n };\n Versions.prototype.deleteByLabel = function (label) {\n return new Versions(this, \"deleteByLabel(versionlabel='\" + label + \"')\").post();\n };\n Versions.prototype.restoreByLabel = function (label) {\n return new Versions(this, \"restoreByLabel(versionlabel='\" + label + \"')\").post();\n };\n return Versions;\n}(queryable_1.QueryableCollection));\nexports.Versions = Versions;\nvar Version = (function (_super) {\n __extends(Version, _super);\n function Version(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Version.prototype, \"checkInComment\", {\n get: function () {\n return new queryable_1.Queryable(this, \"checkInComment\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"created\", {\n get: function () {\n return new queryable_1.Queryable(this, \"created\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"createdBy\", {\n get: function () {\n return new queryable_1.Queryable(this, \"createdBy\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"id\", {\n get: function () {\n return new queryable_1.Queryable(this, \"id\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"isCurrentVersion\", {\n get: function () {\n return new queryable_1.Queryable(this, \"isCurrentVersion\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"size\", {\n get: function () {\n return new queryable_1.Queryable(this, \"size\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"url\", {\n get: function () {\n return new queryable_1.Queryable(this, \"url\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Version.prototype, \"versionLabel\", {\n get: function () {\n return new queryable_1.Queryable(this, \"versionLabel\");\n },\n enumerable: true,\n configurable: true\n });\n Version.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return Version;\n}(queryable_1.QueryableInstance));\nexports.Version = Version;\n(function (CheckinType) {\n CheckinType[CheckinType[\"Minor\"] = 0] = \"Minor\";\n CheckinType[CheckinType[\"Major\"] = 1] = \"Major\";\n CheckinType[CheckinType[\"Overwrite\"] = 2] = \"Overwrite\";\n})(exports.CheckinType || (exports.CheckinType = {}));\nvar CheckinType = exports.CheckinType;\n(function (WebPartsPersonalizationScope) {\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"User\"] = 0] = \"User\";\n WebPartsPersonalizationScope[WebPartsPersonalizationScope[\"Shared\"] = 1] = \"Shared\";\n})(exports.WebPartsPersonalizationScope || (exports.WebPartsPersonalizationScope = {}));\nvar WebPartsPersonalizationScope = exports.WebPartsPersonalizationScope;\n(function (MoveOperations) {\n MoveOperations[MoveOperations[\"Overwrite\"] = 1] = \"Overwrite\";\n MoveOperations[MoveOperations[\"AllowBrokenThickets\"] = 8] = \"AllowBrokenThickets\";\n})(exports.MoveOperations || (exports.MoveOperations = {}));\nvar MoveOperations = exports.MoveOperations;\n(function (TemplateFileType) {\n TemplateFileType[TemplateFileType[\"StandardPage\"] = 0] = \"StandardPage\";\n TemplateFileType[TemplateFileType[\"WikiPage\"] = 1] = \"WikiPage\";\n TemplateFileType[TemplateFileType[\"FormPage\"] = 2] = \"FormPage\";\n})(exports.TemplateFileType || (exports.TemplateFileType = {}));\nvar TemplateFileType = exports.TemplateFileType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar files_1 = require(\"./files\");\nvar items_1 = require(\"./items\");\nvar Folders = (function (_super) {\n __extends(Folders, _super);\n function Folders(baseUrl, path) {\n if (path === void 0) { path = \"folders\"; }\n _super.call(this, baseUrl, path);\n }\n Folders.prototype.getByName = function (name) {\n var f = new Folder(this);\n f.concat(\"('\" + name + \"')\");\n return f;\n };\n Folders.prototype.add = function (url) {\n var _this = this;\n return new Folders(this, \"add('\" + url + \"')\").post().then(function (response) {\n return {\n data: response,\n folder: _this.getByName(url),\n };\n });\n };\n return Folders;\n}(queryable_1.QueryableCollection));\nexports.Folders = Folders;\nvar Folder = (function (_super) {\n __extends(Folder, _super);\n function Folder(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Folder.prototype, \"contentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"contentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"files\", {\n get: function () {\n return new files_1.Files(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"folders\", {\n get: function () {\n return new Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"itemCount\", {\n get: function () {\n return new queryable_1.Queryable(this, \"itemCount\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"listItemAllFields\", {\n get: function () {\n return new items_1.Item(this, \"listItemAllFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"name\", {\n get: function () {\n return new queryable_1.Queryable(this, \"name\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"parentFolder\", {\n get: function () {\n return new Folder(this, \"parentFolder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"properties\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"properties\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"serverRelativeUrl\", {\n get: function () {\n return new queryable_1.Queryable(this, \"serverRelativeUrl\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"uniqueContentTypeOrder\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"uniqueContentTypeOrder\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Folder.prototype, \"welcomePage\", {\n get: function () {\n return new queryable_1.Queryable(this, \"welcomePage\");\n },\n enumerable: true,\n configurable: true\n });\n Folder.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return new Folder(this).post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Folder.prototype.recycle = function () {\n return new Folder(this, \"recycle\").post();\n };\n return Folder;\n}(queryable_1.QueryableInstance));\nexports.Folder = Folder;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Forms = (function (_super) {\n __extends(Forms, _super);\n function Forms(baseUrl, path) {\n if (path === void 0) { path = \"forms\"; }\n _super.call(this, baseUrl, path);\n }\n Forms.prototype.getById = function (id) {\n var i = new Form(this);\n i.concat(\"('\" + id + \"')\");\n return i;\n };\n return Forms;\n}(queryable_1.QueryableCollection));\nexports.Forms = Forms;\nvar Form = (function (_super) {\n __extends(Form, _super);\n function Form(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n return Form;\n}(queryable_1.QueryableInstance));\nexports.Form = Form;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar folders_1 = require(\"./folders\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar util_1 = require(\"../../utils/util\");\nvar odata_1 = require(\"./odata\");\nvar Items = (function (_super) {\n __extends(Items, _super);\n function Items(baseUrl, path) {\n if (path === void 0) { path = \"items\"; }\n _super.call(this, baseUrl, path);\n }\n Items.prototype.getById = function (id) {\n var i = new Item(this);\n i.concat(\"(\" + id + \")\");\n return i;\n };\n Items.prototype.skip = function (skip) {\n this._query.add(\"$skiptoken\", encodeURIComponent(\"Paged=TRUE&p_ID=\" + skip));\n return this;\n };\n Items.prototype.getPaged = function () {\n return this.getAs(new PagedItemCollectionParser());\n };\n Items.prototype.add = function (properties) {\n var _this = this;\n if (properties === void 0) { properties = {}; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance);\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n item: _this.getById(data.Id),\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n return Items;\n}(queryable_1.QueryableCollection));\nexports.Items = Items;\nvar PagedItemCollectionParser = (function (_super) {\n __extends(PagedItemCollectionParser, _super);\n function PagedItemCollectionParser() {\n _super.apply(this, arguments);\n }\n PagedItemCollectionParser.prototype.parse = function (r) {\n return PagedItemCollection.fromResponse(r);\n };\n return PagedItemCollectionParser;\n}(odata_1.ODataParserBase));\nvar Item = (function (_super) {\n __extends(Item, _super);\n function Item(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Item.prototype, \"attachmentFiles\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"AttachmentFiles\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"contentType\", {\n get: function () {\n return new contenttypes_1.ContentType(this, \"ContentType\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"effectiveBasePermissionsForUI\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissionsForUI\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsHTML\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsHTML\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesAsText\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesAsText\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"fieldValuesForEdit\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"FieldValuesForEdit\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Item.prototype, \"folder\", {\n get: function () {\n return new folders_1.Folder(this, \"Folder\");\n },\n enumerable: true,\n configurable: true\n });\n Item.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n this.addBatchDependency();\n var parentList = this.getParent(queryable_1.QueryableInstance, this.parentUrl.substr(0, this.parentUrl.lastIndexOf(\"/\")));\n return parentList.select(\"ListItemEntityTypeFullName\").getAs().then(function (d) {\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": d.ListItemEntityTypeFullName },\n }, properties));\n var promise = _this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n item: _this,\n };\n });\n _this.clearBatchDependency();\n return promise;\n });\n };\n Item.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Item.prototype.recycle = function () {\n var i = new Item(this, \"recycle\");\n return i.post();\n };\n Item.prototype.getWopiFrameUrl = function (action) {\n if (action === void 0) { action = 0; }\n var i = new Item(this, \"getWOPIFrameUrl(@action)\");\n i._query.add(\"@action\", action);\n return i.post().then(function (data) {\n return data.GetWOPIFrameUrl;\n });\n };\n Item.prototype.validateUpdateListItem = function (formValues, newDocumentUpdate) {\n if (newDocumentUpdate === void 0) { newDocumentUpdate = false; }\n var postBody = JSON.stringify({ \"formValues\": formValues, bNewDocumentUpdate: newDocumentUpdate });\n var item = new Item(this, \"validateupdatelistitem\");\n return item.post({ body: postBody });\n };\n return Item;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Item = Item;\nvar PagedItemCollection = (function () {\n function PagedItemCollection() {\n }\n Object.defineProperty(PagedItemCollection.prototype, \"hasNext\", {\n get: function () {\n return typeof this.nextUrl === \"string\" && this.nextUrl.length > 0;\n },\n enumerable: true,\n configurable: true\n });\n PagedItemCollection.fromResponse = function (r) {\n return r.json().then(function (d) {\n var col = new PagedItemCollection();\n col.nextUrl = d[\"odata.nextLink\"];\n col.results = d.value;\n return col;\n });\n };\n PagedItemCollection.prototype.getNext = function () {\n if (this.hasNext) {\n var items = new Items(this.nextUrl, null);\n return items.getPaged();\n }\n return new Promise(function (r) { return r(null); });\n };\n return PagedItemCollection;\n}());\nexports.PagedItemCollection = PagedItemCollection;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar items_1 = require(\"./items\");\nvar views_1 = require(\"./views\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar fields_1 = require(\"./fields\");\nvar forms_1 = require(\"./forms\");\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar util_1 = require(\"../../utils/util\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Lists = (function (_super) {\n __extends(Lists, _super);\n function Lists(baseUrl, path) {\n if (path === void 0) { path = \"lists\"; }\n _super.call(this, baseUrl, path);\n }\n Lists.prototype.getByTitle = function (title) {\n return new List(this, \"getByTitle('\" + title + \"')\");\n };\n Lists.prototype.getById = function (id) {\n var list = new List(this);\n list.concat(\"('\" + id + \"')\");\n return list;\n };\n Lists.prototype.add = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n \"AllowContentTypes\": enableContentTypes,\n \"BaseTemplate\": template,\n \"ContentTypesEnabled\": enableContentTypes,\n \"Description\": description,\n \"Title\": title,\n }, additionalSettings));\n return this.post({ body: postBody }).then(function (data) {\n return { data: data, list: _this.getByTitle(title) };\n });\n };\n Lists.prototype.ensure = function (title, description, template, enableContentTypes, additionalSettings) {\n var _this = this;\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = 100; }\n if (enableContentTypes === void 0) { enableContentTypes = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n if (this.hasBatch) {\n throw new Error(\"The ensure method is not supported as part of a batch.\");\n }\n return new Promise(function (resolve, reject) {\n var list = _this.getByTitle(title);\n list.get().then(function (d) { return resolve({ created: false, data: d, list: list }); }).catch(function () {\n _this.add(title, description, template, enableContentTypes, additionalSettings).then(function (r) {\n resolve({ created: true, data: r.data, list: _this.getByTitle(title) });\n });\n }).catch(function (e) { return reject(e); });\n });\n };\n Lists.prototype.ensureSiteAssetsLibrary = function () {\n var q = new Lists(this, \"ensuresiteassetslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n Lists.prototype.ensureSitePagesLibrary = function () {\n var q = new Lists(this, \"ensuresitepageslibrary\");\n return q.post().then(function (json) {\n return new List(odata_1.extractOdataId(json));\n });\n };\n return Lists;\n}(queryable_1.QueryableCollection));\nexports.Lists = Lists;\nvar List = (function (_super) {\n __extends(List, _super);\n function List(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(List.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"items\", {\n get: function () {\n return new items_1.Items(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"views\", {\n get: function () {\n return new views_1.Views(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"forms\", {\n get: function () {\n return new forms_1.Forms(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"defaultView\", {\n get: function () {\n return new queryable_1.QueryableInstance(this, \"DefaultView\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"effectiveBasePermissions\", {\n get: function () {\n return new queryable_1.Queryable(this, \"EffectiveBasePermissions\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"eventReceivers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"EventReceivers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"relatedFields\", {\n get: function () {\n return new queryable_1.Queryable(this, \"getRelatedFields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(List.prototype, \"informationRightsManagementSettings\", {\n get: function () {\n return new queryable_1.Queryable(this, \"InformationRightsManagementSettings\");\n },\n enumerable: true,\n configurable: true\n });\n List.prototype.getView = function (viewId) {\n return new views_1.View(this, \"getView('\" + viewId + \"')\");\n };\n List.prototype.update = function (properties, eTag) {\n var _this = this;\n if (eTag === void 0) { eTag = \"*\"; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.List\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retList = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retList = _this.getParent(List, _this.parentUrl, \"getByTitle('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n list: retList,\n };\n });\n };\n List.prototype.delete = function (eTag) {\n if (eTag === void 0) { eTag = \"*\"; }\n return this.post({\n headers: {\n \"IF-Match\": eTag,\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n List.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new List(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n List.prototype.getItemsByCAMLQuery = function (query) {\n var expands = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n expands[_i - 1] = arguments[_i];\n }\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.CamlQuery\" } }, query) });\n var q = new List(this, \"getitems\");\n q = q.expand.apply(q, expands);\n return q.post({ body: postBody });\n };\n List.prototype.getListItemChangesSinceToken = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeLogItemQuery\" } }, query) });\n var q = new List(this, \"getlistitemchangessincetoken\");\n return q.post({ body: postBody }, { parse: function (r) { return r.text(); } });\n };\n List.prototype.recycle = function () {\n this.append(\"recycle\");\n return this.post().then(function (data) {\n if (data.hasOwnProperty(\"Recycle\")) {\n return data.Recycle;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListData = function (viewXml) {\n var q = new List(this, \"renderlistdata(@viewXml)\");\n q.query.add(\"@viewXml\", \"'\" + viewXml + \"'\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"RenderListData\")) {\n return data.RenderListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.renderListFormData = function (itemId, formId, mode) {\n var q = new List(this, \"renderlistformdata(itemid=\" + itemId + \", formid='\" + formId + \"', mode=\" + mode + \")\");\n return q.post().then(function (data) {\n data = JSON.parse(data);\n if (data.hasOwnProperty(\"ListData\")) {\n return data.ListData;\n }\n else {\n return data;\n }\n });\n };\n List.prototype.reserveListItemId = function () {\n var q = new List(this, \"reservelistitemid\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"ReserveListItemId\")) {\n return data.ReserveListItemId;\n }\n else {\n return data;\n }\n });\n };\n return List;\n}(queryablesecurable_1.QueryableSecurable));\nexports.List = List;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar quicklaunch_1 = require(\"./quicklaunch\");\nvar topnavigationbar_1 = require(\"./topnavigationbar\");\nvar Navigation = (function (_super) {\n __extends(Navigation, _super);\n function Navigation(baseUrl) {\n _super.call(this, baseUrl, \"navigation\");\n }\n Object.defineProperty(Navigation.prototype, \"quicklaunch\", {\n get: function () {\n return new quicklaunch_1.QuickLaunch(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Navigation.prototype, \"topNavigationBar\", {\n get: function () {\n return new topnavigationbar_1.TopNavigationBar(this);\n },\n enumerable: true,\n configurable: true\n });\n return Navigation;\n}(queryable_1.Queryable));\nexports.Navigation = Navigation;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar logging_1 = require(\"../../utils/logging\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nfunction extractOdataId(candidate) {\n if (candidate.hasOwnProperty(\"odata.id\")) {\n return candidate[\"odata.id\"];\n }\n else if (candidate.hasOwnProperty(\"__metadata\") && candidate.__metadata.hasOwnProperty(\"id\")) {\n return candidate.__metadata.id;\n }\n else {\n logging_1.Logger.log({\n data: candidate,\n level: logging_1.Logger.LogLevel.Error,\n message: \"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\",\n });\n throw new Error(\"Could not extract odata id in object, you may be using nometadata. Object data logged to logger.\");\n }\n}\nexports.extractOdataId = extractOdataId;\nvar ODataParserBase = (function () {\n function ODataParserBase() {\n }\n ODataParserBase.prototype.parse = function (r) {\n return r.json().then(function (json) {\n var result = json;\n if (json.hasOwnProperty(\"d\")) {\n if (json.d.hasOwnProperty(\"results\")) {\n result = json.d.results;\n }\n else {\n result = json.d;\n }\n }\n else if (json.hasOwnProperty(\"value\")) {\n result = json.value;\n }\n return result;\n });\n };\n return ODataParserBase;\n}());\nexports.ODataParserBase = ODataParserBase;\nvar ODataDefaultParser = (function (_super) {\n __extends(ODataDefaultParser, _super);\n function ODataDefaultParser() {\n _super.apply(this, arguments);\n }\n return ODataDefaultParser;\n}(ODataParserBase));\nexports.ODataDefaultParser = ODataDefaultParser;\nvar ODataRawParserImpl = (function () {\n function ODataRawParserImpl() {\n }\n ODataRawParserImpl.prototype.parse = function (r) {\n return r.json();\n };\n return ODataRawParserImpl;\n}());\nexports.ODataRawParserImpl = ODataRawParserImpl;\nvar ODataValueParserImpl = (function (_super) {\n __extends(ODataValueParserImpl, _super);\n function ODataValueParserImpl() {\n _super.apply(this, arguments);\n }\n ODataValueParserImpl.prototype.parse = function (r) {\n return _super.prototype.parse.call(this, r).then(function (d) { return d; });\n };\n return ODataValueParserImpl;\n}(ODataParserBase));\nvar ODataEntityParserImpl = (function (_super) {\n __extends(ODataEntityParserImpl, _super);\n function ODataEntityParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n var o = new _this.factory(getEntityUrl(d), null);\n return util_1.Util.extend(o, d);\n });\n };\n return ODataEntityParserImpl;\n}(ODataParserBase));\nvar ODataEntityArrayParserImpl = (function (_super) {\n __extends(ODataEntityArrayParserImpl, _super);\n function ODataEntityArrayParserImpl(factory) {\n _super.call(this);\n this.factory = factory;\n }\n ODataEntityArrayParserImpl.prototype.parse = function (r) {\n var _this = this;\n return _super.prototype.parse.call(this, r).then(function (d) {\n return d.map(function (v) {\n var o = new _this.factory(getEntityUrl(v), null);\n return util_1.Util.extend(o, v);\n });\n });\n };\n return ODataEntityArrayParserImpl;\n}(ODataParserBase));\nfunction getEntityUrl(entity) {\n if (entity.hasOwnProperty(\"__metadata\")) {\n return entity.__metadata.uri;\n }\n else if (entity.hasOwnProperty(\"odata.editLink\")) {\n return util_1.Util.combinePaths(\"_api\", entity[\"odata.editLink\"]);\n }\n else {\n logging_1.Logger.write(\"No uri information found in ODataEntity parsing, chaining will fail for this object.\", logging_1.Logger.LogLevel.Warning);\n return \"\";\n }\n}\nexports.ODataRaw = new ODataRawParserImpl();\nfunction ODataValue() {\n return new ODataValueParserImpl();\n}\nexports.ODataValue = ODataValue;\nfunction ODataEntity(factory) {\n return new ODataEntityParserImpl(factory);\n}\nexports.ODataEntity = ODataEntity;\nfunction ODataEntityArray(factory) {\n return new ODataEntityArrayParserImpl(factory);\n}\nexports.ODataEntityArray = ODataEntityArray;\nvar ODataBatch = (function () {\n function ODataBatch(_batchId) {\n if (_batchId === void 0) { _batchId = util_1.Util.getGUID(); }\n this._batchId = _batchId;\n this._requests = [];\n this._batchDepCount = 0;\n }\n ODataBatch.prototype.add = function (url, method, options, parser) {\n var info = {\n method: method.toUpperCase(),\n options: options,\n parser: parser,\n reject: null,\n resolve: null,\n url: url,\n };\n var p = new Promise(function (resolve, reject) {\n info.resolve = resolve;\n info.reject = reject;\n });\n this._requests.push(info);\n return p;\n };\n ODataBatch.prototype.incrementBatchDep = function () {\n this._batchDepCount++;\n };\n ODataBatch.prototype.decrementBatchDep = function () {\n this._batchDepCount--;\n };\n ODataBatch.prototype.execute = function () {\n var _this = this;\n return new Promise(function (resolve, reject) {\n if (_this._batchDepCount > 0) {\n setTimeout(function () { return _this.execute(); }, 100);\n }\n else {\n _this.executeImpl().then(function () { return resolve(); }).catch(reject);\n }\n });\n };\n ODataBatch.prototype.executeImpl = function () {\n var _this = this;\n if (this._requests.length < 1) {\n return new Promise(function (r) { return r(); });\n }\n var batchBody = [];\n var currentChangeSetId = \"\";\n this._requests.forEach(function (reqInfo, index) {\n if (reqInfo.method === \"GET\") {\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n }\n else {\n if (currentChangeSetId.length < 1) {\n currentChangeSetId = util_1.Util.getGUID();\n batchBody.push(\"--batch_\" + _this._batchId + \"\\n\");\n batchBody.push(\"Content-Type: multipart/mixed; boundary=\\\"changeset_\" + currentChangeSetId + \"\\\"\\n\\n\");\n }\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"\\n\");\n }\n batchBody.push(\"Content-Type: application/http\\n\");\n batchBody.push(\"Content-Transfer-Encoding: binary\\n\\n\");\n var headers = {\n \"Accept\": \"application/json;\",\n };\n if (reqInfo.method !== \"GET\") {\n var method = reqInfo.method;\n if (reqInfo.options && reqInfo.options.headers && reqInfo.options.headers[\"X-HTTP-Method\"] !== typeof undefined) {\n method = reqInfo.options.headers[\"X-HTTP-Method\"];\n delete reqInfo.options.headers[\"X-HTTP-Method\"];\n }\n batchBody.push(method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n headers = util_1.Util.extend(headers, { \"Content-Type\": \"application/json;odata=verbose;charset=utf-8\" });\n }\n else {\n batchBody.push(reqInfo.method + \" \" + reqInfo.url + \" HTTP/1.1\\n\");\n }\n if (typeof pnplibconfig_1.RuntimeConfig.headers !== \"undefined\") {\n headers = util_1.Util.extend(headers, pnplibconfig_1.RuntimeConfig.headers);\n }\n if (reqInfo.options && reqInfo.options.headers) {\n headers = util_1.Util.extend(headers, reqInfo.options.headers);\n }\n for (var name_1 in headers) {\n if (headers.hasOwnProperty(name_1)) {\n batchBody.push(name_1 + \": \" + headers[name_1] + \"\\n\");\n }\n }\n batchBody.push(\"\\n\");\n if (reqInfo.options.body) {\n batchBody.push(reqInfo.options.body + \"\\n\\n\");\n }\n });\n if (currentChangeSetId.length > 0) {\n batchBody.push(\"--changeset_\" + currentChangeSetId + \"--\\n\\n\");\n currentChangeSetId = \"\";\n }\n batchBody.push(\"--batch_\" + this._batchId + \"--\\n\");\n var batchHeaders = {\n \"Content-Type\": \"multipart/mixed; boundary=batch_\" + this._batchId,\n };\n var batchOptions = {\n \"body\": batchBody.join(\"\"),\n \"headers\": batchHeaders,\n };\n var client = new httpclient_1.HttpClient();\n return client.post(util_1.Util.makeUrlAbsolute(\"/_api/$batch\"), batchOptions)\n .then(function (r) { return r.text(); })\n .then(this._parseResponse)\n .then(function (responses) {\n if (responses.length !== _this._requests.length) {\n throw new Error(\"Could not properly parse responses to match requests in batch.\");\n }\n var resolutions = [];\n for (var i = 0; i < responses.length; i++) {\n var request = _this._requests[i];\n var response = responses[i];\n if (!response.ok) {\n request.reject(new Error(response.statusText));\n }\n resolutions.push(request.parser.parse(response).then(request.resolve).catch(request.reject));\n }\n return Promise.all(resolutions);\n });\n };\n ODataBatch.prototype._parseResponse = function (body) {\n return new Promise(function (resolve, reject) {\n var responses = [];\n var header = \"--batchresponse_\";\n var statusRegExp = new RegExp(\"^HTTP/[0-9.]+ +([0-9]+) +(.*)\", \"i\");\n var lines = body.split(\"\\n\");\n var state = \"batch\";\n var status;\n var statusText;\n for (var i = 0; i < lines.length; ++i) {\n var line = lines[i];\n switch (state) {\n case \"batch\":\n if (line.substr(0, header.length) === header) {\n state = \"batchHeaders\";\n }\n else {\n if (line.trim() !== \"\") {\n throw new Error(\"Invalid response, line \" + i);\n }\n }\n break;\n case \"batchHeaders\":\n if (line.trim() === \"\") {\n state = \"status\";\n }\n break;\n case \"status\":\n var parts = statusRegExp.exec(line);\n if (parts.length !== 3) {\n throw new Error(\"Invalid status, line \" + i);\n }\n status = parseInt(parts[1], 10);\n statusText = parts[2];\n state = \"statusHeaders\";\n break;\n case \"statusHeaders\":\n if (line.trim() === \"\") {\n state = \"body\";\n }\n break;\n case \"body\":\n var response = void 0;\n if (status === 204) {\n response = new Response();\n }\n else {\n response = new Response(line, { status: status, statusText: statusText });\n }\n responses.push(response);\n state = \"batch\";\n break;\n }\n }\n if (state !== \"status\") {\n reject(new Error(\"Unexpected end of input\"));\n }\n resolve(responses);\n });\n };\n return ODataBatch;\n}());\nexports.ODataBatch = ODataBatch;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar util_1 = require(\"../../utils/util\");\nvar collections_1 = require(\"../../collections/collections\");\nvar httpclient_1 = require(\"../../net/httpclient\");\nvar odata_1 = require(\"./odata\");\nvar caching_1 = require(\"./caching\");\nvar pnplibconfig_1 = require(\"../../configuration/pnplibconfig\");\nvar Queryable = (function () {\n function Queryable(baseUrl, path) {\n this._query = new collections_1.Dictionary();\n this._batch = null;\n if (typeof baseUrl === \"string\") {\n var urlStr = baseUrl;\n if (urlStr.lastIndexOf(\"/\") < 0) {\n this._parentUrl = urlStr;\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n else if (urlStr.lastIndexOf(\"/\") > urlStr.lastIndexOf(\"(\")) {\n var index = urlStr.lastIndexOf(\"/\");\n this._parentUrl = urlStr.slice(0, index);\n path = util_1.Util.combinePaths(urlStr.slice(index), path);\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n else {\n var index = urlStr.lastIndexOf(\"(\");\n this._parentUrl = urlStr.slice(0, index);\n this._url = util_1.Util.combinePaths(urlStr, path);\n }\n }\n else {\n var q = baseUrl;\n this._parentUrl = q._url;\n if (!this.hasBatch && q.hasBatch) {\n this._batch = q._batch;\n }\n var target = q._query.get(\"@target\");\n if (target !== null) {\n this._query.add(\"@target\", target);\n }\n this._url = util_1.Util.combinePaths(this._parentUrl, path);\n }\n }\n Queryable.prototype.concat = function (pathPart) {\n this._url += pathPart;\n };\n Queryable.prototype.append = function (pathPart) {\n this._url = util_1.Util.combinePaths(this._url, pathPart);\n };\n Queryable.prototype.addBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.incrementBatchDep();\n }\n };\n Queryable.prototype.clearBatchDependency = function () {\n if (this._batch !== null) {\n this._batch.decrementBatchDep();\n }\n };\n Object.defineProperty(Queryable.prototype, \"hasBatch\", {\n get: function () {\n return this._batch !== null;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"parentUrl\", {\n get: function () {\n return this._parentUrl;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Queryable.prototype, \"query\", {\n get: function () {\n return this._query;\n },\n enumerable: true,\n configurable: true\n });\n Queryable.prototype.inBatch = function (batch) {\n if (this._batch !== null) {\n throw new Error(\"This query is already part of a batch.\");\n }\n this._batch = batch;\n return this;\n };\n Queryable.prototype.usingCaching = function (options) {\n if (!pnplibconfig_1.RuntimeConfig.globalCacheDisable) {\n this._useCaching = true;\n this._cachingOptions = options;\n }\n return this;\n };\n Queryable.prototype.toUrl = function () {\n return util_1.Util.makeUrlAbsolute(this._url);\n };\n Queryable.prototype.toUrlAndQuery = function () {\n var _this = this;\n var url = this.toUrl();\n if (this._query.count() > 0) {\n url += \"?\";\n var keys = this._query.getKeys();\n url += keys.map(function (key, ix, arr) { return (key + \"=\" + _this._query.get(key)); }).join(\"&\");\n }\n return url;\n };\n Queryable.prototype.get = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.getAs = function (parser, getOptions) {\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n if (getOptions === void 0) { getOptions = {}; }\n return this.getImpl(getOptions, parser);\n };\n Queryable.prototype.post = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.postAs = function (postOptions, parser) {\n if (postOptions === void 0) { postOptions = {}; }\n if (parser === void 0) { parser = new odata_1.ODataDefaultParser(); }\n return this.postImpl(postOptions, parser);\n };\n Queryable.prototype.getParent = function (factory, baseUrl, path) {\n if (baseUrl === void 0) { baseUrl = this.parentUrl; }\n var parent = new factory(baseUrl, path);\n var target = this.query.get(\"@target\");\n if (target !== null) {\n parent.query.add(\"@target\", target);\n }\n return parent;\n };\n Queryable.prototype.getImpl = function (getOptions, parser) {\n if (getOptions === void 0) { getOptions = {}; }\n if (this._useCaching) {\n var options = new caching_1.CachingOptions(this.toUrlAndQuery().toLowerCase());\n if (typeof this._cachingOptions !== \"undefined\") {\n options = util_1.Util.extend(options, this._cachingOptions);\n }\n if (options.store !== null) {\n var data_1 = options.store.get(options.key);\n if (data_1 !== null) {\n return new Promise(function (resolve) { return resolve(data_1); });\n }\n }\n parser = new caching_1.CachingParserWrapper(parser, options);\n }\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.get(this.toUrlAndQuery(), getOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making GET request: \" + response.statusText;\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"GET\", {}, parser);\n }\n };\n Queryable.prototype.postImpl = function (postOptions, parser) {\n if (this._batch === null) {\n var client = new httpclient_1.HttpClient();\n return client.post(this.toUrlAndQuery(), postOptions).then(function (response) {\n if (!response.ok) {\n throw \"Error making POST request: \" + response.statusText;\n }\n if ((response.headers.has(\"Content-Length\") && parseFloat(response.headers.get(\"Content-Length\")) === 0)\n || response.status === 204) {\n return new Promise(function (resolve, reject) { resolve({}); });\n }\n return parser.parse(response);\n });\n }\n else {\n return this._batch.add(this.toUrlAndQuery(), \"POST\", postOptions, parser);\n }\n };\n return Queryable;\n}());\nexports.Queryable = Queryable;\nvar QueryableCollection = (function (_super) {\n __extends(QueryableCollection, _super);\n function QueryableCollection() {\n _super.apply(this, arguments);\n }\n QueryableCollection.prototype.filter = function (filter) {\n this._query.add(\"$filter\", filter);\n return this;\n };\n QueryableCollection.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.orderBy = function (orderBy, ascending) {\n if (ascending === void 0) { ascending = false; }\n var keys = this._query.getKeys();\n var query = [];\n var asc = ascending ? \" asc\" : \"\";\n for (var i = 0; i < keys.length; i++) {\n if (keys[i] === \"$orderby\") {\n query.push(this._query.get(\"$orderby\"));\n break;\n }\n }\n query.push(\"\" + orderBy + asc);\n this._query.add(\"$orderby\", query.join(\",\"));\n return this;\n };\n QueryableCollection.prototype.skip = function (skip) {\n this._query.add(\"$skip\", skip.toString());\n return this;\n };\n QueryableCollection.prototype.top = function (top) {\n this._query.add(\"$top\", top.toString());\n return this;\n };\n return QueryableCollection;\n}(Queryable));\nexports.QueryableCollection = QueryableCollection;\nvar QueryableInstance = (function (_super) {\n __extends(QueryableInstance, _super);\n function QueryableInstance() {\n _super.apply(this, arguments);\n }\n QueryableInstance.prototype.select = function () {\n var selects = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n selects[_i - 0] = arguments[_i];\n }\n this._query.add(\"$select\", selects.join(\",\"));\n return this;\n };\n QueryableInstance.prototype.expand = function () {\n var expands = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n expands[_i - 0] = arguments[_i];\n }\n this._query.add(\"$expand\", expands.join(\",\"));\n return this;\n };\n return QueryableInstance;\n}(Queryable));\nexports.QueryableInstance = QueryableInstance;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar roles_1 = require(\"./roles\");\nvar queryable_1 = require(\"./queryable\");\nvar QueryableSecurable = (function (_super) {\n __extends(QueryableSecurable, _super);\n function QueryableSecurable() {\n _super.apply(this, arguments);\n }\n Object.defineProperty(QueryableSecurable.prototype, \"roleAssignments\", {\n get: function () {\n return new roles_1.RoleAssignments(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(QueryableSecurable.prototype, \"firstUniqueAncestorSecurableObject\", {\n get: function () {\n this.append(\"FirstUniqueAncestorSecurableObject\");\n return new queryable_1.QueryableInstance(this);\n },\n enumerable: true,\n configurable: true\n });\n QueryableSecurable.prototype.getUserEffectivePermissions = function (loginName) {\n this.append(\"getUserEffectivePermissions(@user)\");\n this._query.add(\"@user\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return new queryable_1.Queryable(this);\n };\n QueryableSecurable.prototype.breakRoleInheritance = function (copyRoleAssignments, clearSubscopes) {\n if (copyRoleAssignments === void 0) { copyRoleAssignments = false; }\n if (clearSubscopes === void 0) { clearSubscopes = false; }\n var Breaker = (function (_super) {\n __extends(Breaker, _super);\n function Breaker(baseUrl, copy, clear) {\n _super.call(this, baseUrl, \"breakroleinheritance(copyroleassignments=\" + copy + \", clearsubscopes=\" + clear + \")\");\n }\n Breaker.prototype.break = function () {\n return this.post();\n };\n return Breaker;\n }(queryable_1.Queryable));\n var b = new Breaker(this, copyRoleAssignments, clearSubscopes);\n return b.break();\n };\n QueryableSecurable.prototype.resetRoleInheritance = function () {\n var Resetter = (function (_super) {\n __extends(Resetter, _super);\n function Resetter(baseUrl) {\n _super.call(this, baseUrl, \"resetroleinheritance\");\n }\n Resetter.prototype.reset = function () {\n return this.post();\n };\n return Resetter;\n }(queryable_1.Queryable));\n var r = new Resetter(this);\n return r.reset();\n };\n return QueryableSecurable;\n}(queryable_1.QueryableInstance));\nexports.QueryableSecurable = QueryableSecurable;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar QuickLaunch = (function (_super) {\n __extends(QuickLaunch, _super);\n function QuickLaunch(baseUrl) {\n _super.call(this, baseUrl, \"QuickLaunch\");\n }\n return QuickLaunch;\n}(queryable_1.Queryable));\nexports.QuickLaunch = QuickLaunch;\n","\"use strict\";\nvar search_1 = require(\"./search\");\nvar site_1 = require(\"./site\");\nvar webs_1 = require(\"./webs\");\nvar util_1 = require(\"../../utils/util\");\nvar userprofiles_1 = require(\"./userprofiles\");\nvar odata_1 = require(\"./odata\");\nvar Rest = (function () {\n function Rest() {\n }\n Rest.prototype.search = function (query) {\n var finalQuery;\n if (typeof query === \"string\") {\n finalQuery = { Querytext: query };\n }\n else {\n finalQuery = query;\n }\n return new search_1.Search(\"\").execute(finalQuery);\n };\n Object.defineProperty(Rest.prototype, \"site\", {\n get: function () {\n return new site_1.Site(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"web\", {\n get: function () {\n return new webs_1.Web(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Rest.prototype, \"profiles\", {\n get: function () {\n return new userprofiles_1.UserProfileQuery(\"\");\n },\n enumerable: true,\n configurable: true\n });\n Rest.prototype.createBatch = function () {\n return new odata_1.ODataBatch();\n };\n Rest.prototype.crossDomainSite = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(site_1.Site, addInWebUrl, hostWebUrl, \"site\");\n };\n Rest.prototype.crossDomainWeb = function (addInWebUrl, hostWebUrl) {\n return this._cdImpl(webs_1.Web, addInWebUrl, hostWebUrl, \"web\");\n };\n Rest.prototype._cdImpl = function (factory, addInWebUrl, hostWebUrl, urlPart) {\n if (!util_1.Util.isUrlAbsolute(addInWebUrl)) {\n throw \"The addInWebUrl parameter must be an absolute url.\";\n }\n if (!util_1.Util.isUrlAbsolute(hostWebUrl)) {\n throw \"The hostWebUrl parameter must be an absolute url.\";\n }\n var url = util_1.Util.combinePaths(addInWebUrl, \"_api/SP.AppContextSite(@target)\");\n var instance = new factory(url, urlPart);\n instance.query.add(\"@target\", \"'\" + encodeURIComponent(hostWebUrl) + \"'\");\n return instance;\n };\n return Rest;\n}());\nexports.Rest = Rest;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar RoleAssignments = (function (_super) {\n __extends(RoleAssignments, _super);\n function RoleAssignments(baseUrl, path) {\n if (path === void 0) { path = \"roleassignments\"; }\n _super.call(this, baseUrl, path);\n }\n RoleAssignments.prototype.add = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"addroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.remove = function (principalId, roleDefId) {\n var a = new RoleAssignments(this, \"removeroleassignment(principalid=\" + principalId + \", roledefid=\" + roleDefId + \")\");\n return a.post();\n };\n RoleAssignments.prototype.getById = function (id) {\n var ra = new RoleAssignment(this);\n ra.concat(\"(\" + id + \")\");\n return ra;\n };\n return RoleAssignments;\n}(queryable_1.QueryableCollection));\nexports.RoleAssignments = RoleAssignments;\nvar RoleAssignment = (function (_super) {\n __extends(RoleAssignment, _super);\n function RoleAssignment(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(RoleAssignment.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(RoleAssignment.prototype, \"bindings\", {\n get: function () {\n return new RoleDefinitionBindings(this);\n },\n enumerable: true,\n configurable: true\n });\n RoleAssignment.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleAssignment;\n}(queryable_1.QueryableInstance));\nexports.RoleAssignment = RoleAssignment;\nvar RoleDefinitions = (function (_super) {\n __extends(RoleDefinitions, _super);\n function RoleDefinitions(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitions\"; }\n _super.call(this, baseUrl, path);\n }\n RoleDefinitions.prototype.getById = function (id) {\n return new RoleDefinition(this, \"getById(\" + id + \")\");\n };\n RoleDefinitions.prototype.getByName = function (name) {\n return new RoleDefinition(this, \"getbyname('\" + name + \"')\");\n };\n RoleDefinitions.prototype.getByType = function (roleTypeKind) {\n return new RoleDefinition(this, \"getbytype(\" + roleTypeKind + \")\");\n };\n RoleDefinitions.prototype.add = function (name, description, order, basePermissions) {\n var _this = this;\n var postBody = JSON.stringify({\n BasePermissions: util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, basePermissions),\n Description: description,\n Name: name,\n Order: order,\n __metadata: { \"type\": \"SP.RoleDefinition\" },\n });\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n definition: _this.getById(data.Id),\n };\n });\n };\n return RoleDefinitions;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitions = RoleDefinitions;\nvar RoleDefinition = (function (_super) {\n __extends(RoleDefinition, _super);\n function RoleDefinition(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n RoleDefinition.prototype.update = function (properties) {\n var _this = this;\n if (typeof properties.hasOwnProperty(\"BasePermissions\")) {\n properties[\"BasePermissions\"] = util_1.Util.extend({ __metadata: { type: \"SP.BasePermissions\" } }, properties[\"BasePermissions\"]);\n }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.RoleDefinition\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retDef = _this;\n if (properties.hasOwnProperty(\"Name\")) {\n var parent_1 = _this.getParent(RoleDefinitions, _this.parentUrl, \"\");\n retDef = parent_1.getByName(properties[\"Name\"]);\n }\n return {\n data: data,\n definition: retDef,\n };\n });\n };\n RoleDefinition.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return RoleDefinition;\n}(queryable_1.QueryableInstance));\nexports.RoleDefinition = RoleDefinition;\nvar RoleDefinitionBindings = (function (_super) {\n __extends(RoleDefinitionBindings, _super);\n function RoleDefinitionBindings(baseUrl, path) {\n if (path === void 0) { path = \"roledefinitionbindings\"; }\n _super.call(this, baseUrl, path);\n }\n return RoleDefinitionBindings;\n}(queryable_1.QueryableCollection));\nexports.RoleDefinitionBindings = RoleDefinitionBindings;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar Search = (function (_super) {\n __extends(Search, _super);\n function Search(baseUrl, path) {\n if (path === void 0) { path = \"_api/search/postquery\"; }\n _super.call(this, baseUrl, path);\n }\n Search.prototype.execute = function (query) {\n var formattedBody;\n formattedBody = query;\n if (formattedBody.SelectProperties) {\n formattedBody.SelectProperties = { results: query.SelectProperties };\n }\n if (formattedBody.RefinementFilters) {\n formattedBody.RefinementFilters = { results: query.RefinementFilters };\n }\n if (formattedBody.Refiners) {\n formattedBody.Refiners = { results: query.Refiners };\n }\n if (formattedBody.SortList) {\n formattedBody.SortList = { results: query.SortList };\n }\n if (formattedBody.HithighlightedProperties) {\n formattedBody.HithighlightedProperties = { results: query.HithighlightedProperties };\n }\n if (formattedBody.ReorderingRules) {\n formattedBody.ReorderingRules = { results: query.ReorderingRules };\n }\n var postBody = JSON.stringify({ request: formattedBody });\n return this.post({ body: postBody }).then(function (data) {\n return new SearchResults(data);\n });\n };\n return Search;\n}(queryable_1.QueryableInstance));\nexports.Search = Search;\nvar SearchResults = (function () {\n function SearchResults(rawResponse) {\n var response = rawResponse.postquery ? rawResponse.postquery : rawResponse;\n this.PrimarySearchResults = this.formatSearchResults(response.PrimaryQueryResult.RelevantResults.Table.Rows);\n this.RawSearchResults = response;\n this.ElapsedTime = response.ElapsedTime;\n this.RowCount = response.PrimaryQueryResult.RelevantResults.RowCount;\n this.TotalRows = response.PrimaryQueryResult.RelevantResults.TotalRows;\n this.TotalRowsIncludingDuplicates = response.PrimaryQueryResult.RelevantResults.TotalRowsIncludingDuplicates;\n }\n SearchResults.prototype.formatSearchResults = function (rawResults) {\n var results = new Array(), tempResults = rawResults.results ? rawResults.results : rawResults;\n for (var _i = 0, tempResults_1 = tempResults; _i < tempResults_1.length; _i++) {\n var i = tempResults_1[_i];\n results.push(new SearchResult(i.Cells));\n }\n return results;\n };\n return SearchResults;\n}());\nexports.SearchResults = SearchResults;\nvar SearchResult = (function () {\n function SearchResult(rawItem) {\n var item = rawItem.results ? rawItem.results : rawItem;\n for (var _i = 0, item_1 = item; _i < item_1.length; _i++) {\n var i = item_1[_i];\n this[i.Key] = i.Value;\n }\n }\n return SearchResult;\n}());\nexports.SearchResult = SearchResult;\n(function (SortDirection) {\n SortDirection[SortDirection[\"Ascending\"] = 0] = \"Ascending\";\n SortDirection[SortDirection[\"Descending\"] = 1] = \"Descending\";\n SortDirection[SortDirection[\"FQLFormula\"] = 2] = \"FQLFormula\";\n})(exports.SortDirection || (exports.SortDirection = {}));\nvar SortDirection = exports.SortDirection;\n(function (ReorderingRuleMatchType) {\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultContainsKeyword\"] = 0] = \"ResultContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleContainsKeyword\"] = 1] = \"TitleContainsKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"TitleMatchesKeyword\"] = 2] = \"TitleMatchesKeyword\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlStartsWith\"] = 3] = \"UrlStartsWith\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"UrlExactlyMatches\"] = 4] = \"UrlExactlyMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ContentTypeIs\"] = 5] = \"ContentTypeIs\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"FileExtensionMatches\"] = 6] = \"FileExtensionMatches\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ResultHasTag\"] = 7] = \"ResultHasTag\";\n ReorderingRuleMatchType[ReorderingRuleMatchType[\"ManualCondition\"] = 8] = \"ManualCondition\";\n})(exports.ReorderingRuleMatchType || (exports.ReorderingRuleMatchType = {}));\nvar ReorderingRuleMatchType = exports.ReorderingRuleMatchType;\n(function (QueryPropertyValueType) {\n QueryPropertyValueType[QueryPropertyValueType[\"None\"] = 0] = \"None\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringType\"] = 1] = \"StringType\";\n QueryPropertyValueType[QueryPropertyValueType[\"Int32TYpe\"] = 2] = \"Int32TYpe\";\n QueryPropertyValueType[QueryPropertyValueType[\"BooleanType\"] = 3] = \"BooleanType\";\n QueryPropertyValueType[QueryPropertyValueType[\"StringArrayType\"] = 4] = \"StringArrayType\";\n QueryPropertyValueType[QueryPropertyValueType[\"UnSupportedType\"] = 5] = \"UnSupportedType\";\n})(exports.QueryPropertyValueType || (exports.QueryPropertyValueType = {}));\nvar QueryPropertyValueType = exports.QueryPropertyValueType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar webs_1 = require(\"./webs\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar Site = (function (_super) {\n __extends(Site, _super);\n function Site(baseUrl, path) {\n if (path === void 0) { path = \"_api/site\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Site.prototype, \"rootWeb\", {\n get: function () {\n return new webs_1.Web(this, \"rootweb\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Site.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Site.prototype.getContextInfo = function () {\n var q = new Site(\"\", \"_api/contextinfo\");\n return q.post().then(function (data) {\n if (data.hasOwnProperty(\"GetContextWebInformation\")) {\n var info = data.GetContextWebInformation;\n info.SupportedSchemaVersions = info.SupportedSchemaVersions.results;\n return info;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getDocumentLibraries = function (absoluteWebUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getdocumentlibraries(@v)\");\n q.query.add(\"@v\", \"'\" + absoluteWebUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetDocumentLibraries\")) {\n return data.GetDocumentLibraries;\n }\n else {\n return data;\n }\n });\n };\n Site.prototype.getWebUrlFromPageUrl = function (absolutePageUrl) {\n var q = new queryable_1.Queryable(\"\", \"_api/sp.web.getweburlfrompageurl(@v)\");\n q.query.add(\"@v\", \"'\" + absolutePageUrl + \"'\");\n return q.get().then(function (data) {\n if (data.hasOwnProperty(\"GetWebUrlFromPageUrl\")) {\n return data.GetWebUrlFromPageUrl;\n }\n else {\n return data;\n }\n });\n };\n return Site;\n}(queryable_1.QueryableInstance));\nexports.Site = Site;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar siteusers_1 = require(\"./siteusers\");\nvar util_1 = require(\"../../utils/util\");\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\nvar SiteGroups = (function (_super) {\n __extends(SiteGroups, _super);\n function SiteGroups(baseUrl, path) {\n if (path === void 0) { path = \"sitegroups\"; }\n _super.call(this, baseUrl, path);\n }\n SiteGroups.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n group: _this.getById(data.Id),\n };\n });\n };\n SiteGroups.prototype.getByName = function (groupName) {\n return new SiteGroup(this, \"getByName('\" + groupName + \"')\");\n };\n SiteGroups.prototype.getById = function (id) {\n var sg = new SiteGroup(this);\n sg.concat(\"(\" + id + \")\");\n return sg;\n };\n SiteGroups.prototype.removeById = function (id) {\n var g = new SiteGroups(this, \"removeById('\" + id + \"')\");\n return g.post();\n };\n SiteGroups.prototype.removeByLoginName = function (loginName) {\n var g = new SiteGroups(this, \"removeByLoginName('\" + loginName + \"')\");\n return g.post();\n };\n return SiteGroups;\n}(queryable_1.QueryableCollection));\nexports.SiteGroups = SiteGroups;\nvar SiteGroup = (function (_super) {\n __extends(SiteGroup, _super);\n function SiteGroup(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteGroup.prototype, \"users\", {\n get: function () {\n return new siteusers_1.SiteUsers(this, \"users\");\n },\n enumerable: true,\n configurable: true\n });\n SiteGroup.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.Group\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n var retGroup = _this;\n if (properties.hasOwnProperty(\"Title\")) {\n retGroup = _this.getParent(SiteGroup, _this.parentUrl, \"getByName('\" + properties[\"Title\"] + \"')\");\n }\n return {\n data: data,\n group: retGroup,\n };\n });\n };\n return SiteGroup;\n}(queryable_1.QueryableInstance));\nexports.SiteGroup = SiteGroup;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar util_1 = require(\"../../utils/util\");\nvar SiteUsers = (function (_super) {\n __extends(SiteUsers, _super);\n function SiteUsers(baseUrl, path) {\n if (path === void 0) { path = \"siteusers\"; }\n _super.call(this, baseUrl, path);\n }\n SiteUsers.prototype.getByEmail = function (email) {\n return new SiteUser(this, \"getByEmail('\" + email + \"')\");\n };\n SiteUsers.prototype.getById = function (id) {\n return new SiteUser(this, \"getById(\" + id + \")\");\n };\n SiteUsers.prototype.getByLoginName = function (loginName) {\n var su = new SiteUser(this);\n su.concat(\"(@v)\");\n su.query.add(\"@v\", encodeURIComponent(loginName));\n return su;\n };\n SiteUsers.prototype.removeById = function (id) {\n var o = new SiteUsers(this, \"removeById(\" + id + \")\");\n return o.post();\n };\n SiteUsers.prototype.removeByLoginName = function (loginName) {\n var o = new SiteUsers(this, \"removeByLoginName(@v)\");\n o.query.add(\"@v\", encodeURIComponent(loginName));\n return o.post();\n };\n SiteUsers.prototype.add = function (loginName) {\n var _this = this;\n var postBody = JSON.stringify({ \"__metadata\": { \"type\": \"SP.User\" }, LoginName: loginName });\n return this.post({ body: postBody }).then(function (data) { return _this.getByLoginName(loginName); });\n };\n return SiteUsers;\n}(queryable_1.QueryableCollection));\nexports.SiteUsers = SiteUsers;\nvar SiteUser = (function (_super) {\n __extends(SiteUser, _super);\n function SiteUser(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(SiteUser.prototype, \"groups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this, \"groups\");\n },\n enumerable: true,\n configurable: true\n });\n SiteUser.prototype.update = function (properties) {\n var _this = this;\n var postBody = util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.User\" } }, properties);\n return this.post({\n body: JSON.stringify(postBody),\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n user: _this,\n };\n });\n };\n SiteUser.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n return SiteUser;\n}(queryable_1.QueryableInstance));\nexports.SiteUser = SiteUser;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar TopNavigationBar = (function (_super) {\n __extends(TopNavigationBar, _super);\n function TopNavigationBar(baseUrl) {\n _super.call(this, baseUrl, \"TopNavigationBar\");\n }\n return TopNavigationBar;\n}(queryable_1.QueryableInstance));\nexports.TopNavigationBar = TopNavigationBar;\n","\"use strict\";\n(function (ControlMode) {\n ControlMode[ControlMode[\"Display\"] = 1] = \"Display\";\n ControlMode[ControlMode[\"Edit\"] = 2] = \"Edit\";\n ControlMode[ControlMode[\"New\"] = 3] = \"New\";\n})(exports.ControlMode || (exports.ControlMode = {}));\nvar ControlMode = exports.ControlMode;\n(function (FieldTypes) {\n FieldTypes[FieldTypes[\"Invalid\"] = 0] = \"Invalid\";\n FieldTypes[FieldTypes[\"Integer\"] = 1] = \"Integer\";\n FieldTypes[FieldTypes[\"Text\"] = 2] = \"Text\";\n FieldTypes[FieldTypes[\"Note\"] = 3] = \"Note\";\n FieldTypes[FieldTypes[\"DateTime\"] = 4] = \"DateTime\";\n FieldTypes[FieldTypes[\"Counter\"] = 5] = \"Counter\";\n FieldTypes[FieldTypes[\"Choice\"] = 6] = \"Choice\";\n FieldTypes[FieldTypes[\"Lookup\"] = 7] = \"Lookup\";\n FieldTypes[FieldTypes[\"Boolean\"] = 8] = \"Boolean\";\n FieldTypes[FieldTypes[\"Number\"] = 9] = \"Number\";\n FieldTypes[FieldTypes[\"Currency\"] = 10] = \"Currency\";\n FieldTypes[FieldTypes[\"URL\"] = 11] = \"URL\";\n FieldTypes[FieldTypes[\"Computed\"] = 12] = \"Computed\";\n FieldTypes[FieldTypes[\"Threading\"] = 13] = \"Threading\";\n FieldTypes[FieldTypes[\"Guid\"] = 14] = \"Guid\";\n FieldTypes[FieldTypes[\"MultiChoice\"] = 15] = \"MultiChoice\";\n FieldTypes[FieldTypes[\"GridChoice\"] = 16] = \"GridChoice\";\n FieldTypes[FieldTypes[\"Calculated\"] = 17] = \"Calculated\";\n FieldTypes[FieldTypes[\"File\"] = 18] = \"File\";\n FieldTypes[FieldTypes[\"Attachments\"] = 19] = \"Attachments\";\n FieldTypes[FieldTypes[\"User\"] = 20] = \"User\";\n FieldTypes[FieldTypes[\"Recurrence\"] = 21] = \"Recurrence\";\n FieldTypes[FieldTypes[\"CrossProjectLink\"] = 22] = \"CrossProjectLink\";\n FieldTypes[FieldTypes[\"ModStat\"] = 23] = \"ModStat\";\n FieldTypes[FieldTypes[\"Error\"] = 24] = \"Error\";\n FieldTypes[FieldTypes[\"ContentTypeId\"] = 25] = \"ContentTypeId\";\n FieldTypes[FieldTypes[\"PageSeparator\"] = 26] = \"PageSeparator\";\n FieldTypes[FieldTypes[\"ThreadIndex\"] = 27] = \"ThreadIndex\";\n FieldTypes[FieldTypes[\"WorkflowStatus\"] = 28] = \"WorkflowStatus\";\n FieldTypes[FieldTypes[\"AllDayEvent\"] = 29] = \"AllDayEvent\";\n FieldTypes[FieldTypes[\"WorkflowEventType\"] = 30] = \"WorkflowEventType\";\n})(exports.FieldTypes || (exports.FieldTypes = {}));\nvar FieldTypes = exports.FieldTypes;\n(function (DateTimeFieldFormatType) {\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateOnly\"] = 0] = \"DateOnly\";\n DateTimeFieldFormatType[DateTimeFieldFormatType[\"DateTime\"] = 1] = \"DateTime\";\n})(exports.DateTimeFieldFormatType || (exports.DateTimeFieldFormatType = {}));\nvar DateTimeFieldFormatType = exports.DateTimeFieldFormatType;\n(function (AddFieldOptions) {\n AddFieldOptions[AddFieldOptions[\"DefaultValue\"] = 0] = \"DefaultValue\";\n AddFieldOptions[AddFieldOptions[\"AddToDefaultContentType\"] = 1] = \"AddToDefaultContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToNoContentType\"] = 2] = \"AddToNoContentType\";\n AddFieldOptions[AddFieldOptions[\"AddToAllContentTypes\"] = 4] = \"AddToAllContentTypes\";\n AddFieldOptions[AddFieldOptions[\"AddFieldInternalNameHint\"] = 8] = \"AddFieldInternalNameHint\";\n AddFieldOptions[AddFieldOptions[\"AddFieldToDefaultView\"] = 16] = \"AddFieldToDefaultView\";\n AddFieldOptions[AddFieldOptions[\"AddFieldCheckDisplayName\"] = 32] = \"AddFieldCheckDisplayName\";\n})(exports.AddFieldOptions || (exports.AddFieldOptions = {}));\nvar AddFieldOptions = exports.AddFieldOptions;\n(function (CalendarType) {\n CalendarType[CalendarType[\"Gregorian\"] = 1] = \"Gregorian\";\n CalendarType[CalendarType[\"Japan\"] = 3] = \"Japan\";\n CalendarType[CalendarType[\"Taiwan\"] = 4] = \"Taiwan\";\n CalendarType[CalendarType[\"Korea\"] = 5] = \"Korea\";\n CalendarType[CalendarType[\"Hijri\"] = 6] = \"Hijri\";\n CalendarType[CalendarType[\"Thai\"] = 7] = \"Thai\";\n CalendarType[CalendarType[\"Hebrew\"] = 8] = \"Hebrew\";\n CalendarType[CalendarType[\"GregorianMEFrench\"] = 9] = \"GregorianMEFrench\";\n CalendarType[CalendarType[\"GregorianArabic\"] = 10] = \"GregorianArabic\";\n CalendarType[CalendarType[\"GregorianXLITEnglish\"] = 11] = \"GregorianXLITEnglish\";\n CalendarType[CalendarType[\"GregorianXLITFrench\"] = 12] = \"GregorianXLITFrench\";\n CalendarType[CalendarType[\"KoreaJapanLunar\"] = 14] = \"KoreaJapanLunar\";\n CalendarType[CalendarType[\"ChineseLunar\"] = 15] = \"ChineseLunar\";\n CalendarType[CalendarType[\"SakaEra\"] = 16] = \"SakaEra\";\n CalendarType[CalendarType[\"UmAlQura\"] = 23] = \"UmAlQura\";\n})(exports.CalendarType || (exports.CalendarType = {}));\nvar CalendarType = exports.CalendarType;\n(function (UrlFieldFormatType) {\n UrlFieldFormatType[UrlFieldFormatType[\"Hyperlink\"] = 0] = \"Hyperlink\";\n UrlFieldFormatType[UrlFieldFormatType[\"Image\"] = 1] = \"Image\";\n})(exports.UrlFieldFormatType || (exports.UrlFieldFormatType = {}));\nvar UrlFieldFormatType = exports.UrlFieldFormatType;\n(function (PrincipalType) {\n PrincipalType[PrincipalType[\"None\"] = 0] = \"None\";\n PrincipalType[PrincipalType[\"User\"] = 1] = \"User\";\n PrincipalType[PrincipalType[\"DistributionList\"] = 2] = \"DistributionList\";\n PrincipalType[PrincipalType[\"SecurityGroup\"] = 4] = \"SecurityGroup\";\n PrincipalType[PrincipalType[\"SharePointGroup\"] = 8] = \"SharePointGroup\";\n PrincipalType[PrincipalType[\"All\"] = 15] = \"All\";\n})(exports.PrincipalType || (exports.PrincipalType = {}));\nvar PrincipalType = exports.PrincipalType;\n(function (PageType) {\n PageType[PageType[\"Invalid\"] = -1] = \"Invalid\";\n PageType[PageType[\"DefaultView\"] = 0] = \"DefaultView\";\n PageType[PageType[\"NormalView\"] = 1] = \"NormalView\";\n PageType[PageType[\"DialogView\"] = 2] = \"DialogView\";\n PageType[PageType[\"View\"] = 3] = \"View\";\n PageType[PageType[\"DisplayForm\"] = 4] = \"DisplayForm\";\n PageType[PageType[\"DisplayFormDialog\"] = 5] = \"DisplayFormDialog\";\n PageType[PageType[\"EditForm\"] = 6] = \"EditForm\";\n PageType[PageType[\"EditFormDialog\"] = 7] = \"EditFormDialog\";\n PageType[PageType[\"NewForm\"] = 8] = \"NewForm\";\n PageType[PageType[\"NewFormDialog\"] = 9] = \"NewFormDialog\";\n PageType[PageType[\"SolutionForm\"] = 10] = \"SolutionForm\";\n PageType[PageType[\"PAGE_MAXITEMS\"] = 11] = \"PAGE_MAXITEMS\";\n})(exports.PageType || (exports.PageType = {}));\nvar PageType = exports.PageType;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar UserCustomActions = (function (_super) {\n __extends(UserCustomActions, _super);\n function UserCustomActions(baseUrl, path) {\n if (path === void 0) { path = \"usercustomactions\"; }\n _super.call(this, baseUrl, path);\n }\n UserCustomActions.prototype.getById = function (id) {\n return new UserCustomAction(this, \"(\" + id + \")\");\n };\n UserCustomActions.prototype.add = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({ __metadata: { \"type\": \"SP.UserCustomAction\" } }, properties));\n return this.post({ body: postBody }).then(function (data) {\n return {\n action: _this.getById(data.Id),\n data: data,\n };\n });\n };\n UserCustomActions.prototype.clear = function () {\n var a = new UserCustomActions(this, \"clear\");\n return a.post();\n };\n return UserCustomActions;\n}(queryable_1.QueryableCollection));\nexports.UserCustomActions = UserCustomActions;\nvar UserCustomAction = (function (_super) {\n __extends(UserCustomAction, _super);\n function UserCustomAction(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n UserCustomAction.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.UserCustomAction\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n action: _this,\n data: data,\n };\n });\n };\n return UserCustomAction;\n}(queryable_1.QueryableInstance));\nexports.UserCustomAction = UserCustomAction;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar FileUtil = require(\"../../utils/files\");\nvar odata_1 = require(\"./odata\");\nvar UserProfileQuery = (function (_super) {\n __extends(UserProfileQuery, _super);\n function UserProfileQuery(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.peoplemanager\"; }\n _super.call(this, baseUrl, path);\n this.profileLoader = new ProfileLoader(baseUrl);\n }\n Object.defineProperty(UserProfileQuery.prototype, \"editProfileLink\", {\n get: function () {\n var q = new UserProfileQuery(this, \"EditProfileLink\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"isMyPeopleListPublic\", {\n get: function () {\n var q = new UserProfileQuery(this, \"IsMyPeopleListPublic\");\n return q.getAs(odata_1.ODataValue());\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.amIFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.amIFollowing = function (loginName) {\n var q = new UserProfileQuery(this, \"amifollowing(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowedTags = function (maxCount) {\n if (maxCount === void 0) { maxCount = 20; }\n var q = new UserProfileQuery(this, \"getfollowedtags(\" + maxCount + \")\");\n return q.get();\n };\n UserProfileQuery.prototype.getFollowersFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getfollowersfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"myFollowers\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getmyfollowers\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"myProperties\", {\n get: function () {\n return new UserProfileQuery(this, \"getmyproperties\");\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getPeopleFollowedBy = function (loginName) {\n var q = new UserProfileQuery(this, \"getpeoplefollowedby(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.getPropertiesFor = function (loginName) {\n var q = new UserProfileQuery(this, \"getpropertiesfor(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n Object.defineProperty(UserProfileQuery.prototype, \"trendingTags\", {\n get: function () {\n var q = new UserProfileQuery(this, null);\n q.concat(\".gettrendingtags\");\n return q.get();\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.getUserProfilePropertyFor = function (loginName, propertyName) {\n var q = new UserProfileQuery(this, \"getuserprofilepropertyfor(accountname=@v, propertyname='\" + propertyName + \"')\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.hideSuggestion = function (loginName) {\n var q = new UserProfileQuery(this, \"hidesuggestion(@v)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(loginName) + \"'\");\n return q.post();\n };\n UserProfileQuery.prototype.isFollowing = function (follower, followee) {\n var q = new UserProfileQuery(this, null);\n q.concat(\".isfollowing(possiblefolloweraccountname=@v, possiblefolloweeaccountname=@y)\");\n q.query.add(\"@v\", \"'\" + encodeURIComponent(follower) + \"'\");\n q.query.add(\"@y\", \"'\" + encodeURIComponent(followee) + \"'\");\n return q.get();\n };\n UserProfileQuery.prototype.setMyProfilePic = function (profilePicSource) {\n var _this = this;\n return FileUtil.readBlobAsArrayBuffer(profilePicSource).then(function (buffer) {\n var request = new UserProfileQuery(_this, \"setmyprofilepicture\");\n return request.post({\n body: String.fromCharCode.apply(null, new Uint16Array(buffer)),\n });\n });\n };\n UserProfileQuery.prototype.createPersonalSiteEnqueueBulk = function () {\n var emails = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n emails[_i - 0] = arguments[_i];\n }\n return this.profileLoader.createPersonalSiteEnqueueBulk(emails);\n };\n Object.defineProperty(UserProfileQuery.prototype, \"ownerUserProfile\", {\n get: function () {\n return this.profileLoader.ownerUserProfile;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(UserProfileQuery.prototype, \"userProfile\", {\n get: function () {\n return this.profileLoader.userProfile;\n },\n enumerable: true,\n configurable: true\n });\n UserProfileQuery.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n return this.profileLoader.createPersonalSite(interactiveRequest);\n };\n UserProfileQuery.prototype.shareAllSocialData = function (share) {\n return this.profileLoader.shareAllSocialData(share);\n };\n return UserProfileQuery;\n}(queryable_1.QueryableInstance));\nexports.UserProfileQuery = UserProfileQuery;\nvar ProfileLoader = (function (_super) {\n __extends(ProfileLoader, _super);\n function ProfileLoader(baseUrl, path) {\n if (path === void 0) { path = \"_api/sp.userprofiles.profileloader.getprofileloader\"; }\n _super.call(this, baseUrl, path);\n }\n ProfileLoader.prototype.createPersonalSiteEnqueueBulk = function (emails) {\n var q = new ProfileLoader(this, \"createpersonalsiteenqueuebulk\");\n var postBody = JSON.stringify({ \"emailIDs\": emails });\n return q.post({\n body: postBody,\n });\n };\n Object.defineProperty(ProfileLoader.prototype, \"ownerUserProfile\", {\n get: function () {\n var q = this.getParent(ProfileLoader, this.parentUrl, \"_api/sp.userprofiles.profileloader.getowneruserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(ProfileLoader.prototype, \"userProfile\", {\n get: function () {\n var q = new ProfileLoader(this, \"getuserprofile\");\n return q.postAs();\n },\n enumerable: true,\n configurable: true\n });\n ProfileLoader.prototype.createPersonalSite = function (interactiveRequest) {\n if (interactiveRequest === void 0) { interactiveRequest = false; }\n var q = new ProfileLoader(this, \"getuserprofile/createpersonalsiteenque(\" + interactiveRequest + \")\\\",\");\n return q.post();\n };\n ProfileLoader.prototype.shareAllSocialData = function (share) {\n var q = new ProfileLoader(this, \"getuserprofile/shareallsocialdata(\" + share + \")\\\",\");\n return q.post();\n };\n return ProfileLoader;\n}(queryable_1.Queryable));\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar util_1 = require(\"../../utils/util\");\nvar Views = (function (_super) {\n __extends(Views, _super);\n function Views(baseUrl) {\n _super.call(this, baseUrl, \"views\");\n }\n Views.prototype.getById = function (id) {\n var v = new View(this);\n v.concat(\"('\" + id + \"')\");\n return v;\n };\n Views.prototype.getByTitle = function (title) {\n return new View(this, \"getByTitle('\" + title + \"')\");\n };\n Views.prototype.add = function (title, personalView, additionalSettings) {\n var _this = this;\n if (personalView === void 0) { personalView = false; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n \"Title\": title,\n \"PersonalView\": personalView,\n }, additionalSettings));\n return this.postAs({ body: postBody }).then(function (data) {\n return {\n data: data,\n view: _this.getById(data.Id),\n };\n });\n };\n return Views;\n}(queryable_1.QueryableCollection));\nexports.Views = Views;\nvar View = (function (_super) {\n __extends(View, _super);\n function View(baseUrl, path) {\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(View.prototype, \"fields\", {\n get: function () {\n return new ViewFields(this);\n },\n enumerable: true,\n configurable: true\n });\n View.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.View\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n view: _this,\n };\n });\n };\n View.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n View.prototype.renderAsHtml = function () {\n var q = new queryable_1.Queryable(this, \"renderashtml\");\n return q.get();\n };\n return View;\n}(queryable_1.QueryableInstance));\nexports.View = View;\nvar ViewFields = (function (_super) {\n __extends(ViewFields, _super);\n function ViewFields(baseUrl, path) {\n if (path === void 0) { path = \"viewfields\"; }\n _super.call(this, baseUrl, path);\n }\n ViewFields.prototype.getSchemaXml = function () {\n var q = new queryable_1.Queryable(this, \"schemaxml\");\n return q.get();\n };\n ViewFields.prototype.add = function (fieldTitleOrInternalName) {\n var q = new ViewFields(this, \"addviewfield('\" + fieldTitleOrInternalName + \"')\");\n return q.post();\n };\n ViewFields.prototype.move = function (fieldInternalName, index) {\n var q = new ViewFields(this, \"moveviewfieldto\");\n var postBody = JSON.stringify({ \"field\": fieldInternalName, \"index\": index });\n return q.post({ body: postBody });\n };\n ViewFields.prototype.removeAll = function () {\n var q = new ViewFields(this, \"removeallviewfields\");\n return q.post();\n };\n ViewFields.prototype.remove = function (fieldInternalName) {\n var q = new ViewFields(this, \"removeviewfield('\" + fieldInternalName + \"')\");\n return q.post();\n };\n return ViewFields;\n}(queryable_1.QueryableCollection));\nexports.ViewFields = ViewFields;\n","\"use strict\";\nvar __extends = (this && this.__extends) || function (d, b) {\n for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n};\nvar queryable_1 = require(\"./queryable\");\nvar queryablesecurable_1 = require(\"./queryablesecurable\");\nvar lists_1 = require(\"./lists\");\nvar fields_1 = require(\"./fields\");\nvar navigation_1 = require(\"./navigation\");\nvar sitegroups_1 = require(\"./sitegroups\");\nvar contenttypes_1 = require(\"./contenttypes\");\nvar folders_1 = require(\"./folders\");\nvar roles_1 = require(\"./roles\");\nvar files_1 = require(\"./files\");\nvar util_1 = require(\"../../utils/util\");\nvar lists_2 = require(\"./lists\");\nvar siteusers_1 = require(\"./siteusers\");\nvar usercustomactions_1 = require(\"./usercustomactions\");\nvar odata_1 = require(\"./odata\");\nvar Webs = (function (_super) {\n __extends(Webs, _super);\n function Webs(baseUrl, webPath) {\n if (webPath === void 0) { webPath = \"webs\"; }\n _super.call(this, baseUrl, webPath);\n }\n Webs.prototype.add = function (title, url, description, template, language, inheritPermissions, additionalSettings) {\n if (description === void 0) { description = \"\"; }\n if (template === void 0) { template = \"STS\"; }\n if (language === void 0) { language = 1033; }\n if (inheritPermissions === void 0) { inheritPermissions = true; }\n if (additionalSettings === void 0) { additionalSettings = {}; }\n var props = util_1.Util.extend({\n Description: description,\n Language: language,\n Title: title,\n Url: url,\n UseSamePermissionsAsParentSite: inheritPermissions,\n WebTemplate: template,\n }, additionalSettings);\n var postBody = JSON.stringify({\n \"parameters\": util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.WebCreationInformation\" },\n }, props),\n });\n var q = new Webs(this, \"add\");\n return q.post({ body: postBody }).then(function (data) {\n return {\n data: data,\n web: new Web(odata_1.extractOdataId(data), \"\"),\n };\n });\n };\n return Webs;\n}(queryable_1.QueryableCollection));\nexports.Webs = Webs;\nvar Web = (function (_super) {\n __extends(Web, _super);\n function Web(baseUrl, path) {\n if (path === void 0) { path = \"_api/web\"; }\n _super.call(this, baseUrl, path);\n }\n Object.defineProperty(Web.prototype, \"webs\", {\n get: function () {\n return new Webs(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"contentTypes\", {\n get: function () {\n return new contenttypes_1.ContentTypes(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"lists\", {\n get: function () {\n return new lists_1.Lists(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"fields\", {\n get: function () {\n return new fields_1.Fields(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"availablefields\", {\n get: function () {\n return new fields_1.Fields(this, \"availablefields\");\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"navigation\", {\n get: function () {\n return new navigation_1.Navigation(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteUsers\", {\n get: function () {\n return new siteusers_1.SiteUsers(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"siteGroups\", {\n get: function () {\n return new sitegroups_1.SiteGroups(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"folders\", {\n get: function () {\n return new folders_1.Folders(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"userCustomActions\", {\n get: function () {\n return new usercustomactions_1.UserCustomActions(this);\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Web.prototype, \"roleDefinitions\", {\n get: function () {\n return new roles_1.RoleDefinitions(this);\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getFolderByServerRelativeUrl = function (folderRelativeUrl) {\n return new folders_1.Folder(this, \"getFolderByServerRelativeUrl('\" + folderRelativeUrl + \"')\");\n };\n Web.prototype.getFileByServerRelativeUrl = function (fileRelativeUrl) {\n return new files_1.File(this, \"getFileByServerRelativeUrl('\" + fileRelativeUrl + \"')\");\n };\n Web.prototype.update = function (properties) {\n var _this = this;\n var postBody = JSON.stringify(util_1.Util.extend({\n \"__metadata\": { \"type\": \"SP.Web\" },\n }, properties));\n return this.post({\n body: postBody,\n headers: {\n \"X-HTTP-Method\": \"MERGE\",\n },\n }).then(function (data) {\n return {\n data: data,\n web: _this,\n };\n });\n };\n Web.prototype.delete = function () {\n return this.post({\n headers: {\n \"X-HTTP-Method\": \"DELETE\",\n },\n });\n };\n Web.prototype.applyTheme = function (colorPaletteUrl, fontSchemeUrl, backgroundImageUrl, shareGenerated) {\n var postBody = JSON.stringify({\n backgroundImageUrl: backgroundImageUrl,\n colorPaletteUrl: colorPaletteUrl,\n fontSchemeUrl: fontSchemeUrl,\n shareGenerated: shareGenerated,\n });\n var q = new Web(this, \"applytheme\");\n return q.post({ body: postBody });\n };\n Web.prototype.applyWebTemplate = function (template) {\n var q = new Web(this, \"applywebtemplate\");\n q.concat(\"(@t)\");\n q.query.add(\"@t\", template);\n return q.post();\n };\n Web.prototype.doesUserHavePermissions = function (perms) {\n var q = new Web(this, \"doesuserhavepermissions\");\n q.concat(\"(@p)\");\n q.query.add(\"@p\", JSON.stringify(perms));\n return q.get();\n };\n Web.prototype.ensureUser = function (loginName) {\n var postBody = JSON.stringify({\n logonName: loginName,\n });\n var q = new Web(this, \"ensureuser\");\n return q.post({ body: postBody });\n };\n Web.prototype.availableWebTemplates = function (language, includeCrossLanugage) {\n if (language === void 0) { language = 1033; }\n if (includeCrossLanugage === void 0) { includeCrossLanugage = true; }\n return new queryable_1.QueryableCollection(this, \"getavailablewebtemplates(lcid=\" + language + \", doincludecrosslanguage=\" + includeCrossLanugage + \")\");\n };\n Web.prototype.getCatalog = function (type) {\n var q = new Web(this, \"getcatalog(\" + type + \")\");\n q.select(\"Id\");\n return q.get().then(function (data) {\n return new lists_2.List(odata_1.extractOdataId(data));\n });\n };\n Web.prototype.getChanges = function (query) {\n var postBody = JSON.stringify({ \"query\": util_1.Util.extend({ \"__metadata\": { \"type\": \"SP.ChangeQuery\" } }, query) });\n var q = new Web(this, \"getchanges\");\n return q.post({ body: postBody });\n };\n Object.defineProperty(Web.prototype, \"customListTemplate\", {\n get: function () {\n return new queryable_1.QueryableCollection(this, \"getcustomlisttemplates\");\n },\n enumerable: true,\n configurable: true\n });\n Web.prototype.getUserById = function (id) {\n return new siteusers_1.SiteUser(this, \"getUserById(\" + id + \")\");\n };\n Web.prototype.mapToIcon = function (filename, size, progId) {\n if (size === void 0) { size = 0; }\n if (progId === void 0) { progId = \"\"; }\n var q = new Web(this, \"maptoicon(filename='\" + filename + \"', progid='\" + progId + \"', size=\" + size + \")\");\n return q.get();\n };\n return Web;\n}(queryablesecurable_1.QueryableSecurable));\nexports.Web = Web;\n","\"use strict\";\nfunction readBlobAsText(blob) {\n return readBlobAs(blob, \"string\");\n}\nexports.readBlobAsText = readBlobAsText;\nfunction readBlobAsArrayBuffer(blob) {\n return readBlobAs(blob, \"buffer\");\n}\nexports.readBlobAsArrayBuffer = readBlobAsArrayBuffer;\nfunction readBlobAs(blob, mode) {\n return new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.onload = function (e) {\n resolve(e.target.result);\n };\n switch (mode) {\n case \"string\":\n reader.readAsText(blob);\n break;\n case \"buffer\":\n reader.readAsArrayBuffer(blob);\n break;\n }\n });\n}\n","\"use strict\";\nvar Logger = (function () {\n function Logger() {\n }\n Object.defineProperty(Logger, \"activeLogLevel\", {\n get: function () {\n return Logger.instance.activeLogLevel;\n },\n set: function (value) {\n Logger.instance.activeLogLevel = value;\n },\n enumerable: true,\n configurable: true\n });\n Object.defineProperty(Logger, \"instance\", {\n get: function () {\n if (typeof Logger._instance === \"undefined\" || Logger._instance === null) {\n Logger._instance = new LoggerImpl();\n }\n return Logger._instance;\n },\n enumerable: true,\n configurable: true\n });\n Logger.subscribe = function () {\n var listeners = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n listeners[_i - 0] = arguments[_i];\n }\n for (var i = 0; i < listeners.length; i++) {\n Logger.instance.subscribe(listeners[i]);\n }\n };\n Logger.clearSubscribers = function () {\n return Logger.instance.clearSubscribers();\n };\n Object.defineProperty(Logger, \"count\", {\n get: function () {\n return Logger.instance.count;\n },\n enumerable: true,\n configurable: true\n });\n Logger.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n Logger.instance.log({ level: level, message: message });\n };\n Logger.log = function (entry) {\n Logger.instance.log(entry);\n };\n Logger.measure = function (name, f) {\n return Logger.instance.measure(name, f);\n };\n return Logger;\n}());\nexports.Logger = Logger;\nvar LoggerImpl = (function () {\n function LoggerImpl(activeLogLevel, subscribers) {\n if (activeLogLevel === void 0) { activeLogLevel = Logger.LogLevel.Warning; }\n if (subscribers === void 0) { subscribers = []; }\n this.activeLogLevel = activeLogLevel;\n this.subscribers = subscribers;\n }\n LoggerImpl.prototype.subscribe = function (listener) {\n this.subscribers.push(listener);\n };\n LoggerImpl.prototype.clearSubscribers = function () {\n var s = this.subscribers.slice(0);\n this.subscribers.length = 0;\n return s;\n };\n Object.defineProperty(LoggerImpl.prototype, \"count\", {\n get: function () {\n return this.subscribers.length;\n },\n enumerable: true,\n configurable: true\n });\n LoggerImpl.prototype.write = function (message, level) {\n if (level === void 0) { level = Logger.LogLevel.Verbose; }\n this.log({ level: level, message: message });\n };\n LoggerImpl.prototype.log = function (entry) {\n if (typeof entry === \"undefined\" || entry.level < this.activeLogLevel) {\n return;\n }\n for (var i = 0; i < this.subscribers.length; i++) {\n this.subscribers[i].log(entry);\n }\n };\n LoggerImpl.prototype.measure = function (name, f) {\n console.profile(name);\n try {\n return f();\n }\n finally {\n console.profileEnd();\n }\n };\n return LoggerImpl;\n}());\nvar Logger;\n(function (Logger) {\n (function (LogLevel) {\n LogLevel[LogLevel[\"Verbose\"] = 0] = \"Verbose\";\n LogLevel[LogLevel[\"Info\"] = 1] = \"Info\";\n LogLevel[LogLevel[\"Warning\"] = 2] = \"Warning\";\n LogLevel[LogLevel[\"Error\"] = 3] = \"Error\";\n LogLevel[LogLevel[\"Off\"] = 99] = \"Off\";\n })(Logger.LogLevel || (Logger.LogLevel = {}));\n var LogLevel = Logger.LogLevel;\n var ConsoleListener = (function () {\n function ConsoleListener() {\n }\n ConsoleListener.prototype.log = function (entry) {\n var msg = this.format(entry);\n switch (entry.level) {\n case LogLevel.Verbose:\n case LogLevel.Info:\n console.log(msg);\n break;\n case LogLevel.Warning:\n console.warn(msg);\n break;\n case LogLevel.Error:\n console.error(msg);\n break;\n }\n };\n ConsoleListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return ConsoleListener;\n }());\n Logger.ConsoleListener = ConsoleListener;\n var AzureInsightsListener = (function () {\n function AzureInsightsListener(azureInsightsInstrumentationKey) {\n this.azureInsightsInstrumentationKey = azureInsightsInstrumentationKey;\n var appInsights = window[\"appInsights\"] || function (config) {\n function r(config) {\n t[config] = function () {\n var i = arguments;\n t.queue.push(function () { t[config].apply(t, i); });\n };\n }\n var t = { config: config }, u = document, e = window, o = \"script\", s = u.createElement(o), i, f;\n for (s.src = config.url || \"//az416426.vo.msecnd.net/scripts/a/ai.0.js\", u.getElementsByTagName(o)[0].parentNode.appendChild(s), t.cookie = u.cookie, t.queue = [], i = [\"Event\", \"Exception\", \"Metric\", \"PageView\", \"Trace\"]; i.length;) {\n r(\"track\" + i.pop());\n }\n return r(\"setAuthenticatedUserContext\"), r(\"clearAuthenticatedUserContext\"), config.disableExceptionTracking || (i = \"onerror\", r(\"_\" + i), f = e[i], e[i] = function (config, r, u, e, o) {\n var s = f && f(config, r, u, e, o);\n return s !== !0 && t[\"_\" + i](config, r, u, e, o), s;\n }), t;\n }({\n instrumentationKey: this.azureInsightsInstrumentationKey\n });\n window[\"appInsights\"] = appInsights;\n }\n AzureInsightsListener.prototype.log = function (entry) {\n var ai = window[\"appInsights\"];\n var msg = this.format(entry);\n if (entry.level === LogLevel.Error) {\n ai.trackException(msg);\n }\n else {\n ai.trackEvent(msg);\n }\n };\n AzureInsightsListener.prototype.format = function (entry) {\n return \"Message: \" + entry.message + \". Data: \" + JSON.stringify(entry.data);\n };\n return AzureInsightsListener;\n }());\n Logger.AzureInsightsListener = AzureInsightsListener;\n var FunctionListener = (function () {\n function FunctionListener(method) {\n this.method = method;\n }\n FunctionListener.prototype.log = function (entry) {\n this.method(entry);\n };\n return FunctionListener;\n }());\n Logger.FunctionListener = FunctionListener;\n})(Logger = exports.Logger || (exports.Logger = {}));\n","\"use strict\";\nvar util_1 = require(\"./util\");\nvar PnPClientStorageWrapper = (function () {\n function PnPClientStorageWrapper(store, defaultTimeoutMinutes) {\n this.store = store;\n this.defaultTimeoutMinutes = defaultTimeoutMinutes;\n this.defaultTimeoutMinutes = (defaultTimeoutMinutes === void 0) ? 5 : defaultTimeoutMinutes;\n this.enabled = this.test();\n }\n PnPClientStorageWrapper.prototype.get = function (key) {\n if (!this.enabled) {\n return null;\n }\n var o = this.store.getItem(key);\n if (o == null) {\n return o;\n }\n var persistable = JSON.parse(o);\n if (new Date(persistable.expiration) <= new Date()) {\n this.delete(key);\n return null;\n }\n else {\n return persistable.value;\n }\n };\n PnPClientStorageWrapper.prototype.put = function (key, o, expire) {\n if (this.enabled) {\n this.store.setItem(key, this.createPersistable(o, expire));\n }\n };\n PnPClientStorageWrapper.prototype.delete = function (key) {\n if (this.enabled) {\n this.store.removeItem(key);\n }\n };\n PnPClientStorageWrapper.prototype.getOrPut = function (key, getter, expire) {\n var _this = this;\n if (!this.enabled) {\n return getter();\n }\n if (!util_1.Util.isFunction(getter)) {\n throw \"Function expected for parameter 'getter'.\";\n }\n return new Promise(function (resolve, reject) {\n var o = _this.get(key);\n if (o == null) {\n getter().then(function (d) {\n _this.put(key, d);\n resolve(d);\n });\n }\n else {\n resolve(o);\n }\n });\n };\n PnPClientStorageWrapper.prototype.test = function () {\n var str = \"test\";\n try {\n this.store.setItem(str, str);\n this.store.removeItem(str);\n return true;\n }\n catch (e) {\n return false;\n }\n };\n PnPClientStorageWrapper.prototype.createPersistable = function (o, expire) {\n if (typeof expire === \"undefined\") {\n expire = util_1.Util.dateAdd(new Date(), \"minute\", this.defaultTimeoutMinutes);\n }\n return JSON.stringify({ expiration: expire, value: o });\n };\n return PnPClientStorageWrapper;\n}());\nexports.PnPClientStorageWrapper = PnPClientStorageWrapper;\nvar PnPClientStorage = (function () {\n function PnPClientStorage() {\n this.local = typeof localStorage !== \"undefined\" ? new PnPClientStorageWrapper(localStorage) : null;\n this.session = typeof sessionStorage !== \"undefined\" ? new PnPClientStorageWrapper(sessionStorage) : null;\n }\n return PnPClientStorage;\n}());\nexports.PnPClientStorage = PnPClientStorage;\n","\"use strict\";\nvar Util = (function () {\n function Util() {\n }\n Util.getCtxCallback = function (context, method) {\n var params = [];\n for (var _i = 2; _i < arguments.length; _i++) {\n params[_i - 2] = arguments[_i];\n }\n return function () {\n method.apply(context, params);\n };\n };\n Util.urlParamExists = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n return regex.test(location.search);\n };\n Util.getUrlParamByName = function (name) {\n name = name.replace(/[\\[]/, \"\\\\[\").replace(/[\\]]/, \"\\\\]\");\n var regex = new RegExp(\"[\\\\?&]\" + name + \"=([^&#]*)\");\n var results = regex.exec(location.search);\n return results == null ? \"\" : decodeURIComponent(results[1].replace(/\\+/g, \" \"));\n };\n Util.getUrlParamBoolByName = function (name) {\n var p = this.getUrlParamByName(name);\n var isFalse = (p === \"\" || /false|0/i.test(p));\n return !isFalse;\n };\n Util.stringInsert = function (target, index, s) {\n if (index > 0) {\n return target.substring(0, index) + s + target.substring(index, target.length);\n }\n return s + target;\n };\n Util.dateAdd = function (date, interval, units) {\n var ret = new Date(date.toLocaleString());\n switch (interval.toLowerCase()) {\n case \"year\":\n ret.setFullYear(ret.getFullYear() + units);\n break;\n case \"quarter\":\n ret.setMonth(ret.getMonth() + 3 * units);\n break;\n case \"month\":\n ret.setMonth(ret.getMonth() + units);\n break;\n case \"week\":\n ret.setDate(ret.getDate() + 7 * units);\n break;\n case \"day\":\n ret.setDate(ret.getDate() + units);\n break;\n case \"hour\":\n ret.setTime(ret.getTime() + units * 3600000);\n break;\n case \"minute\":\n ret.setTime(ret.getTime() + units * 60000);\n break;\n case \"second\":\n ret.setTime(ret.getTime() + units * 1000);\n break;\n default:\n ret = undefined;\n break;\n }\n return ret;\n };\n Util.loadStylesheet = function (path, avoidCache) {\n if (avoidCache) {\n path += \"?\" + encodeURIComponent((new Date()).getTime().toString());\n }\n var head = document.getElementsByTagName(\"head\");\n if (head.length > 0) {\n var e = document.createElement(\"link\");\n head[0].appendChild(e);\n e.setAttribute(\"type\", \"text/css\");\n e.setAttribute(\"rel\", \"stylesheet\");\n e.setAttribute(\"href\", path);\n }\n };\n Util.combinePaths = function () {\n var paths = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n paths[_i - 0] = arguments[_i];\n }\n var parts = [];\n for (var i = 0; i < paths.length; i++) {\n if (typeof paths[i] !== \"undefined\" && paths[i] !== null) {\n parts.push(paths[i].replace(/^[\\\\|\\/]/, \"\").replace(/[\\\\|\\/]$/, \"\"));\n }\n }\n return parts.join(\"/\").replace(/\\\\/, \"/\");\n };\n Util.getRandomString = function (chars) {\n var text = \"\";\n var possible = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\";\n for (var i = 0; i < chars; i++) {\n text += possible.charAt(Math.floor(Math.random() * possible.length));\n }\n return text;\n };\n Util.getGUID = function () {\n var d = new Date().getTime();\n var guid = \"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx\".replace(/[xy]/g, function (c) {\n var r = (d + Math.random() * 16) % 16 | 0;\n d = Math.floor(d / 16);\n return (c === \"x\" ? r : (r & 0x3 | 0x8)).toString(16);\n });\n return guid;\n };\n Util.isFunction = function (candidateFunction) {\n return typeof candidateFunction === \"function\";\n };\n Util.isArray = function (array) {\n if (Array.isArray) {\n return Array.isArray(array);\n }\n return array && typeof array.length === \"number\" && array.constructor === Array;\n };\n Util.stringIsNullOrEmpty = function (s) {\n return typeof s === \"undefined\" || s === null || s === \"\";\n };\n Util.extend = function (target, source, noOverwrite) {\n if (noOverwrite === void 0) { noOverwrite = false; }\n var result = {};\n for (var id in target) {\n result[id] = target[id];\n }\n var check = noOverwrite ? function (o, i) { return !o.hasOwnProperty(i); } : function (o, i) { return true; };\n for (var id in source) {\n if (check(result, id)) {\n result[id] = source[id];\n }\n }\n return result;\n };\n Util.applyMixins = function (derivedCtor) {\n var baseCtors = [];\n for (var _i = 1; _i < arguments.length; _i++) {\n baseCtors[_i - 1] = arguments[_i];\n }\n baseCtors.forEach(function (baseCtor) {\n Object.getOwnPropertyNames(baseCtor.prototype).forEach(function (name) {\n derivedCtor.prototype[name] = baseCtor.prototype[name];\n });\n });\n };\n Util.isUrlAbsolute = function (url) {\n return /^https?:\\/\\/|^\\/\\//i.test(url);\n };\n Util.makeUrlAbsolute = function (url) {\n if (Util.isUrlAbsolute(url)) {\n return url;\n }\n if (typeof global._spPageContextInfo !== \"undefined\") {\n if (global._spPageContextInfo.hasOwnProperty(\"webAbsoluteUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webAbsoluteUrl, url);\n }\n else if (global._spPageContextInfo.hasOwnProperty(\"webServerRelativeUrl\")) {\n return Util.combinePaths(global._spPageContextInfo.webServerRelativeUrl, url);\n }\n }\n else {\n return url;\n }\n };\n return Util;\n}());\nexports.Util = Util;\n"],"sourceRoot":"/source/"} \ No newline at end of file diff --git a/server-root/scratchpad.js b/server-root/scratchpad.js index fdc46b84..c1802b1e 100644 --- a/server-root/scratchpad.js +++ b/server-root/scratchpad.js @@ -201,6 +201,37 @@ require(["pnp"], function (pnp) { //pnp.sp.search("Title").then(show); + /* Webhook subscription creation */ + // var notificationUrl = "{ notification url }"; + // var today = new Date(); + // var expirationDate = new Date(today.setDate(today.getDate() + 90)).toISOString(); + // pnp.sp.web.lists.getByTitle("Documents").createSubscriptions(notificationUrl, expirationDate, 'custom').then(function (data) { + // // Show new subscription information + // show(data); + // // Check all subscriptions of the current list + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then(show); + // }); + + /* Show webhook subscriptions of a list/library */ + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then(show); + + /* Update a webhook subscription from a list or library */ + // var subscriptionId = "f5478417-aeee-4e28-9e3a-e3c7343741d1"; + // var today = new Date(); + // var expirationDate = new Date(today.setDate(today.getDate() + 90)).toISOString(); + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions(subscriptionId).then(show); + // pnp.sp.web.lists.getByTitle("Documents").updateSubscriptions(subscriptionId, expirationDate).then(function () { + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions(subscriptionId).then(show); + // }); + + /* Delete a webhook subscription */ + // var subscriptionId = "f5478417-aeee-4e28-9e3a-e3c7343741d1"; + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then(show); + // pnp.sp.web.lists.getByTitle("Documents").deleteSubscriptions(subscriptionId).then(function () { + // pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then(show); + // }); + + function syntaxHighlight(json) { json = json.replace(/&/g, '&').replace(//g, '>'); return json.replace(/("(\\u[a-zA-Z0-9]{4}|\\[^u]|[^\\"])*"(\s*:)?|\b(true|false|null)\b|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)/g, function (match) { diff --git a/settings.example.js b/settings.example.js index e43eead4..dd8a1be4 100644 --- a/settings.example.js +++ b/settings.example.js @@ -10,6 +10,7 @@ var settings = { clientSecret: "{ client secret }", enableWebTests: true, siteUrl: "{ site collection url }", + notificationUrl: "{ notification url }", } } diff --git a/src/net/httpclient.ts b/src/net/httpclient.ts index c337f5e0..54435580 100644 --- a/src/net/httpclient.ts +++ b/src/net/httpclient.ts @@ -131,6 +131,16 @@ export class HttpClient { return this.fetch(url, opts); } + public patch(url: string, options: FetchOptions = {}): Promise { + let opts = Util.extend(options, { method: "PATCH" }); + return this.fetch(url, opts); + } + + public delete(url: string, options: FetchOptions = {}): Promise { + let opts = Util.extend(options, { method: "DELETE" }); + return this.fetch(url, opts); + } + protected getFetchImpl(): HttpClientImpl { if (RuntimeConfig.useSPRequestExecutor) { return new SPRequestExecutorClient(); diff --git a/src/sharepoint/rest/lists.ts b/src/sharepoint/rest/lists.ts index c91eff4c..a3b2c077 100644 --- a/src/sharepoint/rest/lists.ts +++ b/src/sharepoint/rest/lists.ts @@ -294,6 +294,54 @@ export class List extends QueryableSecurable { }); } + /** + * Returns all the webhook subscriptions for the list + * + */ + public getSubscriptions(subscriptionId?: string): Promise { + let subEndPoint = subscriptionId ? `subscriptions('${subscriptionId}')` : "subscriptions"; + let q = new List(this, subEndPoint); + return q.get(); + } + + /** + * Create a new webhook subscription for the list + * + */ + public createSubscriptions(notificationUrl: string, expirationDate: string, clientState?: string): Promise { + let postBody = JSON.stringify({ + "resource": this.toUrl(), + "notificationUrl": notificationUrl, + "expirationDateTime": expirationDate, + "clientState": clientState || "pnp-js-core-subscription", + }); + + let q = new List(this, "subscriptions"); + return q.post({ body: postBody, headers: { "Content-Type": "application/json" } }); + } + + /** + * Update a webhook subscription for the list + * + */ + public updateSubscriptions(subscriptionId: string, expirationDate: string): Promise { + let postBody = JSON.stringify({ + "expirationDateTime": expirationDate, + }); + + let q = new List(this, `subscriptions('${subscriptionId}')`); + return q.patch({ body: postBody, headers: { "Content-Type": "application/json" } }); + } + + /** + * Delete a webhook subscription for the list + * + */ + public deleteSubscriptions(subscriptionId: string): Promise { + let q = new List(this, `subscriptions('${subscriptionId}')`); + return q.delete(); + } + /** * Returns the collection of changes from the change log that have occurred within the list, based on the specified query. */ diff --git a/src/sharepoint/rest/queryable.ts b/src/sharepoint/rest/queryable.ts index f206ae41..ea1cdcaf 100644 --- a/src/sharepoint/rest/queryable.ts +++ b/src/sharepoint/rest/queryable.ts @@ -230,6 +230,14 @@ export class Queryable { return this.postImpl(postOptions, parser); } + protected patch(patchOptions: FetchOptions = {}, parser: ODataParser = new ODataDefaultParser()): Promise { + return this.patchImpl(patchOptions, parser); + } + + protected delete(deleteOptions: FetchOptions = {}, parser: ODataParser = new ODataDefaultParser()): Promise { + return this.deleteImpl(deleteOptions, parser); + } + /** * Gets a parent for this isntance as specified * @@ -319,6 +327,70 @@ export class Queryable { return this._batch.add(this.toUrlAndQuery(), "POST", postOptions, parser); } } + + private patchImpl(patchOptions: FetchOptions, parser: ODataParser): Promise { + + if (this._batch === null) { + + // we are not part of a batch, so proceed as normal + let client = new HttpClient(); + + return client.patch(this.toUrlAndQuery(), patchOptions).then(function (response) { + + // 200 = OK (delete) + // 201 = Created (create) + // 204 = No Content (update) + if (!response.ok) { + throw "Error making POST request: " + response.statusText; + } + + if ((response.headers.has("Content-Length") && parseFloat(response.headers.get("Content-Length")) === 0) + || response.status === 204) { + + // in these cases the server has returned no content, so we create an empty object + // this was done because the fetch browser methods throw exceptions with no content + return new Promise((resolve, reject) => { resolve({}); }); + } + + // pipe our parsed content + return parser.parse(response); + }); + } else { + return this._batch.add(this.toUrlAndQuery(), "PATCH", patchOptions, parser); + } + } + + private deleteImpl(deleteOptions: FetchOptions, parser: ODataParser): Promise { + + if (this._batch === null) { + + // we are not part of a batch, so proceed as normal + let client = new HttpClient(); + + return client.delete(this.toUrlAndQuery(), deleteOptions).then(function (response) { + + // 200 = OK (delete) + // 201 = Created (create) + // 204 = No Content (update) + if (!response.ok) { + throw "Error making POST request: " + response.statusText; + } + + if ((response.headers.has("Content-Length") && parseFloat(response.headers.get("Content-Length")) === 0) + || response.status === 204) { + + // in these cases the server has returned no content, so we create an empty object + // this was done because the fetch browser methods throw exceptions with no content + return new Promise((resolve, reject) => { resolve({}); }); + } + + // pipe our parsed content + return parser.parse(response); + }); + } else { + return this._batch.add(this.toUrlAndQuery(), "DELETE", deleteOptions, parser); + } + } } /** diff --git a/tests/sharepoint/rest/subscriptions.test.ts b/tests/sharepoint/rest/subscriptions.test.ts new file mode 100644 index 00000000..19aaddf0 --- /dev/null +++ b/tests/sharepoint/rest/subscriptions.test.ts @@ -0,0 +1,76 @@ +"use strict"; + +import { expect } from "chai"; +import { Lists } from "../../../src/sharepoint/rest/lists"; +import { testSettings } from "../../test-config.test"; +import pnp from "../../../src/pnp"; + +describe("Lists", () => { + + let lists: Lists; + + beforeEach(() => { + lists = new Lists("_api/web"); + }); + + it("Should be an object", () => { + expect(lists).to.be.a("object"); + }); + + if (testSettings.enableWebTests) { + + describe("getByTitle", () => { + it("Should get a list by title with the expected title", () => { + + // we are expecting that the OOTB list exists + return expect(pnp.sp.web.lists.getByTitle("Documents").get()).to.eventually.have.property("Title", "Documents"); + }); + }); + + describe("getSubscriptions", () => { + it("Should return the subscriptions of the current list", () => { + // we are expecting that the OOTB list exists + let expectVal = expect(pnp.sp.web.lists.getByTitle("Documents").getSubscriptions()); + return expectVal.to.eventually.be.fulfilled; + }); + }); + + describe("createSubscription", () => { + it("Should be able to create a new webhook subscription in the current list", () => { + let today = new Date(); + let expirationDate = new Date(today.setDate(today.getDate() + 90)).toISOString(); + let expectVal = expect(pnp.sp.web.lists.getByTitle("Documents").createSubscriptions(testSettings.notificationUrl, expirationDate)); + return expectVal.to.eventually.be.fulfilled; + }); + }); + + describe("updateSubscription", () => { + it("Should be able to update an existing webhook subscription in the current list", () => { + pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then((data) => { + if (data !== null) { + if (data.length > 0) { + let today = new Date(); + let expirationDate = new Date(today.setDate(today.getDate() + 90)).toISOString(); + let expectVal = expect(pnp.sp.web.lists.getByTitle("Documents").updateSubscriptions(data[0].id, expirationDate)); + return expectVal.to.eventually.be.fulfilled; + } + } + }); + }); + }); + + describe("deleteSubscription", () => { + it("Should be able to delete an existing webhook subscription in the current list", () => { + pnp.sp.web.lists.getByTitle("Documents").getSubscriptions().then((data) => { + if (data !== null) { + if (data.length > 0) { + let expectVal = expect(pnp.sp.web.lists.getByTitle("Documents").deleteSubscriptions(data[0].id)); + return expectVal.to.eventually.be.fulfilled; + } + } + }); + }); + }); + + } +}); diff --git a/tslint.json b/tslint.json index 0a6ff453..f942676a 100644 --- a/tslint.json +++ b/tslint.json @@ -8,7 +8,7 @@ "indent": [true, "spaces"], "label-position": true, "label-undefined": true, - "max-line-length": [true, 140], + "max-line-length": [true, 180], "member-access": true, "member-ordering": [true, "public-before-private",