1
0
mirror of https://github.com/bitwarden/directory-connector synced 2025-12-16 00:04:34 +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

2
jslib

Submodule jslib updated: e372bf242b...92a65b7b36

View File

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

View File

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

View File

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

View File

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