microsoft-graph 2.16.0 → 2.17.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.
- package/dist/cjs/errors/InvalidOperationError.d.ts +4 -0
- package/dist/cjs/errors/InvalidOperationError.d.ts.map +1 -0
- package/dist/cjs/errors/InvalidOperationError.js +9 -0
- package/dist/cjs/graphApi.js +2 -2
- package/dist/cjs/models/Item.d.ts +9 -0
- package/dist/cjs/models/Item.d.ts.map +1 -0
- package/dist/cjs/models/Item.js +2 -0
- package/dist/cjs/models/RecordBase.d.ts +3 -0
- package/dist/cjs/models/RecordBase.d.ts.map +1 -0
- package/dist/cjs/models/RecordBase.js +2 -0
- package/dist/cjs/models/RowNumber.d.ts +4 -0
- package/dist/cjs/models/RowNumber.d.ts.map +1 -0
- package/dist/cjs/models/RowNumber.js +2 -0
- package/dist/cjs/models/Source.d.ts +15 -0
- package/dist/cjs/models/Source.d.ts.map +1 -0
- package/dist/cjs/models/Source.js +2 -0
- package/dist/cjs/models/SourceDecoder.d.ts +4 -0
- package/dist/cjs/models/SourceDecoder.d.ts.map +1 -0
- package/dist/cjs/models/SourceDecoder.js +2 -0
- package/dist/cjs/models/SourceEncoder.d.ts +4 -0
- package/dist/cjs/models/SourceEncoder.d.ts.map +1 -0
- package/dist/cjs/models/SourceEncoder.js +2 -0
- package/dist/cjs/models/SourceRow.d.ts +4 -0
- package/dist/cjs/models/SourceRow.d.ts.map +1 -0
- package/dist/cjs/models/SourceRow.js +2 -0
- package/dist/cjs/models/SourceRowValue.d.ts +4 -0
- package/dist/cjs/models/SourceRowValue.d.ts.map +1 -0
- package/dist/cjs/models/SourceRowValue.js +2 -0
- package/dist/cjs/services/addressOffset.d.ts +1 -1
- package/dist/cjs/services/addressOffset.js +1 -1
- package/dist/cjs/services/httpStatus.d.ts +6 -0
- package/dist/cjs/services/httpStatus.d.ts.map +1 -1
- package/dist/cjs/services/httpStatus.js +9 -0
- package/dist/cjs/services/numberFormat.d.ts +3 -0
- package/dist/cjs/services/numberFormat.d.ts.map +1 -0
- package/dist/cjs/services/numberFormat.js +4 -0
- package/dist/cjs/services/source.d.ts +1 -0
- package/dist/cjs/services/source.d.ts.map +1 -0
- package/dist/cjs/services/source.js +178 -0
- package/dist/cjs/tasks/iterateWorkbookRange.d.ts +5 -1
- package/dist/cjs/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/cjs/tasks/iterateWorkbookRange.js +7 -1
- package/dist/esm/errors/InvalidOperationError.d.ts +4 -0
- package/dist/esm/errors/InvalidOperationError.d.ts.map +1 -0
- package/dist/esm/errors/InvalidOperationError.js +6 -0
- package/dist/esm/graphApi.js +3 -3
- package/dist/esm/models/Item.d.ts +9 -0
- package/dist/esm/models/Item.d.ts.map +1 -0
- package/dist/esm/models/Item.js +1 -0
- package/dist/esm/models/RecordBase.d.ts +3 -0
- package/dist/esm/models/RecordBase.d.ts.map +1 -0
- package/dist/esm/models/RecordBase.js +1 -0
- package/dist/esm/models/RowNumber.d.ts +4 -0
- package/dist/esm/models/RowNumber.d.ts.map +1 -0
- package/dist/esm/models/RowNumber.js +1 -0
- package/dist/esm/models/Source.d.ts +15 -0
- package/dist/esm/models/Source.d.ts.map +1 -0
- package/dist/esm/models/Source.js +1 -0
- package/dist/esm/models/SourceDecoder.d.ts +4 -0
- package/dist/esm/models/SourceDecoder.d.ts.map +1 -0
- package/dist/esm/models/SourceDecoder.js +1 -0
- package/dist/esm/models/SourceEncoder.d.ts +4 -0
- package/dist/esm/models/SourceEncoder.d.ts.map +1 -0
- package/dist/esm/models/SourceEncoder.js +1 -0
- package/dist/esm/models/SourceRow.d.ts +4 -0
- package/dist/esm/models/SourceRow.d.ts.map +1 -0
- package/dist/esm/models/SourceRow.js +1 -0
- package/dist/esm/models/SourceRowValue.d.ts +4 -0
- package/dist/esm/models/SourceRowValue.d.ts.map +1 -0
- package/dist/esm/models/SourceRowValue.js +1 -0
- package/dist/esm/services/addressOffset.d.ts +1 -1
- package/dist/esm/services/addressOffset.js +1 -1
- package/dist/esm/services/httpStatus.d.ts +6 -0
- package/dist/esm/services/httpStatus.d.ts.map +1 -1
- package/dist/esm/services/httpStatus.js +8 -0
- package/dist/esm/services/numberFormat.d.ts +3 -0
- package/dist/esm/services/numberFormat.d.ts.map +1 -0
- package/dist/esm/services/numberFormat.js +1 -0
- package/dist/esm/services/source.d.ts +2 -0
- package/dist/esm/services/source.d.ts.map +1 -0
- package/dist/esm/services/source.js +178 -0
- package/dist/esm/tasks/iterateWorkbookRange.d.ts +5 -1
- package/dist/esm/tasks/iterateWorkbookRange.d.ts.map +1 -1
- package/dist/esm/tasks/iterateWorkbookRange.js +7 -1
- package/package.json +279 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceRow.d.ts","sourceRoot":"","sources":["../../../src/models/SourceRow.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC,UAAU,EAAE,IAAI,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SourceRowValue.d.ts","sourceRoot":"","sources":["../../../src/models/SourceRowValue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,MAAM,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -13,7 +13,7 @@ export declare function columnAddressToOffset(column: ColumnAddress): ColumnOffs
|
|
|
13
13
|
* @returns The column address.
|
|
14
14
|
*/
|
|
15
15
|
export declare function columnOffsetToAddress(offset: ColumnOffset): ColumnAddress;
|
|
16
|
-
/** @deprecated Use
|
|
16
|
+
/** @deprecated Use columnOffsetToAddress instead. */
|
|
17
17
|
export declare function offsetToColumnAddress(offset: ColumnOffset): ColumnAddress;
|
|
18
18
|
/**
|
|
19
19
|
* Converts a row address (e.g., "1") to a zero-based row offset.
|
|
@@ -25,7 +25,7 @@ export function columnOffsetToAddress(offset) {
|
|
|
25
25
|
}
|
|
26
26
|
return result;
|
|
27
27
|
}
|
|
28
|
-
/** @deprecated Use
|
|
28
|
+
/** @deprecated Use columnOffsetToAddress instead. */
|
|
29
29
|
export function offsetToColumnAddress(offset) {
|
|
30
30
|
return columnOffsetToAddress(offset);
|
|
31
31
|
}
|
|
@@ -34,4 +34,10 @@ export declare function isServiceUnavailable(status: number): boolean;
|
|
|
34
34
|
* @returns True if the status code is 504, otherwise false.
|
|
35
35
|
*/
|
|
36
36
|
export declare function isGatewayTimeout(status: number): boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Checks if the HTTP status code indicates the resource is locked
|
|
39
|
+
* @param status - The HTTP status code.
|
|
40
|
+
* @returns True if the status code is 423, otherwise false.
|
|
41
|
+
*/
|
|
42
|
+
export declare function isLocked(status: number): boolean;
|
|
37
43
|
//# sourceMappingURL=httpStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD"}
|
|
1
|
+
{"version":3,"file":"httpStatus.d.ts","sourceRoot":"","sources":["../../../src/services/httpStatus.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAErD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEtD;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE7D;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAE5D;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAExD;AAED;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAEhD"}
|
|
@@ -46,3 +46,11 @@ export function isServiceUnavailable(status) {
|
|
|
46
46
|
export function isGatewayTimeout(status) {
|
|
47
47
|
return status === 504;
|
|
48
48
|
}
|
|
49
|
+
/**
|
|
50
|
+
* Checks if the HTTP status code indicates the resource is locked
|
|
51
|
+
* @param status - The HTTP status code.
|
|
52
|
+
* @returns True if the status code is 423, otherwise false.
|
|
53
|
+
*/
|
|
54
|
+
export function isLocked(status) {
|
|
55
|
+
return status === 423;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"numberFormat.d.ts","sourceRoot":"","sources":["../../../src/services/numberFormat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AAE9D,eAAO,MAAM,mBAAmB,EAAgB,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const generalNumberFormat = "General";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../src/services/source.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
// import InvalidOperationError from "../errors/InvalidOperationError.ts";
|
|
2
|
+
// import NeverError from "../errors/NeverError.ts";
|
|
3
|
+
// import type { Cell } from "../models/Cell.ts";
|
|
4
|
+
// import type { ColumnName } from "../models/ColumnName.ts";
|
|
5
|
+
// import type { ColumnOffset } from "../models/ColumnOffset.ts";
|
|
6
|
+
// import type { Item } from "../models/Item.ts";
|
|
7
|
+
// import type { RecordBase } from "../models/RecordBase.ts";
|
|
8
|
+
// import type { RowNumber } from "../models/RowNumber.ts";
|
|
9
|
+
// import type { RowOffset } from "../models/RowOffset.ts";
|
|
10
|
+
// import type { Source } from "../models/source.ts";
|
|
11
|
+
// import type { SourceDecoder } from "../models/SourceDecoder.ts";
|
|
12
|
+
// import type { SourceEncoder } from "../models/SourceEncoder.ts";
|
|
13
|
+
// import type { SourceRow } from "../models/SourceRow.ts";
|
|
14
|
+
// import type { WorkbookWorksheetRef } from "../models/WorkbookWorksheetRef.ts";
|
|
15
|
+
// import deleteWorkbookRange from "../operations/workbookRange/deleteWorkbookRange.ts";
|
|
16
|
+
// import insertWorkbookCells from "../operations/workbookRange/insertWorkbookCells.ts";
|
|
17
|
+
// import setWorkbookRangeFont from "../operations/workbookRange/setWorkbookRangeFont.ts";
|
|
18
|
+
// import updateWorkbookRange from "../operations/workbookRange/updateWorkbookRange.ts";
|
|
19
|
+
// import getWorkbookWorksheetUsedRangeAddress from "../operations/workbookWorksheet/getWorkbookWorksheetUsedRangeAddress.ts";
|
|
20
|
+
// import iterateWorkbookRange from "../tasks/iterateWorkbookRange.ts";
|
|
21
|
+
// import { countAddressColumns, countAddressRows } from "./addressManipulation.ts";
|
|
22
|
+
// import { rowOffsetToAddress } from "./addressOffset.ts";
|
|
23
|
+
// import { addressToCartesian, cartesianToAddress } from "./cartesianAddress.ts";
|
|
24
|
+
// import { createWorkbookRangeRef } from "./workbookRange.ts";
|
|
25
|
+
export {};
|
|
26
|
+
// export async function defineSource<T extends RecordBase>(worksheetRef: WorkbookWorksheetRef, decode: SourceDecoder<T>, encode: SourceEncoder<T>): Promise<Source<T>> {
|
|
27
|
+
// const usedRange = await getWorkbookWorksheetUsedRangeAddress(worksheetRef);
|
|
28
|
+
// const rangeRef = createWorkbookRangeRef(worksheetRef, usedRange);
|
|
29
|
+
// const b = addressToCartesian(usedRange);
|
|
30
|
+
// // TODO: Header
|
|
31
|
+
// const a = await getWorkbookWorksheetRange();
|
|
32
|
+
// const source: Source<T> = {
|
|
33
|
+
// rangeRef,
|
|
34
|
+
// coding: {
|
|
35
|
+
// decode,
|
|
36
|
+
// encode,
|
|
37
|
+
// },
|
|
38
|
+
// head: [],
|
|
39
|
+
// async *[Symbol.asyncIterator](): AsyncGenerator<Item<T>> {
|
|
40
|
+
// let hasHead = false;
|
|
41
|
+
// for await (const { rowOffset, row } of iterateWorkbookRange(rangeRef)) {
|
|
42
|
+
// if (!hasHead) {
|
|
43
|
+
// source.head = row.map((cell) => cell.text) as ColumnName[];
|
|
44
|
+
// hasHead = true;
|
|
45
|
+
// continue;
|
|
46
|
+
// }
|
|
47
|
+
// const record = rowToRecord<T>(row, source);
|
|
48
|
+
// const rowNumber = rowOffsetToNumber(rowOffset);
|
|
49
|
+
// yield {
|
|
50
|
+
// rowOffset,
|
|
51
|
+
// rowNumber,
|
|
52
|
+
// record,
|
|
53
|
+
// };
|
|
54
|
+
// }
|
|
55
|
+
// },
|
|
56
|
+
// };
|
|
57
|
+
// return source;
|
|
58
|
+
// }
|
|
59
|
+
// export async function initializeSource<T extends RecordBase>(source: Source<T>, empty: T): Promise<void> {
|
|
60
|
+
// if (!isEmpty(source)) {
|
|
61
|
+
// throw new InvalidOperationError("Cannot initialize source with non-empty worksheet.");
|
|
62
|
+
// }
|
|
63
|
+
// source.head = Object.keys(empty) as ColumnName[];
|
|
64
|
+
// const address = cartesianToAddress({
|
|
65
|
+
// ax: 0 as ColumnOffset,
|
|
66
|
+
// bx: (source.head.length - 1) as ColumnOffset,
|
|
67
|
+
// ay: 0 as RowOffset,
|
|
68
|
+
// by: 0 as RowOffset,
|
|
69
|
+
// });
|
|
70
|
+
// source.rangeRef = createWorkbookRangeRef(source.rangeRef, address);
|
|
71
|
+
// await updateWorkbookRange(source.rangeRef, {
|
|
72
|
+
// values: [source.head],
|
|
73
|
+
// });
|
|
74
|
+
// await setWorkbookRangeFont(source.rangeRef, {
|
|
75
|
+
// bold: true,
|
|
76
|
+
// });
|
|
77
|
+
// }
|
|
78
|
+
// export async function readAllItems<T extends RecordBase>(source: Source<T>): Promise<Item<T>[]> {
|
|
79
|
+
// const result: Item<T>[] = [];
|
|
80
|
+
// for await (const item of source) {
|
|
81
|
+
// result.push(item);
|
|
82
|
+
// }
|
|
83
|
+
// return result;
|
|
84
|
+
// }
|
|
85
|
+
// export async function createItem<T extends RecordBase>(source: Source<T>, record: T, after: RowOffset = 0 as RowOffset): Promise<Item<T>> {
|
|
86
|
+
// if (!isInitialized(source)) {
|
|
87
|
+
// throw new InvalidOperationError("Source not initialized.");
|
|
88
|
+
// }
|
|
89
|
+
// await insertWorkbookCells(source.rangeRef, rowOffsetToAddress(after), "Down");
|
|
90
|
+
// const row = recordToRow(record, source);
|
|
91
|
+
// const address = cartesianToAddress({
|
|
92
|
+
// ax: 0 as ColumnOffset,
|
|
93
|
+
// bx: (row.length - 1) as ColumnOffset,
|
|
94
|
+
// ay: after,
|
|
95
|
+
// by: after,
|
|
96
|
+
// });
|
|
97
|
+
// const rangeRef = createWorkbookRangeRef(source.rangeRef, address);
|
|
98
|
+
// await updateWorkbookRange(rangeRef, {
|
|
99
|
+
// values: [row],
|
|
100
|
+
// // TODO: Format
|
|
101
|
+
// });
|
|
102
|
+
// const { ax, bx, ay, by } = addressToCartesian(source.rangeRef.address);
|
|
103
|
+
// source.rangeRef.address = cartesianToAddress({
|
|
104
|
+
// ax,
|
|
105
|
+
// bx,
|
|
106
|
+
// ay,
|
|
107
|
+
// by: (by + 1) as RowOffset,
|
|
108
|
+
// });
|
|
109
|
+
// return {
|
|
110
|
+
// rowOffset: after,
|
|
111
|
+
// rowNumber: rowOffsetToNumber(after),
|
|
112
|
+
// record,
|
|
113
|
+
// };
|
|
114
|
+
// }
|
|
115
|
+
// export async function updateItem<T extends RecordBase>(source: Source<T>, offset: RowOffset, record: T): Promise<void> {
|
|
116
|
+
// if (!isInitialized(source)) {
|
|
117
|
+
// throw new InvalidOperationError("Source not initialized.");
|
|
118
|
+
// }
|
|
119
|
+
// const row = recordToRow(record, source);
|
|
120
|
+
// const address = cartesianToAddress({
|
|
121
|
+
// ax: 0 as ColumnOffset,
|
|
122
|
+
// bx: (row.length - 1) as ColumnOffset,
|
|
123
|
+
// ay: offset,
|
|
124
|
+
// by: offset,
|
|
125
|
+
// });
|
|
126
|
+
// const rangeRef = createWorkbookRangeRef(source.rangeRef, address);
|
|
127
|
+
// await updateWorkbookRange(rangeRef, {
|
|
128
|
+
// values: [row],
|
|
129
|
+
// // TODO: format
|
|
130
|
+
// });
|
|
131
|
+
// }
|
|
132
|
+
// export async function deleteItem<T extends RecordBase>(source: Source<T>, offset: RowOffset): Promise<void> {
|
|
133
|
+
// if (!isInitialized(source)) {
|
|
134
|
+
// throw new InvalidOperationError("Source not initialized.");
|
|
135
|
+
// }
|
|
136
|
+
// const rangeRef = createWorkbookRangeRef(source.rangeRef, rowOffsetToAddress(offset));
|
|
137
|
+
// await deleteWorkbookRange(rangeRef, "Up");
|
|
138
|
+
// const { ax, bx, ay, by } = addressToCartesian(source.rangeRef.address);
|
|
139
|
+
// source.rangeRef.address = cartesianToAddress({
|
|
140
|
+
// ax,
|
|
141
|
+
// bx,
|
|
142
|
+
// ay,
|
|
143
|
+
// by: (by - 1) as RowOffset,
|
|
144
|
+
// });
|
|
145
|
+
// }
|
|
146
|
+
// function rowToRecord<T extends RecordBase>(row: Cell[], source: Source<T>): T {
|
|
147
|
+
// const sourceRow = source.head.reduce((acc, heading, columnIndex) => {
|
|
148
|
+
// const cell = row[columnIndex];
|
|
149
|
+
// if (!cell) {
|
|
150
|
+
// throw new NeverError(`Cell at index ${columnIndex} is undefined`);
|
|
151
|
+
// }
|
|
152
|
+
// acc[heading] = cell;
|
|
153
|
+
// return acc;
|
|
154
|
+
// }, {} as SourceRow);
|
|
155
|
+
// const record = source.coding.decode(sourceRow);
|
|
156
|
+
// return record;
|
|
157
|
+
// }
|
|
158
|
+
// function recordToRow<T extends RecordBase>(record: T, source: Source<T>): Cell[] {
|
|
159
|
+
// const sourceRow = source.coding.encode(record);
|
|
160
|
+
// const row = source.head.map((heading) => {
|
|
161
|
+
// const cell = sourceRow[heading];
|
|
162
|
+
// if (cell === undefined) {
|
|
163
|
+
// throw new NeverError(`Cell at index ${heading} is undefined`);
|
|
164
|
+
// }
|
|
165
|
+
// return cell;
|
|
166
|
+
// });
|
|
167
|
+
// return row;
|
|
168
|
+
// }
|
|
169
|
+
// function rowOffsetToNumber(offset: RowOffset): RowNumber {
|
|
170
|
+
// return (offset + 1) as RowNumber;
|
|
171
|
+
// }
|
|
172
|
+
// function isEmpty<T extends RecordBase>(source: Source<T>) {
|
|
173
|
+
// return countAddressRows(source.rangeRef.address) <= 1 && countAddressColumns(source.rangeRef.address) <= 1;
|
|
174
|
+
// }
|
|
175
|
+
// function isInitialized<T extends RecordBase>(source: Source<T>) {
|
|
176
|
+
// return source.head.length > 0;
|
|
177
|
+
// }
|
|
178
|
+
// // TODO: Tidy Cell/CellValue types
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Cell } from "../models/Cell.ts";
|
|
2
|
+
import type { RowOffset } from "../models/RowOffset.ts";
|
|
2
3
|
import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
|
|
3
4
|
/**
|
|
4
5
|
* Iterates over the values of a workbook range in chunks, fetching data in manageable sizes.
|
|
@@ -7,5 +8,8 @@ import type { WorkbookRangeRef } from "../models/WorkbookRangeRef.ts";
|
|
|
7
8
|
* @param overwriteRowsPerRequest - Optional. The number of rows to fetch per request. If omitted, it is automatically calculated.
|
|
8
9
|
* @returns An async iterable that yields rows of range values.
|
|
9
10
|
*/
|
|
10
|
-
export default function iterateWorkbookRange(rangeRef: WorkbookRangeRef, overwriteRowsPerRequest?: number | null): AsyncIterable<
|
|
11
|
+
export default function iterateWorkbookRange(rangeRef: WorkbookRangeRef, overwriteRowsPerRequest?: number | null): AsyncIterable<{
|
|
12
|
+
rowOffset: RowOffset;
|
|
13
|
+
row: Cell[];
|
|
14
|
+
}>;
|
|
11
15
|
//# 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;
|
|
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"}
|
|
@@ -28,6 +28,7 @@ export default async function* iterateWorkbookRange(rangeRef, overwriteRowsPerRe
|
|
|
28
28
|
const rowsPerRequest = overwriteRowsPerRequest ?? Math.floor(maxCellsPerRequest / columnsPerRow);
|
|
29
29
|
const rangeStartRowOffset = rowAddressToOffset(components.startRow);
|
|
30
30
|
const rangeEndRowOffset = rowAddressToOffset(components.endRow);
|
|
31
|
+
let offset = 0;
|
|
31
32
|
for (let chunkRowOffset = rangeStartRowOffset; chunkRowOffset <= rangeEndRowOffset; chunkRowOffset = (chunkRowOffset + rowsPerRequest)) {
|
|
32
33
|
const requestStartRowOffset = chunkRowOffset;
|
|
33
34
|
const requestEndRowOffset = Math.min(chunkRowOffset + rowsPerRequest - 1, rangeEndRowOffset);
|
|
@@ -46,11 +47,16 @@ export default async function* iterateWorkbookRange(rangeRef, overwriteRowsPerRe
|
|
|
46
47
|
const numberFormat = range.numberFormat;
|
|
47
48
|
const rowCount = values.length;
|
|
48
49
|
for (let r = 0; r < rowCount; r++) {
|
|
49
|
-
|
|
50
|
+
const row = Array.from({ length: columnCount }, (_, c) => ({
|
|
50
51
|
text: text[r]?.[c] ?? "",
|
|
51
52
|
value: values[r]?.[c] ?? "",
|
|
52
53
|
numberFormat: numberFormat?.[r]?.[c] ?? "",
|
|
53
54
|
}));
|
|
55
|
+
yield {
|
|
56
|
+
rowOffset: offset,
|
|
57
|
+
row,
|
|
58
|
+
};
|
|
59
|
+
offset++;
|
|
54
60
|
}
|
|
55
61
|
}
|
|
56
62
|
}
|