microsoft-graph 3.9.4 → 3.9.6
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/CODEOWNERS +1 -0
- package/dist/cjs/operations/driveItem/createDriveItemContent.js +2 -2
- package/dist/cjs/operations/driveItem/getDriveItemByPath.d.ts +2 -2
- package/dist/cjs/operations/driveItem/getDriveItemByPath.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/getDriveItemByPath.js +14 -6
- package/dist/cjs/operations/driveItem/streamDriveItemContent.d.ts +2 -1
- package/dist/cjs/operations/driveItem/streamDriveItemContent.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/createDriveItemContent.js +1 -1
- package/dist/esm/operations/driveItem/getDriveItemByPath.d.ts +2 -2
- package/dist/esm/operations/driveItem/getDriveItemByPath.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/getDriveItemByPath.js +14 -6
- package/dist/esm/operations/driveItem/streamDriveItemContent.d.ts +2 -1
- package/dist/esm/operations/driveItem/streamDriveItemContent.d.ts.map +1 -1
- package/docs/api/getDriveItemByPath.md +2 -2
- package/docs/api/streamDriveItemContent.md +3 -3
- package/package.json +1 -1
package/CODEOWNERS
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
* @benfsai
|
|
@@ -10,7 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.chunkSizeMultiple = void 0;
|
|
12
12
|
exports.default = createDriveItemContent;
|
|
13
|
-
const
|
|
13
|
+
const node_path_1 = require("node:path");
|
|
14
14
|
const InvalidArgumentError_ts_1 = __importDefault(require("../../errors/InvalidArgumentError.js"));
|
|
15
15
|
const ProtocolError_ts_1 = __importDefault(require("../../errors/ProtocolError.js"));
|
|
16
16
|
const driveItem_ts_1 = require("../../services/driveItem.js");
|
|
@@ -46,7 +46,7 @@ async function createDriveItemContent(parentRef, itemPath, contentStream, conten
|
|
|
46
46
|
const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
|
|
47
47
|
const uploadSessionUrl = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/createUploadSession`, parentRef)}`;
|
|
48
48
|
const accessToken = await parentRef.context.generateAccessToken();
|
|
49
|
-
const fileName = (0,
|
|
49
|
+
const fileName = (0, node_path_1.basename)(itemPath);
|
|
50
50
|
const { uploadUrl } = await (0, http_ts_1.execute)({
|
|
51
51
|
url: uploadSessionUrl,
|
|
52
52
|
method: "POST",
|
|
@@ -9,10 +9,10 @@ import type { DriveItemPath, DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
9
9
|
import type { GraphOperation } from "../../models/GraphOperation.ts";
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve the metadata for an item in a drive by file path.
|
|
12
|
-
* @param
|
|
12
|
+
* @param parentRef Reference to the drive or drive item containing the item.
|
|
13
13
|
* @param itemPath Path of the item within the drive.
|
|
14
14
|
* @returns The metadata of the specified drive item, including its reference information.
|
|
15
15
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get
|
|
16
16
|
*/
|
|
17
|
-
export default function getDriveItemByPath(
|
|
17
|
+
export default function getDriveItemByPath(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath): GraphOperation<DriveItem & DriveItemRef>;
|
|
18
18
|
//# sourceMappingURL=getDriveItemByPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.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;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.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;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA8BhJ"}
|
|
@@ -15,25 +15,33 @@ const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
|
|
|
15
15
|
const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
16
16
|
/**
|
|
17
17
|
* Retrieve the metadata for an item in a drive by file path.
|
|
18
|
-
* @param
|
|
18
|
+
* @param parentRef Reference to the drive or drive item containing the item.
|
|
19
19
|
* @param itemPath Path of the item within the drive.
|
|
20
20
|
* @returns The metadata of the specified drive item, including its reference information.
|
|
21
21
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get
|
|
22
22
|
*/
|
|
23
|
-
function getDriveItemByPath(
|
|
23
|
+
function getDriveItemByPath(parentRef, itemPath) {
|
|
24
24
|
if (!itemPath.startsWith("/")) {
|
|
25
25
|
throw new InvalidArgumentError_ts_1.default("itemPath must start with a forward slash (/)");
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
let normalizedPath;
|
|
28
|
+
if ("id" in parentRef) {
|
|
29
|
+
// parentRef is a DriveItemRef
|
|
30
|
+
normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${itemPath}`;
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
// parentRef is a DriveRef
|
|
34
|
+
normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${itemPath}`;
|
|
35
|
+
}
|
|
28
36
|
return (0, operationInvoker_ts_1.operation)({
|
|
29
|
-
context:
|
|
37
|
+
context: parentRef.context,
|
|
30
38
|
method: "GET",
|
|
31
|
-
path: (0, templatedPaths_ts_1.generatePath)(normalizedPath,
|
|
39
|
+
path: (0, templatedPaths_ts_1.generatePath)(normalizedPath, parentRef),
|
|
32
40
|
headers: {},
|
|
33
41
|
body: null,
|
|
34
42
|
responseTransform: (response) => {
|
|
35
43
|
const item = response;
|
|
36
|
-
const itemRef = (0, driveItem_ts_1.createDriveItemRef)(
|
|
44
|
+
const itemRef = (0, driveItem_ts_1.createDriveItemRef)(parentRef, item.id);
|
|
37
45
|
return {
|
|
38
46
|
...item,
|
|
39
47
|
...itemRef,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module streamDriveItemContent
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
|
+
import type { Readable } from "node:stream";
|
|
6
7
|
import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
7
8
|
/**
|
|
8
9
|
* Stream the content of a drive item.
|
|
@@ -12,5 +13,5 @@ import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
12
13
|
* @throws Error if the download fails or the response is not a stream.
|
|
13
14
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get-content
|
|
14
15
|
*/
|
|
15
|
-
export default function streamDriveItemContent(itemRef: DriveItemRef): Promise<
|
|
16
|
+
export default function streamDriveItemContent(itemRef: DriveItemRef): Promise<Readable>;
|
|
16
17
|
//# sourceMappingURL=streamDriveItemContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAe7F"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* @module createDriveItemContent
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
|
-
import { basename } from "path";
|
|
6
|
+
import { basename } from "node:path";
|
|
7
7
|
import InvalidArgumentError from "../../errors/InvalidArgumentError.js";
|
|
8
8
|
import ProtocolError from "../../errors/ProtocolError.js";
|
|
9
9
|
import { createDriveItemRef } from "../../services/driveItem.js";
|
|
@@ -9,10 +9,10 @@ import type { DriveItemPath, DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
9
9
|
import type { GraphOperation } from "../../models/GraphOperation.ts";
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve the metadata for an item in a drive by file path.
|
|
12
|
-
* @param
|
|
12
|
+
* @param parentRef Reference to the drive or drive item containing the item.
|
|
13
13
|
* @param itemPath Path of the item within the drive.
|
|
14
14
|
* @returns The metadata of the specified drive item, including its reference information.
|
|
15
15
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get
|
|
16
16
|
*/
|
|
17
|
-
export default function getDriveItemByPath(
|
|
17
|
+
export default function getDriveItemByPath(parentRef: DriveRef | DriveItemRef, itemPath: DriveItemPath): GraphOperation<DriveItem & DriveItemRef>;
|
|
18
18
|
//# sourceMappingURL=getDriveItemByPath.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.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;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,
|
|
1
|
+
{"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.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;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA8BhJ"}
|
|
@@ -9,25 +9,33 @@ import { operation } from "../../services/operationInvoker.js";
|
|
|
9
9
|
import { generatePath } from "../../services/templatedPaths.js";
|
|
10
10
|
/**
|
|
11
11
|
* Retrieve the metadata for an item in a drive by file path.
|
|
12
|
-
* @param
|
|
12
|
+
* @param parentRef Reference to the drive or drive item containing the item.
|
|
13
13
|
* @param itemPath Path of the item within the drive.
|
|
14
14
|
* @returns The metadata of the specified drive item, including its reference information.
|
|
15
15
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get
|
|
16
16
|
*/
|
|
17
|
-
export default function getDriveItemByPath(
|
|
17
|
+
export default function getDriveItemByPath(parentRef, itemPath) {
|
|
18
18
|
if (!itemPath.startsWith("/")) {
|
|
19
19
|
throw new InvalidArgumentError("itemPath must start with a forward slash (/)");
|
|
20
20
|
}
|
|
21
|
-
|
|
21
|
+
let normalizedPath;
|
|
22
|
+
if ("id" in parentRef) {
|
|
23
|
+
// parentRef is a DriveItemRef
|
|
24
|
+
normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${itemPath}`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
// parentRef is a DriveRef
|
|
28
|
+
normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${itemPath}`;
|
|
29
|
+
}
|
|
22
30
|
return operation({
|
|
23
|
-
context:
|
|
31
|
+
context: parentRef.context,
|
|
24
32
|
method: "GET",
|
|
25
|
-
path: generatePath(normalizedPath,
|
|
33
|
+
path: generatePath(normalizedPath, parentRef),
|
|
26
34
|
headers: {},
|
|
27
35
|
body: null,
|
|
28
36
|
responseTransform: (response) => {
|
|
29
37
|
const item = response;
|
|
30
|
-
const itemRef = createDriveItemRef(
|
|
38
|
+
const itemRef = createDriveItemRef(parentRef, item.id);
|
|
31
39
|
return {
|
|
32
40
|
...item,
|
|
33
41
|
...itemRef,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module streamDriveItemContent
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
|
+
import type { Readable } from "node:stream";
|
|
6
7
|
import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
7
8
|
/**
|
|
8
9
|
* Stream the content of a drive item.
|
|
@@ -12,5 +13,5 @@ import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
|
12
13
|
* @throws Error if the download fails or the response is not a stream.
|
|
13
14
|
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-get-content
|
|
14
15
|
*/
|
|
15
|
-
export default function streamDriveItemContent(itemRef: DriveItemRef): Promise<
|
|
16
|
+
export default function streamDriveItemContent(itemRef: DriveItemRef): Promise<Readable>;
|
|
16
17
|
//# sourceMappingURL=streamDriveItemContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,
|
|
1
|
+
{"version":3,"file":"streamDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/streamDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAK9D;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAe7F"}
|
|
@@ -8,7 +8,7 @@ Retrieve the metadata for an item in a drive by file path.
|
|
|
8
8
|
|
|
9
9
|
### getDriveItemByPath()
|
|
10
10
|
|
|
11
|
-
> **getDriveItemByPath**(`
|
|
11
|
+
> **getDriveItemByPath**(`parentRef`, `itemPath`): [`GraphOperation`](GraphOperation.md#graphoperation)\<`DriveItem` & [`SiteRef`](Site-1.md#siteref) & `object` & `object`\>
|
|
12
12
|
|
|
13
13
|
Defined in: [src/operations/driveItem/getDriveItemByPath.ts:23](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/getDriveItemByPath.ts#L23)
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ Retrieve the metadata for an item in a drive by file path.
|
|
|
18
18
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| ------ | ------ | ------ |
|
|
21
|
-
| `
|
|
21
|
+
| `parentRef` | [`DriveRef`](Drive-1.md#driveref) \| [`DriveItemRef`](DriveItem-1.md#driveitemref) | Reference to the drive or drive item containing the item. |
|
|
22
22
|
| `itemPath` | [`DriveItemPath`](DriveItem-1.md#driveitempath) | Path of the item within the drive. |
|
|
23
23
|
|
|
24
24
|
#### Returns
|
|
@@ -8,9 +8,9 @@ Stream the content of a drive item as a Node.js readable stream.
|
|
|
8
8
|
|
|
9
9
|
### streamDriveItemContent()
|
|
10
10
|
|
|
11
|
-
> **streamDriveItemContent**(`itemRef`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`
|
|
11
|
+
> **streamDriveItemContent**(`itemRef`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Readable`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/stream.d.ts#L68)\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/operations/driveItem/streamDriveItemContent.ts:
|
|
13
|
+
Defined in: [src/operations/driveItem/streamDriveItemContent.ts:21](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/streamDriveItemContent.ts#L21)
|
|
14
14
|
|
|
15
15
|
Stream the content of a drive item.
|
|
16
16
|
|
|
@@ -22,7 +22,7 @@ Stream the content of a drive item.
|
|
|
22
22
|
|
|
23
23
|
#### Returns
|
|
24
24
|
|
|
25
|
-
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`
|
|
25
|
+
[`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<[`Readable`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/stream.d.ts#L68)\>
|
|
26
26
|
|
|
27
27
|
A Node.js readable stream of the drive item content.
|
|
28
28
|
|