microsoft-graph 3.11.16 → 3.11.18
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.
|
@@ -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,
|
|
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,CA8ClE;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"}
|
|
@@ -29,10 +29,27 @@ exports.rootDriveItemPath = driveItemPath("/");
|
|
|
29
29
|
* @throws InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
30
30
|
*/
|
|
31
31
|
function driveItemPath(...segments) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
32
|
+
// Throw if any original segment is an empty string
|
|
33
|
+
if (segments.some((seg) => seg === "")) {
|
|
34
|
+
throw new InvalidArgumentError_ts_1.default("Segment cannot be an empty string.");
|
|
35
|
+
}
|
|
36
|
+
// Special case: if no segments, return root
|
|
37
|
+
if (segments.length === 0) {
|
|
38
|
+
return "/";
|
|
39
|
+
}
|
|
40
|
+
// Remove leading/trailing slashes from all segments except if the segment is exactly "/"
|
|
41
|
+
const cleanedSegments = segments
|
|
42
|
+
.map((seg, i) => {
|
|
43
|
+
if (seg === "/")
|
|
44
|
+
return i === 0 ? "" : seg; // root as first segment becomes empty, else keep
|
|
45
|
+
return seg.replace(/^\/+|\/+$/g, "");
|
|
46
|
+
})
|
|
47
|
+
.filter((seg, i) => !(i === 0 && seg === "")); // remove empty first segment (root)
|
|
48
|
+
// If any segment is empty after cleaning, throw (except for the special root case handled above)
|
|
49
|
+
if (cleanedSegments.some((seg) => seg === "")) {
|
|
50
|
+
throw new InvalidArgumentError_ts_1.default("Segment cannot be an empty string.");
|
|
51
|
+
}
|
|
52
|
+
for (const segment of cleanedSegments) {
|
|
36
53
|
if (!segmentPattern.test(segment)) {
|
|
37
54
|
throw new InvalidArgumentError_ts_1.default(`Segment '${segment}' does not match required pattern '${segmentPattern}'.`);
|
|
38
55
|
}
|
|
@@ -43,10 +60,7 @@ function driveItemPath(...segments) {
|
|
|
43
60
|
throw new InvalidArgumentError_ts_1.default(`Segment '${segment}' cannot end with a period.`);
|
|
44
61
|
}
|
|
45
62
|
}
|
|
46
|
-
|
|
47
|
-
if (!path.startsWith("/")) {
|
|
48
|
-
path = `/${path}`;
|
|
49
|
-
}
|
|
63
|
+
const path = `/${cleanedSegments.join("/")}`;
|
|
50
64
|
if (path.includes("//")) {
|
|
51
65
|
throw new InvalidArgumentError_ts_1.default("Path cannot contain consecutive slashes.");
|
|
52
66
|
}
|
|
@@ -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,
|
|
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,CA8ClE;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"}
|
|
@@ -18,10 +18,27 @@ export const rootDriveItemPath = driveItemPath("/");
|
|
|
18
18
|
* @throws InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
19
19
|
*/
|
|
20
20
|
export function driveItemPath(...segments) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
21
|
+
// Throw if any original segment is an empty string
|
|
22
|
+
if (segments.some((seg) => seg === "")) {
|
|
23
|
+
throw new InvalidArgumentError("Segment cannot be an empty string.");
|
|
24
|
+
}
|
|
25
|
+
// Special case: if no segments, return root
|
|
26
|
+
if (segments.length === 0) {
|
|
27
|
+
return "/";
|
|
28
|
+
}
|
|
29
|
+
// Remove leading/trailing slashes from all segments except if the segment is exactly "/"
|
|
30
|
+
const cleanedSegments = segments
|
|
31
|
+
.map((seg, i) => {
|
|
32
|
+
if (seg === "/")
|
|
33
|
+
return i === 0 ? "" : seg; // root as first segment becomes empty, else keep
|
|
34
|
+
return seg.replace(/^\/+|\/+$/g, "");
|
|
35
|
+
})
|
|
36
|
+
.filter((seg, i) => !(i === 0 && seg === "")); // remove empty first segment (root)
|
|
37
|
+
// If any segment is empty after cleaning, throw (except for the special root case handled above)
|
|
38
|
+
if (cleanedSegments.some((seg) => seg === "")) {
|
|
39
|
+
throw new InvalidArgumentError("Segment cannot be an empty string.");
|
|
40
|
+
}
|
|
41
|
+
for (const segment of cleanedSegments) {
|
|
25
42
|
if (!segmentPattern.test(segment)) {
|
|
26
43
|
throw new InvalidArgumentError(`Segment '${segment}' does not match required pattern '${segmentPattern}'.`);
|
|
27
44
|
}
|
|
@@ -32,10 +49,7 @@ export function driveItemPath(...segments) {
|
|
|
32
49
|
throw new InvalidArgumentError(`Segment '${segment}' cannot end with a period.`);
|
|
33
50
|
}
|
|
34
51
|
}
|
|
35
|
-
|
|
36
|
-
if (!path.startsWith("/")) {
|
|
37
|
-
path = `/${path}`;
|
|
38
|
-
}
|
|
52
|
+
const path = `/${cleanedSegments.join("/")}`;
|
|
39
53
|
if (path.includes("//")) {
|
|
40
54
|
throw new InvalidArgumentError("Path cannot contain consecutive slashes.");
|
|
41
55
|
}
|
package/docs/api/driveItem.md
CHANGED
|
@@ -34,7 +34,7 @@ Defined in: [src/services/driveItem.ts:18](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:84](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L84)
|
|
38
38
|
|
|
39
39
|
Creates a reference to a drive item.
|
|
40
40
|
|
|
@@ -87,7 +87,7 @@ InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
|
|
|
87
87
|
|
|
88
88
|
> **getDriveItemExtension**(`item`): `string`
|
|
89
89
|
|
|
90
|
-
Defined in: [src/services/driveItem.ts:
|
|
90
|
+
Defined in: [src/services/driveItem.ts:122](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L122)
|
|
91
91
|
|
|
92
92
|
Gets the file extension of a drive item.
|
|
93
93
|
|
|
@@ -109,7 +109,7 @@ File extension ie. "txt", "jpg"
|
|
|
109
109
|
|
|
110
110
|
> **getDriveItemParent**(`item`): [`DriveItemRef`](DriveItem-1.md#driveitemref)
|
|
111
111
|
|
|
112
|
-
Defined in: [src/services/driveItem.ts:
|
|
112
|
+
Defined in: [src/services/driveItem.ts:132](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L132)
|
|
113
113
|
|
|
114
114
|
Gets the parent for a drive item. Typically this is the folder of a file.
|
|
115
115
|
|
|
@@ -131,7 +131,7 @@ Parent drive item.
|
|
|
131
131
|
|
|
132
132
|
> **splitDriveItemPath**(`filePath`): `object`
|
|
133
133
|
|
|
134
|
-
Defined in: [src/services/driveItem.ts:
|
|
134
|
+
Defined in: [src/services/driveItem.ts:102](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L102)
|
|
135
135
|
|
|
136
136
|
Splits a drive item path into its folder path and file name.
|
|
137
137
|
|