microsoft-graph 3.10.6 → 3.11.8
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/deleteDriveItem.d.ts +18 -2
- package/dist/cjs/operations/driveItem/deleteDriveItem.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/deleteDriveItem.js +6 -3
- package/dist/cjs/operations/driveItem/existsDriveItem.d.ts.map +1 -1
- package/dist/cjs/operations/driveItem/existsDriveItem.js +8 -1
- package/dist/esm/operations/driveItem/deleteDriveItem.d.ts +18 -2
- package/dist/esm/operations/driveItem/deleteDriveItem.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/deleteDriveItem.js +6 -3
- package/dist/esm/operations/driveItem/existsDriveItem.d.ts.map +1 -1
- package/dist/esm/operations/driveItem/existsDriveItem.js +5 -1
- package/docs/api/deleteDriveItem.md +21 -3
- package/docs/api/existsDriveItem.md +1 -1
- package/package.json +1 -1
|
@@ -5,10 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
7
7
|
import type { GraphOperation } from "../../models/GraphOperation.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Options for deleting a drive item.
|
|
10
|
+
* @property bypassSharedLock If true, bypasses any shared locks on the driveItem (e.g., from a coauthoring session).
|
|
11
|
+
* @property bypassCheckedOut If true, bypasses the checkout condition on the driveItem.
|
|
12
|
+
*/
|
|
13
|
+
export type DeleteDriveItemOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* If true, bypasses any shared locks on the driveItem (e.g., from a coauthoring session).
|
|
16
|
+
*/
|
|
17
|
+
bypassSharedLock?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true, bypasses the checkout condition on the driveItem.
|
|
20
|
+
*/
|
|
21
|
+
bypassCheckedOut?: boolean;
|
|
22
|
+
};
|
|
8
23
|
/**
|
|
9
24
|
* Delete an item from a drive.
|
|
10
25
|
* @param itemRef Reference to the drive item to be deleted.
|
|
11
|
-
*
|
|
26
|
+
* @param options Optional settings for the delete operation.
|
|
27
|
+
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-delete
|
|
12
28
|
*/
|
|
13
|
-
export default function deleteDriveItem(itemRef: DriveItemRef): GraphOperation<void>;
|
|
29
|
+
export default function deleteDriveItem(itemRef: DriveItemRef, options?: DeleteDriveItemOptions): GraphOperation<void>;
|
|
14
30
|
//# sourceMappingURL=deleteDriveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/deleteDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"deleteDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/deleteDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,CAAC,IAAI,CAAC,CAWzH"}
|
|
@@ -11,14 +11,17 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
11
11
|
/**
|
|
12
12
|
* Delete an item from a drive.
|
|
13
13
|
* @param itemRef Reference to the drive item to be deleted.
|
|
14
|
-
*
|
|
14
|
+
* @param options Optional settings for the delete operation.
|
|
15
|
+
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-delete
|
|
15
16
|
*/
|
|
16
|
-
function deleteDriveItem(itemRef) {
|
|
17
|
+
function deleteDriveItem(itemRef, options = {}) {
|
|
18
|
+
const prefer = [options.bypassSharedLock && "bypass-shared-lock", options.bypassCheckedOut && "bypass-checked-out"].filter(Boolean).join(", ");
|
|
19
|
+
const headers = prefer ? { prefer } : {};
|
|
17
20
|
return (0, operationInvoker_ts_1.operation)({
|
|
18
21
|
context: itemRef.context,
|
|
19
22
|
method: "DELETE",
|
|
20
23
|
path: (0, templatedPaths_ts_1.generatePath)("/sites/{site-id}/drives/{drive-id}/items/{item-id}", itemRef),
|
|
21
|
-
headers
|
|
24
|
+
headers,
|
|
22
25
|
body: null,
|
|
23
26
|
responseTransform: () => undefined,
|
|
24
27
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CA0B3G"}
|
|
@@ -4,8 +4,12 @@
|
|
|
4
4
|
* @module existsDriveItem
|
|
5
5
|
* @category Operations
|
|
6
6
|
*/
|
|
7
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
+
};
|
|
7
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8
11
|
exports.default = existsDriveItem;
|
|
12
|
+
const InvalidArgumentError_ts_1 = __importDefault(require("../../errors/InvalidArgumentError.js"));
|
|
9
13
|
const http_ts_1 = require("../../services/http.js");
|
|
10
14
|
const httpStatus_ts_1 = require("../../services/httpStatus.js");
|
|
11
15
|
const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
|
|
@@ -16,10 +20,13 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
|
|
|
16
20
|
* @returns If the drive item exists.
|
|
17
21
|
*/
|
|
18
22
|
async function existsDriveItem(driveRef, itemPath) {
|
|
19
|
-
|
|
23
|
+
if (!itemPath.startsWith("/")) {
|
|
24
|
+
throw new InvalidArgumentError_ts_1.default("itemPath must start with a forward slash (/)");
|
|
25
|
+
}
|
|
20
26
|
const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
|
|
21
27
|
const accessToken = await driveRef.context.generateAccessToken();
|
|
22
28
|
const response = await (0, http_ts_1.executeRaw)({
|
|
29
|
+
// TODO: This is not supporting retry and needs fixing
|
|
23
30
|
url,
|
|
24
31
|
method: "GET",
|
|
25
32
|
headers: {
|
|
@@ -5,10 +5,26 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import type { DriveItemRef } from "../../models/DriveItem.ts";
|
|
7
7
|
import type { GraphOperation } from "../../models/GraphOperation.ts";
|
|
8
|
+
/**
|
|
9
|
+
* Options for deleting a drive item.
|
|
10
|
+
* @property bypassSharedLock If true, bypasses any shared locks on the driveItem (e.g., from a coauthoring session).
|
|
11
|
+
* @property bypassCheckedOut If true, bypasses the checkout condition on the driveItem.
|
|
12
|
+
*/
|
|
13
|
+
export type DeleteDriveItemOptions = {
|
|
14
|
+
/**
|
|
15
|
+
* If true, bypasses any shared locks on the driveItem (e.g., from a coauthoring session).
|
|
16
|
+
*/
|
|
17
|
+
bypassSharedLock?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* If true, bypasses the checkout condition on the driveItem.
|
|
20
|
+
*/
|
|
21
|
+
bypassCheckedOut?: boolean;
|
|
22
|
+
};
|
|
8
23
|
/**
|
|
9
24
|
* Delete an item from a drive.
|
|
10
25
|
* @param itemRef Reference to the drive item to be deleted.
|
|
11
|
-
*
|
|
26
|
+
* @param options Optional settings for the delete operation.
|
|
27
|
+
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-delete
|
|
12
28
|
*/
|
|
13
|
-
export default function deleteDriveItem(itemRef: DriveItemRef): GraphOperation<void>;
|
|
29
|
+
export default function deleteDriveItem(itemRef: DriveItemRef, options?: DeleteDriveItemOptions): GraphOperation<void>;
|
|
14
30
|
//# sourceMappingURL=deleteDriveItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deleteDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/deleteDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE;;;;GAIG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,YAAY,GAAG,cAAc,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"deleteDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/deleteDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAIrE;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACpC;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B;;OAEG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,GAAE,sBAA2B,GAAG,cAAc,CAAC,IAAI,CAAC,CAWzH"}
|
|
@@ -8,14 +8,17 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
8
8
|
/**
|
|
9
9
|
* Delete an item from a drive.
|
|
10
10
|
* @param itemRef Reference to the drive item to be deleted.
|
|
11
|
-
*
|
|
11
|
+
* @param options Optional settings for the delete operation.
|
|
12
|
+
* @see https://learn.microsoft.com/en-us/graph/api/driveitem-delete
|
|
12
13
|
*/
|
|
13
|
-
export default function deleteDriveItem(itemRef) {
|
|
14
|
+
export default function deleteDriveItem(itemRef, options = {}) {
|
|
15
|
+
const prefer = [options.bypassSharedLock && "bypass-shared-lock", options.bypassCheckedOut && "bypass-checked-out"].filter(Boolean).join(", ");
|
|
16
|
+
const headers = prefer ? { prefer } : {};
|
|
14
17
|
return operation({
|
|
15
18
|
context: itemRef.context,
|
|
16
19
|
method: "DELETE",
|
|
17
20
|
path: generatePath("/sites/{site-id}/drives/{drive-id}/items/{item-id}", itemRef),
|
|
18
|
-
headers
|
|
21
|
+
headers,
|
|
19
22
|
body: null,
|
|
20
23
|
responseTransform: () => undefined,
|
|
21
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"existsDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/existsDriveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAM/D;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,aAAa,GAAG,OAAO,CAAC,OAAO,CAAC,CA0B3G"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
* @module existsDriveItem
|
|
4
4
|
* @category Operations
|
|
5
5
|
*/
|
|
6
|
+
import InvalidArgumentError from "../../errors/InvalidArgumentError.js";
|
|
6
7
|
import { executeRaw } from "../../services/http.js";
|
|
7
8
|
import { isHttpNotFound, isHttpOk } from "../../services/httpStatus.js";
|
|
8
9
|
import { endpoint } from "../../services/operationInvoker.js";
|
|
@@ -13,10 +14,13 @@ import { generatePath } from "../../services/templatedPaths.js";
|
|
|
13
14
|
* @returns If the drive item exists.
|
|
14
15
|
*/
|
|
15
16
|
export default async function existsDriveItem(driveRef, itemPath) {
|
|
16
|
-
|
|
17
|
+
if (!itemPath.startsWith("/")) {
|
|
18
|
+
throw new InvalidArgumentError("itemPath must start with a forward slash (/)");
|
|
19
|
+
}
|
|
17
20
|
const url = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
|
|
18
21
|
const accessToken = await driveRef.context.generateAccessToken();
|
|
19
22
|
const response = await executeRaw({
|
|
23
|
+
// TODO: This is not supporting retry and needs fixing
|
|
20
24
|
url,
|
|
21
25
|
method: "GET",
|
|
22
26
|
headers: {
|
|
@@ -4,13 +4,30 @@
|
|
|
4
4
|
|
|
5
5
|
Delete an item from a drive.
|
|
6
6
|
|
|
7
|
+
## Type Aliases
|
|
8
|
+
|
|
9
|
+
### DeleteDriveItemOptions
|
|
10
|
+
|
|
11
|
+
> **DeleteDriveItemOptions** = `object`
|
|
12
|
+
|
|
13
|
+
Defined in: [src/operations/driveItem/deleteDriveItem.ts:17](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/deleteDriveItem.ts#L17)
|
|
14
|
+
|
|
15
|
+
Options for deleting a drive item.
|
|
16
|
+
|
|
17
|
+
#### Properties
|
|
18
|
+
|
|
19
|
+
| Property | Type | Description | Defined in |
|
|
20
|
+
| ------ | ------ | ------ | ------ |
|
|
21
|
+
| <a id="bypasscheckedout"></a> `bypassCheckedOut?` | `boolean` | If true, bypasses the checkout condition on the driveItem. | [src/operations/driveItem/deleteDriveItem.ts:25](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/deleteDriveItem.ts#L25) |
|
|
22
|
+
| <a id="bypasssharedlock"></a> `bypassSharedLock?` | `boolean` | If true, bypasses any shared locks on the driveItem (e.g., from a coauthoring session). | [src/operations/driveItem/deleteDriveItem.ts:21](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/deleteDriveItem.ts#L21) |
|
|
23
|
+
|
|
7
24
|
## Functions
|
|
8
25
|
|
|
9
26
|
### deleteDriveItem()
|
|
10
27
|
|
|
11
|
-
> **deleteDriveItem**(`itemRef`): [`GraphOperation`](GraphOperation.md#graphoperation)\<`void`\>
|
|
28
|
+
> **deleteDriveItem**(`itemRef`, `options`): [`GraphOperation`](GraphOperation.md#graphoperation)\<`void`\>
|
|
12
29
|
|
|
13
|
-
Defined in: [src/operations/driveItem/deleteDriveItem.ts:
|
|
30
|
+
Defined in: [src/operations/driveItem/deleteDriveItem.ts:34](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/deleteDriveItem.ts#L34)
|
|
14
31
|
|
|
15
32
|
Delete an item from a drive.
|
|
16
33
|
|
|
@@ -18,7 +35,8 @@ Delete an item from a drive.
|
|
|
18
35
|
|
|
19
36
|
| Parameter | Type | Description |
|
|
20
37
|
| ------ | ------ | ------ |
|
|
21
|
-
| `itemRef` | [`DriveItemRef`](DriveItem-1.md#driveitemref) | Reference to the drive item to be deleted.
|
|
38
|
+
| `itemRef` | [`DriveItemRef`](DriveItem-1.md#driveitemref) | Reference to the drive item to be deleted. |
|
|
39
|
+
| `options` | [`DeleteDriveItemOptions`](#deletedriveitemoptions) | Optional settings for the delete operation. |
|
|
22
40
|
|
|
23
41
|
#### Returns
|
|
24
42
|
|
|
@@ -10,7 +10,7 @@ Check if a given drive item exists.
|
|
|
10
10
|
|
|
11
11
|
> **existsDriveItem**(`driveRef`, `itemPath`): [`Promise`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Promise)\<`boolean`\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/operations/driveItem/existsDriveItem.ts:
|
|
13
|
+
Defined in: [src/operations/driveItem/existsDriveItem.ts:20](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/operations/driveItem/existsDriveItem.ts#L20)
|
|
14
14
|
|
|
15
15
|
Check if a given drive item exists.
|
|
16
16
|
|