mirror of
https://github.com/bitwarden/browser
synced 2025-12-18 09:13:33 +00:00
[PS-1884] [TDL-189] [TDL-203] Move libs/node files to CLI and rename per ADR12 (#4069)
* Extract files only used in cli out of libs/node Move commands from libs/node to cli Move program from libs/node to cli Move services from libs/node to cli Move specs from libs/node to cli Naming changes based on ADR 12 Rename commands Rename models/request Rename models/response Remove entries from whitelist-capital-letters.txt * Merge lowDbStorageService into base class Move logic from extended lowdbStorage.service.ts into base-lowdb-storage.service.ts Delete lowdb-storage.service.ts Rename base-lowdb-storage.service.ts to lowdb-storage.service.ts * Merge login.command with base class program.ts - changed import temporarily to make it easier to review Remove passing in clientId, set "cli" when constructing ssoRedirectUri call Remove setting callbacks, use private methods instead Remove i18nService from constructor params Add syncService, keyConnectorService and logoutCallback to constructor Merge successCallback with handleSuccessResponse Remove validatedParams callback and added private method Move options(program.OptionValues) and set in run() Delete login.command.ts * Rename base-login.command.ts to login.command.ts * Merge base.program.ts with program.ts
This commit is contained in:
committed by
GitHub
parent
166e5a747e
commit
80f5a883e0
3
apps/cli/src/models/response/base.response.ts
Normal file
3
apps/cli/src/models/response/base.response.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export interface BaseResponse {
|
||||
object: string;
|
||||
}
|
||||
@@ -1,11 +1,11 @@
|
||||
import { CipherType } from "@bitwarden/common/enums/cipherType";
|
||||
import { CipherWithIdExport } from "@bitwarden/common/models/export/cipher-with-ids.export";
|
||||
import { CipherView } from "@bitwarden/common/models/view/cipher.view";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { AttachmentResponse } from "./attachmentResponse";
|
||||
import { LoginResponse } from "./loginResponse";
|
||||
import { PasswordHistoryResponse } from "./passwordHistoryResponse";
|
||||
import { AttachmentResponse } from "./attachment.response";
|
||||
import { BaseResponse } from "./base.response";
|
||||
import { LoginResponse } from "./login.response";
|
||||
import { PasswordHistoryResponse } from "./password-history.response";
|
||||
|
||||
export class CipherResponse extends CipherWithIdExport implements BaseResponse {
|
||||
object: string;
|
||||
@@ -1,6 +1,7 @@
|
||||
import { CollectionWithIdExport } from "@bitwarden/common/models/export/collection-with-id.export";
|
||||
import { CollectionView } from "@bitwarden/common/models/view/collection.view";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class CollectionResponse extends CollectionWithIdExport implements BaseResponse {
|
||||
object: string;
|
||||
13
apps/cli/src/models/response/file.response.ts
Normal file
13
apps/cli/src/models/response/file.response.ts
Normal file
@@ -0,0 +1,13 @@
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class FileResponse implements BaseResponse {
|
||||
object: string;
|
||||
data: Buffer;
|
||||
fileName: string;
|
||||
|
||||
constructor(data: Buffer, fileName: string) {
|
||||
this.object = "file";
|
||||
this.data = data;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import { FolderWithIdExport } from "@bitwarden/common/models/export/folder-with-id.export";
|
||||
import { FolderView } from "@bitwarden/common/models/view/folder.view";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class FolderResponse extends FolderWithIdExport implements BaseResponse {
|
||||
object: string;
|
||||
11
apps/cli/src/models/response/list.response.ts
Normal file
11
apps/cli/src/models/response/list.response.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class ListResponse implements BaseResponse {
|
||||
object: string;
|
||||
data: BaseResponse[];
|
||||
|
||||
constructor(data: BaseResponse[]) {
|
||||
this.object = "list";
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
15
apps/cli/src/models/response/message.response.ts
Normal file
15
apps/cli/src/models/response/message.response.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class MessageResponse implements BaseResponse {
|
||||
object: string;
|
||||
title: string;
|
||||
message: string;
|
||||
raw: string;
|
||||
noColor = false;
|
||||
|
||||
constructor(title: string, message: string) {
|
||||
this.object = "message";
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { CollectionView } from "@bitwarden/common/models/view/collection.view";
|
||||
|
||||
import { SelectionReadOnly } from "../selectionReadOnly";
|
||||
import { SelectionReadOnly } from "../selection-read-only";
|
||||
|
||||
import { CollectionResponse } from "./collectionResponse";
|
||||
import { CollectionResponse } from "./collection.response";
|
||||
|
||||
export class OrganizationCollectionResponse extends CollectionResponse {
|
||||
groups: SelectionReadOnly[];
|
||||
@@ -1,6 +1,7 @@
|
||||
import { OrganizationUserStatusType } from "@bitwarden/common/enums/organizationUserStatusType";
|
||||
import { OrganizationUserType } from "@bitwarden/common/enums/organizationUserType";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class OrganizationUserResponse implements BaseResponse {
|
||||
object: string;
|
||||
@@ -1,7 +1,8 @@
|
||||
import { OrganizationUserStatusType } from "@bitwarden/common/enums/organizationUserStatusType";
|
||||
import { OrganizationUserType } from "@bitwarden/common/enums/organizationUserType";
|
||||
import { Organization } from "@bitwarden/common/models/domain/organization";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class OrganizationResponse implements BaseResponse {
|
||||
object: string;
|
||||
@@ -1,9 +1,9 @@
|
||||
import { SendType } from "@bitwarden/common/enums/sendType";
|
||||
import { SendAccessView } from "@bitwarden/common/models/view/send-access.view";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { SendFileResponse } from "./sendFileResponse";
|
||||
import { SendTextResponse } from "./sendTextResponse";
|
||||
import { BaseResponse } from "./base.response";
|
||||
import { SendFileResponse } from "./send-file.response";
|
||||
import { SendTextResponse } from "./send-text.response";
|
||||
|
||||
export class SendAccessResponse implements BaseResponse {
|
||||
static template(): SendAccessResponse {
|
||||
@@ -1,10 +1,10 @@
|
||||
import { SendType } from "@bitwarden/common/enums/sendType";
|
||||
import { Utils } from "@bitwarden/common/misc/utils";
|
||||
import { SendView } from "@bitwarden/common/models/view/send.view";
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
|
||||
import { SendFileResponse } from "./sendFileResponse";
|
||||
import { SendTextResponse } from "./sendTextResponse";
|
||||
import { BaseResponse } from "./base.response";
|
||||
import { SendFileResponse } from "./send-file.response";
|
||||
import { SendTextResponse } from "./send-text.response";
|
||||
|
||||
const dateProperties: string[] = [
|
||||
Utils.nameOf<SendResponse>("deletionDate"),
|
||||
11
apps/cli/src/models/response/string.response.ts
Normal file
11
apps/cli/src/models/response/string.response.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class StringResponse implements BaseResponse {
|
||||
object: string;
|
||||
data: string;
|
||||
|
||||
constructor(data: string) {
|
||||
this.object = "string";
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { BaseResponse } from "@bitwarden/node/cli/models/response/baseResponse";
|
||||
import { BaseResponse } from "./base.response";
|
||||
|
||||
export class TemplateResponse implements BaseResponse {
|
||||
object: string;
|
||||
Reference in New Issue
Block a user