mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
[PM-6032] Run migrations in main process (#7795)
* Run Migrations in Desktop Main Process * Add `waitForMigrations` method * Add `InitOptions` * Fix Destructuring
This commit is contained in:
@@ -36,6 +36,20 @@ import { EncString } from "../models/domain/enc-string";
|
||||
import { StorageOptions } from "../models/domain/storage-options";
|
||||
import { SymmetricCryptoKey } from "../models/domain/symmetric-crypto-key";
|
||||
|
||||
/**
|
||||
* Options for customizing the initiation behavior.
|
||||
*/
|
||||
export type InitOptions = {
|
||||
/**
|
||||
* Whether or not to run state migrations as part of the init process. Defaults to true.
|
||||
*
|
||||
* If false, the init method will instead wait for migrations to complete before doing its
|
||||
* other init operations. Make sure migrations have either already completed, or will complete
|
||||
* before calling {@link StateService.init} with `runMigrations: false`.
|
||||
*/
|
||||
runMigrations?: boolean;
|
||||
};
|
||||
|
||||
export abstract class StateService<T extends Account = Account> {
|
||||
accounts$: Observable<{ [userId: string]: T }>;
|
||||
activeAccount$: Observable<string>;
|
||||
@@ -44,7 +58,7 @@ export abstract class StateService<T extends Account = Account> {
|
||||
addAccount: (account: T) => Promise<void>;
|
||||
setActiveUser: (userId: string) => Promise<void>;
|
||||
clean: (options?: StorageOptions) => Promise<UserId>;
|
||||
init: () => Promise<void>;
|
||||
init: (initOptions?: InitOptions) => Promise<void>;
|
||||
|
||||
getAccessToken: (options?: StorageOptions) => Promise<string>;
|
||||
setAccessToken: (value: string, options?: StorageOptions) => Promise<void>;
|
||||
|
||||
Reference in New Issue
Block a user