@adobe/helix-onedrive-support 11.1.2 → 11.2.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/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ # [11.2.0](https://github.com/adobe/helix-onedrive-support/compare/v11.1.3...v11.2.0) (2023-12-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * introduce Range.getRowCount ([#474](https://github.com/adobe/helix-onedrive-support/issues/474)) ([593d3c1](https://github.com/adobe/helix-onedrive-support/commit/593d3c1a685444493fafa78d594e9c1e6bf58f85))
7
+
8
+ ## [11.1.3](https://github.com/adobe/helix-onedrive-support/compare/v11.1.2...v11.1.3) (2023-12-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @adobe/helix-shared-tokencache to v1.3.16 ([7bac382](https://github.com/adobe/helix-onedrive-support/commit/7bac382e1bc2f3dc8c88fb15169a760d9f941a87))
14
+
1
15
  ## [11.1.2](https://github.com/adobe/helix-onedrive-support/compare/v11.1.1...v11.1.2) (2023-12-07)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "11.1.2",
3
+ "version": "11.2.0",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -28,7 +28,7 @@
28
28
  "homepage": "https://github.com/adobe/helix-onedrive-support#readme",
29
29
  "dependencies": {
30
30
  "@adobe/fetch": "4.1.1",
31
- "@adobe/helix-shared-tokencache": "1.3.15",
31
+ "@adobe/helix-shared-tokencache": "1.3.16",
32
32
  "@azure/msal-node": "2.2.0",
33
33
  "jose": "5.1.3"
34
34
  },
@@ -36,7 +36,7 @@
36
36
  "@adobe/eslint-config-helix": "2.0.5",
37
37
  "@semantic-release/changelog": "6.0.3",
38
38
  "@semantic-release/git": "10.0.1",
39
- "@aws-sdk/client-s3": "3.465.0",
39
+ "@aws-sdk/client-s3": "3.470.0",
40
40
  "ajv": "8.12.0",
41
41
  "c8": "8.0.1",
42
42
  "codecov": "3.8.3",
@@ -49,12 +49,12 @@
49
49
  "jsdoc-to-markdown": "8.0.0",
50
50
  "jsdoc-tsimport-plugin": "1.0.5",
51
51
  "junit-report-builder": "3.1.0",
52
- "lint-staged": "15.1.0",
52
+ "lint-staged": "15.2.0",
53
53
  "mocha": "10.2.0",
54
54
  "mocha-multi-reporters": "1.5.1",
55
55
  "nock": "13.4.0",
56
- "npm": "10.2.4",
57
- "semantic-release": "22.0.8"
56
+ "npm": "10.2.5",
57
+ "semantic-release": "22.0.10"
58
58
  },
59
59
  "lint-staged": {
60
60
  "*.js": "eslint"
@@ -224,12 +224,17 @@ function handleTable(container, segs, method, body) {
224
224
  * @param {object} range The mock range
225
225
  * @param {string} method Request method
226
226
  * @param {object} body Request body
227
+ * @param {string} query query to select values
227
228
  * @returns {object} The response value
228
229
  */
229
- function handleRange(range, method, body) {
230
+ function handleRange(range, method, body, query) {
230
231
  if (method === 'PATCH') {
231
232
  range.values = body;
232
233
  }
234
+ if (method === 'GET' && query) {
235
+ const property = new URLSearchParams(query).get('$select');
236
+ return { [property]: range[property] };
237
+ }
233
238
  return range;
234
239
  }
235
240
 
@@ -424,7 +429,7 @@ export class OneDriveMock extends OneDrive {
424
429
  const type = segs.shift();
425
430
  switch (type) {
426
431
  case 'usedRange':
427
- return handleRange(sheet.usedRange, method, body);
432
+ return handleRange(sheet.usedRange, method, body, query);
428
433
  case 'tables':
429
434
  return handleTable(sheet, segs, method, body);
430
435
  case 'names':
@@ -48,6 +48,11 @@ export declare interface Range {
48
48
  */
49
49
  getRowsAsObjects(opts?:FormatOptions): Promise<Array<object>>;
50
50
 
51
+ /**
52
+ * Returns the row count.
53
+ */
54
+ getRowCount(): Promise<number>;
55
+
51
56
  /**
52
57
  * Returns the values of the range.
53
58
  */
@@ -63,15 +68,15 @@ export declare interface Range {
63
68
 
64
69
  /**
65
70
  * Deletes the cells associated with the range.
66
- * @param shiftValue Specifies which way to shift the cells.
71
+ * @param shiftValue Specifies which way to shift the cells.
67
72
  * The possible values are: Up, Left.
68
73
  */
69
74
  delete(shiftValue: string): Promise<void>;
70
75
 
71
76
  /**
72
- * Inserts a cell or a range of cells into the worksheet in place of this range,
77
+ * Inserts a cell or a range of cells into the worksheet in place of this range,
73
78
  * and shifts the other cells to make space.
74
- * @param shiftValue Specifies which way to shift the cells.
79
+ * @param shiftValue Specifies which way to shift the cells.
75
80
  * The possible values are: Down, Right.
76
81
  */
77
82
  insert(shiftValue: string): Promise<void>;
@@ -71,6 +71,14 @@ export class Range {
71
71
  return rows;
72
72
  }
73
73
 
74
+ async getRowCount() {
75
+ if (this._data) {
76
+ return this._data.rowCount;
77
+ }
78
+ const { rowCount } = await this._graphAPI.doFetch(`${this.uri}?$select=rowCount`);
79
+ return rowCount;
80
+ }
81
+
74
82
  async getValues() {
75
83
  if (!this._values) {
76
84
  if (this._data) {