@microsoft/mgt-electron-provider
Advanced tools
Comparing version 4.0.1-preview.48449c4 to 4.0.1-preview.c572c01
@@ -147,2 +147,4 @@ /** | ||
private _approvedScopes; | ||
protected get approvedScopes(): string[]; | ||
protected set approvedScopes(value: string[]); | ||
/** | ||
@@ -149,0 +151,0 @@ * Creates an instance of ElectronAuthenticator. |
@@ -20,2 +20,3 @@ "use strict"; | ||
const msal_node_1 = require("@azure/msal-node"); | ||
const mgt_element_1 = require("@microsoft/mgt-element"); | ||
const electron_1 = require("electron"); | ||
@@ -60,2 +61,11 @@ const CustomFileProtocol_1 = require("./CustomFileProtocol"); | ||
class ElectronAuthenticator { | ||
get approvedScopes() { | ||
return this._approvedScopes; | ||
} | ||
set approvedScopes(value) { | ||
if (!(0, mgt_element_1.arraysAreEqual)(value, this._approvedScopes)) { | ||
this._approvedScopes = value; | ||
this.mainWindow.webContents.send('approvedScopes', value); | ||
} | ||
} | ||
/** | ||
@@ -200,3 +210,3 @@ * Creates an instance of ElectronAuthenticator. | ||
if (authResponse) { | ||
this._approvedScopes = authResponse.scopes; | ||
this.approvedScopes = authResponse.scopes; | ||
return authResponse.accessToken; | ||
@@ -268,3 +278,3 @@ } | ||
if (response) { | ||
this._approvedScopes = response.scopes; | ||
this.approvedScopes = response.scopes; | ||
this.account = (response === null || response === void 0 ? void 0 : response.account) || undefined; | ||
@@ -271,0 +281,0 @@ } |
@@ -19,2 +19,3 @@ /** | ||
logout: () => Promise<void>; | ||
approvedScopes: (callback: (event: IpcRendererEvent, approvedScopes: string[]) => void) => void; | ||
} | ||
@@ -21,0 +22,0 @@ /** |
@@ -59,2 +59,5 @@ /** | ||
}); | ||
this.contextBridge.approvedScopes((_event, approvedScopes) => { | ||
Providers.globalProvider.approvedScopes = approvedScopes; | ||
}); | ||
} | ||
@@ -61,0 +64,0 @@ /** |
{ | ||
"name": "@microsoft/mgt-electron-provider", | ||
"version": "4.0.1-preview.48449c4", | ||
"version": "4.0.1-preview.c572c01", | ||
"description": "The Microsoft Graph Toolkit Electron Provider", | ||
@@ -46,12 +46,14 @@ "keywords": [ | ||
"@azure/msal-node": "^1.0.3", | ||
"@microsoft/mgt-element": "4.0.1-preview.48449c4", | ||
"@microsoft/microsoft-graph-client": "3.0.2", | ||
"electron": "^11.0.2" | ||
"@microsoft/mgt-element": "4.0.1-preview.c572c01", | ||
"@microsoft/microsoft-graph-client": "3.0.2" | ||
}, | ||
"peerDependencies": { | ||
"electron": ">=11.0.2 <29.0.0" | ||
}, | ||
"devDependencies": { | ||
"electron": "^28.2.2" | ||
}, | ||
"publishConfig": { | ||
"directory": "dist" | ||
}, | ||
"resolutions": { | ||
"responselike": "2.0.0" | ||
} | ||
} |
@@ -21,3 +21,3 @@ /** | ||
import { AuthenticationProviderOptions } from '@microsoft/microsoft-graph-client'; | ||
import { GraphEndpoint } from '@microsoft/mgt-element'; | ||
import { arraysAreEqual, GraphEndpoint } from '@microsoft/mgt-element'; | ||
import { BrowserWindow, ipcMain } from 'electron'; | ||
@@ -201,2 +201,11 @@ import { CustomFileProtocolListener } from './CustomFileProtocol'; | ||
private _approvedScopes: string[]; | ||
protected get approvedScopes(): string[] { | ||
return this._approvedScopes; | ||
} | ||
protected set approvedScopes(value: string[]) { | ||
if (!arraysAreEqual(value, this._approvedScopes)) { | ||
this._approvedScopes = value; | ||
this.mainWindow.webContents.send('approvedScopes', value); | ||
} | ||
} | ||
@@ -351,3 +360,3 @@ /** | ||
if (authResponse) { | ||
this._approvedScopes = authResponse.scopes; | ||
this.approvedScopes = authResponse.scopes; | ||
return authResponse.accessToken; | ||
@@ -416,3 +425,3 @@ } | ||
if (response) { | ||
this._approvedScopes = response.scopes; | ||
this.approvedScopes = response.scopes; | ||
this.account = response?.account || undefined; | ||
@@ -419,0 +428,0 @@ } else { |
@@ -28,2 +28,3 @@ /** | ||
logout: () => Promise<void>; | ||
approvedScopes: (callback: (event: IpcRendererEvent, approvedScopes: string[]) => void) => void; | ||
} | ||
@@ -76,2 +77,5 @@ | ||
}); | ||
this.contextBridge.approvedScopes((_event, approvedScopes) => { | ||
Providers.globalProvider.approvedScopes = approvedScopes; | ||
}); | ||
} | ||
@@ -78,0 +82,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
128151
2202
1
+ Added@electron/get@2.0.3(transitive)
+ Added@microsoft/mgt-element@4.0.1-preview.c572c01(transitive)
+ Added@sindresorhus/is@4.6.0(transitive)
+ Added@szmarczak/http-timer@4.0.6(transitive)
+ Added@types/cacheable-request@6.0.3(transitive)
+ Added@types/http-cache-semantics@4.0.4(transitive)
+ Added@types/keyv@3.1.4(transitive)
+ Added@types/node@18.19.74(transitive)
+ Added@types/responselike@1.0.3(transitive)
+ Added@types/yauzl@2.10.3(transitive)
+ Addedcacheable-lookup@5.0.4(transitive)
+ Addedcacheable-request@7.0.4(transitive)
+ Addeddecompress-response@6.0.0(transitive)
+ Addeddefer-to-connect@2.0.1(transitive)
+ Addedelectron@28.3.3(transitive)
+ Addedextract-zip@2.0.1(transitive)
+ Addedgot@11.8.6(transitive)
+ Addedhttp2-wrapper@1.0.3(transitive)
+ Addedjson-buffer@3.0.1(transitive)
+ Addedkeyv@4.5.4(transitive)
+ Addedmimic-response@3.1.0(transitive)
+ Addednormalize-url@6.1.0(transitive)
+ Addedp-cancelable@2.1.1(transitive)
+ Addedquick-lru@5.1.1(transitive)
+ Addedresolve-alpn@1.2.1(transitive)
+ Addedresponselike@2.0.1(transitive)
+ Addedundici-types@5.26.5(transitive)
- Removedelectron@^11.0.2
- Removed@electron/get@1.14.1(transitive)
- Removed@microsoft/mgt-element@4.0.1-preview.48449c4(transitive)
- Removed@sindresorhus/is@0.14.0(transitive)
- Removed@szmarczak/http-timer@1.1.2(transitive)
- Removed@types/node@12.20.55(transitive)
- Removedbuffer-from@1.1.2(transitive)
- Removedcacheable-request@6.1.0(transitive)
- Removedconcat-stream@1.6.2(transitive)
- Removedconfig-chain@1.1.13(transitive)
- Removedcore-util-is@1.0.3(transitive)
- Removeddebug@2.6.9(transitive)
- Removeddecompress-response@3.3.0(transitive)
- Removeddefer-to-connect@1.1.3(transitive)
- Removedduplexer3@0.1.5(transitive)
- Removedelectron@11.5.0(transitive)
- Removedencodeurl@1.0.2(transitive)
- Removedextract-zip@1.7.0(transitive)
- Removedget-stream@4.1.0(transitive)
- Removedglobal-tunnel-ng@2.7.1(transitive)
- Removedgot@9.6.0(transitive)
- Removedinherits@2.0.4(transitive)
- Removedini@1.3.8(transitive)
- Removedisarray@1.0.0(transitive)
- Removedjson-buffer@3.0.0(transitive)
- Removedkeyv@3.1.0(transitive)
- Removedlodash@4.17.21(transitive)
- Removedlowercase-keys@1.0.1(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedms@2.0.0(transitive)
- Removednormalize-url@4.5.1(transitive)
- Removednpm-conf@1.1.3(transitive)
- Removedp-cancelable@1.1.0(transitive)
- Removedpify@3.0.0(transitive)
- Removedprepend-http@2.0.0(transitive)
- Removedprocess-nextick-args@2.0.1(transitive)
- Removedproto-list@1.2.4(transitive)
- Removedreadable-stream@2.3.8(transitive)
- Removedresponselike@1.0.2(transitive)
- Removedsafe-buffer@5.1.2(transitive)
- Removedstring_decoder@1.1.1(transitive)
- Removedto-readable-stream@1.0.0(transitive)
- Removedtunnel@0.0.6(transitive)
- Removedtypedarray@0.0.6(transitive)
- Removedurl-parse-lax@3.0.0(transitive)
- Removedutil-deprecate@1.0.2(transitive)