diff --git a/src/models/data/attachmentData.ts b/src/models/data/attachmentData.ts deleted file mode 100644 index 252b608080..0000000000 --- a/src/models/data/attachmentData.ts +++ /dev/null @@ -1,20 +0,0 @@ -import { Response } from '@bitwarden/jslib'; - -class AttachmentData { - id: string; - url: string; - fileName: string; - size: number; - sizeName: string; - - constructor(response: Response.Attachment) { - this.id = response.id; - this.url = response.url; - this.fileName = response.fileName; - this.size = response.size; - this.sizeName = response.sizeName; - } -} - -export { AttachmentData }; -(window as any).AttachmentData = AttachmentData; diff --git a/src/models/data/cardData.ts b/src/models/data/cardData.ts deleted file mode 100644 index f0b9f63f2e..0000000000 --- a/src/models/data/cardData.ts +++ /dev/null @@ -1,20 +0,0 @@ -class CardData { - cardholderName: string; - brand: string; - number: string; - expMonth: string; - expYear: string; - code: string; - - constructor(data: any) { - this.cardholderName = data.CardholderName; - this.brand = data.Brand; - this.number = data.Number; - this.expMonth = data.ExpMonth; - this.expYear = data.ExpYear; - this.code = data.Code; - } -} - -export { CardData }; -(window as any).CardData = CardData; diff --git a/src/models/data/cipherData.ts b/src/models/data/cipherData.ts deleted file mode 100644 index 72d583490b..0000000000 --- a/src/models/data/cipherData.ts +++ /dev/null @@ -1,85 +0,0 @@ -import { Data, Enums, Response } from '@bitwarden/jslib'; - -import { AttachmentData } from './attachmentData'; -import { CardData } from './cardData'; -import { FieldData } from './fieldData'; -import { IdentityData } from './identityData'; -import { LoginData } from './loginData'; -import { SecureNoteData } from './secureNoteData'; - -class CipherData { - id: string; - organizationId: string; - folderId: string; - userId: string; - edit: boolean; - organizationUseTotp: boolean; - favorite: boolean; - revisionDate: string; - type: Enums.CipherType; - sizeName: string; - name: string; - notes: string; - login?: LoginData; - secureNote?: SecureNoteData; - card?: CardData; - identity?: IdentityData; - fields?: FieldData[]; - attachments?: AttachmentData[]; - collectionIds?: string[]; - - constructor(response: Response.Cipher, userId: string, collectionIds?: string[]) { - this.id = response.id; - this.organizationId = response.organizationId; - this.folderId = response.folderId; - this.userId = userId; - this.edit = response.edit; - this.organizationUseTotp = response.organizationUseTotp; - this.favorite = response.favorite; - this.revisionDate = response.revisionDate; - this.type = response.type; - - if (collectionIds != null) { - this.collectionIds = collectionIds; - } else { - this.collectionIds = response.collectionIds; - } - - this.name = response.data.Name; - this.notes = response.data.Notes; - - switch (this.type) { - case Enums.CipherType.Login: - this.login = new LoginData(response.data); - break; - case Enums.CipherType.SecureNote: - this.secureNote = new SecureNoteData(response.data); - break; - case Enums.CipherType.Card: - this.card = new CardData(response.data); - break; - case Enums.CipherType.Identity: - this.identity = new IdentityData(response.data); - break; - default: - break; - } - - if (response.data.Fields != null) { - this.fields = []; - response.data.Fields.forEach((field: any) => { - this.fields.push(new FieldData(field)); - }); - } - - if (response.attachments != null) { - this.attachments = []; - response.attachments.forEach((attachment) => { - this.attachments.push(new AttachmentData(attachment)); - }); - } - } -} - -export { CipherData }; -(window as any).CipherData = CipherData; diff --git a/src/models/data/collectionData.ts b/src/models/data/collectionData.ts deleted file mode 100644 index aaf49604ed..0000000000 --- a/src/models/data/collectionData.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Response } from '@bitwarden/jslib'; - -class CollectionData { - id: string; - organizationId: string; - name: string; - - constructor(response: Response.Collection) { - this.id = response.id; - this.organizationId = response.organizationId; - this.name = response.name; - } -} - -export { CollectionData }; -(window as any).CollectionData = CollectionData; diff --git a/src/models/data/fieldData.ts b/src/models/data/fieldData.ts deleted file mode 100644 index 99e68e5cdf..0000000000 --- a/src/models/data/fieldData.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { Enums } from '@bitwarden/jslib'; - -class FieldData { - type: Enums.FieldType; - name: string; - value: string; - - constructor(response: any) { - this.type = response.Type; - this.name = response.Name; - this.value = response.Value; - } -} - -export { FieldData }; -(window as any).FieldData = FieldData; diff --git a/src/models/data/folderData.ts b/src/models/data/folderData.ts deleted file mode 100644 index 75d4dcc4c6..0000000000 --- a/src/models/data/folderData.ts +++ /dev/null @@ -1,18 +0,0 @@ -import { Response } from '@bitwarden/jslib'; - -class FolderData { - id: string; - userId: string; - name: string; - revisionDate: string; - - constructor(response: Response.Folder, userId: string) { - this.userId = userId; - this.name = response.name; - this.id = response.id; - this.revisionDate = response.revisionDate; - } -} - -export { FolderData }; -(window as any).FolderData = FolderData; diff --git a/src/models/data/identityData.ts b/src/models/data/identityData.ts deleted file mode 100644 index ee849166ee..0000000000 --- a/src/models/data/identityData.ts +++ /dev/null @@ -1,44 +0,0 @@ -class IdentityData { - title: string; - firstName: string; - middleName: string; - lastName: string; - address1: string; - address2: string; - address3: string; - city: string; - state: string; - postalCode: string; - country: string; - company: string; - email: string; - phone: string; - ssn: string; - username: string; - passportNumber: string; - licenseNumber: string; - - constructor(data: any) { - this.title = data.Title; - this.firstName = data.FirstName; - this.middleName = data.MiddleName; - this.lastName = data.LastName; - this.address1 = data.Address1; - this.address2 = data.Address2; - this.address3 = data.Address3; - this.city = data.City; - this.state = data.State; - this.postalCode = data.PostalCode; - this.country = data.Country; - this.company = data.Company; - this.email = data.Email; - this.phone = data.Phone; - this.ssn = data.SSN; - this.username = data.Username; - this.passportNumber = data.PassportNumber; - this.licenseNumber = data.LicenseNumber; - } -} - -export { IdentityData }; -(window as any).IdentityData = IdentityData; diff --git a/src/models/data/loginData.ts b/src/models/data/loginData.ts deleted file mode 100644 index de0aecc133..0000000000 --- a/src/models/data/loginData.ts +++ /dev/null @@ -1,16 +0,0 @@ -class LoginData { - uri: string; - username: string; - password: string; - totp: string; - - constructor(data: any) { - this.uri = data.Uri; - this.username = data.Username; - this.password = data.Password; - this.totp = data.Totp; - } -} - -export { LoginData }; -(window as any).LoginData = LoginData; diff --git a/src/models/data/secureNoteData.ts b/src/models/data/secureNoteData.ts deleted file mode 100644 index 22d5af918a..0000000000 --- a/src/models/data/secureNoteData.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { Enums } from '@bitwarden/jslib'; - -class SecureNoteData { - type: Enums.SecureNoteType; - - constructor(data: any) { - this.type = data.Type; - } -} - -export { SecureNoteData }; -(window as any).SecureNoteData = SecureNoteData; diff --git a/src/models/domain/attachment.ts b/src/models/domain/attachment.ts index d77152b007..9957172f31 100644 --- a/src/models/domain/attachment.ts +++ b/src/models/domain/attachment.ts @@ -1,4 +1,4 @@ -import { AttachmentData } from '../data/attachmentData'; +import { Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -10,7 +10,7 @@ class Attachment extends Domain { sizeName: string; fileName: CipherString; - constructor(obj?: AttachmentData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Attachment, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/card.ts b/src/models/domain/card.ts index 3e42f7affb..d8e2b99691 100644 --- a/src/models/domain/card.ts +++ b/src/models/domain/card.ts @@ -1,4 +1,4 @@ -import { CardData } from '../data/cardData'; +import { Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -11,7 +11,7 @@ class Card extends Domain { expYear: CipherString; code: CipherString; - constructor(obj?: CardData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Card, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/cipher.ts b/src/models/domain/cipher.ts index ba008a3d80..038efe1c46 100644 --- a/src/models/domain/cipher.ts +++ b/src/models/domain/cipher.ts @@ -1,6 +1,4 @@ -import { Abstractions, Enums } from '@bitwarden/jslib'; - -import { CipherData } from '../data/cipherData'; +import { Abstractions, Enums, Data } from '@bitwarden/jslib'; import { Attachment } from './attachment'; import { Card } from './card'; @@ -30,7 +28,7 @@ class Cipher extends Domain { fields: Field[]; collectionIds: string[]; - constructor(obj?: CipherData, alreadyEncrypted: boolean = false, localData: any = null) { + constructor(obj?: Data.Cipher, alreadyEncrypted: boolean = false, localData: any = null) { super(); if (obj == null) { return; diff --git a/src/models/domain/collection.ts b/src/models/domain/collection.ts index 0a5079e53a..7d6b75a029 100644 --- a/src/models/domain/collection.ts +++ b/src/models/domain/collection.ts @@ -1,4 +1,4 @@ -import { CollectionData } from '../data/collectionData'; +import { Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -8,7 +8,7 @@ class Collection extends Domain { organizationId: string; name: CipherString; - constructor(obj?: CollectionData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Collection, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/field.ts b/src/models/domain/field.ts index a174050e60..0387e530e2 100644 --- a/src/models/domain/field.ts +++ b/src/models/domain/field.ts @@ -1,6 +1,4 @@ -import { Enums } from '@bitwarden/jslib'; - -import { FieldData } from '../data/fieldData'; +import { Enums, Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -10,7 +8,7 @@ class Field extends Domain { vault: CipherString; type: Enums.FieldType; - constructor(obj?: FieldData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Field, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/identity.ts b/src/models/domain/identity.ts index ede933ac30..f49ce8f47b 100644 --- a/src/models/domain/identity.ts +++ b/src/models/domain/identity.ts @@ -1,4 +1,4 @@ -import { IdentityData } from '../data/identityData'; +import { Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -23,7 +23,7 @@ class Identity extends Domain { passportNumber: CipherString; licenseNumber: CipherString; - constructor(obj?: IdentityData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Identity, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/login.ts b/src/models/domain/login.ts index 8ed1e1f7c7..73bd237399 100644 --- a/src/models/domain/login.ts +++ b/src/models/domain/login.ts @@ -1,4 +1,4 @@ -import { LoginData } from '../data/loginData'; +import { Data } from '@bitwarden/jslib'; import { CipherString } from './cipherString'; import Domain from './domain'; @@ -9,7 +9,7 @@ class Login extends Domain { password: CipherString; totp: CipherString; - constructor(obj?: LoginData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.Login, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/models/domain/secureNote.ts b/src/models/domain/secureNote.ts index d2273cd398..97cbd9044e 100644 --- a/src/models/domain/secureNote.ts +++ b/src/models/domain/secureNote.ts @@ -1,13 +1,11 @@ -import { Enums } from '@bitwarden/jslib'; - -import { SecureNoteData } from '../data/secureNoteData'; +import { Enums, Data } from '@bitwarden/jslib'; import Domain from './domain'; class SecureNote extends Domain { type: Enums.SecureNoteType; - constructor(obj?: SecureNoteData, alreadyEncrypted: boolean = false) { + constructor(obj?: Data.SecureNote, alreadyEncrypted: boolean = false) { super(); if (obj == null) { return; diff --git a/src/popup/app/app.js b/src/popup/app/app.js index 8e5da30f49..7786355176 100644 --- a/src/popup/app/app.js +++ b/src/popup/app/app.js @@ -38,18 +38,9 @@ import { Identity } from '../../models/domain/identity'; import { Login } from '../../models/domain/login'; import { SecureNote } from '../../models/domain/secureNote'; -import { AttachmentData } from '../../models/data/attachmentData'; -import { CardData } from '../../models/data/cardData'; -import { CipherData } from '../../models/data/cipherData'; -import { FieldData } from '../../models/data/fieldData'; -import { FolderData } from '../../models/data/folderData'; -import { IdentityData } from '../../models/data/identityData'; -import { LoginData } from '../../models/data/loginData'; -import { SecureNoteData } from '../../models/data/secureNoteData'; - import { CipherString } from '../../models/domain/cipherString'; -import { Domain, Request, Response } from '@bitwarden/jslib'; +import { Data, Domain, Request, Response } from '@bitwarden/jslib'; angular .module('bit', [ diff --git a/src/services/cipher.service.ts b/src/services/cipher.service.ts index ce263dd6f7..a8bd777c04 100644 --- a/src/services/cipher.service.ts +++ b/src/services/cipher.service.ts @@ -1,12 +1,10 @@ -import { Abstractions, Enums, Request, Response } from '@bitwarden/jslib'; +import { Abstractions, Data, Enums, Request, Response } from '@bitwarden/jslib'; import { Cipher } from '../models/domain/cipher'; import { CipherString } from '../models/domain/cipherString'; import { Field } from '../models/domain/field'; import SymmetricCryptoKey from '../models/domain/symmetricCryptoKey'; -import { CipherData } from '../models/data/cipherData'; - import ApiService from './api.service'; import ConstantsService from './constants.service'; import CryptoService from './crypto.service'; @@ -128,7 +126,7 @@ export default class CipherService { async get(id: string): Promise { const userId = await this.userService.getUserId(); const localData = await this.storageService.get(Keys.localData); - const ciphers = await this.storageService.get<{ [id: string]: CipherData; }>( + const ciphers = await this.storageService.get<{ [id: string]: Data.Cipher; }>( Keys.ciphersPrefix + userId); if (ciphers == null || !ciphers.hasOwnProperty(id)) { return null; @@ -140,7 +138,7 @@ export default class CipherService { async getAll(): Promise { const userId = await this.userService.getUserId(); const localData = await this.storageService.get(Keys.localData); - const ciphers = await this.storageService.get<{ [id: string]: CipherData; }>( + const ciphers = await this.storageService.get<{ [id: string]: Data.Cipher; }>( Keys.ciphersPrefix + userId); const response: Cipher[] = []; for (const id in ciphers) { @@ -292,7 +290,7 @@ export default class CipherService { } const userId = await this.userService.getUserId(); - const data = new CipherData(response, userId, cipher.collectionIds); + const data = new Data.Cipher(response, userId, cipher.collectionIds); await this.upsert(data); } @@ -321,7 +319,7 @@ export default class CipherService { } const userId = await self.userService.getUserId(); - const data = new CipherData(response, userId, cipher.collectionIds); + const data = new Data.Cipher(response, userId, cipher.collectionIds); this.upsert(data); resolve(new Cipher(data)); @@ -333,19 +331,19 @@ export default class CipherService { }); } - async upsert(cipher: CipherData | CipherData[]): Promise { + async upsert(cipher: Data.Cipher | Data.Cipher[]): Promise { const userId = await this.userService.getUserId(); - let ciphers = await this.storageService.get<{ [id: string]: CipherData; }>( + let ciphers = await this.storageService.get<{ [id: string]: Data.Cipher; }>( Keys.ciphersPrefix + userId); if (ciphers == null) { ciphers = {}; } - if (cipher instanceof CipherData) { - const c = cipher as CipherData; + if (cipher instanceof Data.Cipher) { + const c = cipher as Data.Cipher; ciphers[c.id] = c; } else { - (cipher as CipherData[]).forEach((c) => { + (cipher as Data.Cipher[]).forEach((c) => { ciphers[c.id] = c; }); } @@ -354,7 +352,7 @@ export default class CipherService { this.decryptedCipherCache = null; } - async replace(ciphers: { [id: string]: CipherData; }): Promise { + async replace(ciphers: { [id: string]: Data.Cipher; }): Promise { const userId = await this.userService.getUserId(); await this.storageService.save(Keys.ciphersPrefix + userId, ciphers); this.decryptedCipherCache = null; @@ -367,7 +365,7 @@ export default class CipherService { async delete(id: string | string[]): Promise { const userId = await this.userService.getUserId(); - const ciphers = await this.storageService.get<{ [id: string]: CipherData; }>( + const ciphers = await this.storageService.get<{ [id: string]: Data.Cipher; }>( Keys.ciphersPrefix + userId); if (ciphers == null) { return; @@ -393,7 +391,7 @@ export default class CipherService { async deleteAttachment(id: string, attachmentId: string): Promise { const userId = await this.userService.getUserId(); - const ciphers = await this.storageService.get<{ [id: string]: CipherData; }>( + const ciphers = await this.storageService.get<{ [id: string]: Data.Cipher; }>( Keys.ciphersPrefix + userId); if (ciphers == null || !ciphers.hasOwnProperty(id) || ciphers[id].attachments == null) { diff --git a/src/services/collection.service.ts b/src/services/collection.service.ts index 890f12a25d..5606ef4729 100644 --- a/src/services/collection.service.ts +++ b/src/services/collection.service.ts @@ -1,12 +1,10 @@ import { CipherString } from '../models/domain/cipherString'; import { Collection } from '../models/domain/collection'; -import { CollectionData } from '../models/data/collectionData'; - import CryptoService from './crypto.service'; import UserService from './user.service'; -import { Abstractions } from '@bitwarden/jslib'; +import { Abstractions, Data } from '@bitwarden/jslib'; const Keys = { collectionsPrefix: 'collections_', @@ -25,7 +23,7 @@ export default class CollectionService { async get(id: string): Promise { const userId = await this.userService.getUserId(); - const collections = await this.storageService.get<{ [id: string]: CollectionData; }>( + const collections = await this.storageService.get<{ [id: string]: Data.Collection; }>( Keys.collectionsPrefix + userId); if (collections == null || !collections.hasOwnProperty(id)) { return null; @@ -36,7 +34,7 @@ export default class CollectionService { async getAll(): Promise { const userId = await this.userService.getUserId(); - const collections = await this.storageService.get<{ [id: string]: CollectionData; }>( + const collections = await this.storageService.get<{ [id: string]: Data.Collection; }>( Keys.collectionsPrefix + userId); const response: Collection[] = []; for (const id in collections) { @@ -71,19 +69,19 @@ export default class CollectionService { return this.decryptedCollectionCache; } - async upsert(collection: CollectionData | CollectionData[]): Promise { + async upsert(collection: Data.Collection | Data.Collection[]): Promise { const userId = await this.userService.getUserId(); - let collections = await this.storageService.get<{ [id: string]: CollectionData; }>( + let collections = await this.storageService.get<{ [id: string]: Data.Collection; }>( Keys.collectionsPrefix + userId); if (collections == null) { collections = {}; } - if (collection instanceof CollectionData) { - const c = collection as CollectionData; + if (collection instanceof Data.Collection) { + const c = collection as Data.Collection; collections[c.id] = c; } else { - (collection as CollectionData[]).forEach((c) => { + (collection as Data.Collection[]).forEach((c) => { collections[c.id] = c; }); } @@ -92,7 +90,7 @@ export default class CollectionService { this.decryptedCollectionCache = null; } - async replace(collections: { [id: string]: CollectionData; }): Promise { + async replace(collections: { [id: string]: Data.Collection; }): Promise { const userId = await this.userService.getUserId(); await this.storageService.save(Keys.collectionsPrefix + userId, collections); this.decryptedCollectionCache = null; @@ -105,7 +103,7 @@ export default class CollectionService { async delete(id: string | string[]): Promise { const userId = await this.userService.getUserId(); - const collections = await this.storageService.get<{ [id: string]: CollectionData; }>( + const collections = await this.storageService.get<{ [id: string]: Data.Collection; }>( Keys.collectionsPrefix + userId); if (collections == null) { return; diff --git a/src/services/folder.service.ts b/src/services/folder.service.ts index be822067f8..66d4e58054 100644 --- a/src/services/folder.service.ts +++ b/src/services/folder.service.ts @@ -1,12 +1,10 @@ import { CipherString } from '../models/domain/cipherString'; -import { FolderData } from '../models/data/folderData'; - import ApiService from './api.service'; import CryptoService from './crypto.service'; import UserService from './user.service'; -import { Abstractions, Domain, Request, Response } from '@bitwarden/jslib'; +import { Abstractions, Data, Domain, Request, Response } from '@bitwarden/jslib'; const Keys = { foldersPrefix: 'folders_', @@ -33,7 +31,7 @@ export default class FolderService { async get(id: string): Promise { const userId = await this.userService.getUserId(); - const folders = await this.storageService.get<{ [id: string]: FolderData; }>( + const folders = await this.storageService.get<{ [id: string]: Data.Folder; }>( Keys.foldersPrefix + userId); if (folders == null || !folders.hasOwnProperty(id)) { return null; @@ -44,7 +42,7 @@ export default class FolderService { async getAll(): Promise { const userId = await this.userService.getUserId(); - const folders = await this.storageService.get<{ [id: string]: FolderData; }>( + const folders = await this.storageService.get<{ [id: string]: Data.Folder; }>( Keys.foldersPrefix + userId); const response: Domain.Folder[] = []; for (const id in folders) { @@ -95,23 +93,23 @@ export default class FolderService { } const userId = await this.userService.getUserId(); - const data = new FolderData(response, userId); + const data = new Data.Folder(response, userId); await this.upsert(data); } - async upsert(folder: FolderData | FolderData[]): Promise { + async upsert(folder: Data.Folder | Data.Folder[]): Promise { const userId = await this.userService.getUserId(); - let folders = await this.storageService.get<{ [id: string]: FolderData; }>( + let folders = await this.storageService.get<{ [id: string]: Data.Folder; }>( Keys.foldersPrefix + userId); if (folders == null) { folders = {}; } - if (folder instanceof FolderData) { - const f = folder as FolderData; + if (folder instanceof Data.Folder) { + const f = folder as Data.Folder; folders[f.id] = f; } else { - (folder as FolderData[]).forEach((f) => { + (folder as Data.Folder[]).forEach((f) => { folders[f.id] = f; }); } @@ -120,7 +118,7 @@ export default class FolderService { this.decryptedFolderCache = null; } - async replace(folders: { [id: string]: FolderData; }): Promise { + async replace(folders: { [id: string]: Data.Folder; }): Promise { const userId = await this.userService.getUserId(); await this.storageService.save(Keys.foldersPrefix + userId, folders); this.decryptedFolderCache = null; @@ -133,7 +131,7 @@ export default class FolderService { async delete(id: string | string[]): Promise { const userId = await this.userService.getUserId(); - const folders = await this.storageService.get<{ [id: string]: FolderData; }>( + const folders = await this.storageService.get<{ [id: string]: Data.Folder; }>( Keys.foldersPrefix + userId); if (folders == null) { return; diff --git a/src/services/sync.service.ts b/src/services/sync.service.ts index 76e903b835..1c65f524b6 100644 --- a/src/services/sync.service.ts +++ b/src/services/sync.service.ts @@ -1,7 +1,3 @@ -import { CipherData } from '../models/data/cipherData'; -import { CollectionData } from '../models/data/collectionData'; -import { FolderData } from '../models/data/folderData'; - import ApiService from './api.service'; import CipherService from './cipher.service'; import CollectionService from './collection.service'; @@ -10,7 +6,7 @@ import FolderService from './folder.service'; import SettingsService from './settings.service'; import UserService from './user.service'; -import { Abstractions, Response } from '@bitwarden/jslib'; +import { Abstractions, Data, Response } from '@bitwarden/jslib'; const Keys = { lastSyncPrefix: 'lastSync_', @@ -132,25 +128,25 @@ export default class SyncService { } private async syncFolders(userId: string, response: Response.Folder[]) { - const folders: { [id: string]: FolderData; } = {}; + const folders: { [id: string]: Data.Folder; } = {}; response.forEach((f) => { - folders[f.id] = new FolderData(f, userId); + folders[f.id] = new Data.Folder(f, userId); }); return await this.folderService.replace(folders); } private async syncCollections(response: Response.Collection[]) { - const collections: { [id: string]: CollectionData; } = {}; + const collections: { [id: string]: Data.Collection; } = {}; response.forEach((c) => { - collections[c.id] = new CollectionData(c); + collections[c.id] = new Data.Collection(c); }); return await this.collectionService.replace(collections); } private async syncCiphers(userId: string, response: Response.Cipher[]) { - const ciphers: { [id: string]: CipherData; } = {}; + const ciphers: { [id: string]: Data.Cipher; } = {}; response.forEach((c) => { - ciphers[c.id] = new CipherData(c, userId); + ciphers[c.id] = new Data.Cipher(c, userId); }); return await this.cipherService.replace(ciphers); }