@adobe/helix-onedrive-support 11.2.0 → 11.3.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,10 @@
1
+ # [11.3.0](https://github.com/adobe/helix-onedrive-support/compare/v11.2.0...v11.3.0) (2023-12-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * add workbook.application ([#475](https://github.com/adobe/helix-onedrive-support/issues/475)) ([782aa5f](https://github.com/adobe/helix-onedrive-support/commit/782aa5ffae19bfe08a02d7e7fb0218c1ccf09878))
7
+
1
8
  # [11.2.0](https://github.com/adobe/helix-onedrive-support/compare/v11.1.3...v11.2.0) (2023-12-15)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "11.2.0",
3
+ "version": "11.3.0",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -434,6 +434,8 @@ export class OneDriveMock extends OneDrive {
434
434
  return handleTable(sheet, segs, method, body);
435
435
  case 'names':
436
436
  return handleNamedItems(sheet, segs, method, body);
437
+ case 'application':
438
+ return { calculate: () => {} };
437
439
  default:
438
440
  if (type?.startsWith('range(address=') && sheet.usedRange?.values) {
439
441
  const address = type.match(/range\(address='([^)]+)'\)/)[1];
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Copyright 2022 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ /**
14
+ * Excel Workbook Application
15
+ */
16
+ export declare interface Application {
17
+ /**
18
+ * Calculate formulas in the workbook.
19
+ * @param {string} calculationType calculation type
20
+ */
21
+ calculate(calculationType: 'Recalculate' | 'Full' | 'FullRebuild'): Promise<void>;
22
+ }
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Copyright 2022 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+ export class Application {
13
+ /**
14
+ * Create a new instance of this class.
15
+ * @param {import('../GraphAPI.js').GraphAPI} graphAPI graph API
16
+ * @param {string} uri uri for this application
17
+ * @param {any} log logger
18
+ */
19
+ constructor(graphAPI, uri, log) {
20
+ this._graphAPI = graphAPI;
21
+ this._uri = uri;
22
+ this._log = log;
23
+ }
24
+
25
+ async calculate(calculationType) {
26
+ return this._graphAPI.doFetch(`${this.uri}/calculate`, false, {
27
+ method: 'POST',
28
+ body: { calculationType },
29
+ headers: { 'content-type': 'application/json' },
30
+ });
31
+ }
32
+
33
+ get uri() {
34
+ return this._uri;
35
+ }
36
+ }
@@ -13,6 +13,7 @@ import { Table } from './Table';
13
13
  import { Worksheet } from './Worksheet';
14
14
  import { GraphResult } from '../OneDrive';
15
15
  import { NamedItem } from './NamedItem';
16
+ import { Application } from './Application';
16
17
 
17
18
  /**
18
19
  * Excel Work book
@@ -120,4 +121,9 @@ export declare interface Workbook {
120
121
  * @param {string} sessionId session id
121
122
  */
122
123
  setSessionId(sessionId: string): void;
124
+
125
+ /**
126
+ * Return the workbook application
127
+ */
128
+ application(): Application;
123
129
  }
@@ -13,6 +13,7 @@ import { NamedItemContainer } from './NamedItemContainer.js';
13
13
  import { StatusCodeError } from '../StatusCodeError.js';
14
14
  import { Table } from './Table.js';
15
15
  import { Worksheet } from './Worksheet.js';
16
+ import { Application } from './Application.js';
16
17
 
17
18
  export class Workbook extends NamedItemContainer {
18
19
  /**
@@ -158,6 +159,10 @@ export class Workbook extends NamedItemContainer {
158
159
  return table;
159
160
  }
160
161
 
162
+ application() {
163
+ return new Application(this, `${this._uri}/application`, this._log);
164
+ }
165
+
161
166
  get uri() {
162
167
  return this._uri;
163
168
  }