@adobe/helix-onedrive-support 10.1.3 → 10.2.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
+ # [10.2.0](https://github.com/adobe/helix-onedrive-support/compare/v10.1.3...v10.2.0) (2023-07-07)
2
+
3
+
4
+ ### Features
5
+
6
+ * support onedrive-auth initialisation with accessToken without clientId ([d616cdd](https://github.com/adobe/helix-onedrive-support/commit/d616cdd12b5eda8f50471a98ea2555763ed4e61a))
7
+
1
8
  ## [10.1.3](https://github.com/adobe/helix-onedrive-support/compare/v10.1.2...v10.1.3) (2023-07-04)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "10.1.3",
3
+ "version": "10.2.0",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -17,7 +17,7 @@ export enum AcquireMethod {
17
17
  }
18
18
 
19
19
  export declare interface OneDriveAuthOptions {
20
- clientId: string;
20
+ clientId?: string;
21
21
  clientSecret?: string;
22
22
  log?: Console;
23
23
  tenant?: string;
@@ -25,6 +25,7 @@ export declare interface OneDriveAuthOptions {
25
25
  onCode?: Function;
26
26
  localAuthCache?:boolean;
27
27
  acquireMethod?: AcquireMethod;
28
+ accessToken?: string;
28
29
 
29
30
  /**
30
31
  * use cache plugin instead for default (global) token cache.
@@ -58,8 +58,8 @@ export class OneDriveAuth {
58
58
  constructor(opts) {
59
59
  this.fetchContext = keepAliveNoCache({ userAgent: 'adobe-fetch' });
60
60
 
61
- if (!opts.clientId) {
62
- throw new Error('Missing clientId.');
61
+ if (!opts.clientId && !opts.accessToken) {
62
+ throw new Error('Either clientId or accessToken must not be null.');
63
63
  }
64
64
  if (opts.username || opts.password) {
65
65
  throw new Error('Username/password authentication no longer supported.');
@@ -100,6 +100,10 @@ export class OneDriveAuth {
100
100
  caches: new Map(),
101
101
  });
102
102
  }
103
+
104
+ if (opts.accessToken) {
105
+ this.setAccessToken(opts.accessToken);
106
+ }
103
107
  }
104
108
 
105
109
  get app() {