mirror of
https://github.com/bitwarden/browser
synced 2026-02-02 17:53:41 +00:00
migrate more export submodules
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { EncString } from "../../key-management/crypto/models/enc-string";
|
||||
import { Card as CardDomain } from "../../vault/models/domain/card";
|
||||
import { CardView } from "../../vault/models/view/card.view";
|
||||
@@ -29,32 +27,32 @@ export class CardExport {
|
||||
}
|
||||
|
||||
static toDomain(req: CardExport, domain = new CardDomain()) {
|
||||
domain.cardholderName = req.cardholderName != null ? new EncString(req.cardholderName) : null;
|
||||
domain.brand = req.brand != null ? new EncString(req.brand) : null;
|
||||
domain.number = req.number != null ? new EncString(req.number) : null;
|
||||
domain.expMonth = req.expMonth != null ? new EncString(req.expMonth) : null;
|
||||
domain.expYear = req.expYear != null ? new EncString(req.expYear) : null;
|
||||
domain.code = req.code != null ? new EncString(req.code) : null;
|
||||
domain.cardholderName = new EncString(req.cardholderName ?? "");
|
||||
domain.brand = new EncString(req.brand ?? "");
|
||||
domain.number = new EncString(req.number ?? "");
|
||||
domain.expMonth = new EncString(req.expMonth ?? "");
|
||||
domain.expYear = new EncString(req.expYear ?? "");
|
||||
domain.code = new EncString(req.code ?? "");
|
||||
return domain;
|
||||
}
|
||||
|
||||
cardholderName: string;
|
||||
brand: string;
|
||||
number: string;
|
||||
expMonth: string;
|
||||
expYear: string;
|
||||
code: string;
|
||||
cardholderName: string = "";
|
||||
brand: string = "";
|
||||
number: string = "";
|
||||
expMonth: string = "";
|
||||
expYear: string = "";
|
||||
code: string = "";
|
||||
|
||||
constructor(o?: CardView | CardDomain) {
|
||||
if (o == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.cardholderName = safeGetString(o.cardholderName);
|
||||
this.brand = safeGetString(o.brand);
|
||||
this.number = safeGetString(o.number);
|
||||
this.expMonth = safeGetString(o.expMonth);
|
||||
this.expYear = safeGetString(o.expYear);
|
||||
this.code = safeGetString(o.code);
|
||||
this.cardholderName = safeGetString(o.cardholderName ?? "") ?? "";
|
||||
this.brand = safeGetString(o.brand ?? "") ?? "";
|
||||
this.number = safeGetString(o.number ?? "") ?? "";
|
||||
this.expMonth = safeGetString(o.expMonth ?? "") ?? "";
|
||||
this.expYear = safeGetString(o.expYear ?? "") ?? "";
|
||||
this.code = safeGetString(o.code ?? "") ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
// This import has been flagged as unallowed for this class. It may be involved in a circular dependency loop.
|
||||
// eslint-disable-next-line no-restricted-imports
|
||||
import { Collection as CollectionDomain, CollectionView } from "@bitwarden/admin-console/common";
|
||||
@@ -10,11 +8,17 @@ import { CollectionId, emptyGuid, OrganizationId } from "../../types/guid";
|
||||
import { safeGetString } from "./utils";
|
||||
|
||||
export class CollectionExport {
|
||||
constructor() {
|
||||
this.organizationId = emptyGuid as OrganizationId;
|
||||
this.name = "";
|
||||
this.externalId = "";
|
||||
}
|
||||
|
||||
static template(): CollectionExport {
|
||||
const req = new CollectionExport();
|
||||
req.organizationId = emptyGuid as OrganizationId;
|
||||
req.name = "Collection name";
|
||||
req.externalId = null;
|
||||
req.externalId = "";
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -29,7 +33,7 @@ export class CollectionExport {
|
||||
}
|
||||
|
||||
static toDomain(req: CollectionExport, domain: CollectionDomain) {
|
||||
domain.name = req.name != null ? new EncString(req.name) : null;
|
||||
domain.name = new EncString(req.name ?? "");
|
||||
domain.externalId = req.externalId;
|
||||
if (domain.organizationId == null) {
|
||||
domain.organizationId = req.organizationId;
|
||||
@@ -44,7 +48,7 @@ export class CollectionExport {
|
||||
// Use build method instead of ctor so that we can control order of JSON stringify for pretty print
|
||||
build(o: CollectionView | CollectionDomain) {
|
||||
this.organizationId = o.organizationId;
|
||||
this.name = safeGetString(o.name);
|
||||
this.externalId = o.externalId;
|
||||
this.name = safeGetString(o.name) ?? "";
|
||||
this.externalId = o.externalId ?? "";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { EncString } from "../../key-management/crypto/models/enc-string";
|
||||
import { Fido2Credential } from "../../vault/models/domain/fido2-credential";
|
||||
import { Fido2CredentialView } from "../../vault/models/view/fido2-credential.view";
|
||||
@@ -28,7 +26,7 @@ export class Fido2CredentialExport {
|
||||
req.rpName = "rpName";
|
||||
req.userDisplayName = "userDisplayName";
|
||||
req.discoverable = "false";
|
||||
req.creationDate = null;
|
||||
req.creationDate = new Date();
|
||||
return req;
|
||||
}
|
||||
|
||||
@@ -62,36 +60,35 @@ export class Fido2CredentialExport {
|
||||
* @returns Fido2Credential - The populated domain, or a new instance if none was provided.
|
||||
*/
|
||||
static toDomain(req: Fido2CredentialExport, domain = new Fido2Credential()) {
|
||||
domain.credentialId = req.credentialId != null ? new EncString(req.credentialId) : null;
|
||||
domain.keyType = req.keyType != null ? new EncString(req.keyType) : null;
|
||||
domain.keyAlgorithm = req.keyAlgorithm != null ? new EncString(req.keyAlgorithm) : null;
|
||||
domain.keyCurve = req.keyCurve != null ? new EncString(req.keyCurve) : null;
|
||||
domain.keyValue = req.keyValue != null ? new EncString(req.keyValue) : null;
|
||||
domain.rpId = req.rpId != null ? new EncString(req.rpId) : null;
|
||||
domain.userHandle = req.userHandle != null ? new EncString(req.userHandle) : null;
|
||||
domain.userName = req.userName != null ? new EncString(req.userName) : null;
|
||||
domain.counter = req.counter != null ? new EncString(req.counter) : null;
|
||||
domain.rpName = req.rpName != null ? new EncString(req.rpName) : null;
|
||||
domain.userDisplayName =
|
||||
req.userDisplayName != null ? new EncString(req.userDisplayName) : null;
|
||||
domain.discoverable = req.discoverable != null ? new EncString(req.discoverable) : null;
|
||||
domain.credentialId = new EncString(req.credentialId ?? "");
|
||||
domain.keyType = new EncString(req.keyType ?? "");
|
||||
domain.keyAlgorithm = new EncString(req.keyAlgorithm ?? "");
|
||||
domain.keyCurve = new EncString(req.keyCurve ?? "");
|
||||
domain.keyValue = new EncString(req.keyValue ?? "");
|
||||
domain.rpId = new EncString(req.rpId ?? "");
|
||||
domain.userHandle = new EncString(req.userHandle ?? "");
|
||||
domain.userName = new EncString(req.userName ?? "");
|
||||
domain.counter = new EncString(req.counter ?? "");
|
||||
domain.rpName = new EncString(req.rpName ?? "");
|
||||
domain.userDisplayName = new EncString(req.userDisplayName ?? "");
|
||||
domain.discoverable = new EncString(req.discoverable ?? "");
|
||||
domain.creationDate = req.creationDate;
|
||||
return domain;
|
||||
}
|
||||
|
||||
credentialId: string;
|
||||
keyType: string;
|
||||
keyAlgorithm: string;
|
||||
keyCurve: string;
|
||||
keyValue: string;
|
||||
rpId: string;
|
||||
userHandle: string;
|
||||
userName: string;
|
||||
counter: string;
|
||||
rpName: string;
|
||||
userDisplayName: string;
|
||||
discoverable: string;
|
||||
creationDate: Date;
|
||||
credentialId: string = "";
|
||||
keyType: string = "";
|
||||
keyAlgorithm: string = "";
|
||||
keyCurve: string = "";
|
||||
keyValue: string = "";
|
||||
rpId: string = "";
|
||||
userHandle: string = "";
|
||||
userName: string = "";
|
||||
counter: string = "";
|
||||
rpName: string = "";
|
||||
userDisplayName: string = "";
|
||||
discoverable: string = "";
|
||||
creationDate: Date = new Date();
|
||||
|
||||
/**
|
||||
* Constructs a new Fid2CredentialExport instance.
|
||||
@@ -103,18 +100,18 @@ export class Fido2CredentialExport {
|
||||
return;
|
||||
}
|
||||
|
||||
this.credentialId = safeGetString(o.credentialId);
|
||||
this.keyType = safeGetString(o.keyType);
|
||||
this.keyAlgorithm = safeGetString(o.keyAlgorithm);
|
||||
this.keyCurve = safeGetString(o.keyCurve);
|
||||
this.keyValue = safeGetString(o.keyValue);
|
||||
this.rpId = safeGetString(o.rpId);
|
||||
this.userHandle = safeGetString(o.userHandle);
|
||||
this.userName = safeGetString(o.userName);
|
||||
this.counter = safeGetString(String(o.counter));
|
||||
this.rpName = safeGetString(o.rpName);
|
||||
this.userDisplayName = safeGetString(o.userDisplayName);
|
||||
this.discoverable = safeGetString(String(o.discoverable));
|
||||
this.credentialId = safeGetString(o.credentialId) ?? "";
|
||||
this.keyType = safeGetString(o.keyType) ?? "";
|
||||
this.keyAlgorithm = safeGetString(o.keyAlgorithm) ?? "";
|
||||
this.keyCurve = safeGetString(o.keyCurve) ?? "";
|
||||
this.keyValue = safeGetString(o.keyValue) ?? "";
|
||||
this.rpId = safeGetString(o.rpId) ?? "";
|
||||
this.userHandle = safeGetString(o.userHandle ?? "") ?? "";
|
||||
this.userName = safeGetString(o.userName ?? "") ?? "";
|
||||
this.counter = safeGetString(String(o.counter)) ?? "";
|
||||
this.rpName = safeGetString(o.rpName ?? "") ?? "";
|
||||
this.userDisplayName = safeGetString(o.userDisplayName ?? "") ?? "";
|
||||
this.discoverable = safeGetString(String(o.discoverable)) ?? "";
|
||||
this.creationDate = o.creationDate;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
// FIXME: Update this file to be type safe and remove this and next line
|
||||
// @ts-strict-ignore
|
||||
import { EncString } from "../../key-management/crypto/models/enc-string";
|
||||
import { FieldType, LinkedIdType } from "../../vault/enums";
|
||||
import { Field as FieldDomain } from "../../vault/models/domain/field";
|
||||
|
||||
Reference in New Issue
Block a user