diff --git a/jslib b/jslib index 9df96a3288..557b2fc3f0 160000 --- a/jslib +++ b/jslib @@ -1 +1 @@ -Subproject commit 9df96a3288510a5b92837d93513d9981336d0229 +Subproject commit 557b2fc3f093ee1e2eb4515c2e33c613f083c327 diff --git a/src/models/response/cipherResponse.ts b/src/models/response/cipherResponse.ts index 9063888b5c..a481016cc7 100644 --- a/src/models/response/cipherResponse.ts +++ b/src/models/response/cipherResponse.ts @@ -3,11 +3,17 @@ import { CipherView } from 'jslib/models/view/cipherView'; import { Cipher } from '../cipher'; import { AttachmentResponse } from './attachmentResponse'; import { BaseResponse } from './baseResponse'; +import { LoginResponse } from './loginResponse'; +import { PasswordHistoryResponse } from './passwordHistoryResponse'; + +import { CipherType } from 'jslib/enums'; export class CipherResponse extends Cipher implements BaseResponse { object: string; id: string; attachments: AttachmentResponse[]; + revisionDate: Date; + passwordHistory: PasswordHistoryResponse[]; constructor(o: CipherView) { super(); @@ -17,5 +23,12 @@ export class CipherResponse extends Cipher implements BaseResponse { if (o.attachments != null) { this.attachments = o.attachments.map((a) => new AttachmentResponse(a)); } + this.revisionDate = o.revisionDate; + if (o.passwordHistory != null) { + this.passwordHistory = o.passwordHistory.map((h) => new PasswordHistoryResponse(h)); + } + if (o.type === CipherType.Login && o.login != null) { + this.login = new LoginResponse(o.login); + } } } diff --git a/src/models/response/loginResponse.ts b/src/models/response/loginResponse.ts new file mode 100644 index 0000000000..dc5a96f0f6 --- /dev/null +++ b/src/models/response/loginResponse.ts @@ -0,0 +1,12 @@ +import { Login } from '../login'; + +import { LoginView } from 'jslib/models/view'; + +export class LoginResponse extends Login { + passwordRevisionDate: Date; + + constructor(o: LoginView) { + super(o); + this.passwordRevisionDate = o.passwordRevisionDate != null ? o.passwordRevisionDate : null; + } +} diff --git a/src/models/response/passwordHistoryResponse.ts b/src/models/response/passwordHistoryResponse.ts new file mode 100644 index 0000000000..7c092f4220 --- /dev/null +++ b/src/models/response/passwordHistoryResponse.ts @@ -0,0 +1,11 @@ +import { PasswordHistoryView } from 'jslib/models/view/passwordHistoryView'; + +export class PasswordHistoryResponse { + lastUsedDate: Date; + password: string; + + constructor(o: PasswordHistoryView) { + this.lastUsedDate = o.lastUsedDate; + this.password = o.password; + } +}