@adobe/helix-onedrive-support 8.2.7 → 8.3.1
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 +21 -0
- package/package.json +6 -6
- package/src/OneDriveMock.js +23 -2
- package/src/excel/Table.d.ts +8 -2
- package/src/excel/Table.js +7 -1
- package/src/excel/Workbook.d.ts +1 -1
- package/src/excel/Worksheet.d.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,24 @@
|
|
|
1
|
+
## [8.3.1](https://github.com/adobe/helix-onedrive-support/compare/v8.3.0...v8.3.1) (2022-09-10)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([6104975](https://github.com/adobe/helix-onedrive-support/commit/610497533ed12cca4b099993d5a7ef7d4884962e))
|
|
7
|
+
|
|
8
|
+
# [8.3.0](https://github.com/adobe/helix-onedrive-support/compare/v8.2.8...v8.3.0) (2022-09-10)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* support delete column ([#298](https://github.com/adobe/helix-onedrive-support/issues/298)) ([9e41fbd](https://github.com/adobe/helix-onedrive-support/commit/9e41fbdb091f372314bb2311a1c912315c108111))
|
|
14
|
+
|
|
15
|
+
## [8.2.8](https://github.com/adobe/helix-onedrive-support/compare/v8.2.7...v8.2.8) (2022-09-03)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Bug Fixes
|
|
19
|
+
|
|
20
|
+
* **deps:** update external fixes ([fb33ff0](https://github.com/adobe/helix-onedrive-support/commit/fb33ff0a7943bcf62d5513d7e304d4d2f1ecade7))
|
|
21
|
+
|
|
1
22
|
## [8.2.7](https://github.com/adobe/helix-onedrive-support/compare/v8.2.6...v8.2.7) (2022-08-27)
|
|
2
23
|
|
|
3
24
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-onedrive-support",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.1",
|
|
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.
|
|
33
|
-
"@azure/msal-node": "1.
|
|
34
|
-
"jose": "4.9.
|
|
32
|
+
"@aws-sdk/client-s3": "3.168.0",
|
|
33
|
+
"@azure/msal-node": "1.13.0",
|
|
34
|
+
"jose": "4.9.2"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
37
|
"@adobe/eslint-config-helix": "1.3.2",
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
"ajv": "8.11.0",
|
|
41
41
|
"c8": "7.12.0",
|
|
42
42
|
"codecov": "3.8.3",
|
|
43
|
-
"dotenv": "16.0.
|
|
43
|
+
"dotenv": "16.0.2",
|
|
44
44
|
"eslint": "8.23.0",
|
|
45
45
|
"eslint-plugin-header": "3.1.1",
|
|
46
46
|
"eslint-plugin-import": "2.26.0",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"mocha": "10.0.0",
|
|
54
54
|
"mocha-multi-reporters": "1.5.1",
|
|
55
55
|
"nock": "13.2.9",
|
|
56
|
-
"npm": "8.
|
|
56
|
+
"npm": "8.19.1",
|
|
57
57
|
"semantic-release": "19.0.5"
|
|
58
58
|
},
|
|
59
59
|
"lint-staged": {
|
package/src/OneDriveMock.js
CHANGED
|
@@ -96,6 +96,7 @@ function handleTable(container, segs, method, body) {
|
|
|
96
96
|
}
|
|
97
97
|
let command;
|
|
98
98
|
let name;
|
|
99
|
+
let index;
|
|
99
100
|
if (segs[0]) {
|
|
100
101
|
[, command, , name] = segs.shift().match(/([^?(]+)(\('([^)]+)'\))?(\?(.+))?/);
|
|
101
102
|
}
|
|
@@ -113,7 +114,7 @@ function handleTable(container, segs, method, body) {
|
|
|
113
114
|
table.rows.push(...body.values);
|
|
114
115
|
return { index: table.rows.length - 1 };
|
|
115
116
|
}
|
|
116
|
-
|
|
117
|
+
index = parseInt(subCommand.replace(/itemAt\(index=([0-9]+)\)/, '$1'), 10);
|
|
117
118
|
if (index < 0 || index >= table.rows.length) {
|
|
118
119
|
throw new StatusCodeError(`Index out of range: ${index}`, 400);
|
|
119
120
|
}
|
|
@@ -127,7 +128,27 @@ function handleTable(container, segs, method, body) {
|
|
|
127
128
|
return { values: [table.rows[index]] };
|
|
128
129
|
}
|
|
129
130
|
case 'columns': {
|
|
131
|
+
if (method === 'DELETE') {
|
|
132
|
+
const headerName = segs.shift();
|
|
133
|
+
index = table.headerNames.indexOf(headerName);
|
|
134
|
+
if (index === -1) {
|
|
135
|
+
throw new StatusCodeError(`Column name not found: ${headerName}`, 400);
|
|
136
|
+
}
|
|
137
|
+
table.headerNames.splice(index, 1);
|
|
138
|
+
table.rows.forEach((row) => {
|
|
139
|
+
row.splice(index, 1);
|
|
140
|
+
});
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
if (body) {
|
|
144
|
+
({ name, index = table.headerNames.length } = body);
|
|
145
|
+
table.headerNames.splice(index, 0, name);
|
|
146
|
+
table.rows.forEach((row) => {
|
|
147
|
+
row.splice(index, 0, '');
|
|
148
|
+
});
|
|
149
|
+
}
|
|
130
150
|
if (!name) {
|
|
151
|
+
// return all columns and their data
|
|
131
152
|
const cols = table.headerNames.map((n) => ({
|
|
132
153
|
name: n,
|
|
133
154
|
values: [[n]],
|
|
@@ -142,7 +163,7 @@ function handleTable(container, segs, method, body) {
|
|
|
142
163
|
};
|
|
143
164
|
}
|
|
144
165
|
const columnName = name;
|
|
145
|
-
|
|
166
|
+
index = table.headerNames.findIndex((n) => n === columnName);
|
|
146
167
|
if (index === -1) {
|
|
147
168
|
throw new StatusCodeError(`Column name not found: ${columnName}`, 400);
|
|
148
169
|
}
|
package/src/excel/Table.d.ts
CHANGED
|
@@ -86,11 +86,17 @@ export declare interface Table {
|
|
|
86
86
|
*/
|
|
87
87
|
getColumn(name: string): Promise<string[]>;
|
|
88
88
|
|
|
89
|
-
|
|
89
|
+
/**
|
|
90
90
|
* Add a column to an existing table
|
|
91
91
|
* @param name name of new column
|
|
92
92
|
* @param index zero-based index or missing to add at end
|
|
93
93
|
* @returns new column
|
|
94
94
|
*/
|
|
95
|
-
|
|
95
|
+
addColumn(name:string, index?:number): Promise<DriveItem>;
|
|
96
|
+
|
|
97
|
+
/**
|
|
98
|
+
* Delete a column from the table
|
|
99
|
+
* @param name column name
|
|
100
|
+
*/
|
|
101
|
+
deleteColumn(name: string): Promise<void>;
|
|
96
102
|
}
|
package/src/excel/Table.js
CHANGED
|
@@ -116,7 +116,7 @@ export class Table {
|
|
|
116
116
|
const body = {
|
|
117
117
|
name,
|
|
118
118
|
};
|
|
119
|
-
if (index) {
|
|
119
|
+
if (index !== undefined) {
|
|
120
120
|
body.index = index;
|
|
121
121
|
}
|
|
122
122
|
return this._oneDrive.doFetch(`${this.uri}/columns`, false, {
|
|
@@ -125,6 +125,12 @@ export class Table {
|
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
127
|
|
|
128
|
+
async deleteColumn(name) {
|
|
129
|
+
return this._oneDrive.doFetch(`${this.uri}/columns/${name}`, true, {
|
|
130
|
+
method: 'DELETE',
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
|
|
128
134
|
get name() {
|
|
129
135
|
return this._name;
|
|
130
136
|
}
|
package/src/excel/Workbook.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export declare interface Workbook {
|
|
|
51
51
|
* @param hasHeaders whether the table has headers
|
|
52
52
|
* @param name optional name
|
|
53
53
|
*/
|
|
54
|
-
|
|
54
|
+
addTable(address: string, hasHeaders: boolean, name?: string): Promise<Table>;
|
|
55
55
|
|
|
56
56
|
/**
|
|
57
57
|
* Return the named items in a work book
|
package/src/excel/Worksheet.d.ts
CHANGED