@adobe/helix-onedrive-support 8.2.3 → 8.2.6

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,24 @@
1
+ ## [8.2.6](https://github.com/adobe/helix-onedrive-support/compare/v8.2.5...v8.2.6) (2022-08-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external fixes ([#294](https://github.com/adobe/helix-onedrive-support/issues/294)) ([aa0f003](https://github.com/adobe/helix-onedrive-support/commit/aa0f00357c3044906ec999bca4090ba43710c3e4))
7
+
8
+ ## [8.2.5](https://github.com/adobe/helix-onedrive-support/compare/v8.2.4...v8.2.5) (2022-08-13)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update external fixes ([4db3407](https://github.com/adobe/helix-onedrive-support/commit/4db3407046568b4b966c61740e472308ac43bf1e))
14
+
15
+ ## [8.2.4](https://github.com/adobe/helix-onedrive-support/compare/v8.2.3...v8.2.4) (2022-08-10)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * add proper table in mock's addTable ([#292](https://github.com/adobe/helix-onedrive-support/issues/292)) ([6c470ef](https://github.com/adobe/helix-onedrive-support/commit/6c470efa4e923440458e9459aab2e1c57346ba06))
21
+
1
22
  ## [8.2.3](https://github.com/adobe/helix-onedrive-support/compare/v8.2.2...v8.2.3) (2022-08-07)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "8.2.3",
3
+ "version": "8.2.6",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -29,9 +29,9 @@
29
29
  "homepage": "https://github.com/adobe/helix-onedrive-support#readme",
30
30
  "dependencies": {
31
31
  "@adobe/helix-fetch": "3.1.2",
32
- "@aws-sdk/client-s3": "3.142.0",
32
+ "@aws-sdk/client-s3": "3.154.0",
33
33
  "@azure/msal-node": "1.12.1",
34
- "jose": "4.8.3"
34
+ "jose": "4.9.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@adobe/eslint-config-helix": "1.3.2",
@@ -41,7 +41,7 @@
41
41
  "c8": "7.12.0",
42
42
  "codecov": "3.8.3",
43
43
  "dotenv": "16.0.1",
44
- "eslint": "8.21.0",
44
+ "eslint": "8.22.0",
45
45
  "eslint-plugin-header": "3.1.1",
46
46
  "eslint-plugin-import": "2.26.0",
47
47
  "husky": "8.0.1",
@@ -53,8 +53,8 @@
53
53
  "mocha": "10.0.0",
54
54
  "mocha-multi-reporters": "1.5.1",
55
55
  "nock": "13.2.9",
56
- "npm": "8.16.0",
57
- "semantic-release": "19.0.3"
56
+ "npm": "8.18.0",
57
+ "semantic-release": "19.0.4"
58
58
  },
59
59
  "lint-staged": {
60
60
  "*.js": "eslint"
@@ -53,24 +53,44 @@ function handleNamedItems(sheet, segs, method, body) {
53
53
 
54
54
  /**
55
55
  * Handle the `table` operation on a workbook / worksheet
56
- * @param {object} sheet The mock data
56
+ * @param {object} container The mock data
57
57
  * @param {string[]} segs Array of path segments
58
58
  * @param {string} method Request method
59
59
  * @param {object} body Request body
60
60
  * @returns {object} The response value
61
61
  */
62
- function handleTable(sheet, segs, method, body) {
62
+ function handleTable(container, segs, method, body) {
63
63
  const first = segs.shift();
64
64
  if (!first) {
65
- return { value: sheet.tables.map((table) => ({ name: table.name })) };
65
+ return { value: container.tables.map((table) => ({ name: table.name })) };
66
66
  }
67
67
  if (first === 'add') {
68
- const len = sheet.tables.push({
69
- name: `Table${sheet.tables.length + 1}`,
68
+ let sheet = container;
69
+
70
+ const { address } = body;
71
+ const sep = address.indexOf('!');
72
+ if (sep !== -1) {
73
+ sheet = container.sheets.find((s) => s.name === address.substring(0, sep));
74
+ }
75
+
76
+ const { values } = sheet.usedRange;
77
+ const headerNames = [];
78
+ const rows = [];
79
+
80
+ if (body.hasHeaders) {
81
+ headerNames.push(...values[0]);
82
+ rows.push(...values.slice(1));
83
+ } else {
84
+ rows.push(...values);
85
+ }
86
+ const len = container.tables.push({
87
+ name: `Table${container.tables.length + 1}`,
88
+ headerNames,
89
+ rows,
70
90
  });
71
- return sheet.tables[len - 1];
91
+ return container.tables[len - 1];
72
92
  }
73
- const table = sheet.tables.find((t) => t.name === first);
93
+ const table = container.tables.find((t) => t.name === first);
74
94
  if (!table) {
75
95
  throw new StatusCodeError(first, 404);
76
96
  }