1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-09 03:53:53 +00:00

[PM-328] Move exporter to tools (#5070)

* Create and register new libs/exporter

Create package.json
Create tsconfig
Create jest.config
Extend shared and root tsconfig and jest.configs
Register with eslint

* Migrate exportService to libs/exporter

Move exportService (abstraction and impl) into libs/exporter
Refactored exportService to be split into vault-export and event-export
Created barrel-files for both exports
Moved export.service.spec.ts into vault-export
Created an export-helper, which helps build the filename (extract method refactor from ExportService)

* Move components in libs/angular into tools-subfolder

Moved components
Updated imports in jslib-services.module and jslib.module

* Register libs/exporter with browser and fix imports

Move export.component into tools-subfolder

* Register libs/exporter with cli and fix imports

Move export.command into tools-subfolder

* Register libs/exporter with desktop and fix imports

Move export.component into tools-subfolder

* Move export models to libs/exporter

* Update web imports

* Update package-lock.json

* Move export models back as it would create circular dependency

Reponse models in common rely on export models which are in libs/exporter, which relies on common

* Fix up web for event-export

* Update CODEOWNERS

* Add export-models to team-tools-dev

* Simplify domain import

* Moving EventExport into web
This commit is contained in:
Daniel James Smith
2023-04-19 11:30:46 +02:00
committed by GitHub
parent 830af7b06d
commit 192bb5a7b3
53 changed files with 266 additions and 133 deletions

View File

@@ -7,7 +7,6 @@ import { CryptoFunctionService as CryptoFunctionServiceAbstraction } from "@bitw
import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
import { EventCollectionService as EventCollectionServiceAbstraction } from "@bitwarden/common/abstractions/event/event-collection.service";
import { EventUploadService as EventUploadServiceAbstraction } from "@bitwarden/common/abstractions/event/event-upload.service";
import { ExportService as ExportServiceAbstraction } from "@bitwarden/common/abstractions/export.service";
import { FileUploadService as FileUploadServiceAbstraction } from "@bitwarden/common/abstractions/file-upload/file-upload.service";
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
import { LogService as LogServiceAbstraction } from "@bitwarden/common/abstractions/log.service";
@@ -56,7 +55,6 @@ import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptog
import { MultithreadEncryptServiceImplementation } from "@bitwarden/common/services/cryptography/multithread-encrypt.service.implementation";
import { EventCollectionService } from "@bitwarden/common/services/event/event-collection.service";
import { EventUploadService } from "@bitwarden/common/services/event/event-upload.service";
import { ExportService } from "@bitwarden/common/services/export.service";
import { FileUploadService } from "@bitwarden/common/services/file-upload/file-upload.service";
import { MemoryStorageService } from "@bitwarden/common/services/memoryStorage.service";
import { NotificationsService } from "@bitwarden/common/services/notifications.service";
@@ -89,6 +87,10 @@ import { CipherFileUploadService } from "@bitwarden/common/vault/services/file-u
import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder-api.service";
import { SyncNotifierService } from "@bitwarden/common/vault/services/sync/sync-notifier.service";
import { SyncService } from "@bitwarden/common/vault/services/sync/sync.service";
import {
VaultExportService,
VaultExportServiceAbstraction,
} from "@bitwarden/exporter/vault-export";
import { BrowserOrganizationService } from "../admin-console/services/browser-organization.service";
import { BrowserPolicyService } from "../admin-console/services/browser-policy.service";
@@ -155,7 +157,7 @@ export default class MainBackground {
containerService: ContainerService;
auditService: AuditServiceAbstraction;
authService: AuthServiceAbstraction;
exportService: ExportServiceAbstraction;
exportService: VaultExportServiceAbstraction;
searchService: SearchServiceAbstraction;
notificationsService: NotificationsServiceAbstraction;
stateService: StateServiceAbstraction;
@@ -463,7 +465,7 @@ export default class MainBackground {
this.settingsService
);
this.auditService = new AuditService(this.cryptoFunctionService, this.apiService);
this.exportService = new ExportService(
this.exportService = new VaultExportService(
this.folderService,
this.cipherService,
this.apiService,

View File

@@ -23,6 +23,7 @@ import { PasswordGeneratorHistoryComponent } from "../tools/popup/generator/pass
import { SendAddEditComponent } from "../tools/popup/send/send-add-edit.component";
import { SendGroupingsComponent } from "../tools/popup/send/send-groupings.component";
import { SendTypeComponent } from "../tools/popup/send/send-type.component";
import { ExportComponent } from "../tools/popup/settings/export.component";
import { AddEditComponent } from "../vault/popup/components/vault/add-edit.component";
import { AttachmentsComponent } from "../vault/popup/components/vault/attachments.component";
import { CollectionsComponent } from "../vault/popup/components/vault/collections.component";
@@ -36,7 +37,6 @@ import { ViewComponent } from "../vault/popup/components/vault/view.component";
import { DebounceNavigationService } from "./services/debounceNavigationService";
import { AutofillComponent } from "./settings/autofill.component";
import { ExcludedDomainsComponent } from "./settings/excluded-domains.component";
import { ExportComponent } from "./settings/export.component";
import { FolderAddEditComponent } from "./settings/folder-add-edit.component";
import { FoldersComponent } from "./settings/folders.component";
import { HelpAndFeedbackComponent } from "./settings/help-and-feedback.component";

View File

@@ -39,6 +39,7 @@ import { EffluxDatesComponent as SendEffluxDatesComponent } from "../tools/popup
import { SendAddEditComponent } from "../tools/popup/send/send-add-edit.component";
import { SendGroupingsComponent } from "../tools/popup/send/send-groupings.component";
import { SendTypeComponent } from "../tools/popup/send/send-type.component";
import { ExportComponent } from "../tools/popup/settings/export.component";
import { ActionButtonsComponent } from "../vault/popup/components/action-buttons.component";
import { CipherRowComponent } from "../vault/popup/components/cipher-row.component";
import { PasswordRepromptComponent } from "../vault/popup/components/password-reprompt.component";
@@ -65,7 +66,6 @@ import { ServicesModule } from "./services/services.module";
import { AboutComponent } from "./settings/about.component";
import { AutofillComponent } from "./settings/autofill.component";
import { ExcludedDomainsComponent } from "./settings/excluded-domains.component";
import { ExportComponent } from "./settings/export.component";
import { FolderAddEditComponent } from "./settings/folder-add-edit.component";
import { FoldersComponent } from "./settings/folders.component";
import { HelpAndFeedbackComponent } from "./settings/help-and-feedback.component";

View File

@@ -17,7 +17,6 @@ import { EncryptService } from "@bitwarden/common/abstractions/encrypt.service";
import { EnvironmentService } from "@bitwarden/common/abstractions/environment.service";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
import { EventUploadService } from "@bitwarden/common/abstractions/event/event-upload.service";
import { ExportService } from "@bitwarden/common/abstractions/export.service";
import { FileUploadService } from "@bitwarden/common/abstractions/file-upload/file-upload.service";
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
import { I18nService as I18nServiceAbstraction } from "@bitwarden/common/abstractions/i18n.service";
@@ -79,6 +78,7 @@ import {
import { PasswordRepromptService as PasswordRepromptServiceAbstraction } from "@bitwarden/common/vault/abstractions/password-reprompt.service";
import { SyncService } from "@bitwarden/common/vault/abstractions/sync/sync.service.abstraction";
import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder-api.service";
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
import { BrowserOrganizationService } from "../../admin-console/services/browser-organization.service";
import { BrowserPolicyService } from "../../admin-console/services/browser-policy.service";
@@ -342,7 +342,11 @@ function getBgService<T>(service: keyof MainBackground) {
useFactory: getBgService<AutofillService>("autofillService"),
deps: [],
},
{ provide: ExportService, useFactory: getBgService<ExportService>("exportService"), deps: [] },
{
provide: VaultExportServiceAbstraction,
useFactory: getBgService<VaultExportServiceAbstraction>("exportService"),
deps: [],
},
{
provide: KeyConnectorService,
useFactory: getBgService<KeyConnectorService>("keyConnectorService"),

View File

@@ -2,16 +2,16 @@ import { Component } from "@angular/core";
import { UntypedFormBuilder } from "@angular/forms";
import { Router } from "@angular/router";
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component";
import { CryptoService } from "@bitwarden/common/abstractions/crypto.service";
import { EventCollectionService } from "@bitwarden/common/abstractions/event/event-collection.service";
import { ExportService } from "@bitwarden/common/abstractions/export.service";
import { FileDownloadService } from "@bitwarden/common/abstractions/fileDownload/fileDownload.service";
import { I18nService } from "@bitwarden/common/abstractions/i18n.service";
import { LogService } from "@bitwarden/common/abstractions/log.service";
import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUtils.service";
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
@Component({
selector: "app-export",
@@ -22,7 +22,7 @@ export class ExportComponent extends BaseExportComponent {
cryptoService: CryptoService,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService,
exportService: ExportService,
exportService: VaultExportServiceAbstraction,
eventCollectionService: EventCollectionService,
policyService: PolicyService,
private router: Router,

View File

@@ -11,7 +11,8 @@
"baseUrl": ".",
"paths": {
"@bitwarden/common/*": ["../../libs/common/src/*"],
"@bitwarden/angular/*": ["../../libs/angular/src/*"]
"@bitwarden/angular/*": ["../../libs/angular/src/*"],
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"]
},
"useDefineForClassFields": false
},