microsoft-graph 3.12.25 → 3.12.27
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/.github/workflows/check.yml +3 -0
- package/.vscode/settings.json +1 -1
- package/dist/cjs/services/driveItem.d.ts.map +1 -1
- package/dist/cjs/services/driveItem.js +18 -1
- package/dist/esm/services/driveItem.d.ts.map +1 -1
- package/dist/esm/services/driveItem.js +18 -1
- package/docs/api/driveItem.md +5 -5
- package/package.json +1 -1
package/.vscode/settings.json
CHANGED
|
@@ -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;
|
|
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;AAiBpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CA+ClE;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"}
|
|
@@ -22,6 +22,22 @@ const reservedNames = ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4
|
|
|
22
22
|
exports.workbookFileExtension = "xlsx";
|
|
23
23
|
exports.binaryWorkbookFileExtension = "xlsb";
|
|
24
24
|
exports.rootDriveItemPath = driveItemPath("/");
|
|
25
|
+
/**
|
|
26
|
+
* Trims leading and trailing forward slashes from a segment without using a
|
|
27
|
+
* potentially scanner-flagged alternation regex. This is linear and safe.
|
|
28
|
+
* @param value Segment string.
|
|
29
|
+
* @returns Segment without leading/trailing '/'.
|
|
30
|
+
*/
|
|
31
|
+
function trimSlashes(value) {
|
|
32
|
+
let start = 0;
|
|
33
|
+
let end = value.length;
|
|
34
|
+
// 47 is '/'
|
|
35
|
+
while (start < end && value.charCodeAt(start) === 47)
|
|
36
|
+
start++;
|
|
37
|
+
while (end > start && value.charCodeAt(end - 1) === 47)
|
|
38
|
+
end--;
|
|
39
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
40
|
+
}
|
|
25
41
|
/**
|
|
26
42
|
* Creates a drive item path from a given set of segments.
|
|
27
43
|
* @param segments - The segments of the path.
|
|
@@ -42,7 +58,8 @@ function driveItemPath(...segments) {
|
|
|
42
58
|
.map((seg, i) => {
|
|
43
59
|
if (seg === "/")
|
|
44
60
|
return i === 0 ? "" : seg; // root as first segment becomes empty, else keep
|
|
45
|
-
|
|
61
|
+
// Avoid using a polynomial-time regex on uncontrolled input; manual trim is O(n)
|
|
62
|
+
return trimSlashes(seg);
|
|
46
63
|
})
|
|
47
64
|
.filter((seg, i) => !(i === 0 && seg === "")); // remove empty first segment (root)
|
|
48
65
|
// If any segment is empty after cleaning, throw (except for the special root case handled above)
|
|
@@ -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;
|
|
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;AAiBpD;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,aAAa,CA+ClE;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"}
|
|
@@ -11,6 +11,22 @@ const reservedNames = ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4
|
|
|
11
11
|
export const workbookFileExtension = "xlsx";
|
|
12
12
|
export const binaryWorkbookFileExtension = "xlsb";
|
|
13
13
|
export const rootDriveItemPath = driveItemPath("/");
|
|
14
|
+
/**
|
|
15
|
+
* Trims leading and trailing forward slashes from a segment without using a
|
|
16
|
+
* potentially scanner-flagged alternation regex. This is linear and safe.
|
|
17
|
+
* @param value Segment string.
|
|
18
|
+
* @returns Segment without leading/trailing '/'.
|
|
19
|
+
*/
|
|
20
|
+
function trimSlashes(value) {
|
|
21
|
+
let start = 0;
|
|
22
|
+
let end = value.length;
|
|
23
|
+
// 47 is '/'
|
|
24
|
+
while (start < end && value.charCodeAt(start) === 47)
|
|
25
|
+
start++;
|
|
26
|
+
while (end > start && value.charCodeAt(end - 1) === 47)
|
|
27
|
+
end--;
|
|
28
|
+
return start === 0 && end === value.length ? value : value.slice(start, end);
|
|
29
|
+
}
|
|
14
30
|
/**
|
|
15
31
|
* Creates a drive item path from a given set of segments.
|
|
16
32
|
* @param segments - The segments of the path.
|
|
@@ -31,7 +47,8 @@ export function driveItemPath(...segments) {
|
|
|
31
47
|
.map((seg, i) => {
|
|
32
48
|
if (seg === "/")
|
|
33
49
|
return i === 0 ? "" : seg; // root as first segment becomes empty, else keep
|
|
34
|
-
|
|
50
|
+
// Avoid using a polynomial-time regex on uncontrolled input; manual trim is O(n)
|
|
51
|
+
return trimSlashes(seg);
|
|
35
52
|
})
|
|
36
53
|
.filter((seg, i) => !(i === 0 && seg === "")); // remove empty first segment (root)
|
|
37
54
|
// If any segment is empty after cleaning, throw (except for the special root case handled above)
|
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:100](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L100)
|
|
38
38
|
|
|
39
39
|
Creates a reference to a drive item.
|
|
40
40
|
|
|
@@ -61,7 +61,7 @@ ProtocolError if the item ID is missing.
|
|
|
61
61
|
|
|
62
62
|
> **driveItemPath**(...`segments`): [`DriveItemPath`](DriveItem-1.md#driveitempath)
|
|
63
63
|
|
|
64
|
-
Defined in: [src/services/driveItem.ts:
|
|
64
|
+
Defined in: [src/services/driveItem.ts:44](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L44)
|
|
65
65
|
|
|
66
66
|
Creates a drive item path from a given set of segments.
|
|
67
67
|
|
|
@@ -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:138](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L138)
|
|
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:148](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L148)
|
|
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:118](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L118)
|
|
135
135
|
|
|
136
136
|
Splits a drive item path into its folder path and file name.
|
|
137
137
|
|