microsoft-graph 3.10.4 → 3.10.5
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 +6 -0
- package/dist/cjs/services/driveItem.d.ts.map +1 -1
- package/dist/cjs/services/driveItem.js +19 -0
- package/dist/esm/services/driveItem.d.ts +6 -0
- package/dist/esm/services/driveItem.d.ts.map +1 -1
- package/dist/esm/services/driveItem.js +18 -0
- package/docs/api/driveItem.md +22 -0
- package/package.json +1 -1
|
@@ -39,4 +39,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
|
|
|
39
39
|
* @returns File extension ie. "txt", "jpg"
|
|
40
40
|
*/
|
|
41
41
|
export declare function getDriveItemExtension(item: DriveItem): string;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the parent for a drive item. Typically this is the folder of a file.
|
|
44
|
+
* @param item Drive item.
|
|
45
|
+
* @returns Parent drive item.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getDriveItemParent(item: DriveItem & DriveItemRef): DriveItemRef;
|
|
42
48
|
//# sourceMappingURL=driveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,aAA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kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,CAc/E"}
|
|
@@ -13,6 +13,7 @@ exports.driveItemPath = driveItemPath;
|
|
|
13
13
|
exports.createDriveItemRef = createDriveItemRef;
|
|
14
14
|
exports.splitDriveItemPath = splitDriveItemPath;
|
|
15
15
|
exports.getDriveItemExtension = getDriveItemExtension;
|
|
16
|
+
exports.getDriveItemParent = getDriveItemParent;
|
|
16
17
|
const node_path_1 = __importDefault(require("node:path"));
|
|
17
18
|
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
18
19
|
const ProtocolError_ts_1 = __importDefault(require("../errors/ProtocolError.js"));
|
|
@@ -98,3 +99,21 @@ function getDriveItemExtension(item) {
|
|
|
98
99
|
const ext = node_path_1.default.extname(item.name ?? "").toLowerCase();
|
|
99
100
|
return ext.startsWith(".") ? ext.slice(1) : ext;
|
|
100
101
|
}
|
|
102
|
+
/**
|
|
103
|
+
* Gets the parent for a drive item. Typically this is the folder of a file.
|
|
104
|
+
* @param item Drive item.
|
|
105
|
+
* @returns Parent drive item.
|
|
106
|
+
*/
|
|
107
|
+
function getDriveItemParent(item) {
|
|
108
|
+
const parentId = item.parentReference?.id;
|
|
109
|
+
if (!parentId) {
|
|
110
|
+
throw new Error("Parent reference not found for the item.");
|
|
111
|
+
}
|
|
112
|
+
const parentRef = {
|
|
113
|
+
context: item.context,
|
|
114
|
+
siteId: item.siteId,
|
|
115
|
+
driveId: item.driveId,
|
|
116
|
+
itemId: parentId,
|
|
117
|
+
};
|
|
118
|
+
return parentRef;
|
|
119
|
+
}
|
|
@@ -39,4 +39,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
|
|
|
39
39
|
* @returns File extension ie. "txt", "jpg"
|
|
40
40
|
*/
|
|
41
41
|
export declare function getDriveItemExtension(item: DriveItem): string;
|
|
42
|
+
/**
|
|
43
|
+
* Gets the parent for a drive item. Typically this is the folder of a file.
|
|
44
|
+
* @param item Drive item.
|
|
45
|
+
* @returns Parent drive item.
|
|
46
|
+
*/
|
|
47
|
+
export declare function getDriveItemParent(item: DriveItem & DriveItemRef): DriveItemRef;
|
|
42
48
|
//# sourceMappingURL=driveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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"}
|
|
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;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,YAAY,CAc/E"}
|
|
@@ -88,3 +88,21 @@ export function getDriveItemExtension(item) {
|
|
|
88
88
|
const ext = path.extname(item.name ?? "").toLowerCase();
|
|
89
89
|
return ext.startsWith(".") ? ext.slice(1) : ext;
|
|
90
90
|
}
|
|
91
|
+
/**
|
|
92
|
+
* Gets the parent for a drive item. Typically this is the folder of a file.
|
|
93
|
+
* @param item Drive item.
|
|
94
|
+
* @returns Parent drive item.
|
|
95
|
+
*/
|
|
96
|
+
export function getDriveItemParent(item) {
|
|
97
|
+
const parentId = item.parentReference?.id;
|
|
98
|
+
if (!parentId) {
|
|
99
|
+
throw new Error("Parent reference not found for the item.");
|
|
100
|
+
}
|
|
101
|
+
const parentRef = {
|
|
102
|
+
context: item.context,
|
|
103
|
+
siteId: item.siteId,
|
|
104
|
+
driveId: item.driveId,
|
|
105
|
+
itemId: parentId,
|
|
106
|
+
};
|
|
107
|
+
return parentRef;
|
|
108
|
+
}
|
package/docs/api/driveItem.md
CHANGED
|
@@ -105,6 +105,28 @@ File extension ie. "txt", "jpg"
|
|
|
105
105
|
|
|
106
106
|
***
|
|
107
107
|
|
|
108
|
+
### getDriveItemParent()
|
|
109
|
+
|
|
110
|
+
> **getDriveItemParent**(`item`): [`DriveItemRef`](DriveItem-1.md#driveitemref)
|
|
111
|
+
|
|
112
|
+
Defined in: [src/services/driveItem.ts:120](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L120)
|
|
113
|
+
|
|
114
|
+
Gets the parent for a drive item. Typically this is the folder of a file.
|
|
115
|
+
|
|
116
|
+
#### Parameters
|
|
117
|
+
|
|
118
|
+
| Parameter | Type | Description |
|
|
119
|
+
| ------ | ------ | ------ |
|
|
120
|
+
| `item` | `DriveItem` & [`SiteRef`](Site-1.md#siteref) & `object` & `object` | Drive item. |
|
|
121
|
+
|
|
122
|
+
#### Returns
|
|
123
|
+
|
|
124
|
+
[`DriveItemRef`](DriveItem-1.md#driveitemref)
|
|
125
|
+
|
|
126
|
+
Parent drive item.
|
|
127
|
+
|
|
128
|
+
***
|
|
129
|
+
|
|
108
130
|
### splitDriveItemPath()
|
|
109
131
|
|
|
110
132
|
> **splitDriveItemPath**(`filePath`): `object`
|