mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +00:00
* update collection service to use new state provider framework, remove stateservice from collection service, update collections state provider with migrate file and unit test
27 lines
1.2 KiB
TypeScript
27 lines
1.2 KiB
TypeScript
import { Observable } from "rxjs";
|
|
|
|
import { CollectionId } from "../../types/guid";
|
|
import { CollectionData } from "../models/data/collection.data";
|
|
import { Collection } from "../models/domain/collection";
|
|
import { TreeNode } from "../models/domain/tree-node";
|
|
import { CollectionView } from "../models/view/collection.view";
|
|
|
|
export abstract class CollectionService {
|
|
clearActiveUserCache: () => Promise<void>;
|
|
encrypt: (model: CollectionView) => Promise<Collection>;
|
|
decryptedCollectionViews$: (ids: CollectionId[]) => Observable<CollectionView[]>;
|
|
/**
|
|
* @deprecated This method will soon be made private, use `decryptedCollectionViews$` instead.
|
|
*/
|
|
decryptMany: (collections: Collection[]) => Promise<CollectionView[]>;
|
|
get: (id: string) => Promise<Collection>;
|
|
getAll: () => Promise<Collection[]>;
|
|
getAllDecrypted: () => Promise<CollectionView[]>;
|
|
getAllNested: (collections?: CollectionView[]) => Promise<TreeNode<CollectionView>[]>;
|
|
getNested: (id: string) => Promise<TreeNode<CollectionView>>;
|
|
upsert: (collection: CollectionData | CollectionData[]) => Promise<any>;
|
|
replace: (collections: { [id: string]: CollectionData }) => Promise<any>;
|
|
clear: (userId: string) => Promise<any>;
|
|
delete: (id: string | string[]) => Promise<any>;
|
|
}
|