@adobe/helix-onedrive-support 10.4.0 → 10.5.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 +14 -0
- package/package.json +3 -3
- package/src/OneDrive.d.ts +8 -0
- package/src/OneDrive.js +7 -0
- package/src/OneDriveMock.js +9 -0
- package/src/excel/Workbook.d.ts +14 -0
- package/src/excel/Workbook.js +18 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [10.5.1](https://github.com/adobe/helix-onedrive-support/compare/v10.5.0...v10.5.1) (2023-09-02)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update dependency jose to v4.14.5 ([e507ff2](https://github.com/adobe/helix-onedrive-support/commit/e507ff275a47cf6b70347d29839f0aba2e1b14b9))
|
|
7
|
+
|
|
8
|
+
# [10.5.0](https://github.com/adobe/helix-onedrive-support/compare/v10.4.0...v10.5.0) (2023-09-01)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* added excel workbook functionalities ([8782e56](https://github.com/adobe/helix-onedrive-support/commit/8782e560593b02e56dcb33595256089ffaa35132))
|
|
14
|
+
|
|
1
15
|
# [10.4.0](https://github.com/adobe/helix-onedrive-support/compare/v10.3.7...v10.4.0) (2023-08-28)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-onedrive-support",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.5.1",
|
|
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.
|
|
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.
|
|
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",
|
package/src/OneDrive.d.ts
CHANGED
|
@@ -149,6 +149,14 @@ export declare class OneDrive extends EventEmitter {
|
|
|
149
149
|
*/
|
|
150
150
|
getDriveItem(folderItem: DriveItem, relPath?: string, download?: boolean): Promise<GraphResult>;
|
|
151
151
|
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Returns the parentdrive item for the given driveItem
|
|
155
|
+
*
|
|
156
|
+
* @param {DriveItem} driveItem Drive Item.
|
|
157
|
+
*/
|
|
158
|
+
getParentDriveItem(driveItem: DriveItemn): Promise<GraphResult>;
|
|
159
|
+
|
|
152
160
|
/**
|
|
153
161
|
* Tries to get the drive items for the given folder and relative path, by loading the files of
|
|
154
162
|
* the respective directory and returning the item with the best matching filename. Please note,
|
package/src/OneDrive.js
CHANGED
|
@@ -353,6 +353,13 @@ export class OneDrive {
|
|
|
353
353
|
return download ? this.doFetch(`${uri}:/content`, true) : this.doFetch(uri);
|
|
354
354
|
}
|
|
355
355
|
|
|
356
|
+
/**
|
|
357
|
+
*/
|
|
358
|
+
async getParentDriveItem(driveItem) {
|
|
359
|
+
const parentURI = `/drives/${driveItem.parentReference.driveId}/items/${driveItem.parentReference.id}`;
|
|
360
|
+
return this.doFetch(parentURI, false);
|
|
361
|
+
}
|
|
362
|
+
|
|
356
363
|
/**
|
|
357
364
|
*/
|
|
358
365
|
async downloadDriveItem(driveItem) {
|
package/src/OneDriveMock.js
CHANGED
|
@@ -355,6 +355,10 @@ export class OneDriveMock extends OneDrive {
|
|
|
355
355
|
segs.shift();
|
|
356
356
|
if (segs[0]) {
|
|
357
357
|
const sheetName = segs.shift();
|
|
358
|
+
if (method === 'DELETE' && segs.length === 0) {
|
|
359
|
+
data.sheets = data.sheets.filter((s) => (s.name !== sheetName));
|
|
360
|
+
return data.sheets;
|
|
361
|
+
}
|
|
358
362
|
sheet = data.sheets.find((s) => (s.name === sheetName));
|
|
359
363
|
if (!sheet) {
|
|
360
364
|
throw new StatusCodeError(sheetName, 404);
|
|
@@ -363,6 +367,11 @@ export class OneDriveMock extends OneDrive {
|
|
|
363
367
|
// if no more segments, return the sheet data
|
|
364
368
|
return { value: sheet };
|
|
365
369
|
}
|
|
370
|
+
} else if (method === 'POST') {
|
|
371
|
+
data.sheets.push({
|
|
372
|
+
name: body.name,
|
|
373
|
+
});
|
|
374
|
+
return { value: data.sheets.map((st) => ({ name: st.name })) };
|
|
366
375
|
} else {
|
|
367
376
|
return { value: data.sheets.map((st) => ({ name: st.name })) };
|
|
368
377
|
}
|
package/src/excel/Workbook.d.ts
CHANGED
|
@@ -24,6 +24,20 @@ export declare interface Workbook {
|
|
|
24
24
|
*/
|
|
25
25
|
getWorksheetNames(): Promise<string[]>;
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* Create the worksheet with given name in the workbook.
|
|
29
|
+
* @param {string} sheetName sheet name
|
|
30
|
+
* @returns Worksheet
|
|
31
|
+
*
|
|
32
|
+
*/
|
|
33
|
+
createWorksheet(sheetName: string): Worksheet;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Delete the worksheet with given name in the workbook.
|
|
37
|
+
* @param {string} sheetName sheet name
|
|
38
|
+
*/
|
|
39
|
+
deleteWorksheet(sheetName: string): Promise<void>;
|
|
40
|
+
|
|
27
41
|
/**
|
|
28
42
|
* Return a new `Worksheet` instance given its name
|
|
29
43
|
* @param name work sheet name
|
package/src/excel/Workbook.js
CHANGED
|
@@ -38,6 +38,24 @@ export class Workbook extends NamedItemContainer {
|
|
|
38
38
|
return new Worksheet(this._oneDrive, `${this._uri}/worksheets`, name, this._log);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
+
async createWorksheet(sheetName) {
|
|
42
|
+
const uri = `${this.uri}/worksheets`;
|
|
43
|
+
await this._oneDrive.doFetch(uri, false, {
|
|
44
|
+
method: 'POST',
|
|
45
|
+
body: { name: sheetName },
|
|
46
|
+
headers: { 'content-type': 'application/json' },
|
|
47
|
+
});
|
|
48
|
+
return this.worksheet(sheetName);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async deleteWorksheet(sheetName) {
|
|
52
|
+
const uri = `${this.uri}/worksheets/${sheetName}`;
|
|
53
|
+
await this._oneDrive.doFetch(uri, false, {
|
|
54
|
+
method: 'DELETE',
|
|
55
|
+
headers: { 'content-type': 'application/json' },
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
41
59
|
async getTableNames() {
|
|
42
60
|
this.log.debug(`get table names from ${this._uri}/tables`);
|
|
43
61
|
const result = await this._oneDrive.doFetch(`${this._uri}/tables`);
|