@adobe/helix-onedrive-support 8.3.5 → 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 CHANGED
@@ -1,3 +1,10 @@
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
+
1
8
  ## [8.3.5](https://github.com/adobe/helix-onedrive-support/compare/v8.3.4...v8.3.5) (2022-09-29)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "8.3.5",
3
+ "version": "8.3.6",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -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