Browse Source

[chore] Update jslib (#217)

pull/218/head
Addison Beck 4 years ago committed by GitHub
parent
commit
1be64836f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      jslib
  2. 17
      src/app/services/services.module.ts
  3. 12
      src/bwdc.ts
  4. 8
      src/main.ts
  5. 8
      src/services/state.service.ts

2
jslib

@ -1 +1 @@
Subproject commit e372bf242b24f55c1142e33693ad2c801ab74c93 Subproject commit 92a65b7b368a8dbf55350657674c90169b04c30b

17
src/app/services/services.module.ts

@ -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,

12
src/bwdc.ts

@ -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(

8
src/main.ts

@ -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(

8
src/services/state.service.ts

@ -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> {

Loading…
Cancel
Save