microsoft-graph 3.1.1 → 3.1.2
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/SECURITY.md +1 -1
- package/dist/cjs/models/Drive.d.ts +6 -0
- package/dist/cjs/models/Drive.d.ts.map +1 -1
- package/dist/cjs/services/sharepointUrl.d.ts +12 -8
- package/dist/cjs/services/sharepointUrl.d.ts.map +1 -1
- package/dist/cjs/services/sharepointUrl.js +38 -18
- package/dist/esm/models/Drive.d.ts +6 -0
- package/dist/esm/models/Drive.d.ts.map +1 -1
- package/dist/esm/services/sharepointUrl.d.ts +12 -8
- package/dist/esm/services/sharepointUrl.d.ts.map +1 -1
- package/dist/esm/services/sharepointUrl.js +38 -15
- package/docs/api/Drive-1.md +16 -0
- package/docs/api/sharepointUrl.md +6 -18
- package/package.json +1 -1
package/SECURITY.md
CHANGED
|
@@ -6,4 +6,4 @@ Only the latest version is supported.
|
|
|
6
6
|
|
|
7
7
|
## Reporting a Vulnerability
|
|
8
8
|
|
|
9
|
-
To report a
|
|
9
|
+
To report a vulnerability raise a [GitHub Issue](https://github.com/Future-Secure-AI/microsoft-graph/issues).
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drive.d.ts","sourceRoot":"","sources":["../../../src/models/Drive.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC9B,OAAO,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drive.d.ts","sourceRoot":"","sources":["../../../src/models/Drive.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC9B,OAAO,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
|
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
* @module sharepointUrl
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
+
import type { DriveName } from "../models/Drive.ts";
|
|
6
7
|
import type { DriveItemId } from "../models/DriveItem.ts";
|
|
7
8
|
import type { HostName } from "../models/HostName.ts";
|
|
8
9
|
import type { SiteName } from "../models/Site.ts";
|
|
10
|
+
type SharepointUrlComponents = {
|
|
11
|
+
hostName: HostName | null;
|
|
12
|
+
siteName: SiteName | null;
|
|
13
|
+
driveName: DriveName | null;
|
|
14
|
+
itemId: DriveItemId | null;
|
|
15
|
+
};
|
|
9
16
|
/**
|
|
10
|
-
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
11
|
-
* @param
|
|
12
|
-
* @returns An object containing the host name, site name, and item ID.
|
|
17
|
+
* Parses a SharePoint document URL string to extract the site name, host name, drive name and item ID if present.
|
|
18
|
+
* @param urlString SharePoint URL as a string.
|
|
19
|
+
* @returns An object containing the host name, site name, drive name (if present), and item ID (if present).
|
|
13
20
|
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
14
21
|
*/
|
|
15
|
-
export declare function parseSharepointUrl(
|
|
16
|
-
|
|
17
|
-
siteName: SiteName;
|
|
18
|
-
itemId: DriveItemId;
|
|
19
|
-
};
|
|
22
|
+
export declare function parseSharepointUrl(urlString: string): SharepointUrlComponents;
|
|
23
|
+
export {};
|
|
20
24
|
//# sourceMappingURL=sharepointUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,KAAK,uBAAuB,GAAG;IAC9B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAiD7E"}
|
|
@@ -4,37 +4,57 @@
|
|
|
4
4
|
* @module sharepointUrl
|
|
5
5
|
* @category Services
|
|
6
6
|
*/
|
|
7
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
8
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
9
|
-
};
|
|
10
7
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
8
|
exports.parseSharepointUrl = parseSharepointUrl;
|
|
12
|
-
const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
|
|
13
9
|
/**
|
|
14
|
-
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
15
|
-
* @param
|
|
16
|
-
* @returns An object containing the host name, site name, and item ID.
|
|
10
|
+
* Parses a SharePoint document URL string to extract the site name, host name, drive name and item ID if present.
|
|
11
|
+
* @param urlString SharePoint URL as a string.
|
|
12
|
+
* @returns An object containing the host name, site name, drive name (if present), and item ID (if present).
|
|
17
13
|
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
18
14
|
*/
|
|
19
|
-
function parseSharepointUrl(
|
|
15
|
+
function parseSharepointUrl(urlString) {
|
|
16
|
+
let url;
|
|
17
|
+
let hostName = null;
|
|
18
|
+
let siteName = null;
|
|
19
|
+
let driveName = null;
|
|
20
|
+
let itemId = null;
|
|
21
|
+
try {
|
|
22
|
+
url = new URL(urlString);
|
|
23
|
+
}
|
|
24
|
+
catch {
|
|
25
|
+
return {
|
|
26
|
+
hostName: null,
|
|
27
|
+
siteName: null,
|
|
28
|
+
driveName: null,
|
|
29
|
+
itemId: null,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
20
32
|
if (!url.hostname.endsWith(".sharepoint.com")) {
|
|
21
|
-
|
|
33
|
+
return {
|
|
34
|
+
hostName: null,
|
|
35
|
+
siteName: null,
|
|
36
|
+
driveName: null,
|
|
37
|
+
itemId: null,
|
|
38
|
+
};
|
|
22
39
|
}
|
|
23
|
-
|
|
24
|
-
const pathSegments = url.pathname.split("/");
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
|
|
40
|
+
hostName = url.hostname;
|
|
41
|
+
const pathSegments = url.pathname.split("/").filter(Boolean);
|
|
42
|
+
const sitesIdx = pathSegments.findIndex((seg) => seg.toLowerCase() === "sites");
|
|
43
|
+
if (sitesIdx !== -1 && pathSegments[sitesIdx + 1]) {
|
|
44
|
+
siteName = pathSegments[sitesIdx + 1];
|
|
45
|
+
const afterSite = pathSegments[sitesIdx + 2];
|
|
46
|
+
if (afterSite && afterSite.toLowerCase() !== "_layouts" && afterSite.toLowerCase() !== "forms") {
|
|
47
|
+
driveName = afterSite;
|
|
48
|
+
}
|
|
28
49
|
}
|
|
29
|
-
const siteName = pathSegments[siteNameIndex];
|
|
30
50
|
const sourcedoc = url.searchParams.get("sourcedoc");
|
|
31
|
-
if (
|
|
32
|
-
|
|
51
|
+
if (sourcedoc) {
|
|
52
|
+
itemId = decodeURIComponent(sourcedoc.replace(/[{}]/g, "")).toUpperCase();
|
|
33
53
|
}
|
|
34
|
-
const itemId = sourcedoc.replace(/[{}]/g, "").toLocaleUpperCase();
|
|
35
54
|
return {
|
|
36
55
|
hostName,
|
|
37
56
|
siteName,
|
|
57
|
+
driveName,
|
|
38
58
|
itemId,
|
|
39
59
|
};
|
|
40
60
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drive.d.ts","sourceRoot":"","sources":["../../../src/models/Drive.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC9B,OAAO,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC"}
|
|
1
|
+
{"version":3,"file":"Drive.d.ts","sourceRoot":"","sources":["../../../src/models/Drive.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC;;GAEG;AACH,MAAM,MAAM,OAAO,GAAG,MAAM,GAAG;IAC9B,OAAO,EAAE,SAAS,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,QAAQ,GAAG,OAAO,GAAG;IAChC,OAAO,EAAE,OAAO,CAAC;CACjB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
|
|
@@ -3,18 +3,22 @@
|
|
|
3
3
|
* @module sharepointUrl
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
+
import type { DriveName } from "../models/Drive.ts";
|
|
6
7
|
import type { DriveItemId } from "../models/DriveItem.ts";
|
|
7
8
|
import type { HostName } from "../models/HostName.ts";
|
|
8
9
|
import type { SiteName } from "../models/Site.ts";
|
|
10
|
+
type SharepointUrlComponents = {
|
|
11
|
+
hostName: HostName | null;
|
|
12
|
+
siteName: SiteName | null;
|
|
13
|
+
driveName: DriveName | null;
|
|
14
|
+
itemId: DriveItemId | null;
|
|
15
|
+
};
|
|
9
16
|
/**
|
|
10
|
-
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
11
|
-
* @param
|
|
12
|
-
* @returns An object containing the host name, site name, and item ID.
|
|
17
|
+
* Parses a SharePoint document URL string to extract the site name, host name, drive name and item ID if present.
|
|
18
|
+
* @param urlString SharePoint URL as a string.
|
|
19
|
+
* @returns An object containing the host name, site name, drive name (if present), and item ID (if present).
|
|
13
20
|
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
14
21
|
*/
|
|
15
|
-
export declare function parseSharepointUrl(
|
|
16
|
-
|
|
17
|
-
siteName: SiteName;
|
|
18
|
-
itemId: DriveItemId;
|
|
19
|
-
};
|
|
22
|
+
export declare function parseSharepointUrl(urlString: string): SharepointUrlComponents;
|
|
23
|
+
export {};
|
|
20
24
|
//# sourceMappingURL=sharepointUrl.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"sharepointUrl.d.ts","sourceRoot":"","sources":["../../../src/services/sharepointUrl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAElD,KAAK,uBAAuB,GAAG;IAC9B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC1B,SAAS,EAAE,SAAS,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,WAAW,GAAG,IAAI,CAAC;CAC3B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,uBAAuB,CAiD7E"}
|
|
@@ -3,32 +3,55 @@
|
|
|
3
3
|
* @module sharepointUrl
|
|
4
4
|
* @category Services
|
|
5
5
|
*/
|
|
6
|
-
import InvalidArgumentError from "../errors/InvalidArgumentError.js";
|
|
7
6
|
/**
|
|
8
|
-
* Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
9
|
-
* @param
|
|
10
|
-
* @returns An object containing the host name, site name, and item ID.
|
|
7
|
+
* Parses a SharePoint document URL string to extract the site name, host name, drive name and item ID if present.
|
|
8
|
+
* @param urlString SharePoint URL as a string.
|
|
9
|
+
* @returns An object containing the host name, site name, drive name (if present), and item ID (if present).
|
|
11
10
|
* @throws InvalidArgumentError if the URL is invalid or required components are missing.
|
|
12
11
|
*/
|
|
13
|
-
export function parseSharepointUrl(
|
|
12
|
+
export function parseSharepointUrl(urlString) {
|
|
13
|
+
let url;
|
|
14
|
+
let hostName = null;
|
|
15
|
+
let siteName = null;
|
|
16
|
+
let driveName = null;
|
|
17
|
+
let itemId = null;
|
|
18
|
+
try {
|
|
19
|
+
url = new URL(urlString);
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return {
|
|
23
|
+
hostName: null,
|
|
24
|
+
siteName: null,
|
|
25
|
+
driveName: null,
|
|
26
|
+
itemId: null,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
14
29
|
if (!url.hostname.endsWith(".sharepoint.com")) {
|
|
15
|
-
|
|
30
|
+
return {
|
|
31
|
+
hostName: null,
|
|
32
|
+
siteName: null,
|
|
33
|
+
driveName: null,
|
|
34
|
+
itemId: null,
|
|
35
|
+
};
|
|
16
36
|
}
|
|
17
|
-
|
|
18
|
-
const pathSegments = url.pathname.split("/");
|
|
19
|
-
const
|
|
20
|
-
if (
|
|
21
|
-
|
|
37
|
+
hostName = url.hostname;
|
|
38
|
+
const pathSegments = url.pathname.split("/").filter(Boolean);
|
|
39
|
+
const sitesIdx = pathSegments.findIndex((seg) => seg.toLowerCase() === "sites");
|
|
40
|
+
if (sitesIdx !== -1 && pathSegments[sitesIdx + 1]) {
|
|
41
|
+
siteName = pathSegments[sitesIdx + 1];
|
|
42
|
+
const afterSite = pathSegments[sitesIdx + 2];
|
|
43
|
+
if (afterSite && afterSite.toLowerCase() !== "_layouts" && afterSite.toLowerCase() !== "forms") {
|
|
44
|
+
driveName = afterSite;
|
|
45
|
+
}
|
|
22
46
|
}
|
|
23
|
-
const siteName = pathSegments[siteNameIndex];
|
|
24
47
|
const sourcedoc = url.searchParams.get("sourcedoc");
|
|
25
|
-
if (
|
|
26
|
-
|
|
48
|
+
if (sourcedoc) {
|
|
49
|
+
itemId = decodeURIComponent(sourcedoc.replace(/[{}]/g, "")).toUpperCase();
|
|
27
50
|
}
|
|
28
|
-
const itemId = sourcedoc.replace(/[{}]/g, "").toLocaleUpperCase();
|
|
29
51
|
return {
|
|
30
52
|
hostName,
|
|
31
53
|
siteName,
|
|
54
|
+
driveName,
|
|
32
55
|
itemId,
|
|
33
56
|
};
|
|
34
57
|
}
|
package/docs/api/Drive-1.md
CHANGED
|
@@ -22,6 +22,22 @@ Identifier for a drive.
|
|
|
22
22
|
|
|
23
23
|
***
|
|
24
24
|
|
|
25
|
+
### DriveName
|
|
26
|
+
|
|
27
|
+
> **DriveName** = `string` & `object`
|
|
28
|
+
|
|
29
|
+
Defined in: [src/models/Drive.ts:28](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/models/Drive.ts#L28)
|
|
30
|
+
|
|
31
|
+
Name of a drive.
|
|
32
|
+
|
|
33
|
+
#### Type declaration
|
|
34
|
+
|
|
35
|
+
##### \_\_brand
|
|
36
|
+
|
|
37
|
+
> **\_\_brand**: `"DriveName"`
|
|
38
|
+
|
|
39
|
+
***
|
|
40
|
+
|
|
25
41
|
### DriveRef
|
|
26
42
|
|
|
27
43
|
> **DriveRef** = [`SiteRef`](Site-1.md#siteref) & `object`
|
|
@@ -8,35 +8,23 @@ Utilities for parsing and extracting information from SharePoint URLs.
|
|
|
8
8
|
|
|
9
9
|
### parseSharepointUrl()
|
|
10
10
|
|
|
11
|
-
> **parseSharepointUrl**(`
|
|
11
|
+
> **parseSharepointUrl**(`urlString`): `SharepointUrlComponents`
|
|
12
12
|
|
|
13
|
-
Defined in: [src/services/sharepointUrl.ts:
|
|
13
|
+
Defined in: [src/services/sharepointUrl.ts:25](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/sharepointUrl.ts#L25)
|
|
14
14
|
|
|
15
|
-
Parses a SharePoint document URL to extract the site name, host name, and item ID.
|
|
15
|
+
Parses a SharePoint document URL string to extract the site name, host name, drive name and item ID if present.
|
|
16
16
|
|
|
17
17
|
#### Parameters
|
|
18
18
|
|
|
19
19
|
| Parameter | Type | Description |
|
|
20
20
|
| ------ | ------ | ------ |
|
|
21
|
-
| `
|
|
21
|
+
| `urlString` | `string` | SharePoint URL as a string. |
|
|
22
22
|
|
|
23
23
|
#### Returns
|
|
24
24
|
|
|
25
|
-
`
|
|
25
|
+
`SharepointUrlComponents`
|
|
26
26
|
|
|
27
|
-
An object containing the host name, site name, and item ID.
|
|
28
|
-
|
|
29
|
-
##### hostName
|
|
30
|
-
|
|
31
|
-
> **hostName**: [`HostName`](HostName.md#hostname)
|
|
32
|
-
|
|
33
|
-
##### itemId
|
|
34
|
-
|
|
35
|
-
> **itemId**: [`DriveItemId`](DriveItem-1.md#driveitemid)
|
|
36
|
-
|
|
37
|
-
##### siteName
|
|
38
|
-
|
|
39
|
-
> **siteName**: [`SiteName`](Site-1.md#sitename)
|
|
27
|
+
An object containing the host name, site name, drive name (if present), and item ID (if present).
|
|
40
28
|
|
|
41
29
|
#### Throws
|
|
42
30
|
|