microsoft-graph 3.3.0 → 3.4.1

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.
@@ -155,12 +155,12 @@ export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols
155
155
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
156
156
  * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
157
157
  *
158
- * @param address - The original range in A1 notation (e.g., "A1:D10").
159
- * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
160
- * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
161
- * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
162
- * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
163
- * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
158
+ * @param address Original range in A1 notation (e.g., "A1:D10").
159
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default is 0.
160
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end of the remaining rows. Default is Infinity.
161
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default is 0.
162
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end of the remaining columns. Default is Infinity.
163
+ * @returns New A1-style range representing the sliced sub-range (e.g., "B2:C5").
164
164
  *
165
165
  * @example
166
166
  * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
@@ -168,22 +168,22 @@ export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols
168
168
  * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
169
169
  * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
170
170
  */
171
- export declare function subAddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
171
+ export declare function subAddress(address: Address, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): Address;
172
172
  /**
173
173
  * Returns a super-address that extends the given address by skipping/taking rows/columns, possibly outside the original bounds.
174
174
  * Negative skip moves the start above/left of the original range (not from the end).
175
175
  *
176
- * @param address - The original range in A1 notation (e.g., "A1:D10").
177
- * @param skipRows - Number of rows to skip (can be negative to extend above).
178
- * @param takeRows - Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
179
- * @param skipCols - Number of columns to skip (can be negative to extend left).
180
- * @param takeCols - Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
181
- * @returns A new A1-style range representing the superrange (may extend outside original bounds).
176
+ * @param address Original range in A1 notation (e.g., "A1:D10").
177
+ * @param skipRows Number of rows to skip (can be negative to extend above).
178
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
179
+ * @param skipCols Number of columns to skip (can be negative to extend left).
180
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
181
+ * @returns New A1-style range representing the super range (may extend outside original bounds).
182
182
  *
183
183
  * @example
184
184
  * superAddress("B2:C3", -1, 4, -1, 4) // "A1:D5"
185
185
  */
186
- export declare function superAddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
186
+ export declare function superAddress(address: Address, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): Address;
187
187
  /**
188
188
  * Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
189
189
  * @param rangeRef Range reference to extract the sub-range from.
@@ -194,7 +194,7 @@ export declare function superAddress(address: Address, skipRows?: number, takeRo
194
194
  * @returns Extracted sub-range reference.
195
195
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
196
196
  */
197
- export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
197
+ export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): WorkbookRangeRef;
198
198
  /**
199
199
  * Returns a super-range from a WorkbookRangeRef using skip/take semantics, possibly extending outside the original bounds.
200
200
  * Negative skip moves the start above/left of the original range (not from the end).
@@ -206,5 +206,5 @@ export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number,
206
206
  * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
207
207
  * @returns Extended super-range reference.
208
208
  */
209
- export declare function superRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
209
+ export declare function superRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): WorkbookRangeRef;
210
210
  //# sourceMappingURL=addressManipulation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/addressManipulation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAuD,iBAAiB,EAA+B,MAAM,sBAAsB,CAAC;AAGtK,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAuBnE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,OAAO,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAcpE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,iBAAiB,EAAE,UAAU,UAAQ,GAAG,OAAO,CAsBzF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAS5D;AAED;;;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AC,OAAO,EAAE,OAAO,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG5D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAuCzF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,OAAO,CAgDpK;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,OAAO,CAkCtK;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,gBAAgB,CAMrL;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,gBAAgB,CAMvL"}
@@ -356,12 +356,12 @@ function cellToRangeAddress(cell, rows, cols) {
356
356
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
357
357
  * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
358
358
  *
359
- * @param address - The original range in A1 notation (e.g., "A1:D10").
360
- * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
361
- * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
362
- * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
363
- * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
364
- * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
359
+ * @param address Original range in A1 notation (e.g., "A1:D10").
360
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default is 0.
361
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end of the remaining rows. Default is Infinity.
362
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default is 0.
363
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end of the remaining columns. Default is Infinity.
364
+ * @returns New A1-style range representing the sliced sub-range (e.g., "B2:C5").
365
365
  *
366
366
  * @example
367
367
  * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
@@ -369,11 +369,17 @@ function cellToRangeAddress(cell, rows, cols) {
369
369
  * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
370
370
  * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
371
371
  */
372
- function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
372
+ function subAddress(address, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
373
+ if (takeRows === undefined || takeRows === null) {
374
+ takeRows = Number.POSITIVE_INFINITY;
375
+ }
376
+ if (takeCols === undefined || takeCols === null) {
377
+ takeCols = Number.POSITIVE_INFINITY;
378
+ }
373
379
  const { ax, bx, ay, by } = (0, cartesianAddress_ts_1.addressToCartesian)(address);
374
380
  const [startRow, endRow] = slice(ay, by, skipRows, takeRows);
375
381
  const [startCol, endCol] = slice(ax, bx, skipCols, takeCols);
376
- if (startRow < ay || endRow > by || startRow > endRow || startCol < ax || endCol > bx || startCol > endCol) {
382
+ if (startRow < ay || startRow > endRow || startCol < ax || startCol > endCol) {
377
383
  const requestedAddress = (0, cartesianAddress_ts_1.cartesianToAddress)({ ax: startCol, bx: endCol, ay: startRow, by: endRow });
378
384
  throw new InvalidArgumentError_ts_1.default(`Requested subaddress ${requestedAddress} is out of bounds of the base address ${address}.`);
379
385
  }
@@ -401,6 +407,9 @@ function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY,
401
407
  else if (take < 0) {
402
408
  e += take;
403
409
  }
410
+ // Clip e to not exceed the original end
411
+ if (e > end)
412
+ e = end;
404
413
  return [s, e];
405
414
  }
406
415
  }
@@ -408,17 +417,23 @@ function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY,
408
417
  * Returns a super-address that extends the given address by skipping/taking rows/columns, possibly outside the original bounds.
409
418
  * Negative skip moves the start above/left of the original range (not from the end).
410
419
  *
411
- * @param address - The original range in A1 notation (e.g., "A1:D10").
412
- * @param skipRows - Number of rows to skip (can be negative to extend above).
413
- * @param takeRows - Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
414
- * @param skipCols - Number of columns to skip (can be negative to extend left).
415
- * @param takeCols - Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
416
- * @returns A new A1-style range representing the superrange (may extend outside original bounds).
420
+ * @param address Original range in A1 notation (e.g., "A1:D10").
421
+ * @param skipRows Number of rows to skip (can be negative to extend above).
422
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
423
+ * @param skipCols Number of columns to skip (can be negative to extend left).
424
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
425
+ * @returns New A1-style range representing the super range (may extend outside original bounds).
417
426
  *
418
427
  * @example
419
428
  * superAddress("B2:C3", -1, 4, -1, 4) // "A1:D5"
420
429
  */
421
- function superAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
430
+ function superAddress(address, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
431
+ if (takeRows === undefined || takeRows === null) {
432
+ takeRows = Number.POSITIVE_INFINITY;
433
+ }
434
+ if (takeCols === undefined || takeCols === null) {
435
+ takeCols = Number.POSITIVE_INFINITY;
436
+ }
422
437
  const { ax, bx, ay, by } = (0, cartesianAddress_ts_1.addressToCartesian)(address);
423
438
  const [startRow, endRow] = superSlice(ay, by, skipRows, takeRows);
424
439
  const [startCol, endCol] = superSlice(ax, bx, skipCols, takeCols);
@@ -453,7 +468,7 @@ function superAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY
453
468
  * @returns Extracted sub-range reference.
454
469
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
455
470
  */
456
- function subRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
471
+ function subRange(rangeRef, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
457
472
  const address = subAddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
458
473
  return {
459
474
  ...rangeRef,
@@ -471,7 +486,7 @@ function subRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, s
471
486
  * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
472
487
  * @returns Extended super-range reference.
473
488
  */
474
- function superRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
489
+ function superRange(rangeRef, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
475
490
  const address = superAddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
476
491
  return {
477
492
  ...rangeRef,
@@ -3,6 +3,7 @@
3
3
  * @module driveItem
4
4
  * @category Services
5
5
  */
6
+ import type { DriveItem } from "@microsoft/microsoft-graph-types";
6
7
  import type { DriveRef } from "../models/Drive.ts";
7
8
  import type { DriveItemId, DriveItemPath, DriveItemRef } from "../models/DriveItem.ts";
8
9
  export declare const workbookFileExtension = "xlsx";
@@ -32,4 +33,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
32
33
  folderPath: DriveItemPath;
33
34
  fileName: string;
34
35
  };
36
+ /**
37
+ * Gets the file extension of a drive item.
38
+ * @param item Drive item.
39
+ * @returns File extension ie. "txt", "jpg"
40
+ */
41
+ export declare function getDriveItemExtension(item: DriveItem): string;
35
42
  //# sourceMappingURL=driveItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,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,CAkClE;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"}
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,CAkClE;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"}
@@ -12,6 +12,8 @@ exports.rootDriveItemPath = exports.binaryWorkbookFileExtension = exports.workbo
12
12
  exports.driveItemPath = driveItemPath;
13
13
  exports.createDriveItemRef = createDriveItemRef;
14
14
  exports.splitDriveItemPath = splitDriveItemPath;
15
+ exports.getDriveItemExtension = getDriveItemExtension;
16
+ const node_path_1 = __importDefault(require("node:path"));
15
17
  const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
16
18
  const ProtocolError_ts_1 = __importDefault(require("../errors/ProtocolError.js"));
17
19
  const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
@@ -87,3 +89,12 @@ function splitDriveItemPath(filePath) {
87
89
  fileName,
88
90
  };
89
91
  }
92
+ /**
93
+ * Gets the file extension of a drive item.
94
+ * @param item Drive item.
95
+ * @returns File extension ie. "txt", "jpg"
96
+ */
97
+ function getDriveItemExtension(item) {
98
+ const ext = node_path_1.default.extname(item.name ?? "").toLowerCase();
99
+ return ext.startsWith(".") ? ext.slice(1) : ext;
100
+ }
@@ -155,12 +155,12 @@ export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols
155
155
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
156
156
  * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
157
157
  *
158
- * @param address - The original range in A1 notation (e.g., "A1:D10").
159
- * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
160
- * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
161
- * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
162
- * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
163
- * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
158
+ * @param address Original range in A1 notation (e.g., "A1:D10").
159
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default is 0.
160
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end of the remaining rows. Default is Infinity.
161
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default is 0.
162
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end of the remaining columns. Default is Infinity.
163
+ * @returns New A1-style range representing the sliced sub-range (e.g., "B2:C5").
164
164
  *
165
165
  * @example
166
166
  * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
@@ -168,22 +168,22 @@ export declare function cellToRangeAddress(cell: CellAddress, rows: number, cols
168
168
  * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
169
169
  * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
170
170
  */
171
- export declare function subAddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
171
+ export declare function subAddress(address: Address, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): Address;
172
172
  /**
173
173
  * Returns a super-address that extends the given address by skipping/taking rows/columns, possibly outside the original bounds.
174
174
  * Negative skip moves the start above/left of the original range (not from the end).
175
175
  *
176
- * @param address - The original range in A1 notation (e.g., "A1:D10").
177
- * @param skipRows - Number of rows to skip (can be negative to extend above).
178
- * @param takeRows - Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
179
- * @param skipCols - Number of columns to skip (can be negative to extend left).
180
- * @param takeCols - Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
181
- * @returns A new A1-style range representing the superrange (may extend outside original bounds).
176
+ * @param address Original range in A1 notation (e.g., "A1:D10").
177
+ * @param skipRows Number of rows to skip (can be negative to extend above).
178
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
179
+ * @param skipCols Number of columns to skip (can be negative to extend left).
180
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
181
+ * @returns New A1-style range representing the super range (may extend outside original bounds).
182
182
  *
183
183
  * @example
184
184
  * superAddress("B2:C3", -1, 4, -1, 4) // "A1:D5"
185
185
  */
186
- export declare function superAddress(address: Address, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): Address;
186
+ export declare function superAddress(address: Address, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): Address;
187
187
  /**
188
188
  * Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
189
189
  * @param rangeRef Range reference to extract the sub-range from.
@@ -194,7 +194,7 @@ export declare function superAddress(address: Address, skipRows?: number, takeRo
194
194
  * @returns Extracted sub-range reference.
195
195
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
196
196
  */
197
- export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
197
+ export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): WorkbookRangeRef;
198
198
  /**
199
199
  * Returns a super-range from a WorkbookRangeRef using skip/take semantics, possibly extending outside the original bounds.
200
200
  * Negative skip moves the start above/left of the original range (not from the end).
@@ -206,5 +206,5 @@ export declare function subRange(rangeRef: WorkbookRangeRef, skipRows?: number,
206
206
  * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
207
207
  * @returns Extended super-range reference.
208
208
  */
209
- export declare function superRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number, skipCols?: number, takeCols?: number): WorkbookRangeRef;
209
+ export declare function superRange(rangeRef: WorkbookRangeRef, skipRows?: number, takeRows?: number | undefined, skipCols?: number, takeCols?: number | undefined): WorkbookRangeRef;
210
210
  //# sourceMappingURL=addressManipulation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/addressManipulation.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,OAAO,EAAE,WAAW,EAAuD,iBAAiB,EAA+B,MAAM,sBAAsB,CAAC;AAGtK,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAuBnE;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,UAAQ,GAAG,OAAO,CAE9E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,GAAG,iBAAiB,CAcpE;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,iBAAiB,EAAE,UAAU,UAAQ,GAAG,OAAO,CAsBzF;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAGjE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,WAAW,CAGhE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAS5D;AAED;;;;GAIG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AO,EAAE,OAAO,GAAG,MAAM,CAGzD;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAG5D;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAuCzF;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,OAAO,CAgDpK;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,OAAO,CAkCtK;AAED;;;;;;;;;GASG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,gBAAgB,CAMrL;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,EAAE,QAAQ,SAAI,EAAE,QAAQ,GAAE,MAAM,GAAG,SAAqB,GAAG,gBAAgB,CAMvL"}
@@ -327,12 +327,12 @@ export function cellToRangeAddress(cell, rows, cols) {
327
327
  * Supports negative values for `skipRows` and `skipCols` to count from the end.
328
328
  * Supports negative values for `takeRows` and `takeCols` to exclude from the end after skipping.
329
329
  *
330
- * @param address - The original range in A1 notation (e.g., "A1:D10").
331
- * @param skipRows - Number of rows to skip. If negative, skips that many rows from the end. Default is 0.
332
- * @param takeRows - Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity.
333
- * @param skipCols - Number of columns to skip. If negative, skips that many columns from the end. Default is 0.
334
- * @param takeCols - Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity.
335
- * @returns A new A1-style range representing the sliced subrange (e.g., "B2:C5").
330
+ * @param address Original range in A1 notation (e.g., "A1:D10").
331
+ * @param skipRows Number of rows to skip. If negative, skips from the end. Default is 0.
332
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end of the remaining rows. Default is Infinity.
333
+ * @param skipCols Number of columns to skip. If negative, skips from the end. Default is 0.
334
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end of the remaining columns. Default is Infinity.
335
+ * @returns New A1-style range representing the sliced sub-range (e.g., "B2:C5").
336
336
  *
337
337
  * @example
338
338
  * subaddress("A1:D10", -1, 1); // Last row: "A10:D10"
@@ -340,11 +340,17 @@ export function cellToRangeAddress(cell, rows, cols) {
340
340
  * subaddress("A1:D10", 0, -1); // All but last row: "A1:D9"
341
341
  * subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
342
342
  */
343
- export function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
343
+ export function subAddress(address, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
344
+ if (takeRows === undefined || takeRows === null) {
345
+ takeRows = Number.POSITIVE_INFINITY;
346
+ }
347
+ if (takeCols === undefined || takeCols === null) {
348
+ takeCols = Number.POSITIVE_INFINITY;
349
+ }
344
350
  const { ax, bx, ay, by } = addressToCartesian(address);
345
351
  const [startRow, endRow] = slice(ay, by, skipRows, takeRows);
346
352
  const [startCol, endCol] = slice(ax, bx, skipCols, takeCols);
347
- if (startRow < ay || endRow > by || startRow > endRow || startCol < ax || endCol > bx || startCol > endCol) {
353
+ if (startRow < ay || startRow > endRow || startCol < ax || startCol > endCol) {
348
354
  const requestedAddress = cartesianToAddress({ ax: startCol, bx: endCol, ay: startRow, by: endRow });
349
355
  throw new InvalidArgumentError(`Requested subaddress ${requestedAddress} is out of bounds of the base address ${address}.`);
350
356
  }
@@ -372,6 +378,9 @@ export function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INF
372
378
  else if (take < 0) {
373
379
  e += take;
374
380
  }
381
+ // Clip e to not exceed the original end
382
+ if (e > end)
383
+ e = end;
375
384
  return [s, e];
376
385
  }
377
386
  }
@@ -379,17 +388,23 @@ export function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INF
379
388
  * Returns a super-address that extends the given address by skipping/taking rows/columns, possibly outside the original bounds.
380
389
  * Negative skip moves the start above/left of the original range (not from the end).
381
390
  *
382
- * @param address - The original range in A1 notation (e.g., "A1:D10").
383
- * @param skipRows - Number of rows to skip (can be negative to extend above).
384
- * @param takeRows - Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
385
- * @param skipCols - Number of columns to skip (can be negative to extend left).
386
- * @param takeCols - Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
387
- * @returns A new A1-style range representing the superrange (may extend outside original bounds).
391
+ * @param address Original range in A1 notation (e.g., "A1:D10").
392
+ * @param skipRows Number of rows to skip (can be negative to extend above).
393
+ * @param takeRows Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity.
394
+ * @param skipCols Number of columns to skip (can be negative to extend left).
395
+ * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity.
396
+ * @returns New A1-style range representing the super range (may extend outside original bounds).
388
397
  *
389
398
  * @example
390
399
  * superAddress("B2:C3", -1, 4, -1, 4) // "A1:D5"
391
400
  */
392
- export function superAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
401
+ export function superAddress(address, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
402
+ if (takeRows === undefined || takeRows === null) {
403
+ takeRows = Number.POSITIVE_INFINITY;
404
+ }
405
+ if (takeCols === undefined || takeCols === null) {
406
+ takeCols = Number.POSITIVE_INFINITY;
407
+ }
393
408
  const { ax, bx, ay, by } = addressToCartesian(address);
394
409
  const [startRow, endRow] = superSlice(ay, by, skipRows, takeRows);
395
410
  const [startCol, endCol] = superSlice(ax, bx, skipCols, takeCols);
@@ -424,7 +439,7 @@ export function superAddress(address, skipRows = 0, takeRows = Number.POSITIVE_I
424
439
  * @returns Extracted sub-range reference.
425
440
  * @throws InvalidArgumentError if the requested rows or columns exceed the available range.
426
441
  */
427
- export function subRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
442
+ export function subRange(rangeRef, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
428
443
  const address = subAddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
429
444
  return {
430
445
  ...rangeRef,
@@ -442,7 +457,7 @@ export function subRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFI
442
457
  * @param takeCols Number of columns to take after skipping. If negative, excludes from the end. Default Infinity.
443
458
  * @returns Extended super-range reference.
444
459
  */
445
- export function superRange(rangeRef, skipRows = 0, takeRows = Number.POSITIVE_INFINITY, skipCols = 0, takeCols = Number.POSITIVE_INFINITY) {
460
+ export function superRange(rangeRef, skipRows = 0, takeRows = undefined, skipCols = 0, takeCols = undefined) {
446
461
  const address = superAddress(rangeRef.address, skipRows, takeRows, skipCols, takeCols);
447
462
  return {
448
463
  ...rangeRef,
@@ -3,6 +3,7 @@
3
3
  * @module driveItem
4
4
  * @category Services
5
5
  */
6
+ import type { DriveItem } from "@microsoft/microsoft-graph-types";
6
7
  import type { DriveRef } from "../models/Drive.ts";
7
8
  import type { DriveItemId, DriveItemPath, DriveItemRef } from "../models/DriveItem.ts";
8
9
  export declare const workbookFileExtension = "xlsx";
@@ -32,4 +33,10 @@ export declare function splitDriveItemPath(filePath: DriveItemPath): {
32
33
  folderPath: DriveItemPath;
33
34
  fileName: string;
34
35
  };
36
+ /**
37
+ * Gets the file extension of a drive item.
38
+ * @param item Drive item.
39
+ * @returns File extension ie. "txt", "jpg"
40
+ */
41
+ export declare function getDriveItemExtension(item: DriveItem): string;
35
42
  //# sourceMappingURL=driveItem.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"driveItem.d.ts","sourceRoot":"","sources":["../../../src/services/driveItem.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,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,CAkClE;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"}
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,CAkClE;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"}
@@ -3,6 +3,7 @@
3
3
  * @module driveItem
4
4
  * @category Services
5
5
  */
6
+ import path from "node:path";
6
7
  import InvalidArgumentError from "../errors/InvalidArgumentError.js";
7
8
  import ProtocolError from "../errors/ProtocolError.js";
8
9
  const segmentPattern = /^[^"*:<>?\\|#]{1,256}$/;
@@ -78,3 +79,12 @@ export function splitDriveItemPath(filePath) {
78
79
  fileName,
79
80
  };
80
81
  }
82
+ /**
83
+ * Gets the file extension of a drive item.
84
+ * @param item Drive item.
85
+ * @returns File extension ie. "txt", "jpg"
86
+ */
87
+ export function getDriveItemExtension(item) {
88
+ const ext = path.extname(item.name ?? "").toLowerCase();
89
+ return ext.startsWith(".") ? ext.slice(1) : ext;
90
+ }
@@ -499,17 +499,17 @@ Supports negative values for `takeRows` and `takeCols` to exclude from the end a
499
499
 
500
500
  | Parameter | Type | Default value | Description |
501
501
  | ------ | ------ | ------ | ------ |
502
- | `address` | [`Address`](Address.md#address) | `undefined` | The original range in A1 notation (e.g., "A1:D10"). |
503
- | `skipRows` | `number` | `0` | Number of rows to skip. If negative, skips that many rows from the end. Default is 0. |
504
- | `takeRows` | `number` | `Number.POSITIVE_INFINITY` | Number of rows to take after skipping. If negative, excludes that many rows from the end of the remaining rows. Default is Infinity. |
505
- | `skipCols` | `number` | `0` | Number of columns to skip. If negative, skips that many columns from the end. Default is 0. |
506
- | `takeCols` | `number` | `Number.POSITIVE_INFINITY` | Number of columns to take after skipping. If negative, excludes that many columns from the end of the remaining columns. Default is Infinity. |
502
+ | `address` | [`Address`](Address.md#address) | `undefined` | Original range in A1 notation (e.g., "A1:D10"). |
503
+ | `skipRows` | `number` | `0` | Number of rows to skip. If negative, skips from the end. Default is 0. |
504
+ | `takeRows` | `undefined` \| `number` | `undefined` | Number of rows to take after skipping. If negative, excludes from the end of the remaining rows. Default is Infinity. |
505
+ | `skipCols` | `number` | `0` | Number of columns to skip. If negative, skips from the end. Default is 0. |
506
+ | `takeCols` | `undefined` \| `number` | `undefined` | Number of columns to take after skipping. If negative, excludes from the end of the remaining columns. Default is Infinity. |
507
507
 
508
508
  #### Returns
509
509
 
510
510
  [`Address`](Address.md#address)
511
511
 
512
- A new A1-style range representing the sliced subrange (e.g., "B2:C5").
512
+ New A1-style range representing the sliced sub-range (e.g., "B2:C5").
513
513
 
514
514
  #### Example
515
515
 
@@ -526,7 +526,7 @@ subaddress("A1:D10", 0, Infinity, -2, 1); // Second last column: "C1:C10"
526
526
 
527
527
  > **subRange**(`rangeRef`, `skipRows`, `takeRows`, `skipCols`, `takeCols`): [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref)
528
528
 
529
- Defined in: [src/services/addressManipulation.ts:494](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L494)
529
+ Defined in: [src/services/addressManipulation.ts:511](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L511)
530
530
 
531
531
  Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
532
532
 
@@ -536,9 +536,9 @@ Extracts a sub-range from a WorkbookRangeRef using skip/take semantics.
536
536
  | ------ | ------ | ------ | ------ |
537
537
  | `rangeRef` | [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref) | `undefined` | Range reference to extract the sub-range from. |
538
538
  | `skipRows` | `number` | `0` | Number of rows to skip. If negative, skips from the end. Default 0. |
539
- | `takeRows` | `number` | `Number.POSITIVE_INFINITY` | Number of rows to take after skipping. If negative, excludes from the end. Default Infinity. |
539
+ | `takeRows` | `undefined` \| `number` | `undefined` | Number of rows to take after skipping. If negative, excludes from the end. Default Infinity. |
540
540
  | `skipCols` | `number` | `0` | Number of columns to skip. If negative, skips from the end. Default 0. |
541
- | `takeCols` | `number` | `Number.POSITIVE_INFINITY` | Number of columns to take after skipping. If negative, excludes from the end. Default Infinity. |
541
+ | `takeCols` | `undefined` \| `number` | `undefined` | Number of columns to take after skipping. If negative, excludes from the end. Default Infinity. |
542
542
 
543
543
  #### Returns
544
544
 
@@ -556,7 +556,7 @@ InvalidArgumentError if the requested rows or columns exceed the available range
556
556
 
557
557
  > **superAddress**(`address`, `skipRows`, `takeRows`, `skipCols`, `takeCols`): [`Address`](Address.md#address)
558
558
 
559
- Defined in: [src/services/addressManipulation.ts:455](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L455)
559
+ Defined in: [src/services/addressManipulation.ts:465](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L465)
560
560
 
561
561
  Returns a super-address that extends the given address by skipping/taking rows/columns, possibly outside the original bounds.
562
562
  Negative skip moves the start above/left of the original range (not from the end).
@@ -565,17 +565,17 @@ Negative skip moves the start above/left of the original range (not from the end
565
565
 
566
566
  | Parameter | Type | Default value | Description |
567
567
  | ------ | ------ | ------ | ------ |
568
- | `address` | [`Address`](Address.md#address) | `undefined` | The original range in A1 notation (e.g., "A1:D10"). |
568
+ | `address` | [`Address`](Address.md#address) | `undefined` | Original range in A1 notation (e.g., "A1:D10"). |
569
569
  | `skipRows` | `number` | `0` | Number of rows to skip (can be negative to extend above). |
570
- | `takeRows` | `number` | `Number.POSITIVE_INFINITY` | Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity. |
570
+ | `takeRows` | `undefined` \| `number` | `undefined` | Number of rows to take after skipping. If negative, excludes from the end. Default is Infinity. |
571
571
  | `skipCols` | `number` | `0` | Number of columns to skip (can be negative to extend left). |
572
- | `takeCols` | `number` | `Number.POSITIVE_INFINITY` | Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity. |
572
+ | `takeCols` | `undefined` \| `number` | `undefined` | Number of columns to take after skipping. If negative, excludes from the end. Default is Infinity. |
573
573
 
574
574
  #### Returns
575
575
 
576
576
  [`Address`](Address.md#address)
577
577
 
578
- A new A1-style range representing the superrange (may extend outside original bounds).
578
+ New A1-style range representing the super range (may extend outside original bounds).
579
579
 
580
580
  #### Example
581
581
 
@@ -589,7 +589,7 @@ superAddress("B2:C3", -1, 4, -1, 4) // "A1:D5"
589
589
 
590
590
  > **superRange**(`rangeRef`, `skipRows`, `takeRows`, `skipCols`, `takeCols`): [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref)
591
591
 
592
- Defined in: [src/services/addressManipulation.ts:513](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L513)
592
+ Defined in: [src/services/addressManipulation.ts:530](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/addressManipulation.ts#L530)
593
593
 
594
594
  Returns a super-range from a WorkbookRangeRef using skip/take semantics, possibly extending outside the original bounds.
595
595
  Negative skip moves the start above/left of the original range (not from the end).
@@ -600,9 +600,9 @@ Negative skip moves the start above/left of the original range (not from the end
600
600
  | ------ | ------ | ------ | ------ |
601
601
  | `rangeRef` | [`WorkbookRangeRef`](WorkbookRange-1.md#workbookrangeref) | `undefined` | Range reference to extend. |
602
602
  | `skipRows` | `number` | `0` | Number of rows to skip (can be negative to extend above). Default 0. |
603
- | `takeRows` | `number` | `Number.POSITIVE_INFINITY` | Number of rows to take after skipping. If negative, excludes from the end. Default Infinity. |
603
+ | `takeRows` | `undefined` \| `number` | `undefined` | Number of rows to take after skipping. If negative, excludes from the end. Default Infinity. |
604
604
  | `skipCols` | `number` | `0` | Number of columns to skip (can be negative to extend left). Default 0. |
605
- | `takeCols` | `number` | `Number.POSITIVE_INFINITY` | Number of columns to take after skipping. If negative, excludes from the end. Default Infinity. |
605
+ | `takeCols` | `undefined` \| `number` | `undefined` | Number of columns to take after skipping. If negative, excludes from the end. Default Infinity. |
606
606
 
607
607
  #### Returns
608
608
 
@@ -10,7 +10,7 @@ Utilities for working with Microsoft Graph Drive Items (files and folders).
10
10
 
11
11
  > `const` **binaryWorkbookFileExtension**: `"xlsb"` = `"xlsb"`
12
12
 
13
- Defined in: [src/services/driveItem.ts:17](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L17)
13
+ Defined in: [src/services/driveItem.ts:19](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L19)
14
14
 
15
15
  ***
16
16
 
@@ -18,7 +18,7 @@ Defined in: [src/services/driveItem.ts:17](https://github.com/Future-Secure-AI/m
18
18
 
19
19
  > `const` **rootDriveItemPath**: [`DriveItemPath`](DriveItem-1.md#driveitempath)
20
20
 
21
- Defined in: [src/services/driveItem.ts:19](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L19)
21
+ Defined in: [src/services/driveItem.ts:21](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L21)
22
22
 
23
23
  ***
24
24
 
@@ -26,7 +26,7 @@ Defined in: [src/services/driveItem.ts:19](https://github.com/Future-Secure-AI/m
26
26
 
27
27
  > `const` **workbookFileExtension**: `"xlsx"` = `"xlsx"`
28
28
 
29
- Defined in: [src/services/driveItem.ts:16](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L16)
29
+ Defined in: [src/services/driveItem.ts:18](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L18)
30
30
 
31
31
  ## Functions
32
32
 
@@ -34,7 +34,7 @@ Defined in: [src/services/driveItem.ts:16](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:70](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L70)
37
+ Defined in: [src/services/driveItem.ts:72](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L72)
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:27](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L27)
64
+ Defined in: [src/services/driveItem.ts:29](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L29)
65
65
 
66
66
  Creates a drive item path from a given set of segments.
67
67
 
@@ -83,11 +83,33 @@ InvalidArgumentError if a segment is invalid or the path exceeds 400 characters.
83
83
 
84
84
  ***
85
85
 
86
+ ### getDriveItemExtension()
87
+
88
+ > **getDriveItemExtension**(`item`): `string`
89
+
90
+ Defined in: [src/services/driveItem.ts:110](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L110)
91
+
92
+ Gets the file extension of a drive item.
93
+
94
+ #### Parameters
95
+
96
+ | Parameter | Type | Description |
97
+ | ------ | ------ | ------ |
98
+ | `item` | `DriveItem` | Drive item. |
99
+
100
+ #### Returns
101
+
102
+ `string`
103
+
104
+ File extension ie. "txt", "jpg"
105
+
106
+ ***
107
+
86
108
  ### splitDriveItemPath()
87
109
 
88
110
  > **splitDriveItemPath**(`filePath`): `object`
89
111
 
90
- Defined in: [src/services/driveItem.ts:88](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L88)
112
+ Defined in: [src/services/driveItem.ts:90](https://github.com/Future-Secure-AI/microsoft-graph/blob/main/src/services/driveItem.ts#L90)
91
113
 
92
114
  Splits a drive item path into its folder path and file name.
93
115
 
package/package.json CHANGED
@@ -1,14 +1,12 @@
1
1
  {
2
2
  "name": "microsoft-graph",
3
- "version": "3.3.0",
3
+ "version": "3.4.1",
4
4
  "description": "Microsoft GraphAPI SDK for NodeJS",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
7
7
  "types": "./dist/esm/index.d.ts",
8
8
  "scripts": {
9
- "check": "biome check",
10
- "fix": "biome check --fix",
11
- "build": "npm run check && rm -rf ./dist && echo 'Building for ESM...' && tsc -p tsconfig.esm.json && echo 'Building for CJS...' && tsc -p tsconfig.cjs.json && npx tsx update-exports.ts ",
9
+ "build": "biome check --fix && rm -rf ./dist && echo 'Building for ESM...' && tsc -p tsconfig.esm.json && echo 'Building for CJS...' && tsc -p tsconfig.cjs.json && npx tsx update-exports.ts ",
12
10
  "release": "npm run build && npm run docs && npm publish --access public",
13
11
  "test": "vitest --bail=3",
14
12
  "update": "npm-check-updates -u && npm install",