mirror of
https://github.com/bitwarden/browser
synced 2026-01-03 09:03:32 +00:00
[PM-12048] Wire up vNextCollectionService (#14871)
* remove derived state, add cache in service. Fix ts strict errors
* cleanup
* promote vNextCollectionService
* wip
* replace callers in web WIP
* refactor tests for web
* update callers to use vNextCollectionServcie methods in CLI
* WIP make decryptMany public again, fix callers, imports
* wip cli
* wip desktop
* update callers in browser, fix tests
* remove in service cache
* cleanup
* fix test
* clean up
* address cr feedback
* remove duplicate userId
* clean up
* remove unused import
* fix vault-settings-import-nudge.service
* fix caching issue
* clean up
* refactor decryption, cleanup, update callers
* clean up
* Use in-memory statedefinition
* Ac/pm 12048 v next collection service pairing (#15239)
* Draft from pairing with Gibson
* Add todos
* Add comment
* wip
* refactor upsert
---------
Co-authored-by: Brandon <btreston@bitwarden.com>
* clean up
* fix state definitions
* fix linter error
* cleanup
* add test, fix shareReplay
* fix item-more-options component
* fix desktop build
* refactor state to account for null as an initial value, remove caching
* add proper cache, add unit test, update callers
* clean up
* fix routing when deleting collections
* cleanup
* use combineLatest
* fix ts-strict errors, fix error handling
* refactor Collection and CollectionView properties for ts-strict
* Revert "refactor Collection and CollectionView properties for ts-strict"
This reverts commit a5c63aab76.
---------
Co-authored-by: Thomas Rittson <trittson@bitwarden.com>
Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@@ -13,9 +13,9 @@ export const getById = <TId, T extends { id: TId }>(id: TId) =>
|
||||
* @param id The IDs of the objects to return.
|
||||
* @returns An array containing objects with matching IDs, or an empty array if there are no matching objects.
|
||||
*/
|
||||
export const getByIds = <TId, T extends { id: TId }>(ids: TId[]) => {
|
||||
const idSet = new Set(ids);
|
||||
export const getByIds = <TId, T extends { id: TId | undefined }>(ids: TId[]) => {
|
||||
const idSet = new Set(ids.filter((id) => id != null));
|
||||
return map<T[], T[]>((objects) => {
|
||||
return objects.filter((o) => idSet.has(o.id));
|
||||
return objects.filter((o) => o.id && idSet.has(o.id));
|
||||
});
|
||||
};
|
||||
|
||||
@@ -14,7 +14,7 @@ export type DecryptedObject<
|
||||
> = Record<TDecryptedKeys, string> & Omit<TEncryptedObject, TDecryptedKeys>;
|
||||
|
||||
// extracts shared keys from the domain and view types
|
||||
type EncryptableKeys<D extends Domain, V extends View> = (keyof D &
|
||||
export type EncryptableKeys<D extends Domain, V extends View> = (keyof D &
|
||||
ConditionalKeys<D, EncString | null>) &
|
||||
(keyof V & ConditionalKeys<V, string | null>);
|
||||
|
||||
|
||||
@@ -164,9 +164,13 @@ export const SEND_ACCESS_AUTH_MEMORY = new StateDefinition("sendAccessAuth", "me
|
||||
|
||||
// Vault
|
||||
|
||||
export const COLLECTION_DATA = new StateDefinition("collection", "disk", {
|
||||
export const COLLECTION_DISK = new StateDefinition("collection", "disk", {
|
||||
web: "memory",
|
||||
});
|
||||
export const COLLECTION_MEMORY = new StateDefinition("decryptedCollections", "memory", {
|
||||
browser: "memory-large-object",
|
||||
});
|
||||
|
||||
export const FOLDER_DISK = new StateDefinition("folder", "disk", { web: "memory" });
|
||||
export const FOLDER_MEMORY = new StateDefinition("decryptedFolders", "memory", {
|
||||
browser: "memory-large-object",
|
||||
|
||||
@@ -172,7 +172,11 @@ export abstract class CoreSyncService implements SyncService {
|
||||
notification.collectionIds != null &&
|
||||
notification.collectionIds.length > 0
|
||||
) {
|
||||
const collections = await this.collectionService.getAll();
|
||||
const collections = await firstValueFrom(
|
||||
this.collectionService
|
||||
.encryptedCollections$(userId)
|
||||
.pipe(map((collections) => collections ?? [])),
|
||||
);
|
||||
if (collections != null) {
|
||||
for (let i = 0; i < collections.length; i++) {
|
||||
if (notification.collectionIds.indexOf(collections[i].id) > -1) {
|
||||
|
||||
Reference in New Issue
Block a user