mirror of
https://github.com/bitwarden/directory-connector
synced 2025-12-05 23:53:21 +00:00
Update jslib and minor fixes for account switching (#204)
* Update jslib * Update stateMigrationService to use enums * Remove duplicate subclass method * Update jslib
This commit is contained in:
2
jslib
2
jslib
Submodule jslib updated: 9e26336549...ddcfe23367
@@ -3,6 +3,8 @@ import { State } from "jslib-common/models/domain/state";
|
||||
|
||||
import { StateMigrationService as BaseStateMigrationService } from "jslib-common/services/stateMigration.service";
|
||||
|
||||
import { StateVersion } from "jslib-common/enums/stateVersion";
|
||||
|
||||
import { DirectoryType } from "src/enums/directoryType";
|
||||
|
||||
import { Account, DirectoryConfigurations, DirectorySettings } from "src/models/account";
|
||||
@@ -47,21 +49,12 @@ const ClientKeys: { [key: string]: any } = {
|
||||
};
|
||||
|
||||
export class StateMigrationService extends BaseStateMigrationService {
|
||||
async needsMigration(): Promise<boolean> {
|
||||
const currentStateVersion = (
|
||||
await this.storageService.get<State<Account>>("state", {
|
||||
htmlStorageLocation: HtmlStorageLocation.Local,
|
||||
})
|
||||
)?.globals?.stateVersion;
|
||||
return currentStateVersion == null || currentStateVersion < this.latestVersion;
|
||||
}
|
||||
|
||||
async migrate(): Promise<void> {
|
||||
let currentStateVersion =
|
||||
(await this.storageService.get<State<Account>>("state"))?.globals?.stateVersion ?? 1;
|
||||
while (currentStateVersion < this.latestVersion) {
|
||||
(await this.storageService.get<State<Account>>("state"))?.globals?.stateVersion ?? StateVersion.One;
|
||||
while (currentStateVersion < StateVersion.Latest) {
|
||||
switch (currentStateVersion) {
|
||||
case 1:
|
||||
case StateVersion.One:
|
||||
await this.migrateClientKeys();
|
||||
await this.migrateStateFrom1To2();
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user