microsoft-graph 3.1.0 → 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/cjs/tasks/iterateDrives.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateDrives.js +5 -2
- package/dist/cjs/tasks/iterateSiteSearch.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateSiteSearch.js +5 -2
- package/dist/cjs/tasks/iterateSites.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateSites.js +5 -2
- 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/dist/esm/tasks/iterateDrives.d.ts.map +1 -1
- package/dist/esm/tasks/iterateDrives.js +5 -2
- package/dist/esm/tasks/iterateSiteSearch.d.ts.map +1 -1
- package/dist/esm/tasks/iterateSiteSearch.js +5 -2
- package/dist/esm/tasks/iterateSites.d.ts.map +1 -1
- package/dist/esm/tasks/iterateSites.js +5 -2
- package/docs/api/Drive-1.md +16 -0
- package/docs/api/iterateDrives.md +1 -1
- package/docs/api/iterateSiteSearch.md +1 -1
- package/docs/api/iterateSites.md +1 -1
- 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":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,QAAQ,CAAC,CAyBvH"}
|
|
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.default = iterateDrives;
|
|
12
12
|
const listDrives_ts_1 = __importDefault(require("../operations/drive/listDrives.js"));
|
|
13
|
+
const http_ts_1 = require("../services/http.js");
|
|
13
14
|
/**
|
|
14
15
|
* List drives in a site as an async iterable.
|
|
15
16
|
* @param siteRef Reference to the site.
|
|
@@ -24,12 +25,14 @@ async function* iterateDrives(siteRef, maxPerChunk = 1000) {
|
|
|
24
25
|
}
|
|
25
26
|
while (nextLink) {
|
|
26
27
|
const accessToken = await siteRef.context.generateAccessToken();
|
|
27
|
-
const response = await
|
|
28
|
+
const response = await (0, http_ts_1.executeHttpRequest)({
|
|
29
|
+
url: nextLink.toString(),
|
|
30
|
+
method: "GET",
|
|
28
31
|
headers: {
|
|
29
32
|
authorization: `Bearer ${accessToken}`,
|
|
30
33
|
},
|
|
31
34
|
});
|
|
32
|
-
const result =
|
|
35
|
+
const result = response.data;
|
|
33
36
|
drives = result.value;
|
|
34
37
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
35
38
|
for (const drive of drives) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;GAKG;AACH,wBAA+B,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBvH"}
|
|
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.default = iterateSiteSearch;
|
|
12
12
|
const searchSites_ts_1 = __importDefault(require("../operations/site/searchSites.js"));
|
|
13
|
+
const http_ts_1 = require("../services/http.js");
|
|
13
14
|
/**
|
|
14
15
|
* Iterate accessible sites matching the provided search keywords as an async iterable.
|
|
15
16
|
* @param contextRef Reference to the context.
|
|
@@ -23,12 +24,14 @@ async function* iterateSiteSearch(contextRef, search) {
|
|
|
23
24
|
}
|
|
24
25
|
while (nextLink) {
|
|
25
26
|
const accessToken = await contextRef.context.generateAccessToken();
|
|
26
|
-
const response = await
|
|
27
|
+
const response = await (0, http_ts_1.executeHttpRequest)({
|
|
28
|
+
url: nextLink.toString(),
|
|
29
|
+
method: "GET",
|
|
27
30
|
headers: {
|
|
28
31
|
authorization: `Bearer ${accessToken}`,
|
|
29
32
|
},
|
|
30
33
|
});
|
|
31
|
-
const result =
|
|
34
|
+
const result = response.data;
|
|
32
35
|
sites = result.value;
|
|
33
36
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
34
37
|
for (const site of sites) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBtH"}
|
|
@@ -10,6 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
10
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
11
11
|
exports.default = iterateSites;
|
|
12
12
|
const listSites_ts_1 = __importDefault(require("../operations/site/listSites.js"));
|
|
13
|
+
const http_ts_1 = require("../services/http.js");
|
|
13
14
|
/**
|
|
14
15
|
* List sites in your company geography as an async iterable.
|
|
15
16
|
* @param contextRef Reference to the context.
|
|
@@ -24,12 +25,14 @@ async function* iterateSites(contextRef, maxPerChunk = 1000) {
|
|
|
24
25
|
}
|
|
25
26
|
while (nextLink) {
|
|
26
27
|
const accessToken = await contextRef.context.generateAccessToken();
|
|
27
|
-
const response = await
|
|
28
|
+
const response = await (0, http_ts_1.executeHttpRequest)({
|
|
29
|
+
url: nextLink.toString(),
|
|
30
|
+
method: "GET",
|
|
28
31
|
headers: {
|
|
29
32
|
authorization: `Bearer ${accessToken}`,
|
|
30
33
|
},
|
|
31
34
|
});
|
|
32
|
-
const result =
|
|
35
|
+
const result = response.data;
|
|
33
36
|
sites = result.value;
|
|
34
37
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
35
38
|
for (const site of sites) {
|
|
@@ -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
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateDrives.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateDrives.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,SAAS,GAAG,QAAQ,CAAC,CAyBvH"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @category Tasks
|
|
5
5
|
*/
|
|
6
6
|
import listDrives from "../operations/drive/listDrives.js";
|
|
7
|
+
import { executeHttpRequest } from "../services/http.js";
|
|
7
8
|
/**
|
|
8
9
|
* List drives in a site as an async iterable.
|
|
9
10
|
* @param siteRef Reference to the site.
|
|
@@ -18,12 +19,14 @@ export default async function* iterateDrives(siteRef, maxPerChunk = 1000) {
|
|
|
18
19
|
}
|
|
19
20
|
while (nextLink) {
|
|
20
21
|
const accessToken = await siteRef.context.generateAccessToken();
|
|
21
|
-
const response = await
|
|
22
|
+
const response = await executeHttpRequest({
|
|
23
|
+
url: nextLink.toString(),
|
|
24
|
+
method: "GET",
|
|
22
25
|
headers: {
|
|
23
26
|
authorization: `Bearer ${accessToken}`,
|
|
24
27
|
},
|
|
25
28
|
});
|
|
26
|
-
const result =
|
|
29
|
+
const result = response.data;
|
|
27
30
|
drives = result.value;
|
|
28
31
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
29
32
|
for (const drive of drives) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateSiteSearch.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSiteSearch.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;GAKG;AACH,wBAA+B,iBAAiB,CAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBvH"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @category Tasks
|
|
5
5
|
*/
|
|
6
6
|
import searchSites from "../operations/site/searchSites.js";
|
|
7
|
+
import { executeHttpRequest } from "../services/http.js";
|
|
7
8
|
/**
|
|
8
9
|
* Iterate accessible sites matching the provided search keywords as an async iterable.
|
|
9
10
|
* @param contextRef Reference to the context.
|
|
@@ -17,12 +18,14 @@ export default async function* iterateSiteSearch(contextRef, search) {
|
|
|
17
18
|
}
|
|
18
19
|
while (nextLink) {
|
|
19
20
|
const accessToken = await contextRef.context.generateAccessToken();
|
|
20
|
-
const response = await
|
|
21
|
+
const response = await executeHttpRequest({
|
|
22
|
+
url: nextLink.toString(),
|
|
23
|
+
method: "GET",
|
|
21
24
|
headers: {
|
|
22
25
|
authorization: `Bearer ${accessToken}`,
|
|
23
26
|
},
|
|
24
27
|
});
|
|
25
|
-
const result =
|
|
28
|
+
const result = response.data;
|
|
26
29
|
sites = result.value;
|
|
27
30
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
28
31
|
for (const site of sites) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"iterateSites.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateSites.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,kCAAkC,CAAC;AAC7D,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAIjD;;;;;;GAMG;AACH,wBAA+B,YAAY,CAAC,UAAU,EAAE,UAAU,EAAE,WAAW,SAAO,GAAG,cAAc,CAAC,IAAI,GAAG,OAAO,CAAC,CAyBtH"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* @category Tasks
|
|
5
5
|
*/
|
|
6
6
|
import listSites from "../operations/site/listSites.js";
|
|
7
|
+
import { executeHttpRequest } from "../services/http.js";
|
|
7
8
|
/**
|
|
8
9
|
* List sites in your company geography as an async iterable.
|
|
9
10
|
* @param contextRef Reference to the context.
|
|
@@ -18,12 +19,14 @@ export default async function* iterateSites(contextRef, maxPerChunk = 1000) {
|
|
|
18
19
|
}
|
|
19
20
|
while (nextLink) {
|
|
20
21
|
const accessToken = await contextRef.context.generateAccessToken();
|
|
21
|
-
const response = await
|
|
22
|
+
const response = await executeHttpRequest({
|
|
23
|
+
url: nextLink.toString(),
|
|
24
|
+
method: "GET",
|
|
22
25
|
headers: {
|
|
23
26
|
authorization: `Bearer ${accessToken}`,
|
|
24
27
|
},
|
|
25
28
|
});
|
|
26
|
-
const result =
|
|
29
|
+
const result = response.data;
|
|
27
30
|
sites = result.value;
|
|
28
31
|
nextLink = result["@odata.nextLink"] ? new URL(result["@odata.nextLink"]) : null;
|
|
29
32
|
for (const site of sites) {
|
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`
|
|
@@ -10,7 +10,7 @@ List drives in a site as an async iterable.
|
|
|
10
10
|
|
|
11
11
|
> **iterateDrives**(`siteRef`, `maxPerChunk`): [`AsyncGenerator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)\<`DriveItem` & [`SiteRef`](Site-1.md#siteref) & `object`\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/tasks/iterateDrives.ts:
|
|
13
|
+
Defined in: [src/tasks/iterateDrives.ts:20](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/tasks/iterateDrives.ts#L20)
|
|
14
14
|
|
|
15
15
|
List drives in a site as an async iterable.
|
|
16
16
|
|
|
@@ -10,7 +10,7 @@ Iterate accessible sites matching the provided search keywords as an async itera
|
|
|
10
10
|
|
|
11
11
|
> **iterateSiteSearch**(`contextRef`, `search`): [`AsyncGenerator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)\<`Site` & [`SiteRef`](Site-1.md#siteref)\>
|
|
12
12
|
|
|
13
|
-
Defined in: src/tasks/iterateSiteSearch.ts:
|
|
13
|
+
Defined in: [src/tasks/iterateSiteSearch.ts:19](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/tasks/iterateSiteSearch.ts#L19)
|
|
14
14
|
|
|
15
15
|
Iterate accessible sites matching the provided search keywords as an async iterable.
|
|
16
16
|
|
package/docs/api/iterateSites.md
CHANGED
|
@@ -10,7 +10,7 @@ List sites in your company geography as an async iterable.
|
|
|
10
10
|
|
|
11
11
|
> **iterateSites**(`contextRef`, `maxPerChunk`): [`AsyncGenerator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)\<`Site` & [`SiteRef`](Site-1.md#siteref)\>
|
|
12
12
|
|
|
13
|
-
Defined in: [src/tasks/iterateSites.ts:
|
|
13
|
+
Defined in: [src/tasks/iterateSites.ts:20](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/tasks/iterateSites.ts#L20)
|
|
14
14
|
|
|
15
15
|
List sites in your company geography as an async iterable.
|
|
16
16
|
|
|
@@ -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
|
|