@adobe/helix-onedrive-support 8.0.12 → 8.1.2

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,24 @@
1
+ ## [8.1.2](https://github.com/adobe/helix-onedrive-support/compare/v8.1.1...v8.1.2) (2022-07-16)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **deps:** update external fixes ([0417ab1](https://github.com/adobe/helix-onedrive-support/commit/0417ab1a6f59cfea67f25992e7848424a8b1eb90))
7
+
8
+ ## [8.1.1](https://github.com/adobe/helix-onedrive-support/compare/v8.1.0...v8.1.1) (2022-07-09)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **deps:** update dependency @azure/msal-node to v1.11.0 ([bdd4990](https://github.com/adobe/helix-onedrive-support/commit/bdd49907dcfc183529289b3bec1143cdb2ff17b2))
14
+
15
+ # [8.1.0](https://github.com/adobe/helix-onedrive-support/compare/v8.0.12...v8.1.0) (2022-07-05)
16
+
17
+
18
+ ### Features
19
+
20
+ * add initTenantFromMountPoint() ([#284](https://github.com/adobe/helix-onedrive-support/issues/284)) ([1f1861a](https://github.com/adobe/helix-onedrive-support/commit/1f1861ae28fe8edfbbb644b0190165f62e2e0b1e))
21
+
1
22
  ## [8.0.12](https://github.com/adobe/helix-onedrive-support/compare/v8.0.11...v8.0.12) (2022-07-02)
2
23
 
3
24
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/helix-onedrive-support",
3
- "version": "8.0.12",
3
+ "version": "8.1.2",
4
4
  "description": "Helix OneDrive Support",
5
5
  "main": "src/index.js",
6
6
  "exports": {
@@ -29,8 +29,8 @@
29
29
  "homepage": "https://github.com/adobe/helix-onedrive-support#readme",
30
30
  "dependencies": {
31
31
  "@adobe/helix-fetch": "3.1.1",
32
- "@aws-sdk/client-s3": "3.121.0",
33
- "@azure/msal-node": "1.10.0",
32
+ "@aws-sdk/client-s3": "3.131.0",
33
+ "@azure/msal-node": "1.11.0",
34
34
  "jose": "4.8.3"
35
35
  },
36
36
  "devDependencies": {
@@ -53,7 +53,7 @@
53
53
  "mocha": "10.0.0",
54
54
  "mocha-multi-reporters": "1.5.1",
55
55
  "nock": "13.2.8",
56
- "npm": "8.13.2",
56
+ "npm": "8.14.0",
57
57
  "semantic-release": "19.0.3"
58
58
  },
59
59
  "lint-staged": {
@@ -38,6 +38,14 @@ export declare interface OneDriveAuthOptions {
38
38
  tenantCache?: Map<string, string>;
39
39
  }
40
40
 
41
+ /**
42
+ * Helix config mount point
43
+ */
44
+ declare interface MountPoint {
45
+ url: string;
46
+ tenantId?: string;
47
+ }
48
+
41
49
  /**
42
50
  * Helper class that facilitates authentication for one drive.
43
51
  */
@@ -92,7 +100,22 @@ export declare class OneDriveAuth {
92
100
  */
93
101
  authenticate(silentOnly: boolean): Promise<AuthenticationResult>;
94
102
 
103
+ /**
104
+ * Disposes allocated resources.
105
+ */
95
106
  dispose() : Promise<void>;
96
107
 
97
- initTenantFromUrl(sharingUrl: string|URL): Promise<void>;
108
+ /**
109
+ * Initializes the tenant from the url by requesting the required information from microsoft.
110
+ * @param {string|URL} sharingUrl
111
+ * @returns {string} the tenant id
112
+ */
113
+ initTenantFromUrl(sharingUrl: string|URL): Promise<string>;
114
+
115
+ /**
116
+ * Initializes the tenant either with the `tenantId` of the mount point or via the share url.
117
+ * @param {MountPoint} mp
118
+ * @returns {string} the tenant id
119
+ */
120
+ initTenantFromMountPoint(mp: MountPoint): Promise<string>;
98
121
  }
@@ -151,7 +151,7 @@ export class OneDriveAuth {
151
151
 
152
152
  async initTenantFromUrl(sharingUrl) {
153
153
  if (this.tenant) {
154
- return;
154
+ return this.tenant;
155
155
  }
156
156
  const { log } = this;
157
157
  const tenantHost = OneDriveAuth.getTenantHostFromUrl(sharingUrl);
@@ -166,6 +166,20 @@ export class OneDriveAuth {
166
166
  }
167
167
  }
168
168
  log.info(`using tenant ${this.tenant} for ${tenantHost} from ${sharingUrl}`);
169
+ return this.tenant;
170
+ }
171
+
172
+ async initTenantFromMountPoint(mp) {
173
+ const { log } = this;
174
+ if (this.tenant) {
175
+ return this.tenant;
176
+ }
177
+ if (mp.tenantId) {
178
+ this.tenant = mp.tenantId;
179
+ log.info(`using tenant ${this.tenant} from fstab.`);
180
+ return this.tenant;
181
+ }
182
+ return this.initTenantFromUrl(mp.url);
169
183
  }
170
184
 
171
185
  /**