@adobe/helix-onedrive-support 9.1.0 → 9.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 +14 -0
- package/package.json +4 -4
- package/src/OneDriveAuth.d.ts +6 -1
- package/src/OneDriveAuth.js +7 -7
- package/src/index.js +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [9.1.2](https://github.com/adobe/helix-onedrive-support/compare/v9.1.1...v9.1.2) (2022-12-17)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **deps:** update external fixes ([63c186d](https://github.com/adobe/helix-onedrive-support/commit/63c186deb696729154be57fd2b5508aacd2242d0))
|
|
7
|
+
|
|
8
|
+
## [9.1.1](https://github.com/adobe/helix-onedrive-support/compare/v9.1.0...v9.1.1) (2022-12-15)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* export AcquireMethod to let imports use symbolic names ([#328](https://github.com/adobe/helix-onedrive-support/issues/328)) ([d8ebfe1](https://github.com/adobe/helix-onedrive-support/commit/d8ebfe1c65e900ff910efa03edc08046e7b8c067))
|
|
14
|
+
|
|
1
15
|
# [9.1.0](https://github.com/adobe/helix-onedrive-support/compare/v9.0.6...v9.1.0) (2022-12-14)
|
|
2
16
|
|
|
3
17
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/helix-onedrive-support",
|
|
3
|
-
"version": "9.1.
|
|
3
|
+
"version": "9.1.2",
|
|
4
4
|
"description": "Helix OneDrive Support",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"exports": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"homepage": "https://github.com/adobe/helix-onedrive-support#readme",
|
|
30
30
|
"dependencies": {
|
|
31
31
|
"@adobe/fetch": "3.3.0",
|
|
32
|
-
"@aws-sdk/client-s3": "3.
|
|
32
|
+
"@aws-sdk/client-s3": "3.231.0",
|
|
33
33
|
"@azure/msal-node": "1.14.5",
|
|
34
34
|
"jose": "4.11.1"
|
|
35
35
|
},
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"c8": "7.12.0",
|
|
42
42
|
"codecov": "3.8.3",
|
|
43
43
|
"dotenv": "16.0.3",
|
|
44
|
-
"eslint": "8.
|
|
44
|
+
"eslint": "8.30.0",
|
|
45
45
|
"eslint-plugin-header": "3.1.1",
|
|
46
46
|
"eslint-plugin-import": "2.26.0",
|
|
47
47
|
"husky": "8.0.2",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"jsdoc-tsimport-plugin": "1.0.5",
|
|
51
51
|
"junit-report-builder": "3.0.1",
|
|
52
52
|
"lint-staged": "13.1.0",
|
|
53
|
-
"mocha": "10.
|
|
53
|
+
"mocha": "10.2.0",
|
|
54
54
|
"mocha-multi-reporters": "1.5.1",
|
|
55
55
|
"nock": "13.2.9",
|
|
56
56
|
"npm": "9.2.0",
|
package/src/OneDriveAuth.d.ts
CHANGED
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import {AuthenticationResult, ClientApplication, ICachePlugin} from "@azure/msal-node";
|
|
13
13
|
|
|
14
|
+
export enum AcquireMethod {
|
|
15
|
+
BY_CLIENT_CREDENTIAL = 'byClientCredential',
|
|
16
|
+
BY_DEVICE_CODE = 'byDeviceCode',
|
|
17
|
+
}
|
|
18
|
+
|
|
14
19
|
export declare interface OneDriveAuthOptions {
|
|
15
20
|
clientId: string;
|
|
16
21
|
clientSecret?: string;
|
|
@@ -19,7 +24,7 @@ export declare interface OneDriveAuthOptions {
|
|
|
19
24
|
scopes?: string[];
|
|
20
25
|
onCode?: Function;
|
|
21
26
|
localAuthCache?:boolean;
|
|
22
|
-
acquireMethod?:
|
|
27
|
+
acquireMethod?: AcquireMethod;
|
|
23
28
|
|
|
24
29
|
/**
|
|
25
30
|
* use cache plugin instead for default (global) token cache.
|
package/src/OneDriveAuth.js
CHANGED
|
@@ -29,7 +29,7 @@ const MSAL_LOG_LEVELS = [
|
|
|
29
29
|
'trace',
|
|
30
30
|
];
|
|
31
31
|
|
|
32
|
-
export const
|
|
32
|
+
export const AcquireMethod = {
|
|
33
33
|
BY_DEVICE_CODE: 'byDeviceCode',
|
|
34
34
|
BY_CLIENT_CREDENTIAL: 'byClientCredential',
|
|
35
35
|
};
|
|
@@ -77,15 +77,15 @@ export class OneDriveAuth {
|
|
|
77
77
|
this.onCode = opts.onCode;
|
|
78
78
|
this.acquireMethod = opts.acquireMethod || '';
|
|
79
79
|
|
|
80
|
-
const validAcquireMethods = Array.from(Object.values(
|
|
80
|
+
const validAcquireMethods = Array.from(Object.values(AcquireMethod));
|
|
81
81
|
if (this.acquireMethod && !validAcquireMethods.includes(this.acquireMethod)) {
|
|
82
82
|
throw new Error(`Authentication method unknown: ${this.acquireMethod}, should be none or one of: ${validAcquireMethods}`);
|
|
83
83
|
}
|
|
84
|
-
if (this.acquireMethod ===
|
|
85
|
-
throw new Error(`Authontication method ${
|
|
84
|
+
if (this.acquireMethod === AcquireMethod.BY_DEVICE_CODE && !this.onCode) {
|
|
85
|
+
throw new Error(`Authontication method ${AcquireMethod.BY_DEVICE_CODE} requires 'onCode' parameter`);
|
|
86
86
|
}
|
|
87
87
|
if (!this.acquireMethod && this.onCode) {
|
|
88
|
-
this.acquireMethod =
|
|
88
|
+
this.acquireMethod = AcquireMethod.BY_DEVICE_CODE;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
if (!opts.noTenantCache && !process.env.HELIX_ONEDRIVE_NO_TENANT_CACHE) {
|
|
@@ -288,7 +288,7 @@ export class OneDriveAuth {
|
|
|
288
288
|
}
|
|
289
289
|
|
|
290
290
|
try {
|
|
291
|
-
if (this.acquireMethod ===
|
|
291
|
+
if (this.acquireMethod === AcquireMethod.BY_DEVICE_CODE) {
|
|
292
292
|
log.debug('acquire token with device.');
|
|
293
293
|
return await app.acquireTokenByDeviceCode({
|
|
294
294
|
deviceCodeCallback: async (code) => {
|
|
@@ -297,7 +297,7 @@ export class OneDriveAuth {
|
|
|
297
297
|
scopes: this.scopes,
|
|
298
298
|
});
|
|
299
299
|
}
|
|
300
|
-
if (this.acquireMethod ===
|
|
300
|
+
if (this.acquireMethod === AcquireMethod.BY_CLIENT_CREDENTIAL) {
|
|
301
301
|
log.debug('acquire token with client credentials.');
|
|
302
302
|
return await app.acquireTokenByClientCredential({
|
|
303
303
|
scopes: this.scopes,
|
package/src/index.js
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
export { OneDrive } from './OneDrive.js';
|
|
13
|
-
export { OneDriveAuth } from './OneDriveAuth.js';
|
|
13
|
+
export { OneDriveAuth, AcquireMethod } from './OneDriveAuth.js';
|
|
14
14
|
|
|
15
15
|
export { FSCachePlugin } from './cache/FSCachePlugin.js';
|
|
16
16
|
export { FSCacheManager } from './cache/FSCacheManager.js';
|