microsoft-graph 3.3.0 → 3.4.0
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/services/driveItem.d.ts +7 -0
- package/dist/cjs/services/driveItem.d.ts.map +1 -1
- package/dist/cjs/services/driveItem.js +11 -0
- package/dist/esm/services/driveItem.d.ts +7 -0
- package/dist/esm/services/driveItem.d.ts.map +1 -1
- package/dist/esm/services/driveItem.js +10 -0
- package/docs/api/driveItem.md +28 -6
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module driveItem
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
+
import type { DriveItem } from "@microsoft/microsoft-graph-types";
|
|
6
7
|
import type { DriveRef } from "../models/Drive.ts";
|
|
7
8
|
import type { DriveItemId, DriveItemPath, DriveItemRef } from "../models/DriveItem.ts";
|
|
8
9
|
export declare const workbookFileExtension = "xlsx";
|
|
@@ -32,4 +33,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
|
|
|
32
33
|
folderPath: DriveItemPath;
|
|
33
34
|
fileName: string;
|
|
34
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Gets the file extension of a drive item.
|
|
38
|
+
* @param item Drive item.
|
|
39
|
+
* @returns File extension ie. "txt", "jpg"
|
|
40
|
+
*/
|
|
41
|
+
export declare function getDriveItemExtension(item: DriveItem): string;
|
|
35
42
|
//# sourceMappingURL=driveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAMvF,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAElD,eAAO,MAAM,iBAAiB,eAAqB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CAkClE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,YAAY,CAWpG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG;IAAE,UAAU,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAa3G;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAG7D"}
|
|
@@ -12,6 +12,8 @@ exports.rootDriveItemPath = exports.binaryWorkbookFileExtension = exports.workbo
|
|
|
12
12
|
exports.driveItemPath = driveItemPath;
|
|
13
13
|
exports.createDriveItemRef = createDriveItemRef;
|
|
14
14
|
exports.splitDriveItemPath = splitDriveItemPath;
|
|
15
|
+
exports.getDriveItemExtension = getDriveItemExtension;
|
|
16
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
15
17
|
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
16
18
|
const ProtocolError_ts_1 = __importDefault(require("../errors/ProtocolError.js"));
|
|
17
19
|
const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
|
|
@@ -87,3 +89,12 @@ function splitDriveItemPath(filePath) {
|
|
|
87
89
|
fileName,
|
|
88
90
|
};
|
|
89
91
|
}
|
|
92
|
+
/**
|
|
93
|
+
* Gets the file extension of a drive item.
|
|
94
|
+
* @param item Drive item.
|
|
95
|
+
* @returns File extension ie. "txt", "jpg"
|
|
96
|
+
*/
|
|
97
|
+
function getDriveItemExtension(item) {
|
|
98
|
+
const ext = node_path_1.default.extname(item.name ?? "").toLowerCase();
|
|
99
|
+
return ext.startsWith(".") ? ext.slice(1) : ext;
|
|
100
|
+
}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module driveItem
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
+
import type { DriveItem } from "@microsoft/microsoft-graph-types";
|
|
6
7
|
import type { DriveRef } from "../models/Drive.ts";
|
|
7
8
|
import type { DriveItemId, DriveItemPath, DriveItemRef } from "../models/DriveItem.ts";
|
|
8
9
|
export declare const workbookFileExtension = "xlsx";
|
|
@@ -32,4 +33,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
|
|
|
32
33
|
folderPath: DriveItemPath;
|
|
33
34
|
fileName: string;
|
|
34
35
|
};
|
|
36
|
+
/**
|
|
37
|
+
* Gets the file extension of a drive item.
|
|
38
|
+
* @param item Drive item.
|
|
39
|
+
* @returns File extension ie. "txt", "jpg"
|
|
40
|
+
*/
|
|
41
|
+
export declare function getDriveItemExtension(item: DriveItem): string;
|
|
35
42
|
//# sourceMappingURL=driveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAMvF,eAAO,MAAM,qBAAqB,SAAS,CAAC;AAC5C,eAAO,MAAM,2BAA2B,SAAS,CAAC;AAElD,eAAO,MAAM,iBAAiB,eAAqB,CAAC;AAEpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CAkClE;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,GAAG,SAAS,GAAG,YAAY,CAWpG;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,aAAa,GAAG;IAAE,UAAU,EAAE,aAAa,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAa3G;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,CAG7D"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module driveItem
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
+
import path from "node:path";
|
|
6
7
|
import InvalidArgumentError from "../errors/InvalidArgumentError.js";
|
|
7
8
|
import ProtocolError from "../errors/ProtocolError.js";
|
|
8
9
|
const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
|
|
@@ -78,3 +79,12 @@ export function splitDriveItemPath(filePath) {
|
|
|
78
79
|
fileName,
|
|
79
80
|
};
|
|
80
81
|
}
|
|
82
|
+
/**
|
|
83
|
+
* Gets the file extension of a drive item.
|
|
84
|
+
* @param item Drive item.
|
|
85
|
+
* @returns File extension ie. "txt", "jpg"
|
|
86
|
+
*/
|
|
87
|
+
export function getDriveItemExtension(item) {
|
|
88
|
+
const ext = path.extname(item.name ?? "").toLowerCase();
|
|
89
|
+
return ext.startsWith(".") ? ext.slice(1) : ext;
|
|
90
|
+
}
|
package/docs/api/driveItem.md
CHANGED
|
@@ -10,7 +10,7 @@ Utilities for working with Microsoft Graph Drive Items (files and folders).
|
|
|
10
10
|
|
|
11
11
|
> `const` **binaryWorkbookFileExtension**: `"xlsb"` = `"xlsb"`
|
|
12
12
|
|
|
13
|
-
Defined in: [src/services/driveItem.ts:
|
|
13
|
+
Defined in: [src/services/driveItem.ts:19](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L19)
|
|
14
14
|
|
|
15
15
|
***
|
|
16
16
|
|
|
@@ -18,7 +18,7 @@ Defined in: [src/services/driveItem.ts:17](https://github.com/Future-Secure-AI/m
|
|
|
18
18
|
|
|
19
19
|
> `const` **rootDriveItemPath**: [`DriveItemPath`](DriveItem-1.md#driveitempath)
|
|
20
20
|
|
|
21
|
-
Defined in: [src/services/driveItem.ts:
|
|
21
|
+
Defined in: [src/services/driveItem.ts:21](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L21)
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
@@ -26,7 +26,7 @@ Defined in: [src/services/driveItem.ts:19](https://github.com/Future-Secure-AI/m
|
|
|
26
26
|
|
|
27
27
|
> `const` **workbookFileExtension**: `"xlsx"` = `"xlsx"`
|
|
28
28
|
|
|
29
|
-
Defined in: [src/services/driveItem.ts:
|
|
29
|
+
Defined in: [src/services/driveItem.ts:18](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L18)
|
|
30
30
|
|
|
31
31
|
## Functions
|
|
32
32
|
|
|
@@ -34,7 +34,7 @@ Defined in: [src/services/driveItem.ts:16](https://github.com/Future-Secure-AI/m
|
|
|
34
34
|
|
|
35
35
|
> **createDriveItemRef**(`driveRef`, `itemId`): [`DriveItemRef`](DriveItem-1.md#driveitemref)
|
|
36
36
|
|
|
37
|
-
Defined in: [src/services/driveItem.ts:
|
|
37
|
+
Defined in: [src/services/driveItem.ts:72](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L72)
|
|
38
38
|
|
|
39
39
|
Creates a reference to a drive item.
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ ProtocolError if the item ID is missing.
|
|
|
61
61
|
|
|
62
62
|
> **driveItemPath**(...`segments`): [`DriveItemPath`](DriveItem-1.md#driveitempath)
|
|
63
63
|
|
|
64
|
-
Defined in: [src/services/driveItem.ts:
|
|
64
|
+
Defined in: [src/services/driveItem.ts:29](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L29)
|
|
65
65
|
|
|
66
66
|
Creates a drive item path from a given set of segments.
|
|
67
67
|
|
|
@@ -83,11 +83,33 @@ InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
|
83
83
|
|
|
84
84
|
***
|
|
85
85
|
|
|
86
|
+
### getDriveItemExtension()
|
|
87
|
+
|
|
88
|
+
> **getDriveItemExtension**(`item`): `string`
|
|
89
|
+
|
|
90
|
+
Defined in: [src/services/driveItem.ts:110](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L110)
|
|
91
|
+
|
|
92
|
+
Gets the file extension of a drive item.
|
|
93
|
+
|
|
94
|
+
#### Parameters
|
|
95
|
+
|
|
96
|
+
| Parameter | Type | Description |
|
|
97
|
+
| ------ | ------ | ------ |
|
|
98
|
+
| `item` | `DriveItem` | Drive item. |
|
|
99
|
+
|
|
100
|
+
#### Returns
|
|
101
|
+
|
|
102
|
+
`string`
|
|
103
|
+
|
|
104
|
+
File extension ie. "txt", "jpg"
|
|
105
|
+
|
|
106
|
+
***
|
|
107
|
+
|
|
86
108
|
### splitDriveItemPath()
|
|
87
109
|
|
|
88
110
|
> **splitDriveItemPath**(`filePath`): `object`
|
|
89
111
|
|
|
90
|
-
Defined in: [src/services/driveItem.ts:
|
|
112
|
+
Defined in: [src/services/driveItem.ts:90](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L90)
|
|
91
113
|
|
|
92
114
|
Splits a drive item path into its folder path and file name.
|
|
93
115
|
|