@pnp/nodejs 3.21.0-v3nightly.20231220 → 4.0.0-alpha0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,37 +1,37 @@
1
1
  {
2
- "name": "@pnp/nodejs",
3
- "version": "3.21.0-v3nightly.20231220",
4
- "description": "pnp - provides functionality enabling the @pnp libraries within nodejs",
5
- "main": "./index.js",
6
- "typings": "./index",
7
- "dependencies": {
8
- "@azure/msal-node": "1.18.4",
9
- "@pnp/core": "3.21.0-v3nightly.20231220",
10
- "@pnp/logging": "3.21.0-v3nightly.20231220",
11
- "@pnp/queryable": "3.21.0-v3nightly.20231220",
12
- "@pnp/sp": "3.21.0-v3nightly.20231220",
13
- "@pnp/graph": "3.21.0-v3nightly.20231220",
14
- "node-fetch": "3.3.2",
15
- "tslib": "2.6.2"
16
- },
17
- "funding": {
18
- "type": "individual",
19
- "url": "https://github.com/sponsors/patrick-rodgers/"
20
- },
21
- "type": "module",
22
- "engines": {
23
- "node": ">=14.15.1"
24
- },
25
- "author": {
26
- "name": "Microsoft and other contributors"
27
- },
28
- "license": "MIT",
29
- "bugs": {
30
- "url": "https://github.com/pnp/pnpjs/issues"
31
- },
32
- "homepage": "https://github.com/pnp/pnpjs",
33
- "repository": {
34
- "type": "git",
35
- "url": "git:github.com/pnp/pnpjs"
36
- }
2
+ "name": "@pnp/nodejs",
3
+ "version": "4.0.0-alpha0",
4
+ "description": "pnp - provides functionality enabling the @pnp libraries within nodejs",
5
+ "main": "./index.js",
6
+ "typings": "./index",
7
+ "dependencies": {
8
+ "@azure/msal-node": "1.18.3",
9
+ "@pnp/core": "4.0.0-alpha0",
10
+ "@pnp/logging": "4.0.0-alpha0",
11
+ "@pnp/queryable": "4.0.0-alpha0",
12
+ "@pnp/sp": "4.0.0-alpha0",
13
+ "@pnp/graph": "4.0.0-alpha0",
14
+ "node-fetch": "3.3.2",
15
+ "tslib": "2.6.2"
16
+ },
17
+ "funding": {
18
+ "type": "individual",
19
+ "url": "https://github.com/sponsors/patrick-rodgers/"
20
+ },
21
+ "type": "module",
22
+ "engines": {
23
+ "node": ">=14.15.1"
24
+ },
25
+ "author": {
26
+ "name": "Microsoft and other contributors"
27
+ },
28
+ "license": "MIT",
29
+ "bugs": {
30
+ "url": "https://github.com/pnp/pnpjs/issues"
31
+ },
32
+ "homepage": "https://github.com/pnp/pnpjs",
33
+ "repository": {
34
+ "type": "git",
35
+ "url": "git:github.com/pnp/pnpjs"
36
+ }
37
37
  }
@@ -1,30 +1,7 @@
1
1
  /// <reference types="node" />
2
- import { IFileAddResult, IFileUploadProgressData } from "@pnp/sp/files/index.js";
3
- import { ReadStream } from "fs";
4
2
  import { PassThrough } from "stream";
5
3
  export interface IResponseBodyStream {
6
4
  body: PassThrough;
7
5
  knownLength: number;
8
6
  }
9
- declare type ProgressFunc = (data: IFileUploadProgressData) => void;
10
- declare type ChunkedResult = Promise<IFileAddResult>;
11
- declare module "@pnp/sp/files/types" {
12
- interface IFile {
13
- /**
14
- * Gets a PassThrough stream representing the file
15
- */
16
- getStream(): Promise<IResponseBodyStream>;
17
- /**
18
- * Sets a file stream content chunk
19
- */
20
- setStreamContentChunked(stream: ReadStream, progress?: ProgressFunc): ChunkedResult;
21
- }
22
- interface IFiles {
23
- /**
24
- * Adds a file stream in chunks
25
- */
26
- addChunked(url: string, content: Blob | ReadStream, progress?: ProgressFunc, shouldOverWrite?: boolean, chunkSize?: number): ChunkedResult;
27
- }
28
- }
29
- export {};
30
7
  //# sourceMappingURL=stream.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../packages/nodejs/sp-extensions/stream.ts"],"names":[],"mappings":";AACA,OAAO,EAAsB,cAAc,EAAU,uBAAuB,EAAE,MAAM,wBAAwB,CAAC;AAE7G,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAKrC,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB;AA2FD,aAAK,YAAY,GAAG,CAAC,IAAI,EAAE,uBAAuB,KAAK,IAAI,CAAC;AAC5D,aAAK,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;AAE7C,OAAO,QAAQ,qBAAqB,CAAC;IAEjC,UAAU,KAAK;QACX;;WAEG;QACH,SAAS,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;QAE1C;;WAEG;QACH,uBAAuB,CACnB,MAAM,EAAE,UAAU,EAClB,QAAQ,CAAC,EAAE,YAAY,GACxB,aAAa,CAAC;KACpB;IAED,UAAU,MAAM;QACZ;;WAEG;QACH,UAAU,CACN,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,IAAI,GAAG,UAAU,EAC1B,QAAQ,CAAC,EAAE,YAAY,EACvB,eAAe,CAAC,EAAE,OAAO,EACzB,SAAS,CAAC,EAAE,MAAM,GACnB,aAAa,CAAC;KACpB;CACJ"}
1
+ {"version":3,"file":"stream.d.ts","sourceRoot":"","sources":["../../../../packages/nodejs/sp-extensions/stream.ts"],"names":[],"mappings":";AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAKrC,MAAM,WAAW,mBAAmB;IAChC,IAAI,EAAE,WAAW,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;CACvB"}
@@ -1,72 +1,104 @@
1
- import { asCancelableScope, CancelAction, headers } from "@pnp/queryable";
2
- import { File, Files } from "@pnp/sp/files/index.js";
3
- import { spPost, encodePath } from "@pnp/sp";
4
- import { extendFactory, getGUID, isFunc } from "@pnp/core";
5
- import { StreamParse } from "../behaviors/stream-parse.js";
6
- import { fileFromServerRelativePath } from "@pnp/sp/files/index.js";
7
- extendFactory(File, {
8
- getStream() {
9
- return File(this, "$value").using(StreamParse())(headers({ "binaryStringResponseBody": "true" }));
10
- },
11
- /**
12
- * Sets the contents of a file using a chunked upload approach. Not supported in batching.
13
- *
14
- * @param stream The file to upload (as readable stream)
15
- * @param progress A callback function which can be used to track the progress of the upload
16
- */
17
- setStreamContentChunked: asCancelableScope(async function (stream, progress) {
18
- if (!isFunc(progress)) {
19
- progress = () => void (0);
20
- }
21
- const uploadId = getGUID();
22
- const fileRef = File(this).using(CancelAction(() => {
23
- return File(this).cancelUpload(uploadId);
24
- }));
25
- let blockNumber = -1;
26
- let pointer = 0;
27
- for await (const chunk of stream) {
28
- blockNumber++;
29
- progress({
30
- uploadId,
31
- blockNumber,
32
- chunkSize: chunk.length,
33
- currentPointer: pointer,
34
- fileSize: -1,
35
- stage: blockNumber === 0 ? "starting" : "continue",
36
- totalBlocks: -1,
37
- });
38
- if (blockNumber === 0) {
39
- pointer = await fileRef.startUpload(uploadId, chunk);
40
- }
41
- else {
42
- pointer = await fileRef.continueUpload(uploadId, pointer, chunk);
43
- }
44
- }
45
- progress({ uploadId, blockNumber, chunkSize: -1, currentPointer: -1, fileSize: -1, stage: "finishing", totalBlocks: -1 });
46
- return await fileRef.finishUpload(uploadId, pointer, Buffer.from([]));
47
- }),
48
- });
49
- extendFactory(Files, {
50
- /**
51
- * Uploads a file. Not supported for batching
52
- *
53
- * @param url The folder-relative url of the file
54
- * @param content The Blob file content or File readable stream to add
55
- * @param progress A callback function which can be used to track the progress of the upload
56
- * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
57
- * @param chunkSize The size of each file slice, in bytes (default: 10485760)
58
- * @returns The new File and the raw response.
59
- */
60
- addChunked: asCancelableScope(async function (url, content, progress, shouldOverWrite = true, chunkSize = 10485760) {
61
- const response = await spPost(Files(this, `add(overwrite=${shouldOverWrite},url='${encodePath(url)}')`));
62
- const file = fileFromServerRelativePath(this, response.ServerRelativeUrl);
63
- file.using(CancelAction(async () => {
64
- return File(file).delete();
65
- }));
66
- if ("function" === typeof content.read) {
67
- return file.setStreamContentChunked(content, progress);
68
- }
69
- return file.setContentChunked(content, progress, chunkSize);
70
- }),
71
- });
1
+ export {};
2
+ // extendFactory(File, {
3
+ // getStream(): Promise<IResponseBodyStream> {
4
+ // return File(this, "$value").using(StreamParse())(headers({ "binaryStringResponseBody": "true" }));
5
+ // },
6
+ // /**
7
+ // * Sets the contents of a file using a chunked upload approach. Not supported in batching.
8
+ // *
9
+ // * @param stream The file to upload (as readable stream)
10
+ // * @param progress A callback function which can be used to track the progress of the upload
11
+ // */
12
+ // setStreamContentChunked: asCancelableScope(async function (this: IFile, stream: ReadStream, progress?: (data: IFileUploadProgressData) => void): Promise<IFileAddResult> {
13
+ // if (!isFunc(progress)) {
14
+ // progress = () => void (0);
15
+ // }
16
+ // const uploadId = getGUID();
17
+ // const fileRef = File(this).using(CancelAction(() => {
18
+ // return File(this).cancelUpload(uploadId);
19
+ // }));
20
+ // let blockNumber = -1;
21
+ // let pointer = 0;
22
+ // for await (const chunk of stream) {
23
+ // blockNumber++;
24
+ // progress({
25
+ // uploadId,
26
+ // blockNumber,
27
+ // chunkSize: chunk.length,
28
+ // currentPointer: pointer,
29
+ // fileSize: -1,
30
+ // stage: blockNumber === 0 ? "starting" : "continue",
31
+ // totalBlocks: -1,
32
+ // });
33
+ // if (blockNumber === 0) {
34
+ // pointer = await fileRef.startUpload(uploadId, chunk);
35
+ // } else {
36
+ // pointer = await fileRef.continueUpload(uploadId, pointer, chunk);
37
+ // }
38
+ // }
39
+ // progress({ uploadId, blockNumber, chunkSize: -1, currentPointer: -1, fileSize: -1, stage: "finishing", totalBlocks: -1 });
40
+ // return await fileRef.finishUpload(uploadId, pointer, Buffer.from([]));
41
+ // }),
42
+ // });
43
+ // extendFactory(Files, {
44
+ // /**
45
+ // * Uploads a file. Not supported for batching
46
+ // *
47
+ // * @param url The folder-relative url of the file
48
+ // * @param content The Blob file content or File readable stream to add
49
+ // * @param progress A callback function which can be used to track the progress of the upload
50
+ // * @param shouldOverWrite Should a file with the same name in the same location be overwritten? (default: true)
51
+ // * @param chunkSize The size of each file slice, in bytes (default: 10485760)
52
+ // * @returns The new File and the raw response.
53
+ // */
54
+ // addChunked: asCancelableScope(async function (
55
+ // this: IFiles,
56
+ // url: string,
57
+ // content: Blob | ReadStream,
58
+ // progress?: (data: IFileUploadProgressData) => void,
59
+ // shouldOverWrite = true,
60
+ // chunkSize = 10485760
61
+ // ) {
62
+ // const response = await spPost(Files(this, `add(overwrite=${shouldOverWrite},url='${encodePath(url)}')`));
63
+ // const file = fileFromServerRelativePath(this, response.ServerRelativeUrl);
64
+ // file.using(CancelAction(async () => {
65
+ // return File(file).delete();
66
+ // }));
67
+ // if ("function" === typeof (content as ReadStream).read) {
68
+ // return file.setStreamContentChunked(content as ReadStream, progress);
69
+ // }
70
+ // return file.setContentChunked(content as Blob, progress, chunkSize);
71
+ // }),
72
+ // });
73
+ // // these are needed to avoid a type/name not found issue where TSC doesn't properly keep
74
+ // // the references used within the module declarations below
75
+ // type ProgressFunc = (data: IFileUploadProgressData) => void;
76
+ // type ChunkedResult = Promise<IFileAddResult>;
77
+ // declare module "@pnp/sp/files/types" {
78
+ // interface IFile {
79
+ // /**
80
+ // * Gets a PassThrough stream representing the file
81
+ // */
82
+ // getStream(): Promise<IResponseBodyStream>;
83
+ // /**
84
+ // * Sets a file stream content chunk
85
+ // */
86
+ // setStreamContentChunked(
87
+ // stream: ReadStream,
88
+ // progress?: ProgressFunc,
89
+ // ): ChunkedResult;
90
+ // }
91
+ // interface IFiles {
92
+ // /**
93
+ // * Adds a file stream in chunks
94
+ // */
95
+ // addChunked(
96
+ // url: string,
97
+ // content: Blob | ReadStream,
98
+ // progress?: ProgressFunc,
99
+ // shouldOverWrite?: boolean,
100
+ // chunkSize?: number,
101
+ // ): ChunkedResult;
102
+ // }
103
+ // }
72
104
  //# sourceMappingURL=stream.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../../packages/nodejs/sp-extensions/stream.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,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AAC,YAAY,CAAC,KAAK,IAAI,EAAE;YAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC;QAC/B,CAAC,CAAC,CAAC,CAAC;QAEJ,IAAI,UAAU,KAAK,OAAQ,OAAsB,CAAC,IAAI,EAAE;YACpD,OAAO,IAAI,CAAC,uBAAuB,CAAC,OAAqB,EAAE,QAAQ,CAAC,CAAC;SACxE;QAED,OAAO,IAAI,CAAC,iBAAiB,CAAC,OAAe,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;IACxE,CAAC,CAAC;CACL,CAAC,CAAC"}
1
+ {"version":3,"file":"stream.js","sourceRoot":"","sources":["../../../../packages/nodejs/sp-extensions/stream.ts"],"names":[],"mappings":";AAcA,wBAAwB;AAExB,kDAAkD;AAClD,6GAA6G;AAC7G,SAAS;AAET,UAAU;AACV,iGAAiG;AACjG,SAAS;AACT,+DAA+D;AAC/D,mGAAmG;AACnG,UAAU;AACV,iLAAiL;AAEjL,mCAAmC;AACnC,yCAAyC;AACzC,YAAY;AAEZ,sCAAsC;AAEtC,gEAAgE;AAChE,wDAAwD;AACxD,eAAe;AAEf,gCAAgC;AAChC,2BAA2B;AAE3B,8CAA8C;AAC9C,6BAA6B;AAC7B,yBAAyB;AACzB,4BAA4B;AAC5B,+BAA+B;AAC/B,2CAA2C;AAC3C,2CAA2C;AAC3C,gCAAgC;AAChC,sEAAsE;AACtE,mCAAmC;AACnC,kBAAkB;AAClB,uCAAuC;AACvC,wEAAwE;AACxE,uBAAuB;AACvB,oFAAoF;AACpF,gBAAgB;AAChB,YAAY;AAEZ,qIAAqI;AACrI,iFAAiF;AACjF,UAAU;AACV,MAAM;AAEN,yBAAyB;AAEzB,UAAU;AACV,oDAAoD;AACpD,SAAS;AACT,wDAAwD;AACxD,6EAA6E;AAC7E,mGAAmG;AACnG,sHAAsH;AACtH,oFAAoF;AACpF,qDAAqD;AACrD,UAAU;AACV,qDAAqD;AACrD,wBAAwB;AACxB,uBA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