microsoft-graph 2.7.6 → 2.7.8

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 (45) hide show
  1. package/dist/cjs/models/Cartesian.d.ts +9 -0
  2. package/dist/cjs/models/Cartesian.d.ts.map +1 -0
  3. package/dist/cjs/models/Cartesian.js +2 -0
  4. package/dist/cjs/models/ColumnName.d.ts +4 -0
  5. package/dist/cjs/models/ColumnName.d.ts.map +1 -0
  6. package/dist/cjs/models/ColumnName.js +2 -0
  7. package/dist/cjs/models/WorkbookTableColumnRef.d.ts +2 -2
  8. package/dist/cjs/models/WorkbookTableColumnRef.d.ts.map +1 -1
  9. package/dist/cjs/services/addressManipulation.js +4 -4
  10. package/dist/cjs/services/addressOffset.d.ts +4 -0
  11. package/dist/cjs/services/addressOffset.d.ts.map +1 -1
  12. package/dist/cjs/services/addressOffset.js +12 -2
  13. package/dist/cjs/services/cartesianAddress.d.ts +17 -0
  14. package/dist/cjs/services/cartesianAddress.d.ts.map +1 -0
  15. package/dist/cjs/services/cartesianAddress.js +39 -0
  16. package/dist/cjs/services/rangeManipulation.d.ts +28 -0
  17. package/dist/cjs/services/rangeManipulation.d.ts.map +1 -0
  18. package/dist/cjs/services/rangeManipulation.js +78 -0
  19. package/dist/cjs/services/workbookTableColumn.d.ts +3 -3
  20. package/dist/cjs/services/workbookTableColumn.d.ts.map +1 -1
  21. package/dist/cjs/services/workbookTableColumn.js +2 -2
  22. package/dist/cjs/tasks/iterateWorkbookRangeValues.js +2 -2
  23. package/dist/esm/models/Cartesian.d.ts +9 -0
  24. package/dist/esm/models/Cartesian.d.ts.map +1 -0
  25. package/dist/esm/models/Cartesian.js +1 -0
  26. package/dist/esm/models/ColumnName.d.ts +4 -0
  27. package/dist/esm/models/ColumnName.d.ts.map +1 -0
  28. package/dist/esm/models/ColumnName.js +1 -0
  29. package/dist/esm/models/WorkbookTableColumnRef.d.ts +2 -2
  30. package/dist/esm/models/WorkbookTableColumnRef.d.ts.map +1 -1
  31. package/dist/esm/services/addressManipulation.js +5 -5
  32. package/dist/esm/services/addressOffset.d.ts +4 -0
  33. package/dist/esm/services/addressOffset.d.ts.map +1 -1
  34. package/dist/esm/services/addressOffset.js +10 -2
  35. package/dist/esm/services/cartesianAddress.d.ts +17 -0
  36. package/dist/esm/services/cartesianAddress.d.ts.map +1 -0
  37. package/dist/esm/services/cartesianAddress.js +35 -0
  38. package/dist/esm/services/rangeManipulation.d.ts +28 -0
  39. package/dist/esm/services/rangeManipulation.d.ts.map +1 -0
  40. package/dist/esm/services/rangeManipulation.js +70 -0
  41. package/dist/esm/services/workbookTableColumn.d.ts +3 -3
  42. package/dist/esm/services/workbookTableColumn.d.ts.map +1 -1
  43. package/dist/esm/services/workbookTableColumn.js +2 -2
  44. package/dist/esm/tasks/iterateWorkbookRangeValues.js +3 -3
  45. package/package.json +41 -1
@@ -0,0 +1,9 @@
1
+ import type { ColumnOffset } from "../models/ColumnOffset.ts";
2
+ import type { RowOffset } from "../models/RowOffset.ts";
3
+ export type Cartesian = {
4
+ ax: ColumnOffset;
5
+ ay: RowOffset;
6
+ bx: ColumnOffset;
7
+ by: RowOffset;
8
+ };
9
+ //# sourceMappingURL=Cartesian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cartesian.d.ts","sourceRoot":"","sources":["../../../src/models/Cartesian.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,SAAS,CAAC;IACd,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,SAAS,CAAC;CACd,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,4 @@
1
+ export type ColumnName = string & {
2
+ __brand: "ColumnName";
3
+ };
4
+ //# sourceMappingURL=ColumnName.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,6 +1,6 @@
1
- import type { ColumnAddress } from "./Address.ts";
1
+ import type { ColumnName } from "./ColumnName.ts";
2
2
  import type { WorkbookTableRef } from "./WorkbookTableRef.ts";
3
3
  export type WorkbookTableColumnRef = WorkbookTableRef & {
4
- column: ColumnAddress;
4
+ column: ColumnName;
5
5
  };
6
6
  //# sourceMappingURL=WorkbookTableColumnRef.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkbookTableColumnRef.d.ts","sourceRoot":"","sources":["../../../src/models/WorkbookTableColumnRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACvD,MAAM,EAAE,aAAa,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"WorkbookTableColumnRef.d.ts","sourceRoot":"","sources":["../../../src/models/WorkbookTableColumnRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACvD,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC"}
@@ -174,15 +174,15 @@ function offsetAddress(address, columnOffset, rowOffset) {
174
174
  if (newStartRowIndex < (0, addressOffset_ts_1.rowAddressToOffset)(firstRow) || newEndRowIndex > (0, addressOffset_ts_1.rowAddressToOffset)(lastRow)) {
175
175
  throw new InvalidArgumentError_ts_1.default(`Row offset out of bounds: ${newStartRowIndex + 1} to ${newEndRowIndex + 1}`);
176
176
  }
177
- const newStartRow = (0, addressOffset_ts_1.offsetToRowAddress)(newStartRowIndex);
178
- const newEndRow = (0, addressOffset_ts_1.offsetToRowAddress)(newEndRowIndex);
177
+ const newStartRow = (0, addressOffset_ts_1.rowOffsetToAddress)(newStartRowIndex);
178
+ const newEndRow = (0, addressOffset_ts_1.rowOffsetToAddress)(newEndRowIndex);
179
179
  const newStartColumnIndex = (0, addressOffset_ts_1.columnAddressToOffset)(components.startColumn) + columnOffset;
180
180
  const newEndColumnIndex = (0, addressOffset_ts_1.columnAddressToOffset)(components.endColumn) + columnOffset;
181
181
  if (newStartColumnIndex < (0, addressOffset_ts_1.columnAddressToOffset)(firstColumn) || newEndColumnIndex > (0, addressOffset_ts_1.columnAddressToOffset)(lastColumn)) {
182
182
  throw new InvalidArgumentError_ts_1.default(`Column offset out of bounds: ${newStartColumnIndex + 1} to ${newEndColumnIndex + 1}`);
183
183
  }
184
- const newStartColumn = (0, addressOffset_ts_1.offsetToColumnAddress)(newStartColumnIndex);
185
- const newEndColumn = (0, addressOffset_ts_1.offsetToColumnAddress)(newEndColumnIndex);
184
+ const newStartColumn = (0, addressOffset_ts_1.columnOffsetToAddress)(newStartColumnIndex);
185
+ const newEndColumn = (0, addressOffset_ts_1.columnOffsetToAddress)(newEndColumnIndex);
186
186
  return composeAddress({
187
187
  startColumn: newStartColumn,
188
188
  endColumn: newEndColumn,
@@ -12,6 +12,8 @@ export declare function columnAddressToOffset(column: ColumnAddress): ColumnOffs
12
12
  * @param offset - The zero-based column offset.
13
13
  * @returns The column address.
14
14
  */
15
+ export declare function columnOffsetToAddress(offset: ColumnOffset): ColumnAddress;
16
+ /** @deprecated Use columnAddressToOffset instead. */
15
17
  export declare function offsetToColumnAddress(offset: ColumnOffset): ColumnAddress;
16
18
  /**
17
19
  * Converts a row address (e.g., "1") to a zero-based row offset.
@@ -24,5 +26,7 @@ export declare function rowAddressToOffset(row: RowAddress): RowOffset;
24
26
  * @param offset - The zero-based row offset.
25
27
  * @returns The row address.
26
28
  */
29
+ export declare function rowOffsetToAddress(offset: RowOffset): RowAddress;
30
+ /** @deprecated Use rowOffsetToAddress instead. */
27
31
  export declare function offsetToRowAddress(offset: RowOffset): RowAddress;
28
32
  //# sourceMappingURL=addressOffset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
1
+ {"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.columnAddressToOffset = columnAddressToOffset;
4
+ exports.columnOffsetToAddress = columnOffsetToAddress;
4
5
  exports.offsetToColumnAddress = offsetToColumnAddress;
5
6
  exports.rowAddressToOffset = rowAddressToOffset;
7
+ exports.rowOffsetToAddress = rowOffsetToAddress;
6
8
  exports.offsetToRowAddress = offsetToRowAddress;
7
9
  /**
8
10
  * Converts a column address (e.g., "A") to a zero-based column offset.
@@ -21,7 +23,7 @@ function columnAddressToOffset(column) {
21
23
  * @param offset - The zero-based column offset.
22
24
  * @returns The column address.
23
25
  */
24
- function offsetToColumnAddress(offset) {
26
+ function columnOffsetToAddress(offset) {
25
27
  let result = "";
26
28
  let currentOffset = offset + 1;
27
29
  while (currentOffset > 0) {
@@ -31,6 +33,10 @@ function offsetToColumnAddress(offset) {
31
33
  }
32
34
  return result;
33
35
  }
36
+ /** @deprecated Use columnAddressToOffset instead. */
37
+ function offsetToColumnAddress(offset) {
38
+ return columnOffsetToAddress(offset);
39
+ }
34
40
  /**
35
41
  * Converts a row address (e.g., "1") to a zero-based row offset.
36
42
  * @param row - The row address.
@@ -44,6 +50,10 @@ function rowAddressToOffset(row) {
44
50
  * @param offset - The zero-based row offset.
45
51
  * @returns The row address.
46
52
  */
47
- function offsetToRowAddress(offset) {
53
+ function rowOffsetToAddress(offset) {
48
54
  return (offset + 1).toString();
49
55
  }
56
+ /** @deprecated Use rowOffsetToAddress instead. */
57
+ function offsetToRowAddress(offset) {
58
+ return rowOffsetToAddress(offset);
59
+ }
@@ -0,0 +1,17 @@
1
+ import type { Address } from "../models/Address.ts";
2
+ import type { Cartesian } from "../models/Cartesian.ts";
3
+ /**
4
+ * Converts a cell range address to Cartesian coordinates.
5
+ *
6
+ * @param {Address} address - The cell range address (e.g., "A1:C3").
7
+ * @returns {Cartesian} The Cartesian representation of the address, with start and end coordinates.
8
+ */
9
+ export declare function addressToCartesian(address: Address): Cartesian;
10
+ /**
11
+ * Converts Cartesian coordinates to a cell range address.
12
+ *
13
+ * @param {Cartesian} cartesian - The Cartesian coordinates, including start (ax, ay) and end (bx, by).
14
+ * @returns {Address} The cell range address (e.g., "A1:C3").
15
+ */
16
+ export declare function cartesianToAddress(cartesian: Cartesian): Address;
17
+ //# sourceMappingURL=cartesianAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesianAddress.d.ts","sourceRoot":"","sources":["../../../src/services/cartesianAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAU9D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAchE"}
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addressToCartesian = addressToCartesian;
4
+ exports.cartesianToAddress = cartesianToAddress;
5
+ const addressManipulation_ts_1 = require("./addressManipulation.js");
6
+ const addressOffset_ts_1 = require("./addressOffset.js");
7
+ /**
8
+ * Converts a cell range address to Cartesian coordinates.
9
+ *
10
+ * @param {Address} address - The cell range address (e.g., "A1:C3").
11
+ * @returns {Cartesian} The Cartesian representation of the address, with start and end coordinates.
12
+ */
13
+ function addressToCartesian(address) {
14
+ const components = (0, addressManipulation_ts_1.decomposeAddress)(address);
15
+ const ax = (0, addressOffset_ts_1.columnAddressToOffset)(components.startColumn);
16
+ const ay = (0, addressOffset_ts_1.rowAddressToOffset)(components.startRow);
17
+ const bx = (0, addressOffset_ts_1.columnAddressToOffset)(components.endColumn);
18
+ const by = (0, addressOffset_ts_1.rowAddressToOffset)(components.endRow);
19
+ return { ax, ay, bx, by };
20
+ }
21
+ /**
22
+ * Converts Cartesian coordinates to a cell range address.
23
+ *
24
+ * @param {Cartesian} cartesian - The Cartesian coordinates, including start (ax, ay) and end (bx, by).
25
+ * @returns {Address} The cell range address (e.g., "A1:C3").
26
+ */
27
+ function cartesianToAddress(cartesian) {
28
+ const startColumn = (0, addressOffset_ts_1.columnOffsetToAddress)(cartesian.ax);
29
+ const startRow = (0, addressOffset_ts_1.rowOffsetToAddress)(cartesian.ay);
30
+ const endColumn = (0, addressOffset_ts_1.columnOffsetToAddress)(cartesian.bx);
31
+ const endRow = (0, addressOffset_ts_1.rowOffsetToAddress)(cartesian.by);
32
+ const address = (0, addressManipulation_ts_1.composeAddress)({
33
+ startRow,
34
+ startColumn,
35
+ endRow,
36
+ endColumn,
37
+ });
38
+ return address;
39
+ }
@@ -0,0 +1,28 @@
1
+ import type { Address } from "../models/Address.ts";
2
+ import type { CellRangeValues } from "../models/CellRangeValues.ts";
3
+ /**
4
+ * Converts a 2D array of cell values into range address in the upper left.
5
+ *
6
+ * @param {CellRangeValues} values - A 2D array representing cell values.
7
+ * @returns {Address} The default cell range address (e.g., "A1:C3").
8
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts.
9
+ */
10
+ export declare function inferRangeAddress(values: CellRangeValues): Address;
11
+ /**
12
+ * Converts a 2D array of cell values into an array of objects.
13
+ * Assumes the first row is a header and uses it as keys for the objects.
14
+ *
15
+ * @param {CellRangeValues} values - A 2D array representing cell values.
16
+ * @returns {unknown[]} An array of objects where each object represents a row.
17
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
18
+ */
19
+ export declare function inferRangeObject(values: CellRangeValues): unknown[];
20
+ /**
21
+ * Converts an array of objects into a 2D array of cell values.
22
+ * The first row of the 2D array contains the keys as headers.
23
+ *
24
+ * @param {unknown[]} objs - An array of objects to convert.
25
+ * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
26
+ */
27
+ export declare function inferObjectRange(objs: unknown[]): CellRangeValues;
28
+ //# sourceMappingURL=rangeManipulation.d.ts.map
@@ -0,0 +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;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CASjE"}
@@ -0,0 +1,78 @@
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.inferRangeAddress = inferRangeAddress;
7
+ exports.inferRangeObject = inferRangeObject;
8
+ exports.inferObjectRange = inferObjectRange;
9
+ const InvalidArgumentError_ts_1 = __importDefault(require("../errors/InvalidArgumentError.js"));
10
+ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
11
+ /**
12
+ * Converts a 2D array of cell values into range address in the upper left.
13
+ *
14
+ * @param {CellRangeValues} values - A 2D array representing cell values.
15
+ * @returns {Address} The default cell range address (e.g., "A1:C3").
16
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts.
17
+ */
18
+ function inferRangeAddress(values) {
19
+ const first = values[0];
20
+ if (!first) {
21
+ return "A1";
22
+ }
23
+ for (const row of values) {
24
+ if (row.length !== first.length) {
25
+ throw new InvalidArgumentError_ts_1.default("All rows must have the same number of columns");
26
+ }
27
+ }
28
+ const rowCount = values.length;
29
+ const columnCount = first.length;
30
+ const startRow = 0;
31
+ const startColumn = 0;
32
+ const endRow = (rowCount - 1);
33
+ const endColumn = (columnCount - 1);
34
+ return (0, cartesianAddress_ts_1.cartesianToAddress)({
35
+ ax: startColumn,
36
+ ay: startRow,
37
+ bx: endColumn,
38
+ by: endRow,
39
+ });
40
+ }
41
+ /**
42
+ * Converts a 2D array of cell values into an array of objects.
43
+ * Assumes the first row is a header and uses it as keys for the objects.
44
+ *
45
+ * @param {CellRangeValues} values - A 2D array representing cell values.
46
+ * @returns {unknown[]} An array of objects where each object represents a row.
47
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
48
+ */
49
+ function inferRangeObject(values) {
50
+ const [header, ...rows] = values;
51
+ if (!header) {
52
+ throw new InvalidArgumentError_ts_1.default("Does not contain a header row");
53
+ }
54
+ return rows.map((row, index) => {
55
+ if (row.length !== header.length) {
56
+ throw new InvalidArgumentError_ts_1.default(`Row ${index} length must match header length`);
57
+ }
58
+ return header.reduce((obj, key, index) => {
59
+ obj[key.toString()] = row[index];
60
+ return obj;
61
+ }, {});
62
+ });
63
+ }
64
+ /**
65
+ * Converts an array of objects into a 2D array of cell values.
66
+ * The first row of the 2D array contains the keys as headers.
67
+ *
68
+ * @param {unknown[]} objs - An array of objects to convert.
69
+ * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
70
+ */
71
+ function inferObjectRange(objs) {
72
+ if (objs.length === 0) {
73
+ return [];
74
+ }
75
+ const header = Array.from(new Set(objs.flatMap((obj) => Object.keys(obj))));
76
+ const rows = objs.map((obj) => header.map((key) => obj[key]));
77
+ return [header, ...rows];
78
+ }
@@ -1,12 +1,12 @@
1
- import type { ColumnAddress } from "../models/Address.ts";
1
+ import type { ColumnName } from "../models/ColumnName.ts";
2
2
  import type { WorkbookTableColumnRef } from "../models/WorkbookTableColumnRef.ts";
3
3
  import type { WorkbookTableRef } from "../models/WorkbookTableRef.ts";
4
4
  /**
5
5
  * Creates a reference to a workbook table column.
6
6
  * @param tableRef - The reference to the worksheet containing the table.
7
- * @param column - The ID of the table.
7
+ * @param column - Name of the table column
8
8
  * @returns A reference to the workbook table.
9
9
  * @throws Error if the table ID is missing.
10
10
  */
11
- export declare function createWorkbookTableColumnRef(tableRef: WorkbookTableRef, column: ColumnAddress | undefined): WorkbookTableColumnRef;
11
+ export declare function createWorkbookTableColumnRef(tableRef: WorkbookTableRef, column: ColumnName | string | undefined): WorkbookTableColumnRef;
12
12
  //# sourceMappingURL=workbookTableColumn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workbookTableColumn.d.ts","sourceRoot":"","sources":["../../../src/services/workbookTableColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,sBAAsB,CAelI"}
1
+ {"version":3,"file":"workbookTableColumn.d.ts","sourceRoot":"","sources":["../../../src/services/workbookTableColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,sBAAsB,CAexI"}
@@ -4,13 +4,13 @@ exports.createWorkbookTableColumnRef = createWorkbookTableColumnRef;
4
4
  /**
5
5
  * Creates a reference to a workbook table column.
6
6
  * @param tableRef - The reference to the worksheet containing the table.
7
- * @param column - The ID of the table.
7
+ * @param column - Name of the table column
8
8
  * @returns A reference to the workbook table.
9
9
  * @throws Error if the table ID is missing.
10
10
  */
11
11
  function createWorkbookTableColumnRef(tableRef, column) {
12
12
  if (!column) {
13
- throw new Error("TableId is missing");
13
+ throw new Error("column is missing");
14
14
  }
15
15
  return {
16
16
  contextId: tableRef.contextId,
@@ -36,8 +36,8 @@ async function* iterateWorkbookRangeValues(rangeRef, overwriteRowsPerRequest = n
36
36
  for (let chunkRowOffset = rangeStartRowOffset; chunkRowOffset <= rangeEndRowOffset; chunkRowOffset = (chunkRowOffset + rowsPerRequest)) {
37
37
  const requestStartRowOffset = chunkRowOffset;
38
38
  const requestEndRowOffset = Math.min(chunkRowOffset + rowsPerRequest - 1, rangeEndRowOffset);
39
- const chunkStartRow = (0, addressOffset_ts_1.offsetToRowAddress)(requestStartRowOffset);
40
- const chunkEndRow = (0, addressOffset_ts_1.offsetToRowAddress)(requestEndRowOffset);
39
+ const chunkStartRow = (0, addressOffset_ts_1.rowOffsetToAddress)(requestStartRowOffset);
40
+ const chunkEndRow = (0, addressOffset_ts_1.rowOffsetToAddress)(requestEndRowOffset);
41
41
  const requestAddress = (0, addressManipulation_ts_1.composeAddress)({
42
42
  startRow: chunkStartRow,
43
43
  endRow: chunkEndRow,
@@ -0,0 +1,9 @@
1
+ import type { ColumnOffset } from "../models/ColumnOffset.ts";
2
+ import type { RowOffset } from "../models/RowOffset.ts";
3
+ export type Cartesian = {
4
+ ax: ColumnOffset;
5
+ ay: RowOffset;
6
+ bx: ColumnOffset;
7
+ by: RowOffset;
8
+ };
9
+ //# sourceMappingURL=Cartesian.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Cartesian.d.ts","sourceRoot":"","sources":["../../../src/models/Cartesian.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,SAAS,CAAC;IACd,EAAE,EAAE,YAAY,CAAC;IACjB,EAAE,EAAE,SAAS,CAAC;CACd,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,4 @@
1
+ export type ColumnName = string & {
2
+ __brand: "ColumnName";
3
+ };
4
+ //# sourceMappingURL=ColumnName.d.ts.map
@@ -0,0 +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"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,6 +1,6 @@
1
- import type { ColumnAddress } from "./Address.ts";
1
+ import type { ColumnName } from "./ColumnName.ts";
2
2
  import type { WorkbookTableRef } from "./WorkbookTableRef.ts";
3
3
  export type WorkbookTableColumnRef = WorkbookTableRef & {
4
- column: ColumnAddress;
4
+ column: ColumnName;
5
5
  };
6
6
  //# sourceMappingURL=WorkbookTableColumnRef.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WorkbookTableColumnRef.d.ts","sourceRoot":"","sources":["../../../src/models/WorkbookTableColumnRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACvD,MAAM,EAAE,aAAa,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"WorkbookTableColumnRef.d.ts","sourceRoot":"","sources":["../../../src/models/WorkbookTableColumnRef.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,MAAM,MAAM,sBAAsB,GAAG,gBAAgB,GAAG;IACvD,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import InvalidArgumentError from "../errors/InvalidArgumentError.js";
2
2
  import UnsupportedAddressTypeError from "../errors/UnsupportedAddressTypeError.js";
3
- import { columnAddressToOffset, offsetToColumnAddress, offsetToRowAddress, rowAddressToOffset } from "./addressOffset.js";
3
+ import { columnAddressToOffset, columnOffsetToAddress, rowAddressToOffset, rowOffsetToAddress } from "./addressOffset.js";
4
4
  const firstColumn = "A";
5
5
  const lastColumn = "XFD";
6
6
  const firstRow = "1";
@@ -151,15 +151,15 @@ export function offsetAddress(address, columnOffset, rowOffset) {
151
151
  if (newStartRowIndex < rowAddressToOffset(firstRow) || newEndRowIndex > rowAddressToOffset(lastRow)) {
152
152
  throw new InvalidArgumentError(`Row offset out of bounds: ${newStartRowIndex + 1} to ${newEndRowIndex + 1}`);
153
153
  }
154
- const newStartRow = offsetToRowAddress(newStartRowIndex);
155
- const newEndRow = offsetToRowAddress(newEndRowIndex);
154
+ const newStartRow = rowOffsetToAddress(newStartRowIndex);
155
+ const newEndRow = rowOffsetToAddress(newEndRowIndex);
156
156
  const newStartColumnIndex = columnAddressToOffset(components.startColumn) + columnOffset;
157
157
  const newEndColumnIndex = columnAddressToOffset(components.endColumn) + columnOffset;
158
158
  if (newStartColumnIndex < columnAddressToOffset(firstColumn) || newEndColumnIndex > columnAddressToOffset(lastColumn)) {
159
159
  throw new InvalidArgumentError(`Column offset out of bounds: ${newStartColumnIndex + 1} to ${newEndColumnIndex + 1}`);
160
160
  }
161
- const newStartColumn = offsetToColumnAddress(newStartColumnIndex);
162
- const newEndColumn = offsetToColumnAddress(newEndColumnIndex);
161
+ const newStartColumn = columnOffsetToAddress(newStartColumnIndex);
162
+ const newEndColumn = columnOffsetToAddress(newEndColumnIndex);
163
163
  return composeAddress({
164
164
  startColumn: newStartColumn,
165
165
  endColumn: newEndColumn,
@@ -12,6 +12,8 @@ export declare function columnAddressToOffset(column: ColumnAddress): ColumnOffs
12
12
  * @param offset - The zero-based column offset.
13
13
  * @returns The column address.
14
14
  */
15
+ export declare function columnOffsetToAddress(offset: ColumnOffset): ColumnAddress;
16
+ /** @deprecated Use columnAddressToOffset instead. */
15
17
  export declare function offsetToColumnAddress(offset: ColumnOffset): ColumnAddress;
16
18
  /**
17
19
  * Converts a row address (e.g., "1") to a zero-based row offset.
@@ -24,5 +26,7 @@ export declare function rowAddressToOffset(row: RowAddress): RowOffset;
24
26
  * @param offset - The zero-based row offset.
25
27
  * @returns The row address.
26
28
  */
29
+ export declare function rowOffsetToAddress(offset: RowOffset): RowAddress;
30
+ /** @deprecated Use rowOffsetToAddress instead. */
27
31
  export declare function offsetToRowAddress(offset: RowOffset): RowAddress;
28
32
  //# sourceMappingURL=addressOffset.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
1
+ {"version":3,"file":"addressOffset.d.ts","sourceRoot":"","sources":["../../../src/services/addressOffset.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAExD;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,aAAa,GAAG,YAAY,CAMzE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CASzE;AAED,qDAAqD;AACrD,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,aAAa,CAEzE;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,UAAU,GAAG,SAAS,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE;AAED,kDAAkD;AAClD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,CAEhE"}
@@ -15,7 +15,7 @@ export function columnAddressToOffset(column) {
15
15
  * @param offset - The zero-based column offset.
16
16
  * @returns The column address.
17
17
  */
18
- export function offsetToColumnAddress(offset) {
18
+ export function columnOffsetToAddress(offset) {
19
19
  let result = "";
20
20
  let currentOffset = offset + 1;
21
21
  while (currentOffset > 0) {
@@ -25,6 +25,10 @@ export function offsetToColumnAddress(offset) {
25
25
  }
26
26
  return result;
27
27
  }
28
+ /** @deprecated Use columnAddressToOffset instead. */
29
+ export function offsetToColumnAddress(offset) {
30
+ return columnOffsetToAddress(offset);
31
+ }
28
32
  /**
29
33
  * Converts a row address (e.g., "1") to a zero-based row offset.
30
34
  * @param row - The row address.
@@ -38,6 +42,10 @@ export function rowAddressToOffset(row) {
38
42
  * @param offset - The zero-based row offset.
39
43
  * @returns The row address.
40
44
  */
41
- export function offsetToRowAddress(offset) {
45
+ export function rowOffsetToAddress(offset) {
42
46
  return (offset + 1).toString();
43
47
  }
48
+ /** @deprecated Use rowOffsetToAddress instead. */
49
+ export function offsetToRowAddress(offset) {
50
+ return rowOffsetToAddress(offset);
51
+ }
@@ -0,0 +1,17 @@
1
+ import type { Address } from "../models/Address.ts";
2
+ import type { Cartesian } from "../models/Cartesian.ts";
3
+ /**
4
+ * Converts a cell range address to Cartesian coordinates.
5
+ *
6
+ * @param {Address} address - The cell range address (e.g., "A1:C3").
7
+ * @returns {Cartesian} The Cartesian representation of the address, with start and end coordinates.
8
+ */
9
+ export declare function addressToCartesian(address: Address): Cartesian;
10
+ /**
11
+ * Converts Cartesian coordinates to a cell range address.
12
+ *
13
+ * @param {Cartesian} cartesian - The Cartesian coordinates, including start (ax, ay) and end (bx, by).
14
+ * @returns {Address} The cell range address (e.g., "A1:C3").
15
+ */
16
+ export declare function cartesianToAddress(cartesian: Cartesian): Address;
17
+ //# sourceMappingURL=cartesianAddress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cartesianAddress.d.ts","sourceRoot":"","sources":["../../../src/services/cartesianAddress.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAIxD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,OAAO,GAAG,SAAS,CAU9D;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,SAAS,GAAG,OAAO,CAchE"}
@@ -0,0 +1,35 @@
1
+ import { composeAddress, decomposeAddress } from "./addressManipulation.js";
2
+ import { columnAddressToOffset, columnOffsetToAddress, rowAddressToOffset, rowOffsetToAddress } from "./addressOffset.js";
3
+ /**
4
+ * Converts a cell range address to Cartesian coordinates.
5
+ *
6
+ * @param {Address} address - The cell range address (e.g., "A1:C3").
7
+ * @returns {Cartesian} The Cartesian representation of the address, with start and end coordinates.
8
+ */
9
+ export function addressToCartesian(address) {
10
+ const components = decomposeAddress(address);
11
+ const ax = columnAddressToOffset(components.startColumn);
12
+ const ay = rowAddressToOffset(components.startRow);
13
+ const bx = columnAddressToOffset(components.endColumn);
14
+ const by = rowAddressToOffset(components.endRow);
15
+ return { ax, ay, bx, by };
16
+ }
17
+ /**
18
+ * Converts Cartesian coordinates to a cell range address.
19
+ *
20
+ * @param {Cartesian} cartesian - The Cartesian coordinates, including start (ax, ay) and end (bx, by).
21
+ * @returns {Address} The cell range address (e.g., "A1:C3").
22
+ */
23
+ export function cartesianToAddress(cartesian) {
24
+ const startColumn = columnOffsetToAddress(cartesian.ax);
25
+ const startRow = rowOffsetToAddress(cartesian.ay);
26
+ const endColumn = columnOffsetToAddress(cartesian.bx);
27
+ const endRow = rowOffsetToAddress(cartesian.by);
28
+ const address = composeAddress({
29
+ startRow,
30
+ startColumn,
31
+ endRow,
32
+ endColumn,
33
+ });
34
+ return address;
35
+ }
@@ -0,0 +1,28 @@
1
+ import type { Address } from "../models/Address.ts";
2
+ import type { CellRangeValues } from "../models/CellRangeValues.ts";
3
+ /**
4
+ * Converts a 2D array of cell values into range address in the upper left.
5
+ *
6
+ * @param {CellRangeValues} values - A 2D array representing cell values.
7
+ * @returns {Address} The default cell range address (e.g., "A1:C3").
8
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts.
9
+ */
10
+ export declare function inferRangeAddress(values: CellRangeValues): Address;
11
+ /**
12
+ * Converts a 2D array of cell values into an array of objects.
13
+ * Assumes the first row is a header and uses it as keys for the objects.
14
+ *
15
+ * @param {CellRangeValues} values - A 2D array representing cell values.
16
+ * @returns {unknown[]} An array of objects where each object represents a row.
17
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
18
+ */
19
+ export declare function inferRangeObject(values: CellRangeValues): unknown[];
20
+ /**
21
+ * Converts an array of objects into a 2D array of cell values.
22
+ * The first row of the 2D array contains the keys as headers.
23
+ *
24
+ * @param {unknown[]} objs - An array of objects to convert.
25
+ * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
26
+ */
27
+ export declare function inferObjectRange(objs: unknown[]): CellRangeValues;
28
+ //# sourceMappingURL=rangeManipulation.d.ts.map
@@ -0,0 +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;AAMpE;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA4BlE;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,EAAE,CAoBnE;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,GAAG,eAAe,CASjE"}
@@ -0,0 +1,70 @@
1
+ import InvalidArgumentError from "../errors/InvalidArgumentError.js";
2
+ import { cartesianToAddress } from "./cartesianAddress.js";
3
+ /**
4
+ * Converts a 2D array of cell values into range address in the upper left.
5
+ *
6
+ * @param {CellRangeValues} values - A 2D array representing cell values.
7
+ * @returns {Address} The default cell range address (e.g., "A1:C3").
8
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts.
9
+ */
10
+ export function inferRangeAddress(values) {
11
+ const first = values[0];
12
+ if (!first) {
13
+ return "A1";
14
+ }
15
+ for (const row of values) {
16
+ if (row.length !== first.length) {
17
+ throw new InvalidArgumentError("All rows must have the same number of columns");
18
+ }
19
+ }
20
+ const rowCount = values.length;
21
+ const columnCount = first.length;
22
+ const startRow = 0;
23
+ const startColumn = 0;
24
+ const endRow = (rowCount - 1);
25
+ const endColumn = (columnCount - 1);
26
+ return cartesianToAddress({
27
+ ax: startColumn,
28
+ ay: startRow,
29
+ bx: endColumn,
30
+ by: endRow,
31
+ });
32
+ }
33
+ /**
34
+ * Converts a 2D array of cell values into an array of objects.
35
+ * Assumes the first row is a header and uses it as keys for the objects.
36
+ *
37
+ * @param {CellRangeValues} values - A 2D array representing cell values.
38
+ * @returns {unknown[]} An array of objects where each object represents a row.
39
+ * @throws {InvalidArgumentError} If rows have inconsistent column counts or no header row is present.
40
+ */
41
+ export function inferRangeObject(values) {
42
+ const [header, ...rows] = values;
43
+ if (!header) {
44
+ throw new InvalidArgumentError("Does not contain a header row");
45
+ }
46
+ return rows.map((row, index) => {
47
+ if (row.length !== header.length) {
48
+ throw new InvalidArgumentError(`Row ${index} length must match header length`);
49
+ }
50
+ return header.reduce((obj, key, index) => {
51
+ obj[key.toString()] = row[index];
52
+ return obj;
53
+ }, {});
54
+ });
55
+ }
56
+ /**
57
+ * Converts an array of objects into a 2D array of cell values.
58
+ * The first row of the 2D array contains the keys as headers.
59
+ *
60
+ * @param {unknown[]} objs - An array of objects to convert.
61
+ * @returns {CellRangeValues} A 2D array where the first row is the header and subsequent rows are the object values.
62
+ */
63
+ export function inferObjectRange(objs) {
64
+ if (objs.length === 0) {
65
+ return [];
66
+ }
67
+ const header = Array.from(new Set(objs.flatMap((obj) => Object.keys(obj))));
68
+ const rows = objs.map((obj) => header.map((key) => obj[key]));
69
+ return [header, ...rows];
70
+ }
@@ -1,12 +1,12 @@
1
- import type { ColumnAddress } from "../models/Address.ts";
1
+ import type { ColumnName } from "../models/ColumnName.ts";
2
2
  import type { WorkbookTableColumnRef } from "../models/WorkbookTableColumnRef.ts";
3
3
  import type { WorkbookTableRef } from "../models/WorkbookTableRef.ts";
4
4
  /**
5
5
  * Creates a reference to a workbook table column.
6
6
  * @param tableRef - The reference to the worksheet containing the table.
7
- * @param column - The ID of the table.
7
+ * @param column - Name of the table column
8
8
  * @returns A reference to the workbook table.
9
9
  * @throws Error if the table ID is missing.
10
10
  */
11
- export declare function createWorkbookTableColumnRef(tableRef: WorkbookTableRef, column: ColumnAddress | undefined): WorkbookTableColumnRef;
11
+ export declare function createWorkbookTableColumnRef(tableRef: WorkbookTableRef, column: ColumnName | string | undefined): WorkbookTableColumnRef;
12
12
  //# sourceMappingURL=workbookTableColumn.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"workbookTableColumn.d.ts","sourceRoot":"","sources":["../../../src/services/workbookTableColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,GAAG,SAAS,GAAG,sBAAsB,CAelI"}
1
+ {"version":3,"file":"workbookTableColumn.d.ts","sourceRoot":"","sources":["../../../src/services/workbookTableColumn.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,qCAAqC,CAAC;AAClF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AAEtE;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,sBAAsB,CAexI"}
@@ -1,13 +1,13 @@
1
1
  /**
2
2
  * Creates a reference to a workbook table column.
3
3
  * @param tableRef - The reference to the worksheet containing the table.
4
- * @param column - The ID of the table.
4
+ * @param column - Name of the table column
5
5
  * @returns A reference to the workbook table.
6
6
  * @throws Error if the table ID is missing.
7
7
  */
8
8
  export function createWorkbookTableColumnRef(tableRef, column) {
9
9
  if (!column) {
10
- throw new Error("TableId is missing");
10
+ throw new Error("column is missing");
11
11
  }
12
12
  return {
13
13
  contextId: tableRef.contextId,
@@ -1,7 +1,7 @@
1
1
  import InvalidArgumentError from "../errors/InvalidArgumentError.js";
2
2
  import getWorkbookWorksheetRange from "../operations/workbookRange/getWorkbookWorksheetRange.js";
3
3
  import { composeAddress, decomposeAddress } from "../services/addressManipulation.js";
4
- import { columnAddressToOffset, offsetToRowAddress, rowAddressToOffset } from "../services/addressOffset.js";
4
+ import { columnAddressToOffset, rowAddressToOffset, rowOffsetToAddress } from "../services/addressOffset.js";
5
5
  import { createWorkbookRangeRef } from "../services/workbookRange.js";
6
6
  /**
7
7
  * Maximum number of cells that can be retrieved in a single request, unless overwritten.
@@ -30,8 +30,8 @@ export default async function* iterateWorkbookRangeValues(rangeRef, overwriteRow
30
30
  for (let chunkRowOffset = rangeStartRowOffset; chunkRowOffset <= rangeEndRowOffset; chunkRowOffset = (chunkRowOffset + rowsPerRequest)) {
31
31
  const requestStartRowOffset = chunkRowOffset;
32
32
  const requestEndRowOffset = Math.min(chunkRowOffset + rowsPerRequest - 1, rangeEndRowOffset);
33
- const chunkStartRow = offsetToRowAddress(requestStartRowOffset);
34
- const chunkEndRow = offsetToRowAddress(requestEndRowOffset);
33
+ const chunkStartRow = rowOffsetToAddress(requestStartRowOffset);
34
+ const chunkEndRow = rowOffsetToAddress(requestEndRowOffset);
35
35
  const requestAddress = composeAddress({
36
36
  startRow: chunkStartRow,
37
37
  endRow: chunkEndRow,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "microsoft-graph",
3
- "version": "2.7.6",
3
+ "version": "2.7.8",
4
4
  "description": "Microsoft GraphAPI SDK for NodeJS",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.js",
@@ -117,6 +117,11 @@
117
117
  "require": "./dist/cjs/models/Address.js",
118
118
  "types": "./dist/esm/models/Address.d.ts"
119
119
  },
120
+ "./models/Cartesian": {
121
+ "import": "./dist/esm/models/Cartesian.js",
122
+ "require": "./dist/cjs/models/Cartesian.js",
123
+ "types": "./dist/esm/models/Cartesian.d.ts"
124
+ },
120
125
  "./models/CellRangeValues": {
121
126
  "import": "./dist/esm/models/CellRangeValues.js",
122
127
  "require": "./dist/cjs/models/CellRangeValues.js",
@@ -137,6 +142,11 @@
137
142
  "require": "./dist/cjs/models/ClientSecret.js",
138
143
  "types": "./dist/esm/models/ClientSecret.d.ts"
139
144
  },
145
+ "./models/ColumnName": {
146
+ "import": "./dist/esm/models/ColumnName.js",
147
+ "require": "./dist/cjs/models/ColumnName.js",
148
+ "types": "./dist/esm/models/ColumnName.d.ts"
149
+ },
140
150
  "./models/ColumnOffset": {
141
151
  "import": "./dist/esm/models/ColumnOffset.js",
142
152
  "require": "./dist/cjs/models/ColumnOffset.js",
@@ -542,6 +552,11 @@
542
552
  "require": "./dist/cjs/services/addressOffset.js",
543
553
  "types": "./dist/esm/services/addressOffset.d.ts"
544
554
  },
555
+ "./services/cartesianAddress": {
556
+ "import": "./dist/esm/services/cartesianAddress.js",
557
+ "require": "./dist/cjs/services/cartesianAddress.js",
558
+ "types": "./dist/esm/services/cartesianAddress.d.ts"
559
+ },
545
560
  "./services/context": {
546
561
  "import": "./dist/esm/services/context.js",
547
562
  "require": "./dist/cjs/services/context.js",
@@ -582,6 +597,11 @@
582
597
  "require": "./dist/cjs/services/random.js",
583
598
  "types": "./dist/esm/services/random.d.ts"
584
599
  },
600
+ "./services/rangeManipulation": {
601
+ "import": "./dist/esm/services/rangeManipulation.js",
602
+ "require": "./dist/cjs/services/rangeManipulation.js",
603
+ "types": "./dist/esm/services/rangeManipulation.d.ts"
604
+ },
585
605
  "./services/sharepointUrl": {
586
606
  "import": "./dist/esm/services/sharepointUrl.js",
587
607
  "require": "./dist/cjs/services/sharepointUrl.js",
@@ -767,6 +787,11 @@
767
787
  "import": "./dist/esm/models/Address.js",
768
788
  "types": "./dist/esm/models/Address.d.ts"
769
789
  },
790
+ "./dist/cjs/models/Cartesian.js": {
791
+ "require": "./dist/cjs/models/Cartesian.js",
792
+ "import": "./dist/esm/models/Cartesian.js",
793
+ "types": "./dist/esm/models/Cartesian.d.ts"
794
+ },
770
795
  "./dist/cjs/models/CellRangeValues.js": {
771
796
  "require": "./dist/cjs/models/CellRangeValues.js",
772
797
  "import": "./dist/esm/models/CellRangeValues.js",
@@ -787,6 +812,11 @@
787
812
  "import": "./dist/esm/models/ClientSecret.js",
788
813
  "types": "./dist/esm/models/ClientSecret.d.ts"
789
814
  },
815
+ "./dist/cjs/models/ColumnName.js": {
816
+ "require": "./dist/cjs/models/ColumnName.js",
817
+ "import": "./dist/esm/models/ColumnName.js",
818
+ "types": "./dist/esm/models/ColumnName.d.ts"
819
+ },
790
820
  "./dist/cjs/models/ColumnOffset.js": {
791
821
  "require": "./dist/cjs/models/ColumnOffset.js",
792
822
  "import": "./dist/esm/models/ColumnOffset.js",
@@ -1192,6 +1222,11 @@
1192
1222
  "import": "./dist/esm/services/addressOffset.js",
1193
1223
  "types": "./dist/esm/services/addressOffset.d.ts"
1194
1224
  },
1225
+ "./dist/cjs/services/cartesianAddress.js": {
1226
+ "require": "./dist/cjs/services/cartesianAddress.js",
1227
+ "import": "./dist/esm/services/cartesianAddress.js",
1228
+ "types": "./dist/esm/services/cartesianAddress.d.ts"
1229
+ },
1195
1230
  "./dist/cjs/services/context.js": {
1196
1231
  "require": "./dist/cjs/services/context.js",
1197
1232
  "import": "./dist/esm/services/context.js",
@@ -1232,6 +1267,11 @@
1232
1267
  "import": "./dist/esm/services/random.js",
1233
1268
  "types": "./dist/esm/services/random.d.ts"
1234
1269
  },
1270
+ "./dist/cjs/services/rangeManipulation.js": {
1271
+ "require": "./dist/cjs/services/rangeManipulation.js",
1272
+ "import": "./dist/esm/services/rangeManipulation.js",
1273
+ "types": "./dist/esm/services/rangeManipulation.d.ts"
1274
+ },
1235
1275
  "./dist/cjs/services/sharepointUrl.js": {
1236
1276
  "require": "./dist/cjs/services/sharepointUrl.js",
1237
1277
  "import": "./dist/esm/services/sharepointUrl.js",