-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Dependency injection in the client process (#1471)
- Loading branch information
1 parent
8a11064
commit fdd2cf4
Showing
33 changed files
with
296 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from "./access-token-cache"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export * from "./access-token"; | ||
export * from "./access-token-cache"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Data store is a generic interface for saving key values | ||
*/ | ||
export interface DataStore { | ||
size: number; | ||
|
||
setItem<T= string>(key: string, value: T): Promise<void>; | ||
|
||
getItem<T= string>(key: string): Promise<T>; | ||
|
||
removeItem(key: string): Promise<void>; | ||
|
||
clear(): Promise<void>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { DataStore } from "./data-store"; | ||
|
||
export class InMemoryDataStore implements DataStore { | ||
protected _data = new Map<string, any>(); | ||
|
||
public async setItem<T>(key: string, value: T): Promise<void> { | ||
this._data.set(key, value); | ||
return Promise.resolve(); | ||
} | ||
|
||
public async getItem<T>(key: string): Promise<T> { | ||
return Promise.resolve(this._data.get(key)); | ||
} | ||
|
||
public async removeItem(key: string): Promise<void> { | ||
this._data.delete(key); | ||
return Promise.resolve(); | ||
} | ||
|
||
public async clear(): Promise<void> { | ||
this._data.clear(); | ||
return Promise.resolve(); | ||
} | ||
|
||
public get size() { | ||
return this._data.size; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
export * from "./data-store"; | ||
export * from "./in-memory-data-store"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { NgModule } from "@angular/core"; | ||
import { ServerModule } from "@angular/platform-server"; | ||
import { AADService } from "client/core/aad"; | ||
import { BatchLabsInitializer } from "client/core/batchlabs-initializer"; | ||
import { BlIpcMain } from "client/core/bl-ipc-main"; | ||
import { FileSystem } from "client/core/fs"; | ||
import { LocalDataStore } from "client/core/local-data-store"; | ||
import { LocalFileStorage } from "client/core/local-file-storage"; | ||
import { ProxySettingsManager } from "client/proxy"; | ||
import { autoUpdater } from "electron-updater"; | ||
import { AUTO_UPDATER, BatchLabsApplication } from "./core/batchlabs-application"; | ||
|
||
/** | ||
* BatchLabs client module. This is the root module for managing dependency injection in the Client process | ||
* Only import other modules or use providers. | ||
* DO NOT define any components here. | ||
*/ | ||
@NgModule({ | ||
imports: [ | ||
ServerModule, | ||
], | ||
providers: [ | ||
{ provide: AUTO_UPDATER, useValue: autoUpdater }, | ||
BatchLabsApplication, | ||
BatchLabsInitializer, | ||
ProxySettingsManager, | ||
LocalDataStore, | ||
LocalFileStorage, | ||
AADService, | ||
BlIpcMain, | ||
FileSystem, | ||
], | ||
}) | ||
export class BatchLabsClientModule { | ||
public ngDoBootstrap() { | ||
// Nothing to do | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
export * from "./access-token.service"; | ||
export * from "./access-token-cache"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.