mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
Vault/pm-7580/resolve-cipher-update-race (#8806)
* Resolve updated values from updates Uses the now returned updated values from cipher service to guarantee-return the updated cipher for CLI edits * Use updated cipher for creation * Use updated cipher for editing collections * Await async methods Cipher data more closely approximates server responses. TODO: this should really use actual response types
This commit is contained in:
@@ -47,8 +47,24 @@ export abstract class CipherService {
|
||||
updateLastUsedDate: (id: string) => Promise<void>;
|
||||
updateLastLaunchedDate: (id: string) => Promise<void>;
|
||||
saveNeverDomain: (domain: string) => Promise<void>;
|
||||
createWithServer: (cipher: Cipher, orgAdmin?: boolean) => Promise<any>;
|
||||
updateWithServer: (cipher: Cipher, orgAdmin?: boolean, isNotClone?: boolean) => Promise<any>;
|
||||
/**
|
||||
* Create a cipher with the server
|
||||
*
|
||||
* @param cipher The cipher to create
|
||||
* @param orgAdmin If true, the request is submitted as an organization admin request
|
||||
*
|
||||
* @returns A promise that resolves to the created cipher
|
||||
*/
|
||||
createWithServer: (cipher: Cipher, orgAdmin?: boolean) => Promise<Cipher>;
|
||||
/**
|
||||
* Update a cipher with the server
|
||||
* @param cipher The cipher to update
|
||||
* @param orgAdmin If true, the request is submitted as an organization admin request
|
||||
* @param isNotClone If true, the cipher is not a clone and should be treated as a new cipher
|
||||
*
|
||||
* @returns A promise that resolves to the updated cipher
|
||||
*/
|
||||
updateWithServer: (cipher: Cipher, orgAdmin?: boolean, isNotClone?: boolean) => Promise<Cipher>;
|
||||
shareWithServer: (
|
||||
cipher: CipherView,
|
||||
organizationId: string,
|
||||
@@ -70,7 +86,14 @@ export abstract class CipherService {
|
||||
data: ArrayBuffer,
|
||||
admin?: boolean,
|
||||
) => Promise<Cipher>;
|
||||
saveCollectionsWithServer: (cipher: Cipher) => Promise<any>;
|
||||
/**
|
||||
* Save the collections for a cipher with the server
|
||||
*
|
||||
* @param cipher The cipher to save collections for
|
||||
*
|
||||
* @returns A promise that resolves when the collections have been saved
|
||||
*/
|
||||
saveCollectionsWithServer: (cipher: Cipher) => Promise<Cipher>;
|
||||
/**
|
||||
* Bulk update collections for many ciphers with the server
|
||||
* @param orgId
|
||||
@@ -84,7 +107,13 @@ export abstract class CipherService {
|
||||
collectionIds: CollectionId[],
|
||||
removeCollections: boolean,
|
||||
) => Promise<void>;
|
||||
upsert: (cipher: CipherData | CipherData[]) => Promise<any>;
|
||||
/**
|
||||
* Update the local store of CipherData with the provided data. Values are upserted into the existing store.
|
||||
*
|
||||
* @param cipher The cipher data to upsert. Can be a single CipherData object or an array of CipherData objects.
|
||||
* @returns A promise that resolves to a record of updated cipher store, keyed by their cipher ID. Returns all ciphers, not just those updated
|
||||
*/
|
||||
upsert: (cipher: CipherData | CipherData[]) => Promise<Record<CipherId, CipherData>>;
|
||||
replace: (ciphers: { [id: string]: CipherData }) => Promise<any>;
|
||||
clear: (userId: string) => Promise<any>;
|
||||
moveManyWithServer: (ids: string[], folderId: string) => Promise<any>;
|
||||
|
||||
Reference in New Issue
Block a user