microsoft-graph 2.19.0 → 2.20.0

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 (87) hide show
  1. package/dist/cjs/models/Cell.d.ts +2 -1
  2. package/dist/cjs/models/Cell.d.ts.map +1 -1
  3. package/dist/cjs/models/CellText.d.ts +4 -0
  4. package/dist/cjs/models/CellText.d.ts.map +1 -0
  5. package/dist/cjs/models/ColumnName.d.ts +3 -0
  6. package/dist/cjs/models/ColumnName.d.ts.map +1 -1
  7. package/dist/cjs/models/ColumnOffset.d.ts +3 -0
  8. package/dist/cjs/models/ColumnOffset.d.ts.map +1 -1
  9. package/dist/cjs/models/Row.d.ts +3 -0
  10. package/dist/cjs/models/Row.d.ts.map +1 -0
  11. package/dist/cjs/models/RowNumber.d.ts +3 -0
  12. package/dist/cjs/models/RowNumber.d.ts.map +1 -1
  13. package/dist/cjs/models/RowOffset.d.ts +3 -0
  14. package/dist/cjs/models/RowOffset.d.ts.map +1 -1
  15. package/dist/cjs/services/batch.d.ts +8 -0
  16. package/dist/cjs/services/batch.d.ts.map +1 -0
  17. package/dist/cjs/services/batch.js +10 -0
  18. package/dist/cjs/services/cellText.d.ts +6 -0
  19. package/dist/cjs/services/cellText.d.ts.map +1 -0
  20. package/dist/cjs/services/cellText.js +9 -0
  21. package/dist/cjs/services/rangeManipulation.d.ts +16 -7
  22. package/dist/cjs/services/rangeManipulation.d.ts.map +1 -1
  23. package/dist/cjs/services/rangeManipulation.js +35 -4
  24. package/dist/cjs/tasks/iterateWorkbookRange.d.ts +3 -2
  25. package/dist/cjs/tasks/iterateWorkbookRange.d.ts.map +1 -1
  26. package/dist/cjs/tasks/iterateWorkbookRange.js +3 -8
  27. package/dist/cjs/tasks/iterateWorkbookRangeValues.d.ts +3 -3
  28. package/dist/cjs/tasks/iterateWorkbookRangeValues.d.ts.map +1 -1
  29. package/dist/cjs/tasks/iterateWorkbookRangeValues.js +3 -9
  30. package/dist/cjs/tasks/readWorkbookRows.d.ts +11 -0
  31. package/dist/cjs/tasks/readWorkbookRows.d.ts.map +1 -0
  32. package/dist/cjs/tasks/readWorkbookRows.js +57 -0
  33. package/dist/cjs/tasks/setWorkbookRangeValues.d.ts +2 -2
  34. package/dist/cjs/tasks/setWorkbookRangeValues.d.ts.map +1 -1
  35. package/dist/cjs/tasks/writeWorkbookRows.d.ts +10 -0
  36. package/dist/cjs/tasks/writeWorkbookRows.d.ts.map +1 -0
  37. package/dist/cjs/tasks/writeWorkbookRows.js +59 -0
  38. package/dist/esm/models/Cell.d.ts +2 -1
  39. package/dist/esm/models/Cell.d.ts.map +1 -1
  40. package/dist/esm/models/CellText.d.ts +4 -0
  41. package/dist/esm/models/CellText.d.ts.map +1 -0
  42. package/dist/esm/models/ColumnName.d.ts +3 -0
  43. package/dist/esm/models/ColumnName.d.ts.map +1 -1
  44. package/dist/esm/models/ColumnOffset.d.ts +3 -0
  45. package/dist/esm/models/ColumnOffset.d.ts.map +1 -1
  46. package/dist/esm/models/Row.d.ts +3 -0
  47. package/dist/esm/models/Row.d.ts.map +1 -0
  48. package/dist/esm/models/RowNumber.d.ts +3 -0
  49. package/dist/esm/models/RowNumber.d.ts.map +1 -1
  50. package/dist/esm/models/RowOffset.d.ts +3 -0
  51. package/dist/esm/models/RowOffset.d.ts.map +1 -1
  52. package/dist/esm/services/batch.d.ts +8 -0
  53. package/dist/esm/services/batch.d.ts.map +1 -0
  54. package/dist/esm/services/batch.js +7 -0
  55. package/dist/esm/services/cellText.d.ts +6 -0
  56. package/dist/esm/services/cellText.d.ts.map +1 -0
  57. package/dist/esm/services/cellText.js +6 -0
  58. package/dist/esm/services/rangeManipulation.d.ts +16 -7
  59. package/dist/esm/services/rangeManipulation.d.ts.map +1 -1
  60. package/dist/esm/services/rangeManipulation.js +34 -4
  61. package/dist/esm/tasks/iterateWorkbookRange.d.ts +3 -2
  62. package/dist/esm/tasks/iterateWorkbookRange.d.ts.map +1 -1
  63. package/dist/esm/tasks/iterateWorkbookRange.js +2 -7
  64. package/dist/esm/tasks/iterateWorkbookRangeValues.d.ts +3 -3
  65. package/dist/esm/tasks/iterateWorkbookRangeValues.d.ts.map +1 -1
  66. package/dist/esm/tasks/iterateWorkbookRangeValues.js +2 -8
  67. package/dist/esm/tasks/readWorkbookRows.d.ts +11 -0
  68. package/dist/esm/tasks/readWorkbookRows.d.ts.map +1 -0
  69. package/dist/esm/tasks/readWorkbookRows.js +51 -0
  70. package/dist/esm/tasks/setWorkbookRangeValues.d.ts +2 -2
  71. package/dist/esm/tasks/setWorkbookRangeValues.d.ts.map +1 -1
  72. package/dist/esm/tasks/writeWorkbookRows.d.ts +10 -0
  73. package/dist/esm/tasks/writeWorkbookRows.d.ts.map +1 -0
  74. package/dist/esm/tasks/writeWorkbookRows.js +53 -0
  75. package/package.json +146 -46
  76. package/dist/cjs/models/CellRangeValues.d.ts +0 -3
  77. package/dist/cjs/models/CellRangeValues.d.ts.map +0 -1
  78. package/dist/cjs/models/RowRangeValues.d.ts +0 -3
  79. package/dist/cjs/models/RowRangeValues.d.ts.map +0 -1
  80. package/dist/esm/models/CellRangeValues.d.ts +0 -3
  81. package/dist/esm/models/CellRangeValues.d.ts.map +0 -1
  82. package/dist/esm/models/RowRangeValues.d.ts +0 -3
  83. package/dist/esm/models/RowRangeValues.d.ts.map +0 -1
  84. /package/dist/cjs/models/{CellRangeValues.js → CellText.js} +0 -0
  85. /package/dist/cjs/models/{RowRangeValues.js → Row.js} +0 -0
  86. /package/dist/esm/models/{CellRangeValues.js → CellText.js} +0 -0
  87. /package/dist/esm/models/{RowRangeValues.js → Row.js} +0 -0
@@ -1,7 +1,8 @@
1
1
  import type { CellValue } from "../models/CellValue.ts";
2
+ import type { CellText } from "./CellText.ts";
2
3
  import type { NumberFormat } from "./NumberFormat.ts";
3
4
  export type Cell = {
4
- text: string;
5
+ text: CellText;
5
6
  value: CellValue;
6
7
  numberFormat: NumberFormat;
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type CellText = string & {
2
+ __brand: "CellText";
3
+ };
4
+ //# sourceMappingURL=CellText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CellText.d.ts","sourceRoot":"","sources":["../../../src/models/CellText.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC/B,OAAO,EAAE,UAAU,CAAC;CACpB,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Column name configured by user
3
+ */
1
4
  export type ColumnName = string & {
2
5
  __brand: "ColumnName";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnName.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnName.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"ColumnName.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnName.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Column offset in a table. First column is 0.
3
+ */
1
4
  export type ColumnOffset = number & {
2
5
  __brand: "ColumnOffset";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnOffset.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnOffset.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,OAAO,EAAE,cAAc,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"ColumnOffset.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnOffset.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,OAAO,EAAE,cAAc,CAAC;CACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Cell } from "./Cell.ts";
2
+ export type Row = Cell[];
3
+ //# sourceMappingURL=Row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../src/models/Row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,GAAG,GAAG,IAAI,EAAE,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Row number as it appears in Excel. First row is 1.
3
+ */
1
4
  export type RowNumber = number & {
2
5
  __brand: "RowNumber";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RowNumber.d.ts","sourceRoot":"","sources":["../../../src/models/RowNumber.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"RowNumber.d.ts","sourceRoot":"","sources":["../../../src/models/RowNumber.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Row offset index. First row is 0.
3
+ */
1
4
  export type RowOffset = number & {
2
5
  __brand: "RowOffset";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"RowOffset.d.ts","sourceRoot":"","sources":["../../../src/models/RowOffset.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
1
+ {"version":3,"file":"RowOffset.d.ts","sourceRoot":"","sources":["../../../src/models/RowOffset.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Maximum number of cells that can be retrieved in a single request, unless overwritten.
3
+ * @remarks The Microsoft Graph API documentation does not specify a fixed maximum number of cells that can be retrieved in a single request.
4
+ * However, it mentions that large ranges may result in errors due to resource constraints. Additionally, discussions in developer
5
+ * communities suggest that requests exceeding 10,000 cells may encounter issues.
6
+ */
7
+ export declare const maxCellsPerRequest = 10000;
8
+ //# sourceMappingURL=batch.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"batch.d.ts","sourceRoot":"","sources":["../../../src/services/batch.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,QAAQ,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.maxCellsPerRequest = void 0;
4
+ /**
5
+ * Maximum number of cells that can be retrieved in a single request, unless overwritten.
6
+ * @remarks The Microsoft Graph API documentation does not specify a fixed maximum number of cells that can be retrieved in a single request.
7
+ * However, it mentions that large ranges may result in errors due to resource constraints. Additionally, discussions in developer
8
+ * communities suggest that requests exceeding 10,000 cells may encounter issues.
9
+ */
10
+ exports.maxCellsPerRequest = 10000;
@@ -0,0 +1,6 @@
1
+ import type { CellText } from "../models/CellText.ts";
2
+ /**
3
+ * Casts a string to CellText.
4
+ */
5
+ export declare function asCellText(text: string): CellText;
6
+ //# sourceMappingURL=cellText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cellText.d.ts","sourceRoot":"","sources":["../../../src/services/cellText.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,CAEjD"}
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.asCellText = asCellText;
4
+ /**
5
+ * Casts a string to CellText.
6
+ */
7
+ function asCellText(text) {
8
+ return text;
9
+ }
@@ -1,33 +1,42 @@
1
1
  import type { Address } from "../models/Address.ts";
2
- import type { CellRangeValues } from "../models/CellRangeValues.ts";
2
+ import type { CellValue } from "../models/CellValue.ts";
3
3
  import type { ColumnOffset } from "../models/ColumnOffset.ts";
4
4
  import type { RowOffset } from "../models/RowOffset.ts";
5
5
  /**
6
6
  * Converts a 2D array of cell values into range address in the upper left.
7
7
  *
8
- * @param {CellRangeValues} values - A 2D array representing cell values.
8
+ * @param {CellValue[][]} values - A 2D array representing cell values.
9
9
  * @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
10
10
  * @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
11
11
  * @returns {Address} The default cell range address (e.g., "A1:C3").
12
12
  * @throws {InvalidArgumentError} If rows have inconsistent column counts.
13
13
  */
14
- export declare function inferRangeAddress(values: CellRangeValues, rowOffset?: RowOffset, columnOffset?: ColumnOffset): Address;
14
+ export declare function inferRangeAddress(values: CellValue[][], rowOffset?: RowOffset, columnOffset?: ColumnOffset): Address;
15
+ /**
16
+ * Converts a 2D array of cell values into a row address in the upper left.
17
+ *
18
+ * @param {CellValue[]} row - A single row of cell values.
19
+ * @param {RowOffset} [rowOffset=0] - The row offset to apply to the address.
20
+ * @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the address.
21
+ * @returns {Address} The default cell range address for the row (e.g., "A1").
22
+ */
23
+ export declare function inferRowAddress(row: CellValue[], rowOffset?: RowOffset, columnOffset?: ColumnOffset): Address;
15
24
  /**
16
25
  * Converts a 2D array of cell values into an array of objects.
17
26
  * Assumes the first row is a header and uses it as keys for the objects.
18
27
  *
19
- * @param {CellRangeValues} values - A 2D array representing cell values.
28
+ * @param {CellValue[][]} values - A 2D array representing cell values.
20
29
  * @returns {unknown[]} An array of objects where each object represents a row.
21
30
  * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
22
31
  */
23
- export declare function inferRangeObject(values: CellRangeValues): unknown[];
32
+ export declare function inferRangeObject(values: CellValue[][]): unknown[];
24
33
  /**
25
34
  * Converts an array of objects into a 2D array of cell values.
26
35
  * The first row of the 2D array contains the keys as headers.
27
36
  *
28
37
  * @param {unknown[]} objs - An array of objects to convert.
29
38
  * @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
30
- * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
39
+ * @returns {CellValue[][]} A 2D array where the first row is the header and subsequent rows are the object values.
31
40
  */
32
- export declare function inferObjectRange(objs: unknown[], header?: string[] | null): CellRangeValues;
41
+ export declare function inferObjectRange(objs: unknown[], header?: string[] | null): CellValue[][];
33
42
  //# sourceMappingURL=rangeManipulation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,EAAE,SAAS,GAAE,SAA0B,EAAE,YAAY,GAAE,YAAgC,GAAG,OAAO,CAyBzJ;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,eAAe,CASjG"}
1
+ {"version":3,"file":"rangeManipulation.d.ts","sourceRoot":"","sources":["../../../src/services/rangeManipulation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGxD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,EAAE,SAAS,GAAE,SAA0B,EAAE,YAAY,GAAE,YAAgC,GAAG,OAAO,CA8BvJ;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,SAAS,EAAE,EAAE,SAAS,GAAE,SAA0B,EAAE,YAAY,GAAE,YAAgC,GAAG,OAAO,CAiBhJ;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,OAAO,EAAE,CAoBjE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,GAAE,MAAM,EAAE,GAAG,IAAW,GAAG,SAAS,EAAE,EAAE,CAS/F"}
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.inferRangeAddress = inferRangeAddress;
7
+ exports.inferRowAddress = inferRowAddress;
7
8
  exports.inferRangeObject = inferRangeObject;
8
9
  exports.inferObjectRange = inferObjectRange;
9
10
  const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
@@ -11,7 +12,7 @@ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
11
12
  /**
12
13
  * Converts a 2D array of cell values into range address in the upper left.
13
14
  *
14
- * @param {CellRangeValues} values - A 2D array representing cell values.
15
+ * @param {CellValue[][]} values - A 2D array representing cell values.
15
16
  * @param {RowOffset} [rowOffset=0] - The row offset to apply to the range address.
16
17
  * @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the range address.
17
18
  * @returns {Address} The default cell range address (e.g., "A1:C3").
@@ -20,7 +21,12 @@ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
20
21
  function inferRangeAddress(values, rowOffset = 0, columnOffset = 0) {
21
22
  const first = values[0];
22
23
  if (!first || first.length === 0) {
23
- return "A1";
24
+ return (0, cartesianAddress_ts_1.cartesianToAddress)({
25
+ ax: columnOffset,
26
+ bx: columnOffset,
27
+ ay: rowOffset,
28
+ by: rowOffset,
29
+ });
24
30
  }
25
31
  for (const row of values) {
26
32
  if (row.length !== first.length) {
@@ -38,11 +44,36 @@ function inferRangeAddress(values, rowOffset = 0, columnOffset = 0) {
38
44
  by: endRow,
39
45
  });
40
46
  }
47
+ /**
48
+ * Converts a 2D array of cell values into a row address in the upper left.
49
+ *
50
+ * @param {CellValue[]} row - A single row of cell values.
51
+ * @param {RowOffset} [rowOffset=0] - The row offset to apply to the address.
52
+ * @param {ColumnOffset} [columnOffset=0] - The column offset to apply to the address.
53
+ * @returns {Address} The default cell range address for the row (e.g., "A1").
54
+ */
55
+ function inferRowAddress(row, rowOffset = 0, columnOffset = 0) {
56
+ if (row.length === 0) {
57
+ return (0, cartesianAddress_ts_1.cartesianToAddress)({
58
+ ax: columnOffset,
59
+ bx: columnOffset,
60
+ ay: rowOffset,
61
+ by: rowOffset,
62
+ });
63
+ }
64
+ const endColumn = (columnOffset + row.length - 1);
65
+ return (0, cartesianAddress_ts_1.cartesianToAddress)({
66
+ ax: columnOffset,
67
+ bx: endColumn,
68
+ ay: rowOffset,
69
+ by: rowOffset,
70
+ });
71
+ }
41
72
  /**
42
73
  * Converts a 2D array of cell values into an array of objects.
43
74
  * Assumes the first row is a header and uses it as keys for the objects.
44
75
  *
45
- * @param {CellRangeValues} values - A 2D array representing cell values.
76
+ * @param {CellValue[][]} values - A 2D array representing cell values.
46
77
  * @returns {unknown[]} An array of objects where each object represents a row.
47
78
  * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
48
79
  */
@@ -67,7 +98,7 @@ function inferRangeObject(values) {
67
98
  *
68
99
  * @param {unknown[]} objs - An array of objects to convert.
69
100
  * @param {string[] | null} header - Optional header row. If not provided, it will be inferred from the object keys.
70
- * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
101
+ * @returns {CellValue[][]} A 2D array where the first row is the header and subsequent rows are the object values.
71
102
  */
72
103
  function inferObjectRange(objs, header = null) {
73
104
  if (objs.length === 0) {
@@ -1,4 +1,4 @@
1
- import type { Cell } from "../models/Cell.ts";
1
+ import type { Row } from "../models/Row.ts";
2
2
  import type { RowOffset } from "../models/RowOffset.ts";
3
3
  import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
4
4
  /**
@@ -7,9 +7,10 @@ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
7
7
  * @param rangeRef - A reference to the workbook range to iterate over.
8
8
  * @param overwriteRowsPerRequest - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
9
9
  * @returns An async iterable that yields rows of range values.
10
+ * @deprecated Use `readWorkbookRows` instead.
10
11
  */
11
12
  export default function iterateWorkbookRange(rangeRef: WorkbookRangeRef, overwriteRowsPerRequest?: number | null): AsyncIterable<{
12
13
  rowOffset: RowOffset;
13
- row: Cell[];
14
+ row: Row;
14
15
  }>;
15
16
  //# sourceMappingURL=iterateWorkbookRange.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterateWorkbookRange.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRange.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AActE;;;;;;GAMG;AACH,wBAA+B,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,IAAI,EAAE,CAAA;CAAE,CAAC,CAsDnL"}
1
+ {"version":3,"file":"iterateWorkbookRange.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRange.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOtE;;;;;;;GAOG;AACH,wBAA+B,oBAAoB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,GAAG,CAAA;CAAE,CAAC,CAsDhL"}
@@ -8,20 +8,15 @@ const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgu
8
8
  const getWorkbookWorksheetRange_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookWorksheetRange.js"));
9
9
  const addressManipulation_ts_1 = require("../services/addressManipulation.js");
10
10
  const addressOffset_ts_1 = require("../services/addressOffset.js");
11
+ const batch_ts_1 = require("../services/batch.js");
11
12
  const workbookRange_ts_1 = require("../services/workbookRange.js");
12
- /**
13
- * Maximum number of cells that can be retrieved in a single request, unless overwritten.
14
- * @remarks The Microsoft Graph API documentation does not specify a fixed maximum number of cells that can be retrieved in a single request.
15
- * However, it mentions that large ranges may result in errors due to resource constraints. Additionally, discussions in developer
16
- * communities suggest that requests exceeding 10,000 cells may encounter issues.
17
- */
18
- const maxCellsPerRequest = 10_000;
19
13
  /**
20
14
  * Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
21
15
  *
22
16
  * @param rangeRef - A reference to the workbook range to iterate over.
23
17
  * @param overwriteRowsPerRequest - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
24
18
  * @returns An async iterable that yields rows of range values.
19
+ * @deprecated Use `readWorkbookRows` instead.
25
20
  */
26
21
  async function* iterateWorkbookRange(rangeRef, overwriteRowsPerRequest = null) {
27
22
  const address = rangeRef.address;
@@ -31,7 +26,7 @@ async function* iterateWorkbookRange(rangeRef, overwriteRowsPerRequest = null) {
31
26
  throw new InvalidArgumentError_ts_1.default("overwriteRowsPerRequest must be greater than 0");
32
27
  }
33
28
  const columnCount = (0, addressManipulation_ts_1.countAddressColumns)(address);
34
- const rowsPerRequest = overwriteRowsPerRequest ?? Math.floor(maxCellsPerRequest / columnsPerRow);
29
+ const rowsPerRequest = overwriteRowsPerRequest ?? Math.floor(batch_ts_1.maxCellsPerRequest / columnsPerRow);
35
30
  const rangeStartRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.startRow);
36
31
  const rangeEndRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.endRow);
37
32
  let offset = 0;
@@ -1,4 +1,4 @@
1
- import type { RowRangeValues } from "../models/RowRangeValues.ts";
1
+ import type { CellValue } from "../models/CellValue.ts";
2
2
  import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
3
3
  /**
4
4
  * Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
@@ -6,7 +6,7 @@ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
6
6
  * @param rangeRef - A reference to the workbook range to iterate over.
7
7
  * @param overwriteRowsPerRequest - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
8
8
  * @returns An async iterable that yields rows of range values.
9
- * @deprecated Use `iterateWorkbookRange` instead.
9
+ * @deprecated Use `readWorkbookRows` instead.
10
10
  */
11
- export default function iterateWorkbookRangeValues(rangeRef: WorkbookRangeRef, overwriteRowsPerRequest?: number | null): AsyncIterable<RowRangeValues>;
11
+ export default function iterateWorkbookRangeValues(rangeRef: WorkbookRangeRef, overwriteRowsPerRequest?: number | null): AsyncIterable<CellValue[]>;
12
12
  //# sourceMappingURL=iterateWorkbookRangeValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"iterateWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRangeValues.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AActE;;;;;;;GAOG;AACH,wBAA+B,0BAA0B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC,cAAc,CAAC,CAoClK"}
1
+ {"version":3,"file":"iterateWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/iterateWorkbookRangeValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOtE;;;;;;;GAOG;AACH,wBAA+B,0BAA0B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,uBAAuB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC,SAAS,EAAE,CAAC,CAoC/J"}
@@ -8,21 +8,15 @@ const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgu
8
8
  const getWorkbookWorksheetRange_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookWorksheetRange.js"));
9
9
  const addressManipulation_ts_1 = require("../services/addressManipulation.js");
10
10
  const addressOffset_ts_1 = require("../services/addressOffset.js");
11
+ const batch_ts_1 = require("../services/batch.js");
11
12
  const workbookRange_ts_1 = require("../services/workbookRange.js");
12
- /**
13
- * Maximum number of cells that can be retrieved in a single request, unless overwritten.
14
- * @remarks The Microsoft Graph API documentation does not specify a fixed maximum number of cells that can be retrieved in a single request.
15
- * However, it mentions that large ranges may result in errors due to resource constraints. Additionally, discussions in developer
16
- * communities suggest that requests exceeding 10,000 cells may encounter issues.
17
- */
18
- const maxCellsPerRequest = 10_000;
19
13
  /**
20
14
  * Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
21
15
  *
22
16
  * @param rangeRef - A reference to the workbook range to iterate over.
23
17
  * @param overwriteRowsPerRequest - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
24
18
  * @returns An async iterable that yields rows of range values.
25
- * @deprecated Use `iterateWorkbookRange` instead.
19
+ * @deprecated Use `readWorkbookRows` instead.
26
20
  */
27
21
  async function* iterateWorkbookRangeValues(rangeRef, overwriteRowsPerRequest = null) {
28
22
  const address = rangeRef.address;
@@ -31,7 +25,7 @@ async function* iterateWorkbookRangeValues(rangeRef, overwriteRowsPerRequest = n
31
25
  if (overwriteRowsPerRequest !== null && overwriteRowsPerRequest < 1) {
32
26
  throw new InvalidArgumentError_ts_1.default("overwriteRowsPerRequest must be greater than 0");
33
27
  }
34
- const rowsPerRequest = overwriteRowsPerRequest ?? Math.floor(maxCellsPerRequest / columnsPerRow);
28
+ const rowsPerRequest = overwriteRowsPerRequest ?? Math.floor(batch_ts_1.maxCellsPerRequest / columnsPerRow);
35
29
  const rangeStartRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.startRow);
36
30
  const rangeEndRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.endRow);
37
31
  for (let chunkRowOffset = rangeStartRowOffset; chunkRowOffset <= rangeEndRowOffset; chunkRowOffset = (chunkRowOffset + rowsPerRequest)) {
@@ -0,0 +1,11 @@
1
+ import type { Row } from "../models/Row.ts";
2
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
3
+ /**
4
+ * Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
5
+ *
6
+ * @param rangeRef - A reference to the workbook range to iterate over.
7
+ * @param overwriteMaxRowsPerChunk - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
8
+ * @returns An async iterable that yields rows of range values.
9
+ */
10
+ export default function readWorkbookRows(rangeRef: WorkbookRangeRef, overwriteMaxRowsPerChunk?: number | null): AsyncIterable<Row>;
11
+ //# sourceMappingURL=readWorkbookRows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"readWorkbookRows.d.ts","sourceRoot":"","sources":["../../../src/tasks/readWorkbookRows.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAE5C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAOtE;;;;;;GAMG;AACH,wBAA+B,gBAAgB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,wBAAwB,GAAE,MAAM,GAAG,IAAW,GAAG,aAAa,CAAC,GAAG,CAAC,CA+C9I"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.default = readWorkbookRows;
7
+ const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
8
+ const getWorkbookWorksheetRange_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookWorksheetRange.js"));
9
+ const addressManipulation_ts_1 = require("../services/addressManipulation.js");
10
+ const addressOffset_ts_1 = require("../services/addressOffset.js");
11
+ const workbookRange_ts_1 = require("../services/workbookRange.js");
12
+ const batch_ts_1 = require("../services/batch.js");
13
+ /**
14
+ * Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
15
+ *
16
+ * @param rangeRef - A reference to the workbook range to iterate over.
17
+ * @param overwriteMaxRowsPerChunk - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
18
+ * @returns An async iterable that yields rows of range values.
19
+ */
20
+ async function* readWorkbookRows(rangeRef, overwriteMaxRowsPerChunk = null) {
21
+ const address = rangeRef.address;
22
+ const components = (0, addressManipulation_ts_1.decomposeAddress)(address);
23
+ const columnsPerRow = (0, addressOffset_ts_1.columnAddressToOffset)(components.endColumn) - (0, addressOffset_ts_1.columnAddressToOffset)(components.startColumn) + 1;
24
+ if (overwriteMaxRowsPerChunk !== null && overwriteMaxRowsPerChunk < 1) {
25
+ throw new InvalidArgumentError_ts_1.default("overwriteRowsPerRequest must be greater than 0");
26
+ }
27
+ const columnCount = (0, addressManipulation_ts_1.countAddressColumns)(address);
28
+ const rowsPerRequest = overwriteMaxRowsPerChunk ?? Math.floor(batch_ts_1.maxCellsPerRequest / columnsPerRow);
29
+ const rangeStartRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.startRow);
30
+ const rangeEndRowOffset = (0, addressOffset_ts_1.rowAddressToOffset)(components.endRow);
31
+ for (let chunkRowOffset = rangeStartRowOffset; chunkRowOffset <= rangeEndRowOffset; chunkRowOffset = (chunkRowOffset + rowsPerRequest)) {
32
+ const requestStartRowOffset = chunkRowOffset;
33
+ const requestEndRowOffset = Math.min(chunkRowOffset + rowsPerRequest - 1, rangeEndRowOffset);
34
+ const chunkStartRow = (0, addressOffset_ts_1.rowOffsetToAddress)(requestStartRowOffset);
35
+ const chunkEndRow = (0, addressOffset_ts_1.rowOffsetToAddress)(requestEndRowOffset);
36
+ const requestAddress = (0, addressManipulation_ts_1.composeAddress)({
37
+ startRow: chunkStartRow,
38
+ endRow: chunkEndRow,
39
+ startColumn: components.startColumn,
40
+ endColumn: components.endColumn,
41
+ });
42
+ const requestRef = (0, workbookRange_ts_1.createWorkbookRangeRef)(rangeRef, requestAddress);
43
+ const range = await (0, getWorkbookWorksheetRange_ts_1.default)(requestRef);
44
+ const values = range.values;
45
+ const text = range.text;
46
+ const numberFormat = range.numberFormat;
47
+ const rowCount = values.length;
48
+ for (let r = 0; r < rowCount; r++) {
49
+ const row = Array.from({ length: columnCount }, (_, c) => ({
50
+ text: text[r]?.[c] ?? "",
51
+ value: values[r]?.[c] ?? "",
52
+ numberFormat: numberFormat?.[r]?.[c] ?? "",
53
+ }));
54
+ yield row;
55
+ }
56
+ }
57
+ }
@@ -1,4 +1,4 @@
1
- import type { CellRangeValues } from "../models/CellRangeValues.ts";
1
+ import type { CellValue } from "../models/CellValue.ts";
2
2
  import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
3
3
  /**
4
4
  * Sets the values of a specified workbook range.
@@ -7,5 +7,5 @@ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
7
7
  * @param {CellRangeValues} values - The values to set in the specified workbook range. Must match the range's dimensions.
8
8
  * @returns Nothing
9
9
  */
10
- export default function setWorkbookRangeValues(rangeRef: WorkbookRangeRef, values: CellRangeValues): Promise<void>;
10
+ export default function setWorkbookRangeValues(rangeRef: WorkbookRangeRef, values: CellValue[][]): Promise<void>;
11
11
  //# sourceMappingURL=setWorkbookRangeValues.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"setWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/setWorkbookRangeValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AACpE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE;;;;;;GAMG;AACH,wBAA8B,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,eAAe,iBAcvG"}
1
+ {"version":3,"file":"setWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/setWorkbookRangeValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAItE;;;;;;GAMG;AACH,wBAA8B,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,iBAcrG"}
@@ -0,0 +1,10 @@
1
+ import type { Cell } from "../models/Cell.ts";
2
+ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
3
+ /**
4
+ * Write rows to a workbook range. Uses batching to handle large datasets efficiently.
5
+ * @param originRef The reference to the workbook range where rows will be written. Only the upper-left is used as an origin point.
6
+ * @param rows An iterable or async iterable of rows to write. Each row is an array of cells.
7
+ * @param overrideMaxRowsPerUnderlyingRead Optional maximum number of rows to write in a single underlying read. If not provided, it will be automatically calculated based on a safe value.
8
+ */
9
+ export declare function writeWorkbookRows(originRef: WorkbookRangeRef, rows: Iterable<Partial<Cell>[]> | AsyncIterable<Partial<Cell>[]>, overrideMaxRowsPerUnderlyingRead?: number | null): Promise<void>;
10
+ //# sourceMappingURL=writeWorkbookRows.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"writeWorkbookRows.d.ts","sourceRoot":"","sources":["../../../src/tasks/writeWorkbookRows.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAE9C,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAMtE;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,SAAS,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,aAAa,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,gCAAgC,GAAE,MAAM,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5M"}
@@ -0,0 +1,59 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.writeWorkbookRows = writeWorkbookRows;
7
+ const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
8
+ const updateWorkbookRange_ts_1 = __importDefault(require("../operations/workbookRange/updateWorkbookRange.js"));
9
+ const batch_ts_1 = require("../services/batch.js");
10
+ const cartesianAddress_ts_1 = require("../services/cartesianAddress.js");
11
+ const workbookRange_ts_1 = require("../services/workbookRange.js");
12
+ /**
13
+ * Write rows to a workbook range. Uses batching to handle large datasets efficiently.
14
+ * @param originRef The reference to the workbook range where rows will be written. Only the upper-left is used as an origin point.
15
+ * @param rows An iterable or async iterable of rows to write. Each row is an array of cells.
16
+ * @param overrideMaxRowsPerUnderlyingRead Optional maximum number of rows to write in a single underlying read. If not provided, it will be automatically calculated based on a safe value.
17
+ */
18
+ async function writeWorkbookRows(originRef, rows, overrideMaxRowsPerUnderlyingRead = null) {
19
+ let maxRowsPerUnderlyingRead = overrideMaxRowsPerUnderlyingRead;
20
+ let cellsPerRow = null;
21
+ let rowsCompleted = 0;
22
+ const batch = [];
23
+ for await (const row of rows) {
24
+ if (cellsPerRow === null) {
25
+ cellsPerRow = row.length;
26
+ }
27
+ else if (cellsPerRow !== row.length) {
28
+ throw new InvalidArgumentError_ts_1.default("Not all rows have the same number of cells. Ensure all rows are consistent in length.");
29
+ }
30
+ if (maxRowsPerUnderlyingRead === null) {
31
+ maxRowsPerUnderlyingRead = Math.max(1, Math.floor(batch_ts_1.maxCellsPerRequest / cellsPerRow)); // Excel supports up to 16k columns, which exceeds the assumed 10k cell limit per write. This might not be a problem, but not worth spending time checking this currently either.
32
+ }
33
+ if (batch.push(row) >= maxRowsPerUnderlyingRead) {
34
+ rowsCompleted += await flushBatch(batch, originRef, rowsCompleted);
35
+ }
36
+ }
37
+ await flushBatch(batch, originRef, rowsCompleted);
38
+ }
39
+ async function flushBatch(batch, originRef, rowsCompleted) {
40
+ if (batch.length === 0) {
41
+ return 0;
42
+ }
43
+ const { ay, ax, bx } = (0, cartesianAddress_ts_1.addressToCartesian)(originRef.address);
44
+ const count = batch.length;
45
+ const address = (0, cartesianAddress_ts_1.cartesianToAddress)({
46
+ ay: (rowsCompleted + ay),
47
+ by: (rowsCompleted + ay + count - 1),
48
+ ax,
49
+ bx,
50
+ });
51
+ const rangeRef = (0, workbookRange_ts_1.createWorkbookRangeRef)(originRef, address);
52
+ await (0, updateWorkbookRange_ts_1.default)(rangeRef, {
53
+ values: batch.map((r) => r.map((c) => c.value)),
54
+ text: batch.map((r) => r.map((c) => c.text)),
55
+ numberFormat: batch.map((r) => r.map((c) => c.numberFormat)),
56
+ });
57
+ batch.length = 0;
58
+ return count;
59
+ }
@@ -1,7 +1,8 @@
1
1
  import type { CellValue } from "../models/CellValue.ts";
2
+ import type { CellText } from "./CellText.ts";
2
3
  import type { NumberFormat } from "./NumberFormat.ts";
3
4
  export type Cell = {
4
- text: string;
5
+ text: CellText;
5
6
  value: CellValue;
6
7
  numberFormat: NumberFormat;
7
8
  };
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
1
+ {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEtD,MAAM,MAAM,IAAI,GAAG;IAClB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,SAAS,CAAC;IACjB,YAAY,EAAE,YAAY,CAAC;CAC3B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export type CellText = string & {
2
+ __brand: "CellText";
3
+ };
4
+ //# sourceMappingURL=CellText.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CellText.d.ts","sourceRoot":"","sources":["../../../src/models/CellText.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC/B,OAAO,EAAE,UAAU,CAAC;CACpB,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Column name configured by user
3
+ */
1
4
  export type ColumnName = string & {
2
5
  __brand: "ColumnName";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnName.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnName.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"ColumnName.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnName.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
@@ -1,3 +1,6 @@
1
+ /**
2
+ * Column offset in a table. First column is 0.
3
+ */
1
4
  export type ColumnOffset = number & {
2
5
  __brand: "ColumnOffset";
3
6
  };
@@ -1 +1 @@
1
- {"version":3,"file":"ColumnOffset.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnOffset.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,OAAO,EAAE,cAAc,CAAC;CACxB,CAAC"}
1
+ {"version":3,"file":"ColumnOffset.d.ts","sourceRoot":"","sources":["../../../src/models/ColumnOffset.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG;IACnC,OAAO,EAAE,cAAc,CAAC;CACxB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Cell } from "./Cell.ts";
2
+ export type Row = Cell[];
3
+ //# sourceMappingURL=Row.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Row.d.ts","sourceRoot":"","sources":["../../../src/models/Row.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,MAAM,GAAG,GAAG,IAAI,EAAE,CAAC"}