microsoft-graph 2.25.0 → 2.27.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 (73) hide show
  1. package/dist/cjs/models/Cell.d.ts +1 -3
  2. package/dist/cjs/models/Cell.d.ts.map +1 -1
  3. package/dist/cjs/models/DataSource.d.ts +27 -0
  4. package/dist/cjs/models/DataSource.d.ts.map +1 -0
  5. package/dist/cjs/models/DataSource.js +2 -0
  6. package/dist/cjs/operations/workbookWorksheet/createWorkbookWorksheet.d.ts +1 -0
  7. package/dist/cjs/operations/workbookWorksheet/createWorkbookWorksheet.d.ts.map +1 -1
  8. package/dist/cjs/operations/workbookWorksheet/createWorkbookWorksheet.js +1 -0
  9. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetByName.d.ts +18 -0
  10. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetByName.d.ts.map +1 -0
  11. package/dist/cjs/operations/workbookWorksheet/getWorkbookWorksheetByName.js +37 -0
  12. package/dist/cjs/services/addressManipulation.d.ts.map +1 -1
  13. package/dist/cjs/services/addressManipulation.js +2 -1
  14. package/dist/cjs/services/cartesianAddress.js +2 -2
  15. package/dist/cjs/services/dataSource.d.ts +58 -0
  16. package/dist/cjs/services/dataSource.d.ts.map +1 -0
  17. package/dist/cjs/services/dataSource.js +177 -0
  18. package/dist/cjs/tasks/deleteDriveItemWithRetry.d.ts +1 -0
  19. package/dist/cjs/tasks/deleteDriveItemWithRetry.d.ts.map +1 -1
  20. package/dist/cjs/tasks/deleteDriveItemWithRetry.js +1 -0
  21. package/dist/cjs/tasks/setColumnHidden.d.ts +5 -0
  22. package/dist/cjs/tasks/setColumnHidden.d.ts.map +1 -1
  23. package/dist/cjs/tasks/setColumnHidden.js +5 -0
  24. package/dist/cjs/tasks/setRowHidden.d.ts +5 -0
  25. package/dist/cjs/tasks/setRowHidden.d.ts.map +1 -1
  26. package/dist/cjs/tasks/setRowHidden.js +5 -0
  27. package/dist/cjs/tasks/setWorkbookRangeValues.d.ts +7 -2
  28. package/dist/cjs/tasks/setWorkbookRangeValues.d.ts.map +1 -1
  29. package/dist/cjs/tasks/setWorkbookRangeValues.js +7 -2
  30. package/dist/esm/models/Cell.d.ts +1 -3
  31. package/dist/esm/models/Cell.d.ts.map +1 -1
  32. package/dist/esm/models/DataSource.d.ts +27 -0
  33. package/dist/esm/models/DataSource.d.ts.map +1 -0
  34. package/dist/esm/models/DataSource.js +1 -0
  35. package/dist/esm/operations/workbookWorksheet/createWorkbookWorksheet.d.ts +1 -0
  36. package/dist/esm/operations/workbookWorksheet/createWorkbookWorksheet.d.ts.map +1 -1
  37. package/dist/esm/operations/workbookWorksheet/createWorkbookWorksheet.js +1 -0
  38. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetByName.d.ts +18 -0
  39. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetByName.d.ts.map +1 -0
  40. package/dist/esm/operations/workbookWorksheet/getWorkbookWorksheetByName.js +34 -0
  41. package/dist/esm/services/addressManipulation.d.ts.map +1 -1
  42. package/dist/esm/services/addressManipulation.js +2 -1
  43. package/dist/esm/services/cartesianAddress.js +2 -2
  44. package/dist/esm/services/dataSource.d.ts +58 -0
  45. package/dist/esm/services/dataSource.d.ts.map +1 -0
  46. package/dist/esm/services/dataSource.js +166 -0
  47. package/dist/esm/tasks/deleteDriveItemWithRetry.d.ts +1 -0
  48. package/dist/esm/tasks/deleteDriveItemWithRetry.d.ts.map +1 -1
  49. package/dist/esm/tasks/deleteDriveItemWithRetry.js +1 -0
  50. package/dist/esm/tasks/setColumnHidden.d.ts +5 -0
  51. package/dist/esm/tasks/setColumnHidden.d.ts.map +1 -1
  52. package/dist/esm/tasks/setColumnHidden.js +5 -0
  53. package/dist/esm/tasks/setRowHidden.d.ts +5 -0
  54. package/dist/esm/tasks/setRowHidden.d.ts.map +1 -1
  55. package/dist/esm/tasks/setRowHidden.js +5 -0
  56. package/dist/esm/tasks/setWorkbookRangeValues.d.ts +7 -2
  57. package/dist/esm/tasks/setWorkbookRangeValues.d.ts.map +1 -1
  58. package/dist/esm/tasks/setWorkbookRangeValues.js +7 -2
  59. package/docs/api/Cell.md +3 -9
  60. package/docs/api/README.md +6 -5
  61. package/docs/api/addressManipulation.md +3 -3
  62. package/docs/api/createWorkbookWorksheet.md +5 -1
  63. package/docs/api/getWorkbookWorksheetByName-1.md +32 -0
  64. package/docs/api/getWorkbookWorksheetByName.md +10 -10
  65. package/docs/api/models/DataSource.md +161 -0
  66. package/docs/api/services/dataSource.md +200 -0
  67. package/docs/api/{tasks/setColumnHidden.md → setColumnHidden.md} +6 -4
  68. package/docs/api/{tasks/setRowHidden.md → setRowHidden.md} +6 -4
  69. package/docs/topics/README.md +2 -1
  70. package/docs/topics/versioning.md +17 -0
  71. package/package.json +76 -6
  72. package/docs/api/deleteDriveItemWithRetry.md +0 -33
  73. package/docs/api/tasks/setWorkbookRangeValues.md +0 -3
@@ -26,9 +26,7 @@ export type Cell = {
26
26
  * Text content of a cell in a worksheet.
27
27
  * @remarks This is a string that represents the text displayed in the cell, which may differ from the actual value of the cell (e.g., due to formatting).
28
28
  */
29
- export type CellText = string & {
30
- __brand: "CellText";
31
- };
29
+ export type CellText = string;
32
30
  /**
33
31
  * CellValue represents the value of a cell in a spreadsheet.
34
32
  * @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC/B,OAAO,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Cell, CellValue } from "./Cell.ts";
2
+ import type { ColumnName } from "./Column.ts";
3
+ import type { RowNumber, RowOffset } from "./Row.ts";
4
+ import type { WorkbookRangeRef } from "./WorkbookRange.ts";
5
+ export type DataSource<T extends RecordBase> = {
6
+ bodyRef: WorkbookRangeRef;
7
+ bodyOffset: RowOffset;
8
+ head: ColumnName[];
9
+ coding: {
10
+ decode: RowDecoder<T>;
11
+ encode: RowEncoder<T> | null;
12
+ };
13
+ } & AsyncIterable<Item<T>>;
14
+ export type RowDecoder<T extends RecordBase> = (row: DataSourceRow) => T;
15
+ export type RowEncoder<T extends RecordBase> = (record: T) => DataSourceRow;
16
+ export type ItemIndex = number & {
17
+ __brand: "ItemIndex";
18
+ };
19
+ export type Item<T extends RecordBase> = {
20
+ index: ItemIndex;
21
+ rowNumber: RowNumber;
22
+ record: T;
23
+ };
24
+ export type RecordBase = Record<string, CellValue>;
25
+ export type DataSourceRow = Record<ColumnName, Partial<Cell>>;
26
+ export type RangeOperationCallback = (rangeRef: WorkbookRangeRef) => Promise<void>;
27
+ //# sourceMappingURL=DataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../src/models/DataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI;IAC9C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,MAAM,EAAE;QACP,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KAC7B,CAAC;CACF,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC;AAE5E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -13,6 +13,7 @@ import type { WorkbookWorksheetName, WorkbookWorksheetRef } from "../../models/W
13
13
  * @param name (Optional) The name of the new worksheet.
14
14
  * @returns The newly created worksheet.
15
15
  * @see https://learn.microsoft.com/en-us/graph/api/worksheetcollection-add
16
+ * @remarks While `createWorkbookWorksheet` returns a reference to the worksheet, `getWorkbookWorksheetByName` and `listWorkbookWorksheets` may be unable to see the worksheet for a number of seconds. Calling `calculateWorkbook` can hasten the availability of the new worksheet for these operations.
16
17
  */
17
18
  export default function createWorkbookWorksheet(workbookRef: WorkbookRef, name?: WorkbookWorksheetName): GraphOperation<WorkbookWorksheet & WorkbookWorksheetRef>;
18
19
  //# sourceMappingURL=createWorkbookWorksheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createWorkbookWorksheet.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookWorksheet/createWorkbookWorksheet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAuB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAK1H;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAsBhK"}
1
+ {"version":3,"file":"createWorkbookWorksheet.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookWorksheet/createWorkbookWorksheet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAuB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAK1H;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAsBhK"}
@@ -15,6 +15,7 @@ const workbookWorksheet_ts_1 = require("../../services/workbookWorksheet.js");
15
15
  * @param name (Optional) The name of the new worksheet.
16
16
  * @returns The newly created worksheet.
17
17
  * @see https://learn.microsoft.com/en-us/graph/api/worksheetcollection-add
18
+ * @remarks While `createWorkbookWorksheet` returns a reference to the worksheet, `getWorkbookWorksheetByName` and `listWorkbookWorksheets` may be unable to see the worksheet for a number of seconds. Calling `calculateWorkbook` can hasten the availability of the new worksheet for these operations.
18
19
  */
19
20
  function createWorkbookWorksheet(workbookRef, name) {
20
21
  return (0, operationInvoker_ts_1.operation)({
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Retrieve a worksheet by its name from a workbook.
3
+ * @module getWorkbookWorksheetByName
4
+ * @category Operations
5
+ */
6
+ import type { WorkbookWorksheet } from "@microsoft/microsoft-graph-types";
7
+ import type { GraphOperation } from "../../models/GraphOperation.ts";
8
+ import type { WorkbookRef } from "../../models/Workbook.ts";
9
+ import type { WorkbookWorksheetName, WorkbookWorksheetRef } from "../../models/WorkbookWorksheet.ts";
10
+ /**
11
+ * Retrieve a worksheet by its name from a workbook.
12
+ * @param workbookRef Reference to the workbook.
13
+ * @param worksheetName The name of the worksheet to retrieve.
14
+ * @returns The worksheet object.
15
+ * @see https://learn.microsoft.com/en-us/graph/api/worksheet-get
16
+ */
17
+ export default function getWorkbookWorksheetByName(workbookRef: WorkbookRef, worksheetName: WorkbookWorksheetName): GraphOperation<WorkbookWorksheet & WorkbookWorksheetRef>;
18
+ //# sourceMappingURL=getWorkbookWorksheetByName.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getWorkbookWorksheetByName.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookWorksheet/getWorkbookWorksheetByName.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAuB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAK1H;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,0BAA0B,CAAC,WAAW,EAAE,WAAW,EAAE,aAAa,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAmB3K"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+ /**
3
+ * Retrieve a worksheet by its name from a workbook.
4
+ * @module getWorkbookWorksheetByName
5
+ * @category Operations
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.default = getWorkbookWorksheetByName;
9
+ const operationInvoker_ts_1 = require("../../services/operationInvoker.js");
10
+ const templatedPaths_ts_1 = require("../../services/templatedPaths.js");
11
+ const workbookWorksheet_ts_1 = require("../../services/workbookWorksheet.js");
12
+ /**
13
+ * Retrieve a worksheet by its name from a workbook.
14
+ * @param workbookRef Reference to the workbook.
15
+ * @param worksheetName The name of the worksheet to retrieve.
16
+ * @returns The worksheet object.
17
+ * @see https://learn.microsoft.com/en-us/graph/api/worksheet-get
18
+ */
19
+ function getWorkbookWorksheetByName(workbookRef, worksheetName) {
20
+ return (0, operationInvoker_ts_1.operation)({
21
+ context: workbookRef.context,
22
+ method: "GET",
23
+ path: (0, templatedPaths_ts_1.generatePath)(`/sites/{site-id}/drives/{drive-id}/items/{item-id}/workbook/worksheets('${encodeURIComponent(worksheetName)}')`, workbookRef),
24
+ headers: {
25
+ "workbook-session-id": workbookRef.sessionId,
26
+ },
27
+ body: null,
28
+ responseTransform: (response) => {
29
+ const worksheet = response;
30
+ const worksheetRef = (0, workbookWorksheet_ts_1.createWorkbookWorksheetRef)(workbookRef, worksheet.id);
31
+ return {
32
+ ...worksheet,
33
+ ...worksheetRef,
34
+ };
35
+ },
36
+ });
37
+ }
@@ -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,UA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 +374,8 @@ function subAddress(address, skipRows = 0, takeRows = Number.POSITIVE_INFINITY,
374
374
  const [startRow, endRow] = slice(ay, by, skipRows, takeRows);
375
375
  const [startCol, endCol] = slice(ax, bx, skipCols, takeCols);
376
376
  if (startRow < ay || endRow > by || startRow > endRow || startCol < ax || endCol > bx || startCol > endCol) {
377
- throw new InvalidArgumentError_ts_1.default(`Requested subaddress is out of bounds: rows [${startRow + 1},${endRow + 1}], cols [${startCol + 1},${endCol + 1}] in range.`);
377
+ const requestedAddress = (0, cartesianAddress_ts_1.cartesianToAddress)({ ax: startCol, bx: endCol, ay: startRow, by: endRow });
378
+ throw new InvalidArgumentError_ts_1.default(`Requested subaddress ${requestedAddress} is out of bounds of the base address ${address}.`);
378
379
  }
379
380
  return (0, cartesianAddress_ts_1.cartesianToAddress)({
380
381
  ay: startRow,
@@ -39,10 +39,10 @@ function cartesianToAddress({ ax, ay, bx, by }) {
39
39
  const endColumn = (0, addressOffset_ts_1.columnOffsetToAddress)(bx);
40
40
  const endRow = (0, addressOffset_ts_1.rowOffsetToAddress)(by);
41
41
  if (ax > bx) {
42
- throw new InvalidArgumentError_ts_1.default("Invalid address. End column is before start column.");
42
+ throw new InvalidArgumentError_ts_1.default(`Invalid address. End column is before start column. ax=${ax} bx=${bx}.`);
43
43
  }
44
44
  if (ay > by) {
45
- throw new InvalidArgumentError_ts_1.default("Invalid address. End row is before start row.");
45
+ throw new InvalidArgumentError_ts_1.default(`Invalid address. End row is before start row. ay=${ay} by=${by}.`);
46
46
  }
47
47
  const address = (0, addressManipulation_ts_1.composeAddress)({
48
48
  startRow,
@@ -0,0 +1,58 @@
1
+ import type { DataSource, Item, ItemIndex, RecordBase, RowDecoder, RowEncoder } from "../models/DataSource.ts";
2
+ import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
3
+ /**
4
+ * Define a datasource from an entire worksheet.
5
+ * @template T Type of the record, extending RecordBase.
6
+ * @param worksheetRef Workbook range reference to define the data source on.
7
+ * @param decode Function to decode a row into a record.
8
+ * @param encode Function to encode a record into a row. Optional.
9
+ * @returns The initialized data source.
10
+ */
11
+ export declare function dataSourceFromWorksheet<T extends RecordBase>(worksheetRef: WorkbookRangeRef, decode: RowDecoder<T>, encode?: RowEncoder<T> | null): Promise<DataSource<T>>;
12
+ /**
13
+ * Defines a data source from a given range.
14
+ * @template T Type of the record, extending RecordBase.
15
+ * @param rangeRef Workbook range reference to define the data source on.
16
+ * @param decode Function to decode a row into a record.
17
+ * @param encode Function to encode a record into a row. Optional.
18
+ * @returns The initialized data source.
19
+ */
20
+ export declare function dataSourceFromRange<T extends RecordBase>(rangeRef: WorkbookRangeRef, decode: RowDecoder<T>, encode?: RowEncoder<T> | null): Promise<DataSource<T>>;
21
+ /**
22
+ * Reads all items from the data source.
23
+ * @template T Type of the record, extending RecordBase.
24
+ * @param source Data source to read from.
25
+ * @returns Array of all items in the data source.
26
+ * @deprecated Iterate on the source directly using `for await (const item of source)`.
27
+ */
28
+ export declare function listItems<T extends RecordBase>(source: DataSource<T>): AsyncIterable<Item<T>>;
29
+ /**
30
+ * Creates a new item in the data source.
31
+ * @template T Type of the record, extending RecordBase.
32
+ * @param source Data source to insert into. Must be initialized.
33
+ * @param record Record to insert.
34
+ * @param after Index after which to insert the new item. If null, inserts at the end. If -1 inserts at top.
35
+ * @returns Newly created item, including its index, row number, and record.
36
+ * @throws {InvalidOperationError} If the data source is not initialized.
37
+ * @throws {InvalidArgumentError} If the 'after' index is out of range.
38
+ */
39
+ export declare function createItem<T extends RecordBase>(source: DataSource<T>, record: T, after?: ItemIndex | null): Promise<Item<T>>;
40
+ /**
41
+ * Updates an item in the data source at the specified index.
42
+ * @template T Type of the record, extending RecordBase.
43
+ * @param source Data source to update. Must be initialized.
44
+ * @param index Index of the item to update.
45
+ * @param record New record to write at the specified index.
46
+ * @throws {InvalidOperationError} If the data source is not initialized.
47
+ * @throws {InvalidArgumentError} If the index is out of range.
48
+ */
49
+ export declare function updateItem<T extends RecordBase>(source: DataSource<T>, index: ItemIndex, record: T): Promise<void>;
50
+ /**
51
+ * Deletes an item from the data source at the specified index.
52
+ * @template T Type of the record, extending RecordBase.
53
+ * @param source Data source to delete from. Must be initialized.
54
+ * @param index Index of the item to delete.
55
+ * @throws {InvalidOperationError} If the data source is not initialized.
56
+ */
57
+ export declare function deleteItem<T extends RecordBase>(source: DataSource<T>, index: ItemIndex): Promise<void>;
58
+ //# sourceMappingURL=dataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dataSource.d.ts","sourceRoot":"","sources":["../../../src/services/dataSource.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,UAAU,EAAiB,IAAI,EAAE,SAAS,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE9H,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAWnE;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,SAAS,UAAU,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,GAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAGtL;AACD;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CAAC,CAAC,SAAS,UAAU,EAAE,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,GAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAW,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAqC9K;AAED;;;;;;GAMG;AACH,wBAAuB,SAAS,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAIpG;AAED;;;;;;;;;GASG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,GAAE,SAAS,GAAG,IAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAgBzI;AAED;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CASxH;AAED;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,CAAC,SAAS,UAAU,EAAE,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAI7G"}
@@ -0,0 +1,177 @@
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.dataSourceFromWorksheet = dataSourceFromWorksheet;
7
+ exports.dataSourceFromRange = dataSourceFromRange;
8
+ exports.listItems = listItems;
9
+ exports.createItem = createItem;
10
+ exports.updateItem = updateItem;
11
+ exports.deleteItem = deleteItem;
12
+ const InvalidOperationError_ts_1 = __importDefault(require("../errors/InvalidOperationError.js"));
13
+ const NeverError_ts_1 = __importDefault(require("../errors/NeverError.js"));
14
+ const deleteWorkbookRange_ts_1 = __importDefault(require("../operations/workbookRange/deleteWorkbookRange.js"));
15
+ const getWorkbookWorksheetRange_ts_1 = __importDefault(require("../operations/workbookRange/getWorkbookWorksheetRange.js"));
16
+ const insertWorkbookCells_ts_1 = __importDefault(require("../operations/workbookRange/insertWorkbookCells.js"));
17
+ const updateWorkbookRange_ts_1 = __importDefault(require("../operations/workbookRange/updateWorkbookRange.js"));
18
+ const getWorkbookWorksheetUsedRangeRef_ts_1 = __importDefault(require("../operations/workbookWorksheet/getWorkbookWorksheetUsedRangeRef.js"));
19
+ const readWorkbookRows_ts_1 = __importDefault(require("../tasks/readWorkbookRows.js"));
20
+ const addressManipulation_ts_1 = require("./addressManipulation.js");
21
+ const cartesianAddress_ts_1 = require("./cartesianAddress.js");
22
+ const cellFormat_ts_1 = require("./cellFormat.js");
23
+ /**
24
+ * Define a datasource from an entire worksheet.
25
+ * @template T Type of the record, extending RecordBase.
26
+ * @param worksheetRef Workbook range reference to define the data source on.
27
+ * @param decode Function to decode a row into a record.
28
+ * @param encode Function to encode a record into a row. Optional.
29
+ * @returns The initialized data source.
30
+ */
31
+ async function dataSourceFromWorksheet(worksheetRef, decode, encode = null) {
32
+ const rangeRef = await (0, getWorkbookWorksheetUsedRangeRef_ts_1.default)(worksheetRef);
33
+ return dataSourceFromRange(rangeRef, decode, encode);
34
+ }
35
+ /**
36
+ * Defines a data source from a given range.
37
+ * @template T Type of the record, extending RecordBase.
38
+ * @param rangeRef Workbook range reference to define the data source on.
39
+ * @param decode Function to decode a row into a record.
40
+ * @param encode Function to encode a record into a row. Optional.
41
+ * @returns The initialized data source.
42
+ */
43
+ async function dataSourceFromRange(rangeRef, decode, encode = null) {
44
+ if ((0, addressManipulation_ts_1.countAddressRows)(rangeRef.address) < 1) {
45
+ throw new InvalidOperationError_ts_1.default("Cannot create a data source from an empty range. It must at least contain a header row.");
46
+ }
47
+ const headRef = (0, addressManipulation_ts_1.subRange)(rangeRef, 0, 1);
48
+ const bodyRef = (0, addressManipulation_ts_1.subRange)(rangeRef, 1);
49
+ const head = await getHead(headRef);
50
+ const { ay: bodyOffset } = (0, cartesianAddress_ts_1.addressToCartesian)(bodyRef.address);
51
+ const source = {
52
+ bodyRef,
53
+ bodyOffset,
54
+ coding: {
55
+ decode,
56
+ encode,
57
+ },
58
+ head,
59
+ async *[Symbol.asyncIterator]() {
60
+ let index = 0;
61
+ for await (const row of (0, readWorkbookRows_ts_1.default)(source.bodyRef)) {
62
+ const record = rowToRecord(row, source);
63
+ const rowNumber = indexToRowNumber(source.bodyOffset, index);
64
+ yield {
65
+ index,
66
+ rowNumber,
67
+ record,
68
+ };
69
+ index++;
70
+ }
71
+ },
72
+ };
73
+ return source;
74
+ }
75
+ /**
76
+ * Reads all items from the data source.
77
+ * @template T Type of the record, extending RecordBase.
78
+ * @param source Data source to read from.
79
+ * @returns Array of all items in the data source.
80
+ * @deprecated Iterate on the source directly using `for await (const item of source)`.
81
+ */
82
+ async function* listItems(source) {
83
+ for await (const item of source) {
84
+ yield item;
85
+ }
86
+ }
87
+ /**
88
+ * Creates a new item in the data source.
89
+ * @template T Type of the record, extending RecordBase.
90
+ * @param source Data source to insert into. Must be initialized.
91
+ * @param record Record to insert.
92
+ * @param after Index after which to insert the new item. If null, inserts at the end. If -1 inserts at top.
93
+ * @returns Newly created item, including its index, row number, and record.
94
+ * @throws {InvalidOperationError} If the data source is not initialized.
95
+ * @throws {InvalidArgumentError} If the 'after' index is out of range.
96
+ */
97
+ async function createItem(source, record, after = null) {
98
+ const count = (0, addressManipulation_ts_1.countAddressRows)(source.bodyRef.address);
99
+ const index = (after === null ? count : after + 1);
100
+ const rowNumber = indexToRowNumber(source.bodyOffset, index);
101
+ await (0, insertWorkbookCells_ts_1.default)((0, addressManipulation_ts_1.superRange)(source.bodyRef, index, 1), "Down");
102
+ source.bodyRef = (0, addressManipulation_ts_1.superRange)(source.bodyRef, 0, count + 1);
103
+ await updateItem(source, index, record);
104
+ return {
105
+ index,
106
+ rowNumber,
107
+ record,
108
+ };
109
+ }
110
+ /**
111
+ * Updates an item in the data source at the specified index.
112
+ * @template T Type of the record, extending RecordBase.
113
+ * @param source Data source to update. Must be initialized.
114
+ * @param index Index of the item to update.
115
+ * @param record New record to write at the specified index.
116
+ * @throws {InvalidOperationError} If the data source is not initialized.
117
+ * @throws {InvalidArgumentError} If the index is out of range.
118
+ */
119
+ async function updateItem(source, index, record) {
120
+ const row = recordToRow(record, source);
121
+ const rowRef = (0, addressManipulation_ts_1.subRange)(source.bodyRef, index, 1);
122
+ await (0, updateWorkbookRange_ts_1.default)(rowRef, {
123
+ values: [row.map((x) => x.value)],
124
+ text: [row.map((x) => x.text)],
125
+ numberFormat: [row.map((x) => x.format)],
126
+ });
127
+ }
128
+ /**
129
+ * Deletes an item from the data source at the specified index.
130
+ * @template T Type of the record, extending RecordBase.
131
+ * @param source Data source to delete from. Must be initialized.
132
+ * @param index Index of the item to delete.
133
+ * @throws {InvalidOperationError} If the data source is not initialized.
134
+ */
135
+ async function deleteItem(source, index) {
136
+ const rowRef = (0, addressManipulation_ts_1.subRange)(source.bodyRef, index, 1);
137
+ await (0, deleteWorkbookRange_ts_1.default)(rowRef, "Up");
138
+ source.bodyRef = (0, addressManipulation_ts_1.subRange)(source.bodyRef, 0, -1);
139
+ }
140
+ function rowToRecord(row, source) {
141
+ const sourceRow = source.head.reduce((acc, heading, columnIndex) => {
142
+ const cell = row[columnIndex];
143
+ if (!cell) {
144
+ throw new NeverError_ts_1.default(`Cell at index ${columnIndex} is undefined`);
145
+ }
146
+ acc[heading] = cell;
147
+ return acc;
148
+ }, {});
149
+ const record = source.coding.decode(sourceRow);
150
+ return record;
151
+ }
152
+ function recordToRow(record, source) {
153
+ if (!source.coding.encode) {
154
+ throw new InvalidOperationError_ts_1.default("Data source does not have an encoder defined. Add an encoder for reading.");
155
+ }
156
+ const sourceRow = source.coding.encode(record);
157
+ const row = source.head.map((heading) => {
158
+ const cell = sourceRow[heading];
159
+ if (cell === undefined) {
160
+ throw new Error(`Encoder produced undefined value for '${heading}'.`);
161
+ }
162
+ return {
163
+ value: cell.value ?? "",
164
+ text: cell.text ?? (cell.value ?? "").toString(),
165
+ format: cell.format ?? cellFormat_ts_1.generalCellFormat,
166
+ };
167
+ });
168
+ return row;
169
+ }
170
+ function indexToRowNumber(bodyOffset, index) {
171
+ return (bodyOffset + index + 1); // +1 to convert to 1-based index
172
+ }
173
+ async function getHead(headRef) {
174
+ const headRange = await (0, getWorkbookWorksheetRange_ts_1.default)(headRef);
175
+ const head = headRange.text[0].map((x) => x);
176
+ return head;
177
+ }
@@ -2,6 +2,7 @@
2
2
  * Delete a drive item, avoiding locking issues through automatic retries.
3
3
  * @module deleteDriveItemWithRetry
4
4
  * @category Tasks
5
+ * @hidden
5
6
  */
6
7
  import type { DriveItemRef } from "../models/DriveItem.ts";
7
8
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"deleteDriveItemWithRetry.d.ts","sourceRoot":"","sources":["../../../src/tasks/deleteDriveItemWithRetry.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D;;;;;;GAMG;AACH,wBAA8B,wBAAwB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAahG"}
1
+ {"version":3,"file":"deleteDriveItemWithRetry.d.ts","sourceRoot":"","sources":["../../../src/tasks/deleteDriveItemWithRetry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAI3D;;;;;;GAMG;AACH,wBAA8B,wBAAwB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAahG"}
@@ -3,6 +3,7 @@
3
3
  * Delete a drive item, avoiding locking issues through automatic retries.
4
4
  * @module deleteDriveItemWithRetry
5
5
  * @category Tasks
6
+ * @hidden
6
7
  */
7
8
  var __importDefault = (this && this.__importDefault) || function (mod) {
8
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Set one or more columns visibility.
3
+ * @module setColumnHidden
4
+ * @category Tasks
5
+ */
1
6
  import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
2
7
  /**
3
8
  * Set one or more columns visibility.
@@ -1 +1 @@
1
- {"version":3,"file":"setColumnHidden.d.ts","sourceRoot":"","sources":["../../../src/tasks/setColumnHidden.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQxG"}
1
+ {"version":3,"file":"setColumnHidden.d.ts","sourceRoot":"","sources":["../../../src/tasks/setColumnHidden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;GAIG;AACH,wBAA8B,eAAe,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQxG"}
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * Set one or more columns visibility.
4
+ * @module setColumnHidden
5
+ * @category Tasks
6
+ */
2
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
9
  };
@@ -1,3 +1,8 @@
1
+ /**
2
+ * Set one or more rows visibility.
3
+ * @module setRowHidden
4
+ * @category Tasks
5
+ */
1
6
  import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
2
7
  /**
3
8
  * Set one or more rows visibility.
@@ -1 +1 @@
1
- {"version":3,"file":"setRowHidden.d.ts","sourceRoot":"","sources":["../../../src/tasks/setRowHidden.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;GAKG;AACH,wBAA8B,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrG"}
1
+ {"version":3,"file":"setRowHidden.d.ts","sourceRoot":"","sources":["../../../src/tasks/setRowHidden.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;GAKG;AACH,wBAA8B,YAAY,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAQrG"}
@@ -1,4 +1,9 @@
1
1
  "use strict";
2
+ /**
3
+ * Set one or more rows visibility.
4
+ * @module setRowHidden
5
+ * @category Tasks
6
+ */
2
7
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
8
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
9
  };
@@ -1,11 +1,16 @@
1
+ /**
2
+ * Sets the values of a specified workbook range.
3
+ * @module setWorkbookRangeValues
4
+ * @category Tasks
5
+ * @hidden
6
+ */
1
7
  import type { CellValue } from "../models/Cell.ts";
2
8
  import type { WorkbookRangeRef } from "../models/WorkbookRange.ts";
3
9
  /**
4
10
  * Sets the values of a specified workbook range.
5
- *
6
11
  * @param {WorkbookRangeRef} rangeRef Reference to the workbook range to update.
7
12
  * @param {CellRangeValues} values - The values to set in the specified workbook range. Must match the range's dimensions.
8
- * * @deprecated Use `writeWorkbookRows` instead.
13
+ * @deprecated Use `writeWorkbookRows` instead.
9
14
  * @hidden
10
15
  */
11
16
  export default function setWorkbookRangeValues(rangeRef: WorkbookRangeRef, values: CellValue[][]): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"setWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/setWorkbookRangeValues.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;;;GAOG;AACH,wBAA8B,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,iBAcrG"}
1
+ {"version":3,"file":"setWorkbookRangeValues.d.ts","sourceRoot":"","sources":["../../../src/tasks/setWorkbookRangeValues.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAInE;;;;;;GAMG;AACH,wBAA8B,sBAAsB,CAAC,QAAQ,EAAE,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,iBAcrG"}
@@ -1,4 +1,10 @@
1
1
  "use strict";
2
+ /**
3
+ * Sets the values of a specified workbook range.
4
+ * @module setWorkbookRangeValues
5
+ * @category Tasks
6
+ * @hidden
7
+ */
2
8
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
9
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
10
  };
@@ -9,10 +15,9 @@ const updateWorkbookRange_ts_1 = __importDefault(require("../operations/workbook
9
15
  const addressManipulation_ts_1 = require("../services/addressManipulation.js");
10
16
  /**
11
17
  * Sets the values of a specified workbook range.
12
- *
13
18
  * @param {WorkbookRangeRef} rangeRef Reference to the workbook range to update.
14
19
  * @param {CellRangeValues} values - The values to set in the specified workbook range. Must match the range's dimensions.
15
- * * @deprecated Use `writeWorkbookRows` instead.
20
+ * @deprecated Use `writeWorkbookRows` instead.
16
21
  * @hidden
17
22
  */
18
23
  async function setWorkbookRangeValues(rangeRef, values) {
@@ -26,9 +26,7 @@ export type Cell = {
26
26
  * Text content of a cell in a worksheet.
27
27
  * @remarks This is a string that represents the text displayed in the cell, which may differ from the actual value of the cell (e.g., due to formatting).
28
28
  */
29
- export type CellText = string & {
30
- __brand: "CellText";
31
- };
29
+ export type CellText = string;
32
30
  /**
33
31
  * CellValue represents the value of a cell in a spreadsheet.
34
32
  * @see {@link Cell} for a more comprehensive representation of a cell, which includes text and formatting.
@@ -1 +1 @@
1
- {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG;IAC/B,OAAO,EAAE,UAAU,CAAC;CACpB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
1
+ {"version":3,"file":"Cell.d.ts","sourceRoot":"","sources":["../../../src/models/Cell.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,MAAM,IAAI,GAAG;IAClB;;;OAGG;IACH,IAAI,EAAE,QAAQ,CAAC;IAEf;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,MAAM,EAAE,UAAU,CAAC;CACnB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,QAAQ,GAAG,MAAM,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAElD;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG;IACjC,OAAO,EAAE,YAAY,CAAC;CACtB,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Cell, CellValue } from "./Cell.ts";
2
+ import type { ColumnName } from "./Column.ts";
3
+ import type { RowNumber, RowOffset } from "./Row.ts";
4
+ import type { WorkbookRangeRef } from "./WorkbookRange.ts";
5
+ export type DataSource<T extends RecordBase> = {
6
+ bodyRef: WorkbookRangeRef;
7
+ bodyOffset: RowOffset;
8
+ head: ColumnName[];
9
+ coding: {
10
+ decode: RowDecoder<T>;
11
+ encode: RowEncoder<T> | null;
12
+ };
13
+ } & AsyncIterable<Item<T>>;
14
+ export type RowDecoder<T extends RecordBase> = (row: DataSourceRow) => T;
15
+ export type RowEncoder<T extends RecordBase> = (record: T) => DataSourceRow;
16
+ export type ItemIndex = number & {
17
+ __brand: "ItemIndex";
18
+ };
19
+ export type Item<T extends RecordBase> = {
20
+ index: ItemIndex;
21
+ rowNumber: RowNumber;
22
+ record: T;
23
+ };
24
+ export type RecordBase = Record<string, CellValue>;
25
+ export type DataSourceRow = Record<ColumnName, Partial<Cell>>;
26
+ export type RangeOperationCallback = (rangeRef: WorkbookRangeRef) => Promise<void>;
27
+ //# sourceMappingURL=DataSource.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DataSource.d.ts","sourceRoot":"","sources":["../../../src/models/DataSource.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI;IAC9C,OAAO,EAAE,gBAAgB,CAAC;IAC1B,UAAU,EAAE,SAAS,CAAC;IACtB,IAAI,EAAE,UAAU,EAAE,CAAC;IACnB,MAAM,EAAE;QACP,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC;QACtB,MAAM,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;KAC7B,CAAC;CACF,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;AAE3B,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,GAAG,EAAE,aAAa,KAAK,CAAC,CAAC;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,UAAU,IAAI,CAAC,MAAM,EAAE,CAAC,KAAK,aAAa,CAAC;AAE5E,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG;IAChC,OAAO,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,UAAU,IAAI;IACxC,KAAK,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;AACnD,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AAC9D,MAAM,MAAM,sBAAsB,GAAG,CAAC,QAAQ,EAAE,gBAAgB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -13,6 +13,7 @@ import type { WorkbookWorksheetName, WorkbookWorksheetRef } from "../../models/W
13
13
  * @param name (Optional) The name of the new worksheet.
14
14
  * @returns The newly created worksheet.
15
15
  * @see https://learn.microsoft.com/en-us/graph/api/worksheetcollection-add
16
+ * @remarks While `createWorkbookWorksheet` returns a reference to the worksheet, `getWorkbookWorksheetByName` and `listWorkbookWorksheets` may be unable to see the worksheet for a number of seconds. Calling `calculateWorkbook` can hasten the availability of the new worksheet for these operations.
16
17
  */
17
18
  export default function createWorkbookWorksheet(workbookRef: WorkbookRef, name?: WorkbookWorksheetName): GraphOperation<WorkbookWorksheet & WorkbookWorksheetRef>;
18
19
  //# sourceMappingURL=createWorkbookWorksheet.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createWorkbookWorksheet.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookWorksheet/createWorkbookWorksheet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAuB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAK1H;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAsBhK"}
1
+ {"version":3,"file":"createWorkbookWorksheet.d.ts","sourceRoot":"","sources":["../../../../src/operations/workbookWorksheet/createWorkbookWorksheet.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,kCAAkC,CAAC;AAC1E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,gCAAgC,CAAC;AACrE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,KAAK,EAAuB,qBAAqB,EAAE,oBAAoB,EAAE,MAAM,mCAAmC,CAAC;AAK1H;;;;;;;GAOG;AACH,MAAM,CAAC,OAAO,UAAU,uBAAuB,CAAC,WAAW,EAAE,WAAW,EAAE,IAAI,CAAC,EAAE,qBAAqB,GAAG,cAAc,CAAC,iBAAiB,GAAG,oBAAoB,CAAC,CAsBhK"}
@@ -12,6 +12,7 @@ import { createWorkbookWorksheetRef } from "../../services/workbookWorksheet.js"
12
12
  * @param name (Optional) The name of the new worksheet.
13
13
  * @returns The newly created worksheet.
14
14
  * @see https://learn.microsoft.com/en-us/graph/api/worksheetcollection-add
15
+ * @remarks While `createWorkbookWorksheet` returns a reference to the worksheet, `getWorkbookWorksheetByName` and `listWorkbookWorksheets` may be unable to see the worksheet for a number of seconds. Calling `calculateWorkbook` can hasten the availability of the new worksheet for these operations.
15
16
  */
16
17
  export default function createWorkbookWorksheet(workbookRef, name) {
17
18
  return operation({