1
0
mirror of https://github.com/bitwarden/browser.git synced 2025-02-08 00:01:28 +01:00

Consolidate definition of storage keys

This way, external teams need only look at one file (perhaps to be
changed to a directory in the future) to completely define a new storage
location
This commit is contained in:
Matt Gibson 2023-10-05 11:53:04 -04:00
parent 6c88677d70
commit 3f3045e3e5
No known key found for this signature in database
GPG Key ID: 0B3AF4C7D6472DD1
4 changed files with 7 additions and 9 deletions

View File

@ -1,5 +1,3 @@
// Export all established state definitions
export * from "./state-definitions";
// Export all established KeyDefinitions
export * from "./key-definitions";
export { DefaultGlobalStateProvider } from "./default-global-state.provider";

View File

@ -4,7 +4,9 @@ import { DeriveContext, DerivedStateDefinition } from "./derived-state-definitio
import { StateDefinition } from "./state-definition";
/**
*
* KeyDefinitions describe the precise location to store data for a given piece of state.
* The StateDefinition is used to describe the domain of the state, and the KeyDefinition
* sub-divides that domain into specific keys.
*/
// TODO Import Purpose type
export class KeyDefinition<T> {

View File

@ -2,9 +2,11 @@ import { FolderData } from "../../vault/models/data/folder.data";
import { FolderView } from "../../vault/models/view/folder.view";
import { KeyDefinition } from "./key-definition";
import { FOLDER_SERVICE_DISK, FOLDER_SERVICE_MEMORY } from "./state-definitions";
import { StateDefinition } from "./state-definition";
// FolderService Keys
// FolderService
const FOLDER_SERVICE_DISK = new StateDefinition("folderService", "disk");
const FOLDER_SERVICE_MEMORY = new StateDefinition("folderService", "memory");
export const FOLDERS = KeyDefinition.record<FolderData>(
FOLDER_SERVICE_DISK,
"folders",

View File

@ -1,4 +0,0 @@
import { StateDefinition } from "./state-definition";
export const FOLDER_SERVICE_DISK = new StateDefinition("FolderService", "disk");
export const FOLDER_SERVICE_MEMORY = new StateDefinition("FolderService", "memory");