microsoft-graph 3.11.20 → 3.11.22

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.
Files changed (28) hide show
  1. package/README.md +0 -11
  2. package/dist/cjs/operations/driveItem/createDriveItem.d.ts.map +1 -1
  3. package/dist/cjs/operations/driveItem/createDriveItem.js +2 -1
  4. package/dist/cjs/operations/driveItem/createDriveItemContent.d.ts.map +1 -1
  5. package/dist/cjs/operations/driveItem/createDriveItemContent.js +44 -60
  6. package/dist/cjs/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  7. package/dist/cjs/operations/driveItem/existsDriveItem.js +2 -1
  8. package/dist/cjs/operations/driveItem/getDriveItemByPath.d.ts.map +1 -1
  9. package/dist/cjs/operations/driveItem/getDriveItemByPath.js +3 -2
  10. package/dist/cjs/operations/workbook/createBinaryWorkbook.d.ts.map +1 -1
  11. package/dist/cjs/operations/workbook/createBinaryWorkbook.js +2 -1
  12. package/dist/cjs/operations/workbook/createWorkbook.d.ts.map +1 -1
  13. package/dist/cjs/operations/workbook/createWorkbook.js +2 -1
  14. package/dist/cjs/services/driveItem.js +1 -1
  15. package/dist/esm/operations/driveItem/createDriveItem.d.ts.map +1 -1
  16. package/dist/esm/operations/driveItem/createDriveItem.js +2 -1
  17. package/dist/esm/operations/driveItem/createDriveItemContent.d.ts.map +1 -1
  18. package/dist/esm/operations/driveItem/createDriveItemContent.js +44 -60
  19. package/dist/esm/operations/driveItem/existsDriveItem.d.ts.map +1 -1
  20. package/dist/esm/operations/driveItem/existsDriveItem.js +2 -1
  21. package/dist/esm/operations/driveItem/getDriveItemByPath.d.ts.map +1 -1
  22. package/dist/esm/operations/driveItem/getDriveItemByPath.js +3 -2
  23. package/dist/esm/operations/workbook/createBinaryWorkbook.d.ts.map +1 -1
  24. package/dist/esm/operations/workbook/createBinaryWorkbook.js +2 -1
  25. package/dist/esm/operations/workbook/createWorkbook.d.ts.map +1 -1
  26. package/dist/esm/operations/workbook/createWorkbook.js +2 -1
  27. package/dist/esm/services/driveItem.js +1 -1
  28. package/package.json +1 -1
package/README.md CHANGED
@@ -6,17 +6,6 @@ This is an extensible library that allows access to Microsoft's GraphAPI, includ
6
6
 
7
7
  ℹ️ This is a THIRD PARTY library and not associated with Microsoft.
8
8
 
9
- ## Breaking changes
10
- Version 2.25.0 has a few breaking changes:
11
- * **Signature change for `insertWorkbookCells` from `insertWorkbookCells(worksheetRef, address, shift)` to `insertWorkbookCells(rangeRef, shift)`**
12
- * `graphApi.ts` has moved to `services/operationInvoker.ts`
13
- * `NumberFormat` renamed to `CellFormat`
14
- * `Cell.numberFormat` renamed to `Cell.format`
15
- * `services/numberFormat.ts` moved to `services/cellFormat.ts`
16
- * Merged a number of files in `models` to reduce import count.
17
- * Removed return value from `setColumnHidden` and `setRowHidden`
18
- * `services/listDriveItems` now returns async iterable. Wrap this with `iterateToArray` if an array is actually desired.
19
-
20
9
  ## TLDR
21
10
  Install the NPM package `npm i microsoft-graph`, then:
22
11
 
@@ -1 +1 @@
1
- {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAsBxL"}
1
+ {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAuBxL"}
@@ -22,10 +22,11 @@ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
22
22
  */
23
23
  function createDriveItem(parentRef, itemPath, contextType, content) {
24
24
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
25
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
25
26
  return (0, operationInvoker_ts_1.operation)({
26
27
  context: parentRef.context,
27
28
  method: "PUT",
28
- path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
29
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
29
30
  headers: {
30
31
  "content-type": contextType,
31
32
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM1F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAc5C;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAsH7P"}
1
+ {"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM1F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAc5C;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAuG7P"}
@@ -47,7 +47,8 @@ async function createDriveItemContent(parentRef, itemPath, contentStream, conten
47
47
  throw new InvalidArgumentError_ts_1.default(`Chunk size (${maxChunkSize.toLocaleString()}) must be a multiple of ${(exports.chunkSizeMultiple / 1024).toLocaleString()} KiB *${exports.chunkSizeMultiple.toLocaleString()} bytes).`);
48
48
  }
49
49
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
50
- const uploadSessionUrl = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:${itemPath}:/createUploadSession`, parentRef)}`;
50
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
51
+ const uploadSessionUrl = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:${encodedItemPath}:/createUploadSession`, parentRef)}`;
51
52
  const accessToken = await parentRef.context.generateAccessToken();
52
53
  const fileName = (0, node_path_1.basename)(itemPath);
53
54
  const { uploadUrl } = await (0, http_ts_1.execute)({
@@ -65,72 +66,55 @@ async function createDriveItemContent(parentRef, itemPath, contentStream, conten
65
66
  }),
66
67
  responseType: "json",
67
68
  });
69
+ const reader = contentStream[Symbol.asyncIterator] ? contentStream[Symbol.asyncIterator]() : null;
70
+ if (!reader) {
71
+ throw new InvalidArgumentError_ts_1.default("contentStream is not an async iterable");
72
+ }
68
73
  let contentPosition = 0;
69
74
  let item = null;
70
75
  let leftover = null;
71
- try {
72
- const reader = contentStream[Symbol.asyncIterator] ? contentStream[Symbol.asyncIterator]() : null;
73
- if (!reader) {
74
- throw new InvalidArgumentError_ts_1.default("contentStream is not an async iterable");
75
- }
76
- while (contentPosition < contentLength) {
77
- const chunkSize = Math.min(maxChunkSize, contentLength - contentPosition);
78
- const buffer = Buffer.alloc(chunkSize);
79
- let length = 0;
80
- while (length < chunkSize) {
81
- let c = null;
82
- if (leftover) {
83
- c = leftover;
84
- leftover = null;
85
- }
86
- else {
87
- const { value, done } = await reader.next();
88
- if (done)
89
- break;
90
- c = Buffer.isBuffer(value) ? value : Buffer.from(value);
91
- }
92
- const toCopy = Math.min(c.length, chunkSize - length);
93
- c.copy(buffer, length, 0, toCopy);
94
- length += toCopy;
95
- if (toCopy < c.length) {
96
- leftover = c.subarray(toCopy);
97
- }
76
+ while (contentPosition < contentLength) {
77
+ const chunkSize = Math.min(maxChunkSize, contentLength - contentPosition);
78
+ const buffer = Buffer.alloc(chunkSize);
79
+ let length = 0;
80
+ while (length < chunkSize) {
81
+ let c = null;
82
+ if (leftover) {
83
+ c = leftover;
84
+ leftover = null;
98
85
  }
99
- const chunkStart = contentPosition;
100
- const chunkEnd = contentPosition + length - 1;
101
- const chunk = buffer.subarray(0, length);
102
- const response = await (0, http_ts_1.execute)({
103
- url: uploadUrl,
104
- method: "PUT",
105
- headers: {
106
- "Content-Length": `${length}`,
107
- "Content-Range": `bytes ${chunkStart}-${chunkEnd}/${contentLength}`,
108
- },
109
- data: chunk,
110
- responseType: "json",
111
- });
112
- contentPosition += length;
113
- progress(contentPosition);
114
- if (isDriveItem(response)) {
115
- item = response;
116
- break;
86
+ else {
87
+ const { value, done } = await reader.next();
88
+ if (done)
89
+ break;
90
+ c = Buffer.isBuffer(value) ? value : Buffer.from(value);
91
+ }
92
+ const toCopy = Math.min(c.length, chunkSize - length);
93
+ c.copy(buffer, length, 0, toCopy);
94
+ length += toCopy;
95
+ if (toCopy < c.length) {
96
+ leftover = c.subarray(toCopy);
117
97
  }
118
98
  }
119
- }
120
- catch (err) {
121
- try {
122
- await (0, http_ts_1.execute)({
123
- url: uploadUrl,
124
- method: "DELETE",
125
- headers: {
126
- authorization: `Bearer ${accessToken}`,
127
- },
128
- });
129
- }
130
- catch {
131
- // Ignore errors from cancel attempt
99
+ const chunkStart = contentPosition;
100
+ const chunkEnd = contentPosition + length - 1;
101
+ const chunk = buffer.subarray(0, length);
102
+ const response = await (0, http_ts_1.execute)({
103
+ url: uploadUrl,
104
+ method: "PUT",
105
+ headers: {
106
+ "Content-Length": `${length}`,
107
+ "Content-Range": `bytes ${chunkStart}-${chunkEnd}/${contentLength}`,
108
+ },
109
+ data: chunk,
110
+ responseType: "json",
111
+ });
112
+ contentPosition += length;
113
+ progress(contentPosition);
114
+ if (isDriveItem(response)) {
115
+ item = response;
116
+ break;
132
117
  }
133
- throw err;
134
118
  }
135
119
  progress(contentPosition);
136
120
  if (!item) {
@@ -1 +1 @@
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"}
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,CA2B3G"}
@@ -23,7 +23,8 @@ async function existsDriveItem(driveRef, itemPath) {
23
23
  if (!itemPath.startsWith("/")) {
24
24
  throw new InvalidArgumentError_ts_1.default("itemPath must start with a forward slash (/)");
25
25
  }
26
- const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
26
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
27
+ const url = `${operationInvoker_ts_1.endpoint}${(0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/root:${encodedItemPath}`, driveRef)}`;
27
28
  const accessToken = await driveRef.context.generateAccessToken();
28
29
  const response = await (0, http_ts_1.executeRaw)({
29
30
  // TODO: This is not supporting retry and needs fixing
@@ -1 +1 @@
1
- {"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA8BhJ"}
1
+ {"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA+BhJ"}
@@ -24,14 +24,15 @@ function getDriveItemByPath(parentRef, itemPath) {
24
24
  if (!itemPath.startsWith("/")) {
25
25
  throw new InvalidArgumentError_ts_1.default("itemPath must start with a forward slash (/)");
26
26
  }
27
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
27
28
  let normalizedPath;
28
29
  if ("id" in parentRef) {
29
30
  // parentRef is a DriveItemRef
30
- normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${itemPath}`;
31
+ normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${encodedItemPath}`;
31
32
  }
32
33
  else {
33
34
  // parentRef is a DriveRef
34
- normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${itemPath}`;
35
+ normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${encodedItemPath}`;
35
36
  }
36
37
  return (0, operationInvoker_ts_1.operation)({
37
38
  context: parentRef.context,
@@ -1 +1 @@
1
- {"version":3,"file":"createBinaryWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createBinaryWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQ5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CAyBjJ"}
1
+ {"version":3,"file":"createBinaryWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createBinaryWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQ5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CA0BjJ"}
@@ -26,11 +26,12 @@ function createBinaryWorkbook(parentRef, itemPath) {
26
26
  if (!itemPath.endsWith(`.${driveItem_ts_1.binaryWorkbookFileExtension}`)) {
27
27
  throw new InvalidArgumentError_ts_1.default(`Item path must end with '.${driveItem_ts_1.workbookFileExtension}'`);
28
28
  }
29
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
29
30
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
30
31
  return (0, operationInvoker_ts_1.operation)({
31
32
  context: parentRef.context,
32
33
  method: "PUT",
33
- path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
34
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
34
35
  headers: {
35
36
  "content-type": "application/vnd.ms-excel.sheet.binary",
36
37
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CAyB3I"}
1
+ {"version":3,"file":"createWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CA2B3I"}
@@ -25,11 +25,12 @@ function createWorkbook(parentRef, itemPath) {
25
25
  if (!itemPath.endsWith(`.${driveItem_ts_1.workbookFileExtension}`)) {
26
26
  throw new InvalidArgumentError_ts_1.default(`Item path must end with '.${driveItem_ts_1.workbookFileExtension}'`);
27
27
  }
28
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
28
29
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
29
30
  return (0, operationInvoker_ts_1.operation)({
30
31
  context: parentRef.context,
31
32
  method: "PUT",
32
- path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
33
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
33
34
  headers: {
34
35
  "content-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
35
36
  },
@@ -17,7 +17,7 @@ exports.getDriveItemParent = getDriveItemParent;
17
17
  const node_path_1 = __importDefault(require("node:path"));
18
18
  const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
19
19
  const ProtocolError_ts_1 = __importDefault(require("../errors/ProtocolError.js"));
20
- const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
20
+ const segmentPattern = /^[^"*:<>\\|]{1,256}$/;
21
21
  const reservedNames = ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"];
22
22
  exports.workbookFileExtension = "xlsx";
23
23
  exports.binaryWorkbookFileExtension = "xlsb";
@@ -1 +1 @@
1
- {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAsBxL"}
1
+ {"version":3,"file":"createDriveItem.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItem.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAClE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;;;;GASG;AACH,MAAM,CAAC,OAAO,UAAU,eAAe,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,WAAW,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CAuBxL"}
@@ -19,10 +19,11 @@ import { generatePath } from "../../services/templatedPaths.js";
19
19
  */
20
20
  export default function createDriveItem(parentRef, itemPath, contextType, content) {
21
21
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
22
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
22
23
  return operation({
23
24
  context: parentRef.context,
24
25
  method: "PUT",
25
- path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
26
+ path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
26
27
  headers: {
27
28
  "content-type": contextType,
28
29
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM1F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAc5C;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAsH7P"}
1
+ {"version":3,"file":"createDriveItemContent.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/createDriveItemContent.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAIlE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAM1F;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,QAAa,CAAC;AAc5C;;;;;GAKG;AACH,MAAM,WAAW,6BAA6B;IAC7C,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CACnC;AAED;;;;;;;;;;;;;GAaG;AACH,wBAA8B,sBAAsB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,CAAC,cAAc,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAAE,6BAAkC,GAAG,OAAO,CAAC,SAAS,GAAG,YAAY,CAAC,CAuG7P"}
@@ -40,7 +40,8 @@ export default async function createDriveItemContent(parentRef, itemPath, conten
40
40
  throw new InvalidArgumentError(`Chunk size (${maxChunkSize.toLocaleString()}) must be a multiple of ${(chunkSizeMultiple / 1024).toLocaleString()} KiB *${chunkSizeMultiple.toLocaleString()} bytes).`);
41
41
  }
42
42
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
43
- const uploadSessionUrl = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:${itemPath}:/createUploadSession`, parentRef)}`;
43
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
44
+ const uploadSessionUrl = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:${encodedItemPath}:/createUploadSession`, parentRef)}`;
44
45
  const accessToken = await parentRef.context.generateAccessToken();
45
46
  const fileName = basename(itemPath);
46
47
  const { uploadUrl } = await execute({
@@ -58,72 +59,55 @@ export default async function createDriveItemContent(parentRef, itemPath, conten
58
59
  }),
59
60
  responseType: "json",
60
61
  });
62
+ const reader = contentStream[Symbol.asyncIterator] ? contentStream[Symbol.asyncIterator]() : null;
63
+ if (!reader) {
64
+ throw new InvalidArgumentError("contentStream is not an async iterable");
65
+ }
61
66
  let contentPosition = 0;
62
67
  let item = null;
63
68
  let leftover = null;
64
- try {
65
- const reader = contentStream[Symbol.asyncIterator] ? contentStream[Symbol.asyncIterator]() : null;
66
- if (!reader) {
67
- throw new InvalidArgumentError("contentStream is not an async iterable");
68
- }
69
- while (contentPosition < contentLength) {
70
- const chunkSize = Math.min(maxChunkSize, contentLength - contentPosition);
71
- const buffer = Buffer.alloc(chunkSize);
72
- let length = 0;
73
- while (length < chunkSize) {
74
- let c = null;
75
- if (leftover) {
76
- c = leftover;
77
- leftover = null;
78
- }
79
- else {
80
- const { value, done } = await reader.next();
81
- if (done)
82
- break;
83
- c = Buffer.isBuffer(value) ? value : Buffer.from(value);
84
- }
85
- const toCopy = Math.min(c.length, chunkSize - length);
86
- c.copy(buffer, length, 0, toCopy);
87
- length += toCopy;
88
- if (toCopy < c.length) {
89
- leftover = c.subarray(toCopy);
90
- }
69
+ while (contentPosition < contentLength) {
70
+ const chunkSize = Math.min(maxChunkSize, contentLength - contentPosition);
71
+ const buffer = Buffer.alloc(chunkSize);
72
+ let length = 0;
73
+ while (length < chunkSize) {
74
+ let c = null;
75
+ if (leftover) {
76
+ c = leftover;
77
+ leftover = null;
91
78
  }
92
- const chunkStart = contentPosition;
93
- const chunkEnd = contentPosition + length - 1;
94
- const chunk = buffer.subarray(0, length);
95
- const response = await execute({
96
- url: uploadUrl,
97
- method: "PUT",
98
- headers: {
99
- "Content-Length": `${length}`,
100
- "Content-Range": `bytes ${chunkStart}-${chunkEnd}/${contentLength}`,
101
- },
102
- data: chunk,
103
- responseType: "json",
104
- });
105
- contentPosition += length;
106
- progress(contentPosition);
107
- if (isDriveItem(response)) {
108
- item = response;
109
- break;
79
+ else {
80
+ const { value, done } = await reader.next();
81
+ if (done)
82
+ break;
83
+ c = Buffer.isBuffer(value) ? value : Buffer.from(value);
84
+ }
85
+ const toCopy = Math.min(c.length, chunkSize - length);
86
+ c.copy(buffer, length, 0, toCopy);
87
+ length += toCopy;
88
+ if (toCopy < c.length) {
89
+ leftover = c.subarray(toCopy);
110
90
  }
111
91
  }
112
- }
113
- catch (err) {
114
- try {
115
- await execute({
116
- url: uploadUrl,
117
- method: "DELETE",
118
- headers: {
119
- authorization: `Bearer ${accessToken}`,
120
- },
121
- });
122
- }
123
- catch {
124
- // Ignore errors from cancel attempt
92
+ const chunkStart = contentPosition;
93
+ const chunkEnd = contentPosition + length - 1;
94
+ const chunk = buffer.subarray(0, length);
95
+ const response = await execute({
96
+ url: uploadUrl,
97
+ method: "PUT",
98
+ headers: {
99
+ "Content-Length": `${length}`,
100
+ "Content-Range": `bytes ${chunkStart}-${chunkEnd}/${contentLength}`,
101
+ },
102
+ data: chunk,
103
+ responseType: "json",
104
+ });
105
+ contentPosition += length;
106
+ progress(contentPosition);
107
+ if (isDriveItem(response)) {
108
+ item = response;
109
+ break;
125
110
  }
126
- throw err;
127
111
  }
128
112
  progress(contentPosition);
129
113
  if (!item) {
@@ -1 +1 @@
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"}
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,CA2B3G"}
@@ -17,7 +17,8 @@ export default async function existsDriveItem(driveRef, itemPath) {
17
17
  if (!itemPath.startsWith("/")) {
18
18
  throw new InvalidArgumentError("itemPath must start with a forward slash (/)");
19
19
  }
20
- const url = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/root:${itemPath}`, driveRef)}`;
20
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
21
+ const url = `${endpoint}${generatePath(`/sites/{site-id}/drives/{drive-id}/root:${encodedItemPath}`, driveRef)}`;
21
22
  const accessToken = await driveRef.context.generateAccessToken();
22
23
  const response = await executeRaw({
23
24
  // TODO: This is not supporting retry and needs fixing
@@ -1 +1 @@
1
- {"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA8BhJ"}
1
+ {"version":3,"file":"getDriveItemByPath.d.ts","sourceRoot":"","sources":["../../../../src/operations/driveItem/getDriveItemByPath.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AAKrE;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,kBAAkB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,YAAY,CAAC,CA+BhJ"}
@@ -18,14 +18,15 @@ export default function getDriveItemByPath(parentRef, itemPath) {
18
18
  if (!itemPath.startsWith("/")) {
19
19
  throw new InvalidArgumentError("itemPath must start with a forward slash (/)");
20
20
  }
21
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
21
22
  let normalizedPath;
22
23
  if ("id" in parentRef) {
23
24
  // parentRef is a DriveItemRef
24
- normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${itemPath}`;
25
+ normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/items/{item-id}" : `/sites/{site-id}/drives/{drive-id}/items/{item-id}:${encodedItemPath}`;
25
26
  }
26
27
  else {
27
28
  // parentRef is a DriveRef
28
- normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${itemPath}`;
29
+ normalizedPath = itemPath === "/" ? "/sites/{site-id}/drives/{drive-id}/root" : `/sites/{site-id}/drives/{drive-id}/root:${encodedItemPath}`;
29
30
  }
30
31
  return operation({
31
32
  context: parentRef.context,
@@ -1 +1 @@
1
- {"version":3,"file":"createBinaryWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createBinaryWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQ5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CAyBjJ"}
1
+ {"version":3,"file":"createBinaryWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createBinaryWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAQ5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,oBAAoB,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CA0BjJ"}
@@ -20,11 +20,12 @@ export default function createBinaryWorkbook(parentRef, itemPath) {
20
20
  if (!itemPath.endsWith(`.${binaryWorkbookFileExtension}`)) {
21
21
  throw new InvalidArgumentError(`Item path must end with '.${workbookFileExtension}'`);
22
22
  }
23
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
23
24
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
24
25
  return operation({
25
26
  context: parentRef.context,
26
27
  method: "PUT",
27
- path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
28
+ path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
28
29
  headers: {
29
30
  "content-type": "application/vnd.ms-excel.sheet.binary",
30
31
  },
@@ -1 +1 @@
1
- {"version":3,"file":"createWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CAyB3I"}
1
+ {"version":3,"file":"createWorkbook.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbook/createWorkbook.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAElE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAe,aAAa,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC1F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAK5D;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,SAAS,EAAE,QAAQ,GAAG,YAAY,EAAE,QAAQ,EAAE,aAAa,GAAG,cAAc,CAAC,SAAS,GAAG,WAAW,CAAC,CA2B3I"}
@@ -19,11 +19,12 @@ export default function createWorkbook(parentRef, itemPath) {
19
19
  if (!itemPath.endsWith(`.${workbookFileExtension}`)) {
20
20
  throw new InvalidArgumentError(`Item path must end with '.${workbookFileExtension}'`);
21
21
  }
22
+ const encodedItemPath = itemPath.split("/").map(encodeURIComponent).join("/");
22
23
  const pathSegment = parentRef.itemId ? "items/{item-id}" : "root";
23
24
  return operation({
24
25
  context: parentRef.context,
25
26
  method: "PUT",
26
- path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${itemPath}:/content`, parentRef),
27
+ path: generatePath(`/sites/{site-id}/drives/{drive-id}/${pathSegment}:/${encodedItemPath}:/content`, parentRef),
27
28
  headers: {
28
29
  "content-type": "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
29
30
  },
@@ -6,7 +6,7 @@
6
6
  import path from "node:path";
7
7
  import InvalidArgumentError from "../errors/InvalidArgumentError.js";
8
8
  import ProtocolError from "../errors/ProtocolError.js";
9
- const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
9
+ const segmentPattern = /^[^"*:<>\\|]{1,256}$/;
10
10
  const reservedNames = ["CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", "COM8", "COM9", "LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9"];
11
11
  export const workbookFileExtension = "xlsx";
12
12
  export const binaryWorkbookFileExtension = "xlsb";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microsoft-graph",
3
- "version": "3.11.20",
3
+ "version": "3.11.22",
4
4
  "description": "Microsoft GraphAPI SDK for NodeJS",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",