Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@pnp/sp

Package Overview
Dependencies
Maintainers
7
Versions
1074
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@pnp/sp - npm Package Compare versions

Comparing version 2.0.0-15 to 2.0.0-16

2

batch.js

@@ -150,3 +150,3 @@ import { __extends } from "tslib";

if (!headers.has("X-ClientService-ClientTag")) {
headers.append("X-ClientService-ClientTag", "PnPCoreJS:@pnp-2.0.0-15");
headers.append("X-ClientService-ClientTag", "PnPCoreJS:@pnp-2.0.0-16");
}

@@ -153,0 +153,0 @@ // write headers into batch body

@@ -549,2 +549,3 @@ import { __awaiter, __decorate, __extends, __generator } from "tslib";

return __awaiter(this, void 0, void 0, function () {
var lastPubData;
return __generator(this, function (_a) {

@@ -556,4 +557,11 @@ switch (_a.label) {

}
return [4 /*yield*/, spPost(initFrom(this, "_api/sitepages/pages(" + this.json.Id + ")/" + method), body(metadata("SP.Publishing.SitePage")))];
case 1: return [2 /*return*/, _a.sent()];
if (!stringIsNullOrEmpty(this.json.VersionInfo.LastVersionCreatedBy)) return [3 /*break*/, 2];
lastPubData = new Date(this.json.VersionInfo.LastVersionCreated);
if (!(lastPubData.getFullYear() < 2000)) return [3 /*break*/, 2];
return [4 /*yield*/, this.save(true)];
case 1:
_a.sent();
_a.label = 2;
case 2: return [4 /*yield*/, spPost(initFrom(this, "_api/sitepages/pages(" + this.json.Id + ")/" + method), body(metadata("SP.Publishing.SitePage")))];
case 3: return [2 /*return*/, _a.sent()];
}

@@ -560,0 +568,0 @@ });

@@ -7,2 +7,5 @@ import { IFiles } from "./types";

interface IFolder {
/**
* Folder containing files
*/
readonly files: IFiles;

@@ -9,0 +12,0 @@ }

@@ -7,2 +7,5 @@ import { IFile } from "./types";

interface IItem {
/**
* File in sharepoint site
*/
readonly file: IFile;

@@ -9,0 +12,0 @@ }

@@ -24,2 +24,10 @@ import { _SharePointQueryableInstance, ISharePointQueryableInstance, _SharePointQueryableCollection, IDeleteableWithETag } from "../sharepointqueryable";

/**
* Adds a file using the pound percent safe methods
*
* @param url Excoded url of the file
* @param content The file content
* @param parameters Additional parameters to control method behavior
*/
addUsingPath(url: string, content: string | ArrayBuffer | Blob, parameters?: IAddUsingPathProps): Promise<IFileAddResult>;
/**
* Uploads a file. Not supported for batching

@@ -274,2 +282,8 @@ *

export declare const Version: import("../sharepointqueryable").ISPInvokableFactory<IVersion>;
/**
* Types for document check in.
* Minor = 0
* Major = 1
* Overwrite = 2
*/
export declare enum CheckinType {

@@ -280,2 +294,5 @@ Minor = 0,

}
/**
* Describes file and result
*/
export interface IFileAddResult {

@@ -285,2 +302,7 @@ file: IFile;

}
/**
* File move opertions
* Overwrite = 1
* AllowBrokenThickets = 8
*/
export declare enum MoveOperations {

@@ -296,2 +318,5 @@ Overwrite = 1,

}
/**
* Describes SharePoint file upload progress data
*/
export interface IFileUploadProgressData {

@@ -306,2 +331,16 @@ uploadId: string;

}
export interface IAddUsingPathProps {
/**
* Overwrite the file if it exists
*/
Overwrite: boolean;
/**
* specifies whether to auto checkout on invalid Data. It'll be useful if the list contains validation whose requirements upload will not be able to meet.
*/
AutoCheckoutOnInvalidData?: boolean;
/**
* Specifies a XOR hash of the file data which should be used to ensure end-2-end data integrity, base64 representation
*/
XorHash?: string;
}
//# sourceMappingURL=types.d.ts.map
import { __awaiter, __decorate, __extends, __generator } from "tslib";
import { _SharePointQueryableInstance, _SharePointQueryableCollection, spInvokableFactory, SharePointQueryableInstance, deleteableWithETag, } from "../sharepointqueryable";
import { TextParser, BlobParser, JSONParser, BufferParser, headers } from "@pnp/odata";
import { assign, getGUID } from "@pnp/common";
import { assign, getGUID, isFunc, stringIsNullOrEmpty } from "@pnp/common";
import { Item } from "../items";

@@ -51,2 +51,40 @@ import { odataUrlFrom } from "../odata";

/**
* Adds a file using the pound percent safe methods
*
* @param url Excoded url of the file
* @param content The file content
* @param parameters Additional parameters to control method behavior
*/
_Files.prototype.addUsingPath = function (url, content, parameters) {
if (parameters === void 0) { parameters = { Overwrite: false }; }
return __awaiter(this, void 0, void 0, function () {
var path, resp;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
path = ["AddUsingPath(decodedurl='" + escapeQueryStrValue(url) + "'"];
if (parameters) {
if (parameters.Overwrite) {
path.push(",Overwrite=true");
}
if (parameters.AutoCheckoutOnInvalidData) {
path.push(",AutoCheckoutOnInvalidData=true");
}
if (!stringIsNullOrEmpty(parameters.XorHash)) {
path.push(",XorHash=" + escapeQueryStrValue(parameters.XorHash));
}
}
path.push(")");
return [4 /*yield*/, spPost(Files(this, path.join("")), { body: content })];
case 1:
resp = _a.sent();
return [2 /*return*/, {
data: resp,
file: this.getByName(url),
}];
}
});
});
};
/**
* Uploads a file. Not supported for batching

@@ -325,26 +363,36 @@ *

_File.prototype.setContentChunked = function (file, progress, chunkSize) {
var _this = this;
if (chunkSize === void 0) { chunkSize = 10485760; }
if (progress === undefined) {
progress = function () { return null; };
}
var fileSize = file.size;
var blockCount = parseInt((file.size / chunkSize).toString(), 10) + ((file.size % chunkSize === 0) ? 1 : 0);
var uploadId = getGUID();
// start the chain with the first fragment
progress({ uploadId: uploadId, blockNumber: 1, chunkSize: chunkSize, currentPointer: 0, fileSize: fileSize, stage: "starting", totalBlocks: blockCount });
var chain = this.startUpload(uploadId, file.slice(0, chunkSize));
var _loop_1 = function (i) {
chain = chain.then(function (pointer) {
progress({ uploadId: uploadId, blockNumber: i, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: "continue", totalBlocks: blockCount });
return _this.continueUpload(uploadId, pointer, file.slice(pointer, pointer + chunkSize));
return __awaiter(this, void 0, void 0, function () {
var fileSize, totalBlocks, uploadId, currentPointer, i;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
if (!isFunc(progress)) {
progress = function () { return null; };
}
fileSize = file.size;
totalBlocks = parseInt((fileSize / chunkSize).toString(), 10) + ((fileSize % chunkSize === 0) ? 1 : 0);
uploadId = getGUID();
// report that we are starting
progress({ uploadId: uploadId, blockNumber: 1, chunkSize: chunkSize, currentPointer: 0, fileSize: fileSize, stage: "starting", totalBlocks: totalBlocks });
return [4 /*yield*/, this.startUpload(uploadId, file.slice(0, chunkSize))];
case 1:
currentPointer = _a.sent();
i = 2;
_a.label = 2;
case 2:
if (!(i < totalBlocks)) return [3 /*break*/, 5];
progress({ uploadId: uploadId, blockNumber: i, chunkSize: chunkSize, currentPointer: currentPointer, fileSize: fileSize, stage: "continue", totalBlocks: totalBlocks });
return [4 /*yield*/, this.continueUpload(uploadId, currentPointer, file.slice(currentPointer, currentPointer + chunkSize))];
case 3:
currentPointer = _a.sent();
_a.label = 4;
case 4:
i++;
return [3 /*break*/, 2];
case 5:
progress({ uploadId: uploadId, blockNumber: totalBlocks, chunkSize: chunkSize, currentPointer: currentPointer, fileSize: fileSize, stage: "finishing", totalBlocks: totalBlocks });
return [2 /*return*/, this.finishUpload(uploadId, currentPointer, file.slice(currentPointer))];
}
});
};
// skip the first and last blocks
for (var i = 2; i < blockCount; i++) {
_loop_1(i);
}
return chain.then(function (pointer) {
progress({ uploadId: uploadId, blockNumber: blockCount, chunkSize: chunkSize, currentPointer: pointer, fileSize: fileSize, stage: "finishing", totalBlocks: blockCount });
return _this.finishUpload(uploadId, pointer, file.slice(pointer));
});

@@ -529,2 +577,8 @@ };

export var Version = spInvokableFactory(_Version);
/**
* Types for document check in.
* Minor = 0
* Major = 1
* Overwrite = 2
*/
export var CheckinType;

@@ -536,2 +590,7 @@ (function (CheckinType) {

})(CheckinType || (CheckinType = {}));
/**
* File move opertions
* Overwrite = 1
* AllowBrokenThickets = 8
*/
export var MoveOperations;

@@ -538,0 +597,0 @@ (function (MoveOperations) {

@@ -108,4 +108,5 @@ import { TypedHash } from "@pnp/common";

* @param overrideParameters The parameters that are used to override and extend the regular SPRenderListDataParameters.
* @param queryParams Allows setting of query parameters
*/
renderListDataAsStream(parameters: IRenderListDataParameters, overrideParameters?: any): Promise<any>;
renderListDataAsStream(parameters: IRenderListDataParameters, overrideParameters?: any, queryParams?: Map<string, string>): Promise<any>;
/**

@@ -112,0 +113,0 @@ * Gets the field values and field schema attributes for a list item.

import { __awaiter, __decorate, __extends, __generator } from "tslib";
import { assign, hOP } from "@pnp/common";
import { assign, hOP, jsS } from "@pnp/common";
import { body, headers } from "@pnp/odata";

@@ -319,5 +319,7 @@ import { SharePointQueryable, SharePointQueryableCollection, _SharePointQueryableInstance, _SharePointQueryableCollection, spInvokableFactory, deleteableWithETag, } from "../sharepointqueryable";

* @param overrideParameters The parameters that are used to override and extend the regular SPRenderListDataParameters.
* @param queryParams Allows setting of query parameters
*/
_List.prototype.renderListDataAsStream = function (parameters, overrideParameters) {
_List.prototype.renderListDataAsStream = function (parameters, overrideParameters, queryParams) {
if (overrideParameters === void 0) { overrideParameters = null; }
if (queryParams === void 0) { queryParams = new Map(); }
var postBody = body({

@@ -327,3 +329,9 @@ overrideParameters: assign(metadata("SP.RenderListDataOverrideParameters"), overrideParameters),

});
return spPost(this.clone(List, "RenderListDataAsStream", true), postBody);
var clone = this.clone(List, "RenderListDataAsStream", true);
if (queryParams && queryParams.size > 0) {
queryParams.forEach(function (v, k) { return clone.query.set(k, v); });
}
return spPost(clone, {
body: jsS(postBody),
});
};

@@ -330,0 +338,0 @@ /**

{
"name": "@pnp/sp",
"version": "2.0.0-15",
"version": "2.0.0-16",
"description": "pnp - provides a fluent api for working with SharePoint REST",

@@ -9,5 +9,5 @@ "main": "./index.js",

"tslib": "1.10.0",
"@pnp/common": "2.0.0-15",
"@pnp/logging": "2.0.0-15",
"@pnp/odata": "2.0.0-15"
"@pnp/common": "2.0.0-16",
"@pnp/logging": "2.0.0-16",
"@pnp/odata": "2.0.0-16"
},

@@ -14,0 +14,0 @@ "author": {

@@ -7,3 +7,3 @@ import { SearchQueryInit } from "./types";

export { ISearch, SearchQueryBuilder, SearchResults, Search, } from "./query";
export { ISuggest, IPersonalResultSuggestion, ISuggestQuery as ISearchSuggestQuery, ISuggestResult as ISearchSuggestResult, Suggest, } from "./suggest";
export { ISuggest, IPersonalResultSuggestion, ISuggestQuery, ISuggestResult, Suggest, } from "./suggest";
declare module "../rest" {

@@ -10,0 +10,0 @@ interface SPRest {

import { _SharePointQueryableInstance } from "../sharepointqueryable";
import { IWeb } from "../webs/types";
import { SPBatch } from "../batch";
import { IChangeQuery } from "../types";
export declare class _Site extends _SharePointQueryableInstance {

@@ -38,2 +39,8 @@ /**

/**
* Returns the collection of changes from the change log that have occurred within the list, based on the specified query
*
* @param query The change query
*/
getChanges(query: IChangeQuery): Promise<any>;
/**
* Opens a web by id (using POST)

@@ -40,0 +47,0 @@ *

@@ -139,2 +139,11 @@ import { __awaiter, __decorate, __extends, __generator } from "tslib";

/**
* Returns the collection of changes from the change log that have occurred within the list, based on the specified query
*
* @param query The change query
*/
_Site.prototype.getChanges = function (query) {
var postBody = body({ "query": assign({ "__metadata": { "type": "SP.ChangeQuery" } }, query) });
return spPost(this.clone(Web, "getchanges"), postBody);
};
/**
* Opens a web by id (using POST)

@@ -283,2 +292,5 @@ *

__decorate([
tag("si.getChanges")
], _Site.prototype, "getChanges", null);
__decorate([
tag("si.openWebById")

@@ -285,0 +297,0 @@ ], _Site.prototype, "openWebById", null);

@@ -35,3 +35,3 @@ import { __awaiter, __generator } from "tslib";

methodName = tag.getClientTag(headers);
clientTag = "PnPCoreJS:2.0.0-15:" + methodName;
clientTag = "PnPCoreJS:2.0.0-16:" + methodName;
if (clientTag.length > 32) {

@@ -45,3 +45,3 @@ clientTag = clientTag.substr(0, 32);

// does not work in browsers
headers.append("User-Agent", "NONISV|SharePointPnP|PnPjs/2.0.0-15");
headers.append("User-Agent", "NONISV|SharePointPnP|PnPjs/2.0.0-16");
}

@@ -48,0 +48,0 @@ opts = assign(opts, { headers: headers });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc