@adobe/helix-onedrive-support 8.3.4 → 8.3.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 +14 -0
- package/package.json +1 -1
- package/src/OneDrive.js +4 -1
- package/src/OneDriveAuth.js +4 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [8.3.6](https://github.com/adobe/helix-onedrive-support/compare/v8.3.5...v8.3.6) (2022-09-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* OneDriveAuth: properly scoped fetch context ([#304](https://github.com/adobe/helix-onedrive-support/issues/304)) ([faa92f1](https://github.com/adobe/helix-onedrive-support/commit/faa92f1dcc65f6a0faca7c611f41e303ffa7d9ec))
|
|
7
|
+
|
|
8
|
+
## [8.3.5](https://github.com/adobe/helix-onedrive-support/compare/v8.3.4...v8.3.5) (2022-09-29)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* properly scoped fetch context ([388bd99](https://github.com/adobe/helix-onedrive-support/commit/388bd9929e8fe47ebcdd51dbad9c354ab19c45f3))
|
|
14
|
+
|
|
1
15
|
## [8.3.4](https://github.com/adobe/helix-onedrive-support/compare/v8.3.3...v8.3.4) (2022-09-25)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
package/src/OneDrive.js
CHANGED
|
@@ -17,7 +17,6 @@ import { StatusCodeError } from './StatusCodeError.js';
|
|
|
17
17
|
import { editDistance, sanitizeName, splitByExtension } from './utils.js';
|
|
18
18
|
import { SharePointSite } from './SharePointSite.js';
|
|
19
19
|
|
|
20
|
-
const { fetch, reset } = keepAliveNoCache({ userAgent: 'adobe-fetch' });
|
|
21
20
|
/**
|
|
22
21
|
* the maximum subscription time in milliseconds
|
|
23
22
|
* @see https://docs.microsoft.com/en-us/graph/api/resources/subscription?view=graph-rest-1.0#maximum-length-of-subscription-per-resource-type
|
|
@@ -87,6 +86,8 @@ export class OneDrive {
|
|
|
87
86
|
* @param {OneDriveOptions} opts Options
|
|
88
87
|
*/
|
|
89
88
|
constructor(opts) {
|
|
89
|
+
this.fetchContext = keepAliveNoCache({ userAgent: 'adobe-fetch' });
|
|
90
|
+
|
|
90
91
|
if (!opts.auth) {
|
|
91
92
|
throw new Error('Missing auth.');
|
|
92
93
|
}
|
|
@@ -104,6 +105,7 @@ export class OneDrive {
|
|
|
104
105
|
async dispose() {
|
|
105
106
|
// TODO: clear other state?
|
|
106
107
|
await this.auth.dispose();
|
|
108
|
+
const { reset } = this.fetchContext;
|
|
107
109
|
return reset();
|
|
108
110
|
}
|
|
109
111
|
|
|
@@ -124,6 +126,7 @@ export class OneDrive {
|
|
|
124
126
|
opts.headers.authorization = `Bearer ${accessToken}`;
|
|
125
127
|
const url = `https://graph.microsoft.com/v1.0${relUrl}`;
|
|
126
128
|
try {
|
|
129
|
+
const { fetch } = this.fetchContext;
|
|
127
130
|
const resp = await fetch(url, opts);
|
|
128
131
|
if (!resp.ok) {
|
|
129
132
|
const text = await resp.text();
|
package/src/OneDriveAuth.js
CHANGED
|
@@ -17,8 +17,6 @@ import { decodeJwt } from 'jose';
|
|
|
17
17
|
import { MemCachePlugin } from './cache/MemCachePlugin.js';
|
|
18
18
|
import { StatusCodeError } from './StatusCodeError.js';
|
|
19
19
|
|
|
20
|
-
const { fetch, reset } = keepAliveNoCache({ userAgent: 'adobe-fetch' });
|
|
21
|
-
|
|
22
20
|
const AZ_AUTHORITY_HOST_URL = 'https://login.windows.net';
|
|
23
21
|
const AZ_COMMON_TENANT = 'common';
|
|
24
22
|
|
|
@@ -54,6 +52,8 @@ export class OneDriveAuth {
|
|
|
54
52
|
* @param {OneDriveAuthOptions} opts Options
|
|
55
53
|
*/
|
|
56
54
|
constructor(opts) {
|
|
55
|
+
this.fetchContext = keepAliveNoCache({ userAgent: 'adobe-fetch' });
|
|
56
|
+
|
|
57
57
|
if (!opts.clientId) {
|
|
58
58
|
throw new Error('Missing clientId.');
|
|
59
59
|
}
|
|
@@ -119,6 +119,7 @@ export class OneDriveAuth {
|
|
|
119
119
|
async resolveTenant(tenantHostName) {
|
|
120
120
|
const { log } = this;
|
|
121
121
|
const configUrl = `https://login.windows.net/${tenantHostName}.onmicrosoft.com/.well-known/openid-configuration`;
|
|
122
|
+
const { fetch } = this.fetchContext;
|
|
122
123
|
const res = await fetch(configUrl);
|
|
123
124
|
if (!res.ok) {
|
|
124
125
|
log.info(`error fetching openid-configuration for ${tenantHostName}: ${res.status}. Fallback to 'common'`);
|
|
@@ -187,6 +188,7 @@ export class OneDriveAuth {
|
|
|
187
188
|
// eslint-disable-next-line class-methods-use-this
|
|
188
189
|
async dispose() {
|
|
189
190
|
// TODO: clear other state?
|
|
191
|
+
const { reset } = this.fetchContext;
|
|
190
192
|
return reset();
|
|
191
193
|
}
|
|
192
194
|
|