\")) {\r\n value = \"
\" + value + \"
\";\r\n }\r\n this.data.innerHTML = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideText.prototype, \"order\", {\r\n get: function () {\r\n return this.data.position.controlIndex;\r\n },\r\n set: function (value) {\r\n this.data.position.controlIndex = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ClientSideText.prototype.onColumnChange = function (col) {\r\n this.data.position.sectionFactor = col.factor;\r\n this.data.position.controlIndex = getNextOrder(col.controls);\r\n this.data.position.zoneIndex = col.data.position.zoneIndex;\r\n this.data.position.sectionIndex = col.data.position.sectionIndex;\r\n };\r\n ClientSideText.Default = {\r\n addedFromPersistedData: false,\r\n anchorComponentId: \"\",\r\n controlType: 4,\r\n displayMode: 2,\r\n editorType: \"CKEditor\",\r\n emphasis: {},\r\n id: \"\",\r\n innerHTML: \"\",\r\n position: {\r\n controlIndex: 1,\r\n layoutIndex: 1,\r\n sectionFactor: 12,\r\n sectionIndex: 1,\r\n zoneIndex: 1,\r\n },\r\n };\r\n return ClientSideText;\r\n}(ColumnControl));\r\nexport { ClientSideText };\r\nvar ClientSideWebpart = /** @class */ (function (_super) {\r\n tslib_1.__extends(ClientSideWebpart, _super);\r\n function ClientSideWebpart(json) {\r\n if (json === void 0) { json = ClientSideWebpart.Default; }\r\n return _super.call(this, json) || this;\r\n }\r\n ClientSideWebpart.fromComponentDef = function (definition) {\r\n var part = new ClientSideWebpart();\r\n part.import(definition);\r\n return part;\r\n };\r\n Object.defineProperty(ClientSideWebpart.prototype, \"title\", {\r\n get: function () {\r\n return this.data.webPartData.title;\r\n },\r\n set: function (value) {\r\n this.data.webPartData.title = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideWebpart.prototype, \"description\", {\r\n get: function () {\r\n return this.data.webPartData.description;\r\n },\r\n set: function (value) {\r\n this.data.webPartData.description = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideWebpart.prototype, \"order\", {\r\n get: function () {\r\n return this.data.position.controlIndex;\r\n },\r\n set: function (value) {\r\n this.data.position.controlIndex = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideWebpart.prototype, \"height\", {\r\n get: function () {\r\n return this.data.reservedHeight;\r\n },\r\n set: function (value) {\r\n this.data.reservedHeight = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideWebpart.prototype, \"width\", {\r\n get: function () {\r\n return this.data.reservedWidth;\r\n },\r\n set: function (value) {\r\n this.data.reservedWidth = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ClientSideWebpart.prototype, \"dataVersion\", {\r\n get: function () {\r\n return this.data.webPartData.dataVersion;\r\n },\r\n set: function (value) {\r\n this.data.webPartData.dataVersion = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n ClientSideWebpart.prototype.setProperties = function (properties) {\r\n this.data.webPartData.properties = extend(this.data.webPartData.properties, properties);\r\n return this;\r\n };\r\n ClientSideWebpart.prototype.getProperties = function () {\r\n return this.data.webPartData.properties;\r\n };\r\n ClientSideWebpart.prototype.onColumnChange = function (col) {\r\n this.data.position.sectionFactor = col.factor;\r\n this.data.position.controlIndex = getNextOrder(col.controls);\r\n this.data.position.zoneIndex = col.data.position.zoneIndex;\r\n this.data.position.sectionIndex = col.data.position.sectionIndex;\r\n };\r\n ClientSideWebpart.prototype.import = function (component) {\r\n var id = getGUID();\r\n var componendId = component.Id.replace(/^\\{|\\}$/g, \"\").toLowerCase();\r\n var manifest = JSON.parse(component.Manifest);\r\n var preconfiguredEntries = manifest.preconfiguredEntries[0];\r\n this.setData(Object.assign({}, this.data, {\r\n id: id,\r\n webPartData: {\r\n dataVersion: \"1.0\",\r\n description: preconfiguredEntries.description.default,\r\n id: componendId,\r\n instanceId: id,\r\n properties: preconfiguredEntries.properties,\r\n title: preconfiguredEntries.title.default,\r\n },\r\n webPartId: componendId,\r\n }));\r\n };\r\n ClientSideWebpart.Default = {\r\n addedFromPersistedData: false,\r\n controlType: 3,\r\n displayMode: 2,\r\n emphasis: {},\r\n id: null,\r\n position: {\r\n controlIndex: 1,\r\n sectionFactor: 12,\r\n sectionIndex: 1,\r\n zoneIndex: 1,\r\n },\r\n reservedHeight: 500,\r\n reservedWidth: 500,\r\n webPartData: null,\r\n webPartId: null,\r\n };\r\n return ClientSideWebpart;\r\n}(ColumnControl));\r\nexport { ClientSideWebpart };\r\n//# sourceMappingURL=clientsidepages.js.map","import * as tslib_1 from \"tslib\";\r\nimport { SharePointQueryableCollection, SharePointQueryableInstance, defaultPath } from \"./sharepointqueryable\";\r\nimport { extend, jsS } from \"@pnp/common\";\r\nimport { odataUrlFrom } from \"./odata\";\r\nimport { metadata } from \"./utils/metadata\";\r\n/**\r\n * Represents a Collection of comments\r\n */\r\nvar Comments = /** @class */ (function (_super) {\r\n tslib_1.__extends(Comments, _super);\r\n function Comments() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Comments_1 = Comments;\r\n /**\r\n * Adds a new comment to this collection\r\n *\r\n * @param info Comment information to add\r\n */\r\n Comments.prototype.add = function (info) {\r\n var _this = this;\r\n if (typeof info === \"string\") {\r\n info = { text: info };\r\n }\r\n var postBody = jsS(extend(metadata(\"Microsoft.SharePoint.Comments.comment\"), info));\r\n return this.clone(Comments_1, null).postCore({ body: postBody }).then(function (d) {\r\n return extend(_this.getById(d.id), d);\r\n });\r\n };\r\n /**\r\n * Gets a comment by id\r\n *\r\n * @param id Id of the comment to load\r\n */\r\n Comments.prototype.getById = function (id) {\r\n var c = new Comment(this);\r\n c.concat(\"(\" + id + \")\");\r\n return c;\r\n };\r\n /**\r\n * Deletes all the comments in this collection\r\n */\r\n Comments.prototype.clear = function () {\r\n return this.clone(Comments_1, \"DeleteAll\").postCore();\r\n };\r\n var Comments_1;\r\n Comments = Comments_1 = tslib_1.__decorate([\r\n defaultPath(\"comments\")\r\n ], Comments);\r\n return Comments;\r\n}(SharePointQueryableCollection));\r\nexport { Comments };\r\n/**\r\n * Represents a comment\r\n */\r\nvar Comment = /** @class */ (function (_super) {\r\n tslib_1.__extends(Comment, _super);\r\n function Comment() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Object.defineProperty(Comment.prototype, \"replies\", {\r\n get: function () {\r\n return new Replies(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Likes the comment as the current user\r\n */\r\n Comment.prototype.like = function () {\r\n return this.clone(Comment, \"Like\").postCore();\r\n };\r\n /**\r\n * Unlikes the comment as the current user\r\n */\r\n Comment.prototype.unlike = function () {\r\n return this.clone(Comment, \"Unlike\").postCore();\r\n };\r\n /**\r\n * Deletes this comment\r\n */\r\n Comment.prototype.delete = function () {\r\n return this.clone(Comment, \"DeleteComment\").postCore();\r\n };\r\n return Comment;\r\n}(SharePointQueryableInstance));\r\nexport { Comment };\r\n/**\r\n * Represents a Collection of comments\r\n */\r\nvar Replies = /** @class */ (function (_super) {\r\n tslib_1.__extends(Replies, _super);\r\n function Replies() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Replies_1 = Replies;\r\n /**\r\n * Adds a new reply to this collection\r\n *\r\n * @param info Comment information to add\r\n */\r\n Replies.prototype.add = function (info) {\r\n if (typeof info === \"string\") {\r\n info = { text: info };\r\n }\r\n var postBody = jsS(extend(metadata(\"Microsoft.SharePoint.Comments.comment\"), info));\r\n return this.clone(Replies_1, null).postCore({ body: postBody }).then(function (d) {\r\n return extend(new Comment(odataUrlFrom(d)), d);\r\n });\r\n };\r\n var Replies_1;\r\n Replies = Replies_1 = tslib_1.__decorate([\r\n defaultPath(\"replies\")\r\n ], Replies);\r\n return Replies;\r\n}(SharePointQueryableCollection));\r\nexport { Replies };\r\n//# sourceMappingURL=comments.js.map","import { RuntimeConfig, FetchClient, } from \"@pnp/common\";\r\nexport function setup(config) {\r\n RuntimeConfig.extend(config);\r\n}\r\nvar SPRuntimeConfigImpl = /** @class */ (function () {\r\n function SPRuntimeConfigImpl() {\r\n }\r\n Object.defineProperty(SPRuntimeConfigImpl.prototype, \"headers\", {\r\n get: function () {\r\n var spPart = RuntimeConfig.get(\"sp\");\r\n if (spPart !== undefined && spPart.headers !== undefined) {\r\n return spPart.headers;\r\n }\r\n return {};\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SPRuntimeConfigImpl.prototype, \"baseUrl\", {\r\n get: function () {\r\n var spPart = RuntimeConfig.get(\"sp\");\r\n if (spPart !== undefined && spPart.baseUrl !== undefined) {\r\n return spPart.baseUrl;\r\n }\r\n if (RuntimeConfig.spfxContext !== undefined && RuntimeConfig.spfxContext !== null) {\r\n return RuntimeConfig.spfxContext.pageContext.web.absoluteUrl;\r\n }\r\n return null;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(SPRuntimeConfigImpl.prototype, \"fetchClientFactory\", {\r\n get: function () {\r\n var spPart = RuntimeConfig.get(\"sp\");\r\n if (spPart !== undefined && spPart.fetchClientFactory !== undefined) {\r\n return spPart.fetchClientFactory;\r\n }\r\n else {\r\n return function () { return new FetchClient(); };\r\n }\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return SPRuntimeConfigImpl;\r\n}());\r\nexport { SPRuntimeConfigImpl };\r\nexport var SPRuntimeConfig = new SPRuntimeConfigImpl();\r\n//# sourceMappingURL=splibconfig.js.map","import * as tslib_1 from \"tslib\";\r\nimport { jsS } from \"@pnp/common\";\r\nimport { SharePointQueryableCollection, SharePointQueryableInstance, defaultPath } from \"./sharepointqueryable\";\r\nimport { metadata } from \"./utils/metadata\";\r\n/**\r\n * Describes a collection of content types\r\n *\r\n */\r\nvar ContentTypes = /** @class */ (function (_super) {\r\n tslib_1.__extends(ContentTypes, _super);\r\n function ContentTypes() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n ContentTypes_1 = ContentTypes;\r\n /**\r\n * Adds an existing contenttype to a content type collection\r\n *\r\n * @param contentTypeId in the following format, for example: 0x010102\r\n */\r\n ContentTypes.prototype.addAvailableContentType = function (contentTypeId) {\r\n var _this = this;\r\n var postBody = jsS({\r\n \"contentTypeId\": contentTypeId,\r\n });\r\n return this.clone(ContentTypes_1, \"addAvailableContentType\").postCore({ body: postBody }).then(function (data) {\r\n return {\r\n contentType: _this.getById(data.id),\r\n data: data,\r\n };\r\n });\r\n };\r\n /**\r\n * Gets a ContentType by content type id\r\n */\r\n ContentTypes.prototype.getById = function (id) {\r\n var ct = new ContentType(this);\r\n ct.concat(\"('\" + id + \"')\");\r\n return ct;\r\n };\r\n /**\r\n * Adds a new content type to the collection\r\n *\r\n * @param id The desired content type id for the new content type (also determines the parent content type)\r\n * @param name The name of the content type\r\n * @param description The description of the content type\r\n * @param group The group in which to add the content type\r\n * @param additionalSettings Any additional settings to provide when creating the content type\r\n *\r\n */\r\n ContentTypes.prototype.add = function (id, name, description, group, additionalSettings) {\r\n var _this = this;\r\n if (description === void 0) { description = \"\"; }\r\n if (group === void 0) { group = \"Custom Content Types\"; }\r\n if (additionalSettings === void 0) { additionalSettings = {}; }\r\n var postBody = jsS(Object.assign(metadata(\"SP.ContentType\"), {\r\n \"Description\": description,\r\n \"Group\": group,\r\n \"Id\": { \"StringValue\": id },\r\n \"Name\": name,\r\n }, additionalSettings));\r\n return this.postCore({ body: postBody }).then(function (data) {\r\n return { contentType: _this.getById(data.id), data: data };\r\n });\r\n };\r\n var ContentTypes_1;\r\n ContentTypes = ContentTypes_1 = tslib_1.__decorate([\r\n defaultPath(\"contenttypes\")\r\n ], ContentTypes);\r\n return ContentTypes;\r\n}(SharePointQueryableCollection));\r\nexport { ContentTypes };\r\n/**\r\n * Describes a single ContentType instance\r\n *\r\n */\r\nvar ContentType = /** @class */ (function (_super) {\r\n tslib_1.__extends(ContentType, _super);\r\n function ContentType() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Delete this content type\r\n */\r\n _this.delete = _this._delete;\r\n return _this;\r\n }\r\n Object.defineProperty(ContentType.prototype, \"fieldLinks\", {\r\n /**\r\n * Gets the column (also known as field) references in the content type.\r\n */\r\n get: function () {\r\n return new FieldLinks(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ContentType.prototype, \"fields\", {\r\n /**\r\n * Gets a value that specifies the collection of fields for the content type.\r\n */\r\n get: function () {\r\n return new SharePointQueryableCollection(this, \"fields\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ContentType.prototype, \"parent\", {\r\n /**\r\n * Gets the parent content type of the content type.\r\n */\r\n get: function () {\r\n return new ContentType(this, \"parent\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(ContentType.prototype, \"workflowAssociations\", {\r\n /**\r\n * Gets a value that specifies the collection of workflow associations for the content type.\r\n */\r\n get: function () {\r\n return new SharePointQueryableCollection(this, \"workflowAssociations\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n return ContentType;\r\n}(SharePointQueryableInstance));\r\nexport { ContentType };\r\n/**\r\n * Represents a collection of field link instances\r\n */\r\nvar FieldLinks = /** @class */ (function (_super) {\r\n tslib_1.__extends(FieldLinks, _super);\r\n function FieldLinks() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Gets a FieldLink by GUID id\r\n *\r\n * @param id The GUID id of the field link\r\n */\r\n FieldLinks.prototype.getById = function (id) {\r\n var fl = new FieldLink(this);\r\n fl.concat(\"(guid'\" + id + \"')\");\r\n return fl;\r\n };\r\n FieldLinks = tslib_1.__decorate([\r\n defaultPath(\"fieldlinks\")\r\n ], FieldLinks);\r\n return FieldLinks;\r\n}(SharePointQueryableCollection));\r\nexport { FieldLinks };\r\n/**\r\n * Represents a field link instance\r\n */\r\nvar FieldLink = /** @class */ (function (_super) {\r\n tslib_1.__extends(FieldLink, _super);\r\n function FieldLink() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n return FieldLink;\r\n}(SharePointQueryableInstance));\r\nexport { FieldLink };\r\n//# sourceMappingURL=contenttypes.js.map","import * as tslib_1 from \"tslib\";\r\nimport { SharePointQueryableInstance, SharePointQueryableCollection, defaultPath } from \"./sharepointqueryable\";\r\nimport { jsS } from \"@pnp/common\";\r\n/**\r\n * Describes a collection of List objects\r\n *\r\n */\r\nvar Features = /** @class */ (function (_super) {\r\n tslib_1.__extends(Features, _super);\r\n function Features() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Features_1 = Features;\r\n /**\r\n * Adds a new list to the collection\r\n *\r\n * @param id The Id of the feature (GUID)\r\n * @param force If true the feature activation will be forced\r\n */\r\n Features.prototype.add = function (id, force) {\r\n var _this = this;\r\n if (force === void 0) { force = false; }\r\n return this.clone(Features_1, \"add\").postCore({\r\n body: jsS({\r\n featdefScope: 0,\r\n featureId: id,\r\n force: force,\r\n }),\r\n }).then(function (data) {\r\n return {\r\n data: data,\r\n feature: _this.getById(id),\r\n };\r\n });\r\n };\r\n /**\r\n * Gets a list from the collection by guid id\r\n *\r\n * @param id The Id of the feature (GUID)\r\n */\r\n Features.prototype.getById = function (id) {\r\n var feature = new Feature(this);\r\n feature.concat(\"('\" + id + \"')\");\r\n return feature;\r\n };\r\n /**\r\n * Removes (deactivates) a feature from the collection\r\n *\r\n * @param id The Id of the feature (GUID)\r\n * @param force If true the feature deactivation will be forced\r\n */\r\n Features.prototype.remove = function (id, force) {\r\n if (force === void 0) { force = false; }\r\n return this.clone(Features_1, \"remove\").postCore({\r\n body: jsS({\r\n featureId: id,\r\n force: force,\r\n }),\r\n });\r\n };\r\n var Features_1;\r\n Features = Features_1 = tslib_1.__decorate([\r\n defaultPath(\"features\")\r\n ], Features);\r\n return Features;\r\n}(SharePointQueryableCollection));\r\nexport { Features };\r\nvar Feature = /** @class */ (function (_super) {\r\n tslib_1.__extends(Feature, _super);\r\n function Feature() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n /**\r\n * Removes (deactivates) a feature from the collection\r\n *\r\n * @param force If true the feature deactivation will be forced\r\n */\r\n Feature.prototype.deactivate = function (force) {\r\n var _this = this;\r\n if (force === void 0) { force = false; }\r\n var removeDependency = this.addBatchDependency();\r\n var idGet = new Feature(this).select(\"DefinitionId\");\r\n return idGet.get().then(function (feature) {\r\n var promise = _this.getParent(Features, _this.parentUrl, \"\", _this.batch).remove(feature.DefinitionId, force);\r\n removeDependency();\r\n return promise;\r\n });\r\n };\r\n return Feature;\r\n}(SharePointQueryableInstance));\r\nexport { Feature };\r\n//# sourceMappingURL=features.js.map","import * as tslib_1 from \"tslib\";\r\nimport { SharePointQueryableCollection, SharePointQueryableInstance, defaultPath } from \"./sharepointqueryable\";\r\nimport { extend, jsS } from \"@pnp/common\";\r\nimport { DateTimeFieldFormatType, DateTimeFieldFriendlyFormatType, FieldTypes, CalendarType, UrlFieldFormatType, ChoiceFieldFormatType, } from \"./types\";\r\nimport { metadata } from \"./utils/metadata\";\r\n/**\r\n * Describes a collection of Field objects\r\n *\r\n */\r\nvar Fields = /** @class */ (function (_super) {\r\n tslib_1.__extends(Fields, _super);\r\n function Fields() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Fields_1 = Fields;\r\n /**\r\n * Gets a field from the collection by id\r\n *\r\n * @param id The Id of the list\r\n */\r\n Fields.prototype.getById = function (id) {\r\n var f = new Field(this);\r\n f.concat(\"('\" + id + \"')\");\r\n return f;\r\n };\r\n /**\r\n * Gets a field from the collection by title\r\n *\r\n * @param title The case-sensitive title of the field\r\n */\r\n Fields.prototype.getByTitle = function (title) {\r\n return new Field(this, \"getByTitle('\" + title + \"')\");\r\n };\r\n /**\r\n * Gets a field from the collection by using internal name or title\r\n *\r\n * @param name The case-sensitive internal name or title of the field\r\n */\r\n Fields.prototype.getByInternalNameOrTitle = function (name) {\r\n return new Field(this, \"getByInternalNameOrTitle('\" + name + \"')\");\r\n };\r\n /**\r\n * Creates a field based on the specified schema\r\n */\r\n Fields.prototype.createFieldAsXml = function (xml) {\r\n var _this = this;\r\n var info;\r\n if (typeof xml === \"string\") {\r\n info = { SchemaXml: xml };\r\n }\r\n else {\r\n info = xml;\r\n }\r\n var postBody = jsS({\r\n \"parameters\": extend(metadata(\"SP.XmlSchemaFieldCreationInformation\"), info),\r\n });\r\n return this.clone(Fields_1, \"createfieldasxml\").postCore({ body: postBody }).then(function (data) {\r\n return {\r\n data: data,\r\n field: _this.getById(data.Id),\r\n };\r\n });\r\n };\r\n /**\r\n * Adds a new field to the collection\r\n *\r\n * @param title The new field's title\r\n * @param fieldType The new field's type (ex: SP.FieldText)\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.add = function (title, fieldType, properties) {\r\n var _this = this;\r\n var postBody = jsS(Object.assign(metadata(fieldType), {\r\n \"Title\": title,\r\n }, properties));\r\n return this.clone(Fields_1, null).postCore({ body: postBody }).then(function (data) {\r\n return {\r\n data: data,\r\n field: _this.getById(data.Id),\r\n };\r\n });\r\n };\r\n /**\r\n * Adds a new SP.FieldText to the collection\r\n *\r\n * @param title The field title\r\n * @param maxLength The maximum number of characters allowed in the value of the field.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addText = function (title, maxLength, properties) {\r\n if (maxLength === void 0) { maxLength = 255; }\r\n var props = {\r\n FieldTypeKind: 2,\r\n MaxLength: maxLength,\r\n };\r\n return this.add(title, \"SP.FieldText\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldCalculated to the collection\r\n *\r\n * @param title The field title.\r\n * @param formula The formula for the field.\r\n * @param dateFormat The date and time format that is displayed in the field.\r\n * @param outputType Specifies the output format for the field. Represents a FieldType value.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addCalculated = function (title, formula, dateFormat, outputType, properties) {\r\n if (outputType === void 0) { outputType = FieldTypes.Text; }\r\n var props = {\r\n DateFormat: dateFormat,\r\n FieldTypeKind: 17,\r\n Formula: formula,\r\n OutputType: outputType,\r\n };\r\n return this.add(title, \"SP.FieldCalculated\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldDateTime to the collection\r\n *\r\n * @param title The field title\r\n * @param displayFormat The format of the date and time that is displayed in the field.\r\n * @param calendarType Specifies the calendar type of the field.\r\n * @param friendlyDisplayFormat The type of friendly display format that is used in the field.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addDateTime = function (title, displayFormat, calendarType, friendlyDisplayFormat, properties) {\r\n if (displayFormat === void 0) { displayFormat = DateTimeFieldFormatType.DateOnly; }\r\n if (calendarType === void 0) { calendarType = CalendarType.Gregorian; }\r\n if (friendlyDisplayFormat === void 0) { friendlyDisplayFormat = DateTimeFieldFriendlyFormatType.Unspecified; }\r\n var props = {\r\n DateTimeCalendarType: calendarType,\r\n DisplayFormat: displayFormat,\r\n FieldTypeKind: 4,\r\n FriendlyDisplayFormat: friendlyDisplayFormat,\r\n };\r\n return this.add(title, \"SP.FieldDateTime\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldNumber to the collection\r\n *\r\n * @param title The field title\r\n * @param minValue The field's minimum value\r\n * @param maxValue The field's maximum value\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addNumber = function (title, minValue, maxValue, properties) {\r\n var props = { FieldTypeKind: 9 };\r\n if (minValue !== undefined) {\r\n props = extend({ MinimumValue: minValue }, props);\r\n }\r\n if (maxValue !== undefined) {\r\n props = extend({ MaximumValue: maxValue }, props);\r\n }\r\n return this.add(title, \"SP.FieldNumber\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldCurrency to the collection\r\n *\r\n * @param title The field title\r\n * @param minValue The field's minimum value\r\n * @param maxValue The field's maximum value\r\n * @param currencyLocalId Specifies the language code identifier (LCID) used to format the value of the field\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addCurrency = function (title, minValue, maxValue, currencyLocalId, properties) {\r\n if (currencyLocalId === void 0) { currencyLocalId = 1033; }\r\n var props = {\r\n CurrencyLocaleId: currencyLocalId,\r\n FieldTypeKind: 10,\r\n };\r\n if (minValue !== undefined) {\r\n props = extend({ MinimumValue: minValue }, props);\r\n }\r\n if (maxValue !== undefined) {\r\n props = extend({ MaximumValue: maxValue }, props);\r\n }\r\n return this.add(title, \"SP.FieldCurrency\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldMultiLineText to the collection\r\n *\r\n * @param title The field title\r\n * @param numberOfLines Specifies the number of lines of text to display for the field.\r\n * @param richText Specifies whether the field supports rich formatting.\r\n * @param restrictedMode Specifies whether the field supports a subset of rich formatting.\r\n * @param appendOnly Specifies whether all changes to the value of the field are displayed in list forms.\r\n * @param allowHyperlink Specifies whether a hyperlink is allowed as a value of the field.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n *\r\n */\r\n Fields.prototype.addMultilineText = function (title, numberOfLines, richText, restrictedMode, appendOnly, allowHyperlink, properties) {\r\n if (numberOfLines === void 0) { numberOfLines = 6; }\r\n if (richText === void 0) { richText = true; }\r\n if (restrictedMode === void 0) { restrictedMode = false; }\r\n if (appendOnly === void 0) { appendOnly = false; }\r\n if (allowHyperlink === void 0) { allowHyperlink = true; }\r\n var props = {\r\n AllowHyperlink: allowHyperlink,\r\n AppendOnly: appendOnly,\r\n FieldTypeKind: 3,\r\n NumberOfLines: numberOfLines,\r\n RestrictedMode: restrictedMode,\r\n RichText: richText,\r\n };\r\n return this.add(title, \"SP.FieldMultiLineText\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldUrl to the collection\r\n *\r\n * @param title The field title\r\n */\r\n Fields.prototype.addUrl = function (title, displayFormat, properties) {\r\n if (displayFormat === void 0) { displayFormat = UrlFieldFormatType.Hyperlink; }\r\n var props = {\r\n DisplayFormat: displayFormat,\r\n FieldTypeKind: 11,\r\n };\r\n return this.add(title, \"SP.FieldUrl\", extend(props, properties));\r\n };\r\n /** Adds a user field to the colleciton\r\n *\r\n * @param title The new field's title\r\n * @param selectionMode The selection mode of the field\r\n * @param selectionGroup Value that specifies the identifier of the SharePoint group whose members can be selected as values of the field\r\n * @param properties\r\n */\r\n Fields.prototype.addUser = function (title, selectionMode, properties) {\r\n var props = {\r\n FieldTypeKind: 20,\r\n SelectionMode: selectionMode,\r\n };\r\n return this.add(title, \"SP.FieldUser\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a SP.FieldLookup to the collection\r\n *\r\n * @param title The new field's title\r\n * @param lookupListId The guid id of the list where the source of the lookup is found\r\n * @param lookupFieldName The internal name of the field in the source list\r\n * @param properties Set of additional properties to set on the new field\r\n */\r\n Fields.prototype.addLookup = function (title, lookupListId, lookupFieldName, properties) {\r\n var _this = this;\r\n var props = extend({\r\n FieldTypeKind: 7,\r\n LookupFieldName: lookupFieldName,\r\n LookupListId: lookupListId,\r\n Title: title,\r\n }, properties);\r\n var postBody = jsS({\r\n \"parameters\": extend(metadata(\"SP.FieldCreationInformation\"), props),\r\n });\r\n return this.clone(Fields_1, \"addfield\").postCore({ body: postBody }).then(function (data) {\r\n return {\r\n data: data,\r\n field: _this.getById(data.Id),\r\n };\r\n });\r\n };\r\n /**\r\n * Adds a new SP.FieldChoice to the collection\r\n *\r\n * @param title The field title.\r\n * @param choices The choices for the field.\r\n * @param format The display format of the available options for the field.\r\n * @param fillIn Specifies whether the field allows fill-in values.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addChoice = function (title, choices, format, fillIn, properties) {\r\n if (format === void 0) { format = ChoiceFieldFormatType.Dropdown; }\r\n var props = {\r\n Choices: {\r\n results: choices,\r\n },\r\n EditFormat: format,\r\n FieldTypeKind: 6,\r\n FillInChoice: fillIn,\r\n };\r\n return this.add(title, \"SP.FieldChoice\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldMultiChoice to the collection\r\n *\r\n * @param title The field title.\r\n * @param choices The choices for the field.\r\n * @param fillIn Specifies whether the field allows fill-in values.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addMultiChoice = function (title, choices, fillIn, properties) {\r\n var props = {\r\n Choices: {\r\n results: choices,\r\n },\r\n FieldTypeKind: 15,\r\n FillInChoice: fillIn,\r\n };\r\n return this.add(title, \"SP.FieldMultiChoice\", extend(props, properties));\r\n };\r\n /**\r\n * Adds a new SP.FieldBoolean to the collection\r\n *\r\n * @param title The field title.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addBoolean = function (title, properties) {\r\n var props = {\r\n FieldTypeKind: 8,\r\n };\r\n return this.add(title, \"SP.Field\", extend(props, properties));\r\n };\r\n /**\r\n * Creates a secondary (dependent) lookup field, based on the Id of the primary lookup field.\r\n *\r\n * @param displayName The display name of the new field.\r\n * @param primaryLookupFieldId The guid of the primary Lookup Field.\r\n * @param showField Which field to show from the lookup list.\r\n */\r\n Fields.prototype.addDependentLookupField = function (displayName, primaryLookupFieldId, showField) {\r\n var _this = this;\r\n return this.clone(Fields_1, \"adddependentlookupfield(displayName='\" + displayName + \"', primarylookupfieldid='\" + primaryLookupFieldId + \"', showfield='\" + showField + \"')\")\r\n .postCore()\r\n .then(function (data) {\r\n return {\r\n data: data,\r\n field: _this.getById(data.Id),\r\n };\r\n });\r\n };\r\n /**\r\n * Adds a new SP.FieldLocation to the collection\r\n *\r\n * @param title The field title.\r\n * @param properties Differ by type of field being created (see: https://msdn.microsoft.com/en-us/library/office/dn600182.aspx)\r\n */\r\n Fields.prototype.addLocation = function (title, properties) {\r\n var props = { FieldTypeKind: 33 };\r\n return this.add(title, \"SP.FieldLocation\", extend(props, properties));\r\n };\r\n var Fields_1;\r\n Fields = Fields_1 = tslib_1.__decorate([\r\n defaultPath(\"fields\")\r\n ], Fields);\r\n return Fields;\r\n}(SharePointQueryableCollection));\r\nexport { Fields };\r\n/**\r\n * Describes a single of Field instance\r\n *\r\n */\r\nvar Field = /** @class */ (function (_super) {\r\n tslib_1.__extends(Field, _super);\r\n function Field() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Delete this fields\r\n *\r\n */\r\n _this.delete = _this._delete;\r\n return _this;\r\n }\r\n /**\r\n * Updates this field intance with the supplied properties\r\n *\r\n * @param properties A plain object hash of values to update for the list\r\n * @param fieldType The type value, required to update child field type properties\r\n */\r\n Field.prototype.update = function (properties, fieldType) {\r\n var _this = this;\r\n if (fieldType === void 0) { fieldType = \"SP.Field\"; }\r\n var postBody = jsS(extend(metadata(fieldType), properties));\r\n return this.postCore({\r\n body: postBody,\r\n headers: {\r\n \"X-HTTP-Method\": \"MERGE\",\r\n },\r\n }).then(function (data) {\r\n return {\r\n data: data,\r\n field: _this,\r\n };\r\n });\r\n };\r\n /**\r\n * Sets the value of the ShowInDisplayForm property for this field.\r\n */\r\n Field.prototype.setShowInDisplayForm = function (show) {\r\n return this.clone(Field, \"setshowindisplayform(\" + show + \")\").postCore();\r\n };\r\n /**\r\n * Sets the value of the ShowInEditForm property for this field.\r\n */\r\n Field.prototype.setShowInEditForm = function (show) {\r\n return this.clone(Field, \"setshowineditform(\" + show + \")\").postCore();\r\n };\r\n /**\r\n * Sets the value of the ShowInNewForm property for this field.\r\n */\r\n Field.prototype.setShowInNewForm = function (show) {\r\n return this.clone(Field, \"setshowinnewform(\" + show + \")\").postCore();\r\n };\r\n return Field;\r\n}(SharePointQueryableInstance));\r\nexport { Field };\r\n//# sourceMappingURL=fields.js.map","import * as tslib_1 from \"tslib\";\r\nimport { SharePointQueryableCollection, SharePointQueryableInstance, defaultPath } from \"./sharepointqueryable\";\r\nimport { TextParser, BlobParser, JSONParser, BufferParser } from \"@pnp/odata\";\r\nimport { extend, getGUID } from \"@pnp/common\";\r\nimport { LimitedWebPartManager } from \"./webparts\";\r\nimport { Item } from \"./items\";\r\nimport { SharePointQueryableShareableFile } from \"./sharepointqueryableshareable\";\r\nimport { odataUrlFrom } from \"./odata\";\r\n/**\r\n * Describes a collection of File objects\r\n *\r\n */\r\nvar Files = /** @class */ (function (_super) {\r\n tslib_1.__extends(Files, _super);\r\n function Files() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Files_1 = Files;\r\n /**\r\n * Gets a File by filename\r\n *\r\n * @param name The name of the file, including extension.\r\n */\r\n Files.prototype.getByName = function (name) {\r\n var f = new File(this);\r\n f.concat(\"('\" + name + \"')\");\r\n return f;\r\n };\r\n /**\r\n * Uploads a file. Not supported for batching\r\n *\r\n * @param url The folder-relative url of the file.\r\n * @param content The file contents blob.\r\n * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)\r\n * @returns The new File and the raw response.\r\n */\r\n Files.prototype.add = function (url, content, shouldOverWrite) {\r\n var _this = this;\r\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\r\n return new Files_1(this, \"add(overwrite=\" + shouldOverWrite + \",url='\" + url + \"')\")\r\n .postCore({\r\n body: content,\r\n }).then(function (response) {\r\n return {\r\n data: response,\r\n file: _this.getByName(url),\r\n };\r\n });\r\n };\r\n /**\r\n * Uploads a file. Not supported for batching\r\n *\r\n * @param url The folder-relative url of the file.\r\n * @param content The Blob file content to add\r\n * @param progress A callback function which can be used to track the progress of the upload\r\n * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)\r\n * @param chunkSize The size of each file slice, in bytes (default: 10485760)\r\n * @returns The new File and the raw response.\r\n */\r\n Files.prototype.addChunked = function (url, content, progress, shouldOverWrite, chunkSize) {\r\n var _this = this;\r\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\r\n if (chunkSize === void 0) { chunkSize = 10485760; }\r\n var adder = this.clone(Files_1, \"add(overwrite=\" + shouldOverWrite + \",url='\" + url + \"')\", false);\r\n return adder.postCore()\r\n .then(function () { return _this.getByName(url); })\r\n .then(function (file) { return file.setContentChunked(content, progress, chunkSize); });\r\n };\r\n /**\r\n * Adds a ghosted file to an existing list or document library. Not supported for batching.\r\n *\r\n * @param fileUrl The server-relative url where you want to save the file.\r\n * @param templateFileType The type of use to create the file.\r\n * @returns The template file that was added and the raw response.\r\n */\r\n Files.prototype.addTemplateFile = function (fileUrl, templateFileType) {\r\n var _this = this;\r\n return this.clone(Files_1, \"addTemplateFile(urloffile='\" + fileUrl + \"',templatefiletype=\" + templateFileType + \")\", false)\r\n .postCore().then(function (response) {\r\n return {\r\n data: response,\r\n file: _this.getByName(fileUrl),\r\n };\r\n });\r\n };\r\n var Files_1;\r\n Files = Files_1 = tslib_1.__decorate([\r\n defaultPath(\"files\")\r\n ], Files);\r\n return Files;\r\n}(SharePointQueryableCollection));\r\nexport { Files };\r\n/**\r\n * Describes a single File instance\r\n *\r\n */\r\nvar File = /** @class */ (function (_super) {\r\n tslib_1.__extends(File, _super);\r\n function File() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Object.defineProperty(File.prototype, \"listItemAllFields\", {\r\n /**\r\n * Gets a value that specifies the list item field values for the list item corresponding to the file.\r\n *\r\n */\r\n get: function () {\r\n return new SharePointQueryableInstance(this, \"listItemAllFields\");\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(File.prototype, \"versions\", {\r\n /**\r\n * Gets a collection of versions\r\n *\r\n */\r\n get: function () {\r\n return new Versions(this);\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Approves the file submitted for content approval with the specified comment.\r\n * Only documents in lists that are enabled for content approval can be approved.\r\n *\r\n * @param comment The comment for the approval.\r\n */\r\n File.prototype.approve = function (comment) {\r\n if (comment === void 0) { comment = \"\"; }\r\n return this.clone(File, \"approve(comment='\" + comment + \"')\").postCore();\r\n };\r\n /**\r\n * Stops the chunk upload session without saving the uploaded data. Does not support batching.\r\n * If the file doesn’t already exist in the library, the partially uploaded file will be deleted.\r\n * Use this in response to user action (as in a request to cancel an upload) or an error or exception.\r\n * Use the uploadId value that was passed to the StartUpload method that started the upload session.\r\n * This method is currently available only on Office 365.\r\n *\r\n * @param uploadId The unique identifier of the upload session.\r\n */\r\n File.prototype.cancelUpload = function (uploadId) {\r\n return this.clone(File, \"cancelUpload(uploadId=guid'\" + uploadId + \"')\", false).postCore();\r\n };\r\n /**\r\n * Checks the file in to a document library based on the check-in type.\r\n *\r\n * @param comment A comment for the check-in. Its length must be <= 1023.\r\n * @param checkinType The check-in type for the file.\r\n */\r\n File.prototype.checkin = function (comment, checkinType) {\r\n if (comment === void 0) { comment = \"\"; }\r\n if (checkinType === void 0) { checkinType = CheckinType.Major; }\r\n if (comment.length > 1023) {\r\n throw Error(\"The maximum comment length is 1023 characters.\");\r\n }\r\n return this.clone(File, \"checkin(comment='\" + comment + \"',checkintype=\" + checkinType + \")\").postCore();\r\n };\r\n /**\r\n * Checks out the file from a document library.\r\n */\r\n File.prototype.checkout = function () {\r\n return this.clone(File, \"checkout\").postCore();\r\n };\r\n /**\r\n * Copies the file to the destination url.\r\n *\r\n * @param url The absolute url or server relative url of the destination file path to copy to.\r\n * @param shouldOverWrite Should a file with the same name in the same location be overwritten?\r\n */\r\n File.prototype.copyTo = function (url, shouldOverWrite) {\r\n if (shouldOverWrite === void 0) { shouldOverWrite = true; }\r\n return this.clone(File, \"copyTo(strnewurl='\" + url + \"',boverwrite=\" + shouldOverWrite + \")\").postCore();\r\n };\r\n /**\r\n * Delete this file.\r\n *\r\n * @param eTag Value used in the IF-Match header, by default \"*\"\r\n */\r\n File.prototype.delete = function (eTag) {\r\n if (eTag === void 0) { eTag = \"*\"; }\r\n return this.clone(File, null).postCore({\r\n headers: {\r\n \"IF-Match\": eTag,\r\n \"X-HTTP-Method\": \"DELETE\",\r\n },\r\n });\r\n };\r\n /**\r\n * Denies approval for a file that was submitted for content approval.\r\n * Only documents in lists that are enabled for content approval can be denied.\r\n *\r\n * @param comment The comment for the denial.\r\n */\r\n File.prototype.deny = function (comment) {\r\n if (comment === void 0) { comment = \"\"; }\r\n if (comment.length > 1023) {\r\n throw Error(\"The maximum comment length is 1023 characters.\");\r\n }\r\n return this.clone(File, \"deny(comment='\" + comment + \"')\").postCore();\r\n };\r\n /**\r\n * Specifies the control set used to access, modify, or add Web Parts associated with this Web Part Page and view.\r\n * An exception is thrown if the file is not an ASPX page.\r\n *\r\n * @param scope The WebPartsPersonalizationScope view on the Web Parts page.\r\n */\r\n File.prototype.getLimitedWebPartManager = function (scope) {\r\n if (scope === void 0) { scope = WebPartsPersonalizationScope.Shared; }\r\n return new LimitedWebPartManager(this, \"getLimitedWebPartManager(scope=\" + scope + \")\");\r\n };\r\n /**\r\n * Moves the file to the specified destination url.\r\n *\r\n * @param url The absolute url or server relative url of the destination file path to move to.\r\n * @param moveOperations The bitwise MoveOperations value for how to move the file.\r\n */\r\n File.prototype.moveTo = function (url, moveOperations) {\r\n if (moveOperations === void 0) { moveOperations = MoveOperations.Overwrite; }\r\n return this.clone(File, \"moveTo(newurl='\" + url + \"',flags=\" + moveOperations + \")\").postCore();\r\n };\r\n /**\r\n * Submits the file for content approval with the specified comment.\r\n *\r\n * @param comment The comment for the published file. Its length must be <= 1023.\r\n */\r\n File.prototype.publish = function (comment) {\r\n if (comment === void 0) { comment = \"\"; }\r\n if (comment.length > 1023) {\r\n throw Error(\"The maximum comment length is 1023 characters.\");\r\n }\r\n return this.clone(File, \"publish(comment='\" + comment + \"')\").postCore();\r\n };\r\n /**\r\n * Moves the file to the Recycle Bin and returns the identifier of the new Recycle Bin item.\r\n *\r\n * @returns The GUID of the recycled file.\r\n */\r\n File.prototype.recycle = function () {\r\n return this.clone(File, \"recycle\").postCore();\r\n };\r\n /**\r\n * Reverts an existing checkout for the file.\r\n *\r\n */\r\n File.prototype.undoCheckout = function () {\r\n return this.clone(File, \"undoCheckout\").postCore();\r\n };\r\n /**\r\n * Removes the file from content approval or unpublish a major version.\r\n *\r\n * @param comment The comment for the unpublish operation. Its length must be <= 1023.\r\n */\r\n File.prototype.unpublish = function (comment) {\r\n if (comment === void 0) { comment = \"\"; }\r\n if (comment.length > 1023) {\r\n throw Error(\"The maximum comment length is 1023 characters.\");\r\n }\r\n return this.clone(File, \"unpublish(comment='\" + comment + \"')\").postCore();\r\n };\r\n /**\r\n * Gets the contents of the file as text. Not supported in batching.\r\n *\r\n */\r\n File.prototype.getText = function () {\r\n return this.clone(File, \"$value\", false).get(new TextParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n };\r\n /**\r\n * Gets the contents of the file as a blob, does not work in Node.js. Not supported in batching.\r\n *\r\n */\r\n File.prototype.getBlob = function () {\r\n return this.clone(File, \"$value\", false).get(new BlobParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n };\r\n /**\r\n * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.\r\n */\r\n File.prototype.getBuffer = function () {\r\n return this.clone(File, \"$value\", false).get(new BufferParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n };\r\n /**\r\n * Gets the contents of a file as an ArrayBuffer, works in Node.js. Not supported in batching.\r\n */\r\n File.prototype.getJSON = function () {\r\n return this.clone(File, \"$value\", false).get(new JSONParser(), { headers: { \"binaryStringResponseBody\": \"true\" } });\r\n };\r\n /**\r\n * Sets the content of a file, for large files use setContentChunked. Not supported in batching.\r\n *\r\n * @param content The file content\r\n *\r\n */\r\n File.prototype.setContent = function (content) {\r\n var _this = this;\r\n return this.clone(File, \"$value\", false).postCore({\r\n body: content,\r\n headers: {\r\n \"X-HTTP-Method\": \"PUT\",\r\n },\r\n }).then(function (_) { return new File(_this); });\r\n };\r\n /**\r\n * Gets the associated list item for this folder, loading the default properties\r\n */\r\n File.prototype.getItem = function () {\r\n var selects = [];\r\n for (var _i = 0; _i < arguments.length; _i++) {\r\n selects[_i] = arguments[_i];\r\n }\r\n var q = this.listItemAllFields;\r\n return q.select.apply(q, selects).get().then(function (d) {\r\n return extend(new Item(odataUrlFrom(d)), d);\r\n });\r\n };\r\n /**\r\n * Sets the contents of a file using a chunked upload approach. Not supported in batching.\r\n *\r\n * @param file The file to upload\r\n * @param progress A callback function which can be used to track the progress of the upload\r\n * @param chunkSize The size of each file slice, in bytes (default: 10485760)\r\n */\r\n File.prototype.setContentChunked = function (file, progress, chunkSize) {\r\n var _this = this;\r\n if (chunkSize === void 0) { chunkSize = 10485760; }\r\n if (progress === undefined) {\r\n progress = function () { return null; };\r\n }\r\n var fileSize = file.size;\r\n var blockCount = parseInt((file.size / chunkSize).toString(), 10) + ((file.size % chunkSize === 0) ? 1 : 0);\r\n var uploadId = getGUID();\r\n // start the chain with the first fragment\r\n progress({ uploadId: uploadId, blockNumber: 1, chunkSize: chunkSize, currentPointer: 0, fileSize: fileSize, stage: \"starting\", totalBlocks: blockCount });\r\n var chain = this.startUpload(uploadId, file.slice(0, chunkSize));\r\n var _loop_1 = function (i) {\r\n chain = chain.then(function (pointer) {\r\n progress({ uploadId: uploadId, blockNumber: i, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: \"continue\", totalBlocks: blockCount });\r\n return _this.continueUpload(uploadId, pointer, file.slice(pointer, pointer + chunkSize));\r\n });\r\n };\r\n // skip the first and last blocks\r\n for (var i = 2; i < blockCount; i++) {\r\n _loop_1(i);\r\n }\r\n return chain.then(function (pointer) {\r\n progress({ uploadId: uploadId, blockNumber: blockCount, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: \"finishing\", totalBlocks: blockCount });\r\n return _this.finishUpload(uploadId, pointer, file.slice(pointer));\r\n });\r\n };\r\n /**\r\n * Starts a new chunk upload session and uploads the first fragment.\r\n * The current file content is not changed when this method completes.\r\n * The method is idempotent (and therefore does not change the result) as long as you use the same values for uploadId and stream.\r\n * The upload session ends either when you use the CancelUpload method or when you successfully\r\n * complete the upload session by passing the rest of the file contents through the ContinueUpload and FinishUpload methods.\r\n * The StartUpload and ContinueUpload methods return the size of the running total of uploaded data in bytes,\r\n * so you can pass those return values to subsequent uses of ContinueUpload and FinishUpload.\r\n * This method is currently available only on Office 365.\r\n *\r\n * @param uploadId The unique identifier of the upload session.\r\n * @param fragment The file contents.\r\n * @returns The size of the total uploaded data in bytes.\r\n */\r\n File.prototype.startUpload = function (uploadId, fragment) {\r\n return this.clone(File, \"startUpload(uploadId=guid'\" + uploadId + \"')\", false)\r\n .postCore({ body: fragment })\r\n .then(function (n) {\r\n // When OData=verbose the payload has the following shape:\r\n // { StartUpload: \"10485760\" }\r\n if (typeof n === \"object\") {\r\n n = n.StartUpload;\r\n }\r\n return parseFloat(n);\r\n });\r\n };\r\n /**\r\n * Continues the chunk upload session with an additional fragment.\r\n * The current file content is not changed.\r\n * Use the uploadId value that was passed to the StartUpload method that started the upload session.\r\n * This method is currently available only on Office 365.\r\n *\r\n * @param uploadId The unique identifier of the upload session.\r\n * @param fileOffset The size of the offset into the file where the fragment starts.\r\n * @param fragment The file contents.\r\n * @returns The size of the total uploaded data in bytes.\r\n */\r\n File.prototype.continueUpload = function (uploadId, fileOffset, fragment) {\r\n return this.clone(File, \"continueUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\", false)\r\n .postCore({ body: fragment })\r\n .then(function (n) {\r\n // When OData=verbose the payload has the following shape:\r\n // { ContinueUpload: \"20971520\" }\r\n if (typeof n === \"object\") {\r\n n = n.ContinueUpload;\r\n }\r\n return parseFloat(n);\r\n });\r\n };\r\n /**\r\n * Uploads the last file fragment and commits the file. The current file content is changed when this method completes.\r\n * Use the uploadId value that was passed to the StartUpload method that started the upload session.\r\n * This method is currently available only on Office 365.\r\n *\r\n * @param uploadId The unique identifier of the upload session.\r\n * @param fileOffset The size of the offset into the file where the fragment starts.\r\n * @param fragment The file contents.\r\n * @returns The newly uploaded file.\r\n */\r\n File.prototype.finishUpload = function (uploadId, fileOffset, fragment) {\r\n return this.clone(File, \"finishUpload(uploadId=guid'\" + uploadId + \"',fileOffset=\" + fileOffset + \")\", false)\r\n .postCore({ body: fragment })\r\n .then(function (response) {\r\n return {\r\n data: response,\r\n file: new File(odataUrlFrom(response)),\r\n };\r\n });\r\n };\r\n return File;\r\n}(SharePointQueryableShareableFile));\r\nexport { File };\r\n/**\r\n * Describes a collection of Version objects\r\n *\r\n */\r\nvar Versions = /** @class */ (function (_super) {\r\n tslib_1.__extends(Versions, _super);\r\n function Versions() {\r\n return _super !== null && _super.apply(this, arguments) || this;\r\n }\r\n Versions_1 = Versions;\r\n /**\r\n * Gets a version by id\r\n *\r\n * @param versionId The id of the version to retrieve\r\n */\r\n Versions.prototype.getById = function (versionId) {\r\n var v = new Version(this);\r\n v.concat(\"(\" + versionId + \")\");\r\n return v;\r\n };\r\n /**\r\n * Deletes all the file version objects in the collection.\r\n *\r\n */\r\n Versions.prototype.deleteAll = function () {\r\n return new Versions_1(this, \"deleteAll\").postCore();\r\n };\r\n /**\r\n * Deletes the specified version of the file.\r\n *\r\n * @param versionId The ID of the file version to delete.\r\n */\r\n Versions.prototype.deleteById = function (versionId) {\r\n return this.clone(Versions_1, \"deleteById(vid=\" + versionId + \")\").postCore();\r\n };\r\n /**\r\n * Recycles the specified version of the file.\r\n *\r\n * @param versionId The ID of the file version to delete.\r\n */\r\n Versions.prototype.recycleByID = function (versionId) {\r\n return this.clone(Versions_1, \"recycleByID(vid=\" + versionId + \")\").postCore();\r\n };\r\n /**\r\n * Deletes the file version object with the specified version label.\r\n *\r\n * @param label The version label of the file version to delete, for example: 1.2\r\n */\r\n Versions.prototype.deleteByLabel = function (label) {\r\n return this.clone(Versions_1, \"deleteByLabel(versionlabel='\" + label + \"')\").postCore();\r\n };\r\n /**\r\n * Recycles the file version object with the specified version label.\r\n *\r\n * @param label The version label of the file version to delete, for example: 1.2\r\n */\r\n Versions.prototype.recycleByLabel = function (label) {\r\n return this.clone(Versions_1, \"recycleByLabel(versionlabel='\" + label + \"')\").postCore();\r\n };\r\n /**\r\n * Creates a new file version from the file specified by the version label.\r\n *\r\n * @param label The version label of the file version to restore, for example: 1.2\r\n */\r\n Versions.prototype.restoreByLabel = function (label) {\r\n return this.clone(Versions_1, \"restoreByLabel(versionlabel='\" + label + \"')\").postCore();\r\n };\r\n var Versions_1;\r\n Versions = Versions_1 = tslib_1.__decorate([\r\n defaultPath(\"versions\")\r\n ], Versions);\r\n return Versions;\r\n}(SharePointQueryableCollection));\r\nexport { Versions };\r\n/**\r\n * Describes a single Version instance\r\n *\r\n */\r\nvar Version = /** @class */ (function (_super) {\r\n tslib_1.__extends(Version, _super);\r\n function Version() {\r\n var _this = _super !== null && _super.apply(this, arguments) || this;\r\n /**\r\n * Delete a specific version of a file.\r\n *\r\n * @param eTag Value used in the IF-Match header, by default \"*\"\r\n */\r\n _this.delete = _this._deleteWithETag;\r\n return _this;\r\n // /**\r\n // * Delete a specific version of a file.\r\n // *\r\n // * @param eTag Value used in the IF-Match header, by default \"*\"\r\n // */\r\n // public delete(eTag = \"*\"): Promise