@adobe/helix-onedrive-support 10.5.0 → 10.6.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
+ # [10.6.0](https://github.com/adobe/helix-onedrive-support/compare/v10.5.1...v10.6.0) (2023-09-04)
2
+
3
+
4
+ ### Features
5
+
6
+ * support insert and delete range operations ([#430](https://github.com/adobe/helix-onedrive-support/issues/430)) ([7fda231](https://github.com/adobe/helix-onedrive-support/commit/7fda2313ac90dba164fc9d75d45fd24eb5feefba))
7
+
8
+ ## [10.5.1](https://github.com/adobe/helix-onedrive-support/compare/v10.5.0...v10.5.1) (2023-09-02)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency jose to v4.14.5 ([e507ff2](https://github.com/adobe/helix-onedrive-support/commit/e507ff275a47cf6b70347d29839f0aba2e1b14b9))
14
+
1
15
  # [10.5.0](https://github.com/adobe/helix-onedrive-support/compare/v10.4.0...v10.5.0) (2023-09-01)
2
16
 
3
17
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "10.5.0",
3
+ "version": "10.6.0",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -30,13 +30,13 @@
30
30
  "@adobe/fetch": "4.0.13",
31
31
  "@adobe/helix-shared-tokencache": "1.3.5",
32
32
  "@azure/msal-node": "2.0.2",
33
- "jose": "4.14.4"
33
+ "jose": "4.14.5"
34
34
  },
35
35
  "devDependencies": {
36
36
  "@adobe/eslint-config-helix": "2.0.3",
37
37
  "@semantic-release/changelog": "6.0.3",
38
38
  "@semantic-release/git": "10.0.1",
39
- "@aws-sdk/client-s3": "3.400.0",
39
+ "@aws-sdk/client-s3": "3.405.0",
40
40
  "ajv": "8.12.0",
41
41
  "c8": "8.0.1",
42
42
  "codecov": "3.8.3",
@@ -388,9 +388,24 @@ export class OneDriveMock extends OneDrive {
388
388
  return handleNamedItems(sheet, segs, method, body);
389
389
  default:
390
390
  if (type && type.startsWith('range(address=')) {
391
- return {
392
- address: type.match(/range\(address='([^)]+)'\)/)[1],
393
- };
391
+ const address = type.match(/range\(address='([^)]+)'\)/)[1];
392
+ const operation = segs.shift();
393
+ const usedRangeValues = [...sheet.usedRange.values];
394
+ if (operation === 'delete') {
395
+ if (address === 'A2:B2') {
396
+ usedRangeValues.splice(1, 1);
397
+ sheet.usedRange.values = usedRangeValues;
398
+ }
399
+ } else if (operation === 'insert') {
400
+ if (address === 'A2:B2') {
401
+ usedRangeValues.splice(2, 0, ['', '']);
402
+ sheet.usedRange.values = usedRangeValues;
403
+ }
404
+ } else {
405
+ return {
406
+ address,
407
+ };
408
+ }
394
409
  }
395
410
  // default return the data
396
411
  return { value: data };
@@ -60,4 +60,19 @@ export declare interface Range {
60
60
  * array dimension as the range addressed
61
61
  */
62
62
  update(values: object): Promise<void>;
63
+
64
+ /**
65
+ * Deletes the cells associated with the range.
66
+ * @param shiftValue Specifies which way to shift the cells.
67
+ * The possible values are: Up, Left.
68
+ */
69
+ delete(shiftValue: string): Promise<void>;
70
+
71
+ /**
72
+ * Inserts a cell or a range of cells into the worksheet in place of this range,
73
+ * and shifts the other cells to make space.
74
+ * @param shiftValue Specifies which way to shift the cells.
75
+ * The possible values are: Down, Right.
76
+ */
77
+ insert(shiftValue: string): Promise<void>;
63
78
  }
@@ -85,4 +85,21 @@ export class Range {
85
85
  });
86
86
  this._values = result.values;
87
87
  }
88
+
89
+ async delete(shift = 'Up') {
90
+ await this._oneDrive.doFetch(`${this.uri}/delete`, false, {
91
+ method: 'POST',
92
+ body: { shift },
93
+ });
94
+ this._values = null;
95
+ this._data = null;
96
+ }
97
+
98
+ async insert(shift = 'Down') {
99
+ const result = await this._oneDrive.doFetch(`${this.uri}/insert`, false, {
100
+ method: 'POST',
101
+ body: { shift },
102
+ });
103
+ this._values = result.values;
104
+ }
88
105
  }