microsoft-graph 3.8.0 → 3.9.1
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/dist/cjs/operations/driveItem/createDriveItemContent.d.ts +10 -2
- package/dist/cjs/operations/driveItem/createDriveItemContent.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/createDriveItemContent.js +5 -12
- package/dist/cjs/services/iteration.d.ts +6 -6
- package/dist/cjs/services/iteration.d.ts.map +1 -1
- package/dist/cjs/services/iteration.js +7 -7
- package/dist/esm/operations/driveItem/createDriveItemContent.d.ts +10 -2
- package/dist/esm/operations/driveItem/createDriveItemContent.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/createDriveItemContent.js +5 -12
- package/dist/esm/services/iteration.d.ts +6 -6
- package/dist/esm/services/iteration.d.ts.map +1 -1
- package/dist/esm/services/iteration.js +5 -5
- package/docs/api/Iteration.md +22 -13
- package/docs/api/README.md +1 -1
- package/docs/api/createDriveItemContent.md +82 -17
- package/package.json +1 -1
|
@@ -12,10 +12,18 @@ import type { DriveItemPath, DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
12
12
|
* @param itemPath Path (including the filename) for the new drive item within the given parent.
|
|
13
13
|
* @param contentStream A Node.js readable stream containing the file content.
|
|
14
14
|
* @param totalSize The total size in bytes of the content to be uploaded.
|
|
15
|
-
* @param
|
|
15
|
+
* @param options Optional. Additional options for the upload operation.
|
|
16
|
+
* @param options.conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
|
|
17
|
+
* @param options.chunkSize Optional. The size of each chunk to be uploaded in bytes. Default is 10MB.
|
|
18
|
+
* @param options.progress Optional. A callback function that is called periodically with the upload progress as a percentage.
|
|
16
19
|
* @returns The newly created drive item.
|
|
17
20
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
|
|
18
21
|
* @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
|
|
19
22
|
*/
|
|
20
|
-
export
|
|
23
|
+
export interface CreateDriveItemContentOptions {
|
|
24
|
+
conflictBehavior?: "fail" | "replace" | "rename";
|
|
25
|
+
chunkSize?: number;
|
|
26
|
+
progress?: (pct: number) => void;
|
|
27
|
+
}
|
|
28
|
+
export default function createDriveItemContent(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath, contentStream: NodeJS.ReadableStream, totalSize: number, options?: CreateDriveItemContentOptions): Promise<DriveItem & DriveItemRef>;
|
|
21
29
|
//# sourceMappingURL=createDriveItemContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB1F
|
|
1
|
+
{"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB1F;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAwGzP"}
|
|
@@ -15,18 +15,8 @@ const http_ts_1 = require("../../services/http.js");
|
|
|
15
15
|
const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
|
|
16
16
|
const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
17
17
|
const defaultChunkSize = 10 * 1024 * 1024;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
* @param parentRef Reference to the parent drive or folder where the drive item will be created.
|
|
21
|
-
* @param itemPath Path (including the filename) for the new drive item within the given parent.
|
|
22
|
-
* @param contentStream A Node.js readable stream containing the file content.
|
|
23
|
-
* @param totalSize The total size in bytes of the content to be uploaded.
|
|
24
|
-
* @param conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
|
|
25
|
-
* @returns The newly created drive item.
|
|
26
|
-
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
|
|
27
|
-
* @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
|
|
28
|
-
*/
|
|
29
|
-
async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, conflictBehavior = "fail", chunkSize = defaultChunkSize) {
|
|
18
|
+
async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, options = {}) {
|
|
19
|
+
const { conflictBehavior = "fail", chunkSize = defaultChunkSize, progress } = options;
|
|
30
20
|
const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
|
|
31
21
|
const uploadSessionUrl = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/createUploadSession`, parentRef)}`;
|
|
32
22
|
const accessToken = await parentRef.context.generateAccessToken();
|
|
@@ -78,6 +68,9 @@ async function createDriveItemContent(parentRef, itemPath, contentStream, totalS
|
|
|
78
68
|
responseType: "json",
|
|
79
69
|
});
|
|
80
70
|
position += thisChunk.length;
|
|
71
|
+
if (progress && totalSize > 0) {
|
|
72
|
+
progress(Math.min(100, (position / totalSize) * 100));
|
|
73
|
+
}
|
|
81
74
|
currentChunk = currentChunk.subarray(chunkSize);
|
|
82
75
|
if (isDriveItem(res)) {
|
|
83
76
|
driveItem = res;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utilities for iterating over AsyncIterables.
|
|
3
|
+
* Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item.
|
|
3
4
|
* @module Iteration
|
|
4
5
|
* @category Services
|
|
6
|
+
* @template TIn The type of items in the input iterable.
|
|
7
|
+
* @template TOut The type of items in the resulting array (after conversion).
|
|
8
|
+
* @param {Iterable<TIn> | AsyncIterable<TIn>} iterable - The iterable or async iterable to collect items from.
|
|
9
|
+
* @returns {Promise<TOut[]>} A promise that resolves to an array of collected (and possibly converted) items.
|
|
5
10
|
*/
|
|
6
|
-
|
|
7
|
-
* Iterate over an AsyncIterable and collect all items into an array.
|
|
8
|
-
* @param iterable
|
|
9
|
-
* @returns Array of items collected from the iterable.
|
|
10
|
-
*/
|
|
11
|
-
export declare function iterateToArray<T, U = T>(iterable: AsyncIterable<T>, converter?: (item: T) => U): Promise<U[]>;
|
|
11
|
+
export declare function iterateToArray<TIn, TOut = TIn>(iterable: Iterable<TIn> | AsyncIterable<TIn>, converter?: (item: TIn) => TOut): Promise<TOut[]>;
|
|
12
12
|
//# sourceMappingURL=iteration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration.d.ts","sourceRoot":"","sources":["../../../src/services/iteration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"iteration.d.ts","sourceRoot":"","sources":["../../../src/services/iteration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAMpJ"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.iterateToArray = iterateToArray;
|
|
2
4
|
/**
|
|
3
5
|
* Utilities for iterating over AsyncIterables.
|
|
6
|
+
* Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item.
|
|
4
7
|
* @module Iteration
|
|
5
8
|
* @category Services
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
* Iterate over an AsyncIterable and collect all items into an array.
|
|
11
|
-
* @param iterable
|
|
12
|
-
* @returns Array of items collected from the iterable.
|
|
9
|
+
* @template TIn The type of items in the input iterable.
|
|
10
|
+
* @template TOut The type of items in the resulting array (after conversion).
|
|
11
|
+
* @param {Iterable<TIn> | AsyncIterable<TIn>} iterable - The iterable or async iterable to collect items from.
|
|
12
|
+
* @returns {Promise<TOut[]>} A promise that resolves to an array of collected (and possibly converted) items.
|
|
13
13
|
*/
|
|
14
14
|
async function iterateToArray(iterable, converter) {
|
|
15
15
|
const result = [];
|
|
@@ -12,10 +12,18 @@ import type { DriveItemPath, DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
12
12
|
* @param itemPath Path (including the filename) for the new drive item within the given parent.
|
|
13
13
|
* @param contentStream A Node.js readable stream containing the file content.
|
|
14
14
|
* @param totalSize The total size in bytes of the content to be uploaded.
|
|
15
|
-
* @param
|
|
15
|
+
* @param options Optional. Additional options for the upload operation.
|
|
16
|
+
* @param options.conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
|
|
17
|
+
* @param options.chunkSize Optional. The size of each chunk to be uploaded in bytes. Default is 10MB.
|
|
18
|
+
* @param options.progress Optional. A callback function that is called periodically with the upload progress as a percentage.
|
|
16
19
|
* @returns The newly created drive item.
|
|
17
20
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
|
|
18
21
|
* @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
|
|
19
22
|
*/
|
|
20
|
-
export
|
|
23
|
+
export interface CreateDriveItemContentOptions {
|
|
24
|
+
conflictBehavior?: "fail" | "replace" | "rename";
|
|
25
|
+
chunkSize?: number;
|
|
26
|
+
progress?: (pct: number) => void;
|
|
27
|
+
}
|
|
28
|
+
export default function createDriveItemContent(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath, contentStream: NodeJS.ReadableStream, totalSize: number, options?: CreateDriveItemContentOptions): Promise<DriveItem & DriveItemRef>;
|
|
21
29
|
//# sourceMappingURL=createDriveItemContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB1F
|
|
1
|
+
{"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAkB1F;;;;;;;;;;;;;GAaG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAC;IACjD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAwGzP"}
|
|
@@ -9,18 +9,8 @@ import { execute } from "../../services/http.js";
|
|
|
9
9
|
import { endpoint } from "../../services/operationInvoker.js";
|
|
10
10
|
import { generatePath } from "../../services/templatedPaths.js";
|
|
11
11
|
const defaultChunkSize = 10 * 1024 * 1024;
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
* @param parentRef Reference to the parent drive or folder where the drive item will be created.
|
|
15
|
-
* @param itemPath Path (including the filename) for the new drive item within the given parent.
|
|
16
|
-
* @param contentStream A Node.js readable stream containing the file content.
|
|
17
|
-
* @param totalSize The total size in bytes of the content to be uploaded.
|
|
18
|
-
* @param conflictBehavior Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
|
|
19
|
-
* @returns The newly created drive item.
|
|
20
|
-
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
|
|
21
|
-
* @see https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
|
|
22
|
-
*/
|
|
23
|
-
export default async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, conflictBehavior = "fail", chunkSize = defaultChunkSize) {
|
|
12
|
+
export default async function createDriveItemContent(parentRef, itemPath, contentStream, totalSize, options = {}) {
|
|
13
|
+
const { conflictBehavior = "fail", chunkSize = defaultChunkSize, progress } = options;
|
|
24
14
|
const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
|
|
25
15
|
const uploadSessionUrl = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/createUploadSession`, parentRef)}`;
|
|
26
16
|
const accessToken = await parentRef.context.generateAccessToken();
|
|
@@ -72,6 +62,9 @@ export default async function createDriveItemContent(parentRef, itemPath, conten
|
|
|
72
62
|
responseType: "json",
|
|
73
63
|
});
|
|
74
64
|
position += thisChunk.length;
|
|
65
|
+
if (progress && totalSize > 0) {
|
|
66
|
+
progress(Math.min(100, (position / totalSize) * 100));
|
|
67
|
+
}
|
|
75
68
|
currentChunk = currentChunk.subarray(chunkSize);
|
|
76
69
|
if (isDriveItem(res)) {
|
|
77
70
|
driveItem = res;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utilities for iterating over AsyncIterables.
|
|
3
|
+
* Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item.
|
|
3
4
|
* @module Iteration
|
|
4
5
|
* @category Services
|
|
6
|
+
* @template TIn The type of items in the input iterable.
|
|
7
|
+
* @template TOut The type of items in the resulting array (after conversion).
|
|
8
|
+
* @param {Iterable<TIn> | AsyncIterable<TIn>} iterable - The iterable or async iterable to collect items from.
|
|
9
|
+
* @returns {Promise<TOut[]>} A promise that resolves to an array of collected (and possibly converted) items.
|
|
5
10
|
*/
|
|
6
|
-
|
|
7
|
-
* Iterate over an AsyncIterable and collect all items into an array.
|
|
8
|
-
* @param iterable
|
|
9
|
-
* @returns Array of items collected from the iterable.
|
|
10
|
-
*/
|
|
11
|
-
export declare function iterateToArray<T, U = T>(iterable: AsyncIterable<T>, converter?: (item: T) => U): Promise<U[]>;
|
|
11
|
+
export declare function iterateToArray<TIn, TOut = TIn>(iterable: Iterable<TIn> | AsyncIterable<TIn>, converter?: (item: TIn) => TOut): Promise<TOut[]>;
|
|
12
12
|
//# sourceMappingURL=iteration.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iteration.d.ts","sourceRoot":"","sources":["../../../src/services/iteration.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"iteration.d.ts","sourceRoot":"","sources":["../../../src/services/iteration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,cAAc,CAAC,GAAG,EAAE,IAAI,GAAG,GAAG,EAAE,QAAQ,EAAE,QAAQ,CAAC,GAAG,CAAC,GAAG,aAAa,CAAC,GAAG,CAAC,EAAE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,CAMpJ"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Utilities for iterating over AsyncIterables.
|
|
3
|
+
* Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item.
|
|
3
4
|
* @module Iteration
|
|
4
5
|
* @category Services
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
9
|
-
* @returns Array of items collected from the iterable.
|
|
6
|
+
* @template TIn The type of items in the input iterable.
|
|
7
|
+
* @template TOut The type of items in the resulting array (after conversion).
|
|
8
|
+
* @param {Iterable<TIn> | AsyncIterable<TIn>} iterable - The iterable or async iterable to collect items from.
|
|
9
|
+
* @returns {Promise<TOut[]>} A promise that resolves to an array of collected (and possibly converted) items.
|
|
10
10
|
*/
|
|
11
11
|
export async function iterateToArray(iterable, converter) {
|
|
12
12
|
const result = [];
|
package/docs/api/Iteration.md
CHANGED
|
@@ -3,33 +3,42 @@
|
|
|
3
3
|
# Iteration
|
|
4
4
|
|
|
5
5
|
Utilities for iterating over AsyncIterables.
|
|
6
|
+
Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item.
|
|
7
|
+
|
|
8
|
+
## Template
|
|
9
|
+
|
|
10
|
+
The type of items in the input iterable.
|
|
11
|
+
|
|
12
|
+
## Template
|
|
13
|
+
|
|
14
|
+
The type of items in the resulting array (after conversion).
|
|
15
|
+
|
|
16
|
+
## Param
|
|
17
|
+
|
|
18
|
+
The iterable or async iterable to collect items from.
|
|
6
19
|
|
|
7
20
|
## Functions
|
|
8
21
|
|
|
9
22
|
### iterateToArray()
|
|
10
23
|
|
|
11
|
-
> **iterateToArray**\<`
|
|
12
|
-
|
|
13
|
-
Defined in: [src/services/iteration.ts:12](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/iteration.ts#L12)
|
|
24
|
+
> **iterateToArray**\<`TIn`, `TOut`\>(`iterable`, `converter?`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TOut`[]\>
|
|
14
25
|
|
|
15
|
-
|
|
26
|
+
Defined in: [src/services/iteration.ts:11](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/iteration.ts#L11)
|
|
16
27
|
|
|
17
28
|
#### Type Parameters
|
|
18
29
|
|
|
19
30
|
| Type Parameter | Default type |
|
|
20
31
|
| ------ | ------ |
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
32
|
+
| `TIn` | - |
|
|
33
|
+
| `TOut` | `TIn` |
|
|
23
34
|
|
|
24
35
|
#### Parameters
|
|
25
36
|
|
|
26
|
-
| Parameter | Type |
|
|
27
|
-
| ------ | ------ |
|
|
28
|
-
| `iterable` | `AsyncIterable`\<`
|
|
29
|
-
| `converter?` | (`item`) => `
|
|
37
|
+
| Parameter | Type |
|
|
38
|
+
| ------ | ------ |
|
|
39
|
+
| `iterable` | [`Iterable`](https://www.typescriptlang.org/docs/handbook/iterators-and-generators.html#iterable-interface)\<`TIn`, `any`, `any`\> \| `AsyncIterable`\<`TIn`, `any`, `any`\> |
|
|
40
|
+
| `converter?` | (`item`) => `TOut` |
|
|
30
41
|
|
|
31
42
|
#### Returns
|
|
32
43
|
|
|
33
|
-
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`
|
|
34
|
-
|
|
35
|
-
Array of items collected from the iterable.
|
|
44
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`TOut`[]\>
|
package/docs/api/README.md
CHANGED
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
| [error](error.md) | Utilities for handling errors |
|
|
165
165
|
| [http](http.md) | HTTP request utilities for Microsoft Graph API, with proxy support. |
|
|
166
166
|
| [httpStatus](httpStatus.md) | Utilities for analyzing HTTP status codes for Microsoft Graph API responses. |
|
|
167
|
-
| [Iteration](Iteration.md) | Utilities for iterating over AsyncIterables. |
|
|
167
|
+
| [Iteration](Iteration.md) | Utilities for iterating over AsyncIterables. Collects all items from an Iterable or AsyncIterable into an array, optionally converting each item. |
|
|
168
168
|
| [objectMapping](objectMapping.md) | Automated conversion of rows to objects and vice versa based on defined mapping rules. |
|
|
169
169
|
| [operationId](operationId.md) | Utilities for converting between operation IDs and indexes. |
|
|
170
170
|
| [operationInvoker](operationInvoker.md) | Invoke operations, potentially as parallel or sequential batches. |
|
|
@@ -4,34 +4,99 @@
|
|
|
4
4
|
|
|
5
5
|
Creates a new drive item in the specified parent drive or folder using a stream as content.
|
|
6
6
|
|
|
7
|
-
##
|
|
8
|
-
|
|
9
|
-
### createDriveItemContent()
|
|
7
|
+
## Interfaces
|
|
10
8
|
|
|
11
|
-
|
|
9
|
+
### CreateDriveItemContentOptions
|
|
12
10
|
|
|
13
|
-
Defined in: [src/operations/driveItem/createDriveItemContent.ts:
|
|
11
|
+
Defined in: [src/operations/driveItem/createDriveItemContent.ts:42](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/createDriveItemContent.ts#L42)
|
|
14
12
|
|
|
15
13
|
Creates a new drive item in the specified parent drive or folder using a stream as content.
|
|
16
14
|
|
|
17
|
-
####
|
|
15
|
+
#### Param
|
|
18
16
|
|
|
19
|
-
|
|
20
|
-
| ------ | ------ | ------ | ------ |
|
|
21
|
-
| `parentRef` | [`DriveRef`](Drive-1.md#driveref) \| [`DriveItemRef`](DriveItem-1.md#driveitemref) | `undefined` | Reference to the parent drive or folder where the drive item will be created. |
|
|
22
|
-
| `itemPath` | [`DriveItemPath`](DriveItem-1.md#driveitempath) | `undefined` | Path (including the filename) for the new drive item within the given parent. |
|
|
23
|
-
| `contentStream` | [`ReadableStream`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/globals.d.ts#L202) | `undefined` | A Node.js readable stream containing the file content. |
|
|
24
|
-
| `totalSize` | `number` | `undefined` | The total size in bytes of the content to be uploaded. |
|
|
25
|
-
| `conflictBehavior` | `"replace"` \| `"fail"` \| `"rename"` | `"fail"` | Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'. |
|
|
26
|
-
| `chunkSize` | `number` | `defaultChunkSize` | - |
|
|
17
|
+
Reference to the parent drive or folder where the drive item will be created.
|
|
27
18
|
|
|
28
|
-
####
|
|
19
|
+
#### Param
|
|
29
20
|
|
|
30
|
-
|
|
21
|
+
Path (including the filename) for the new drive item within the given parent.
|
|
22
|
+
|
|
23
|
+
#### Param
|
|
24
|
+
|
|
25
|
+
A Node.js readable stream containing the file content.
|
|
26
|
+
|
|
27
|
+
#### Param
|
|
28
|
+
|
|
29
|
+
The total size in bytes of the content to be uploaded.
|
|
30
|
+
|
|
31
|
+
#### Param
|
|
31
32
|
|
|
32
|
-
|
|
33
|
+
Optional. Additional options for the upload operation.
|
|
34
|
+
|
|
35
|
+
#### Param
|
|
36
|
+
|
|
37
|
+
Optional. Specifies how to handle conflicts if the file already exists. Default is 'fail'.
|
|
38
|
+
|
|
39
|
+
#### Param
|
|
40
|
+
|
|
41
|
+
Optional. The size of each chunk to be uploaded in bytes. Default is 10MB.
|
|
42
|
+
|
|
43
|
+
#### Param
|
|
44
|
+
|
|
45
|
+
Optional. A callback function that is called periodically with the upload progress as a percentage.
|
|
33
46
|
|
|
34
47
|
#### See
|
|
35
48
|
|
|
36
49
|
- https://learn.microsoft.com/en-us/graph/api/driveitem-createuploadsession
|
|
37
50
|
- https://learn.microsoft.com/en-us/graph/api/resources/uploadsession
|
|
51
|
+
|
|
52
|
+
#### Properties
|
|
53
|
+
|
|
54
|
+
##### chunkSize?
|
|
55
|
+
|
|
56
|
+
> `optional` **chunkSize**: `number`
|
|
57
|
+
|
|
58
|
+
Defined in: [src/operations/driveItem/createDriveItemContent.ts:44](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/createDriveItemContent.ts#L44)
|
|
59
|
+
|
|
60
|
+
##### conflictBehavior?
|
|
61
|
+
|
|
62
|
+
> `optional` **conflictBehavior**: `"replace"` \| `"fail"` \| `"rename"`
|
|
63
|
+
|
|
64
|
+
Defined in: [src/operations/driveItem/createDriveItemContent.ts:43](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/createDriveItemContent.ts#L43)
|
|
65
|
+
|
|
66
|
+
##### progress()?
|
|
67
|
+
|
|
68
|
+
> `optional` **progress**: (`pct`) => `void`
|
|
69
|
+
|
|
70
|
+
Defined in: [src/operations/driveItem/createDriveItemContent.ts:45](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/createDriveItemContent.ts#L45)
|
|
71
|
+
|
|
72
|
+
###### Parameters
|
|
73
|
+
|
|
74
|
+
| Parameter | Type |
|
|
75
|
+
| ------ | ------ |
|
|
76
|
+
| `pct` | `number` |
|
|
77
|
+
|
|
78
|
+
###### Returns
|
|
79
|
+
|
|
80
|
+
`void`
|
|
81
|
+
|
|
82
|
+
## Functions
|
|
83
|
+
|
|
84
|
+
### createDriveItemContent()
|
|
85
|
+
|
|
86
|
+
> **createDriveItemContent**(`parentRef`, `itemPath`, `contentStream`, `totalSize`, `options`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`DriveItem` & [`SiteRef`](Site-1.md#siteref) & `object` & `object`\>
|
|
87
|
+
|
|
88
|
+
Defined in: [src/operations/driveItem/createDriveItemContent.ts:48](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/createDriveItemContent.ts#L48)
|
|
89
|
+
|
|
90
|
+
#### Parameters
|
|
91
|
+
|
|
92
|
+
| Parameter | Type |
|
|
93
|
+
| ------ | ------ |
|
|
94
|
+
| `parentRef` | [`DriveRef`](Drive-1.md#driveref) \| [`DriveItemRef`](DriveItem-1.md#driveitemref) |
|
|
95
|
+
| `itemPath` | [`DriveItemPath`](DriveItem-1.md#driveitempath) |
|
|
96
|
+
| `contentStream` | [`ReadableStream`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/globals.d.ts#L202) |
|
|
97
|
+
| `totalSize` | `number` |
|
|
98
|
+
| `options` | [`CreateDriveItemContentOptions`](#createdriveitemcontentoptions) |
|
|
99
|
+
|
|
100
|
+
#### Returns
|
|
101
|
+
|
|
102
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`DriveItem` & [`SiteRef`](Site-1.md#siteref) & `object` & `object`\>
|