1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-15 15:53:41 +00:00

[chore] Update jslib (#217)

This commit is contained in:
Addison Beck
2022-01-31 18:01:24 -05:00
committed by GitHub
parent f2389189a3
commit 1be64836f4
5 changed files with 33 additions and 14 deletions

View File

@@ -45,7 +45,10 @@ import { StateMigrationService } from "../../services/stateMigration.service";
import { Account } from "../../models/account";
import { AccountFactory } from "jslib-common/models/domain/account";
import { GlobalStateFactory } from "jslib-common/factories/globalStateFactory";
import { StateFactory } from "jslib-common/factories/stateFactory";
import { GlobalState } from "jslib-common/models/domain/globalState";
function refreshTokenCallback(injector: Injector) {
return () => {
@@ -196,7 +199,15 @@ export function initFactory(
LaunchGuardService,
{
provide: StateMigrationServiceAbstraction,
useClass: StateMigrationService,
useFactory: (
storageService: StorageServiceAbstraction,
secureStorageService: StorageServiceAbstraction
) =>
new StateMigrationService(
storageService,
secureStorageService,
new GlobalStateFactory(GlobalState)
),
deps: [StorageServiceAbstraction, "SECURE_STORAGE"],
},
{
@@ -213,7 +224,7 @@ export function initFactory(
logService,
stateMigrationService,
true, // TODO: It seems like we aren't applying this from settings anywhere. Is toggling secure storage working?
new AccountFactory(Account)
new StateFactory(GlobalState, Account)
),
deps: [
StorageServiceAbstraction,

View File

@@ -40,10 +40,13 @@ import { StorageService as StorageServiceAbstraction } from "jslib-common/abstra
import { Program } from "./program";
import { AccountFactory } from "jslib-common/models/domain/account";
import { Account } from "./models/account";
import { GlobalStateFactory } from "jslib-common/factories/globalStateFactory";
import { StateFactory } from "jslib-common/factories/stateFactory";
import { GlobalState } from "jslib-common/models/domain/globalState";
// tslint:disable-next-line
const packageJson = require("./package.json");
@@ -123,7 +126,8 @@ export class Main {
this.stateMigrationService = new StateMigrationService(
this.storageService,
this.secureStorageService
this.secureStorageService,
new GlobalStateFactory(GlobalState)
);
this.stateService = new StateService(
@@ -132,7 +136,7 @@ export class Main {
this.logService,
this.stateMigrationService,
process.env.BITWARDENCLI_CONNECTOR_PLAINTEXT_SECRETS !== "true",
new AccountFactory(Account)
new StateFactory(GlobalState, Account)
);
this.cryptoService = new CryptoService(

View File

@@ -15,10 +15,12 @@ import { WindowMain } from "jslib-electron/window.main";
import { StateService } from "./services/state.service";
import { AccountFactory } from "jslib-common/models/domain/account";
import { Account } from "./models/account";
import { StateFactory } from "jslib-common/factories/stateFactory";
import { GlobalState } from "jslib-common/models/domain/globalState";
export class Main {
logService: ElectronLogService;
i18nService: I18nService;
@@ -64,7 +66,7 @@ export class Main {
this.logService,
null,
true,
new AccountFactory(Account)
new StateFactory(GlobalState, Account)
);
this.windowMain = new WindowMain(

View File

@@ -1,8 +1,10 @@
import { StateService as BaseStateService } from "jslib-common/services/state.service";
import { AccountFactory } from "jslib-common/models/domain/account";
import { GlobalState } from "jslib-common/models/domain/globalState";
import { StorageOptions } from "jslib-common/models/domain/storageOptions";
import { StateFactory } from "jslib-common/factories/stateFactory";
import { Account } from "src/models/account";
import { AzureConfiguration } from "src/models/azureConfiguration";
import { GSuiteConfiguration } from "src/models/gsuiteConfiguration";
@@ -48,9 +50,9 @@ export class StateService extends BaseStateService<Account> implements StateServ
protected logService: LogService,
protected stateMigrationService: StateMigrationService,
private useSecureStorageForSecrets = true,
protected accountFactory: AccountFactory<Account>
protected stateFactory: StateFactory<Account, GlobalState>
) {
super(storageService, secureStorageService, logService, stateMigrationService, accountFactory);
super(storageService, secureStorageService, logService, stateMigrationService, stateFactory);
}
async getDirectory<T extends IConfiguration>(type: DirectoryType): Promise<T> {