Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-328] Move exporter to tools #5070

Merged
merged 20 commits into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
573c0b0
Create and register new libs/exporter
djsmith85 Mar 16, 2023
b46479c
Migrate exportService to libs/exporter
djsmith85 Mar 16, 2023
5126642
Move components in libs/angular into tools-subfolder
djsmith85 Mar 16, 2023
25bfc3c
Register libs/exporter with browser and fix imports
djsmith85 Mar 16, 2023
91fe936
Register libs/exporter with cli and fix imports
djsmith85 Mar 16, 2023
1d9ff87
Register libs/exporter with desktop and fix imports
djsmith85 Mar 16, 2023
d5b4701
Merge branch 'master' of https://github.com/bitwarden/clients into pm…
djsmith85 Mar 23, 2023
b3ae5f3
Merge branch 'master' of https://github.com/bitwarden/clients into pm…
djsmith85 Mar 23, 2023
0720f3e
Move export models to libs/exporter
djsmith85 Mar 24, 2023
6320e0c
Update web imports
djsmith85 Mar 24, 2023
6a145fa
Update package-lock.json
djsmith85 Mar 24, 2023
4972870
Move export models back as it would create circular dependency
djsmith85 Mar 24, 2023
2cf40e9
Fix up web for event-export
djsmith85 Mar 24, 2023
6761303
Update CODEOWNERS
djsmith85 Mar 24, 2023
b6745f1
Merge branch 'master' of https://github.com/bitwarden/clients into pm…
djsmith85 Apr 4, 2023
033b354
Merge branch 'master' of https://github.com/bitwarden/clients into pm…
djsmith85 Apr 13, 2023
41e5a25
Add export-models to team-tools-dev
djsmith85 Apr 13, 2023
87b8403
Merge branch 'master' of https://github.com/bitwarden/clients into pm…
djsmith85 Apr 18, 2023
ec86811
Simplify domain import
djsmith85 Apr 18, 2023
ac6cdd9
Moving EventExport into web
djsmith85 Apr 18, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@
{
"target": "./libs/common/**/*",
"from": "./libs/importer/**/*"
},
{
"target": "./libs/common/**/*",
"from": "./libs/exporter/**/*"
}
]
}
Expand Down Expand Up @@ -160,6 +164,12 @@
"rules": {
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/importer/*", "src/**/*"] }]
}
},
{
"files": ["libs/exporter/src/**/*.ts"],
"rules": {
"no-restricted-imports": ["error", { "patterns": ["@bitwarden/exporter/*", "src/**/*"] }]
}
}
]
}
4 changes: 3 additions & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ apps/cli/src/app/tools @bitwarden/team-tools-dev
apps/desktop/src/app/tools @bitwarden/team-tools-dev
apps/web/src/app/tools @bitwarden/team-tools-dev
libs/angular/src/tools @bitwarden/team-tools-dev
libs/common/src/models/export @bitwarden/team-tools-dev
libs/common/src/tools @bitwarden/team-tools-dev
libs/exporter @bitwarden/team-tools-dev
libs/importer @bitwarden/team-tools-dev

## Vault team files ##
Expand All @@ -49,4 +51,4 @@ libs/common/src/admin-console @bitwarden/team-admin-console-dev
## Billing team files ##
apps/web/src/app/billing @bitwarden/team-billing-dev
libs/angular/src/billing @bitwarden/team-billing-dev
libs/common/src/billing @bitwarden/team-billing-dev
libs/common/src/billing @bitwarden/team-billing-dev
10 changes: 6 additions & 4 deletions apps/browser/src/background/main.background.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -155,7 +157,7 @@ export default class MainBackground {
containerService: ContainerService;
auditService: AuditServiceAbstraction;
authService: AuthServiceAbstraction;
exportService: ExportServiceAbstraction;
exportService: VaultExportServiceAbstraction;
searchService: SearchServiceAbstraction;
notificationsService: NotificationsServiceAbstraction;
stateService: StateServiceAbstraction;
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/popup/app-routing.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion apps/browser/src/popup/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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";
Expand Down
8 changes: 6 additions & 2 deletions apps/browser/src/popup/services/services.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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";
Expand Down Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion apps/browser/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
9 changes: 6 additions & 3 deletions apps/cli/src/bw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ import { ContainerService } from "@bitwarden/common/services/container.service";
import { CryptoService } from "@bitwarden/common/services/crypto.service";
import { EncryptServiceImplementation } from "@bitwarden/common/services/cryptography/encrypt.service.implementation";
import { EnvironmentService } from "@bitwarden/common/services/environment.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 { NoopMessagingService } from "@bitwarden/common/services/noopMessaging.service";
Expand All @@ -55,6 +54,10 @@ import { FolderApiService } from "@bitwarden/common/vault/services/folder/folder
import { FolderService } from "@bitwarden/common/vault/services/folder/folder.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 {
ImportApiService,
ImportApiServiceAbstraction,
Expand Down Expand Up @@ -105,7 +108,7 @@ export class Main {
auditService: AuditService;
importService: ImportServiceAbstraction;
importApiService: ImportApiServiceAbstraction;
exportService: ExportService;
exportService: VaultExportServiceAbstraction;
searchService: SearchService;
cryptoFunctionService: NodeCryptoFunctionService;
encryptService: EncryptServiceImplementation;
Expand Down Expand Up @@ -381,7 +384,7 @@ export class Main {
this.collectionService,
this.cryptoService
);
this.exportService = new ExportService(
this.exportService = new VaultExportService(
this.folderService,
this.cipherService,
this.apiService,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
import * as program from "commander";
import * as inquirer from "inquirer";

import {
ExportFormat,
ExportService,
EXPORT_FORMATS,
} from "@bitwarden/common/abstractions/export.service";
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
import { PolicyType } from "@bitwarden/common/admin-console/enums";
import { Utils } from "@bitwarden/common/misc/utils";
import {
ExportFormat,
EXPORT_FORMATS,
VaultExportServiceAbstraction,
} from "@bitwarden/exporter/vault-export";

import { Response } from "../models/response";
import { CliUtils } from "../utils";

export class ExportCommand {
constructor(private exportService: ExportService, private policyService: PolicyService) {}
constructor(
private exportService: VaultExportServiceAbstraction,
private policyService: PolicyService
) {}

async run(options: program.OptionValues): Promise<Response> {
if (
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/vault.program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { ConfirmCommand } from "./admin-console/commands/confirm.command";
import { ShareCommand } from "./admin-console/commands/share.command";
import { Main } from "./bw";
import { EditCommand } from "./commands/edit.command";
import { ExportCommand } from "./commands/export.command";
import { GetCommand } from "./commands/get.command";
import { ListCommand } from "./commands/list.command";
import { RestoreCommand } from "./commands/restore.command";
import { Response } from "./models/response";
import { Program } from "./program";
import { ExportCommand } from "./tools/export.command";
import { ImportCommand } from "./tools/import.command";
import { CliUtils } from "./utils";
import { CreateCommand } from "./vault/create.command";
Expand Down
2 changes: 1 addition & 1 deletion apps/cli/src/vault/models/folder.response.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { FolderWithIdExport } from "@bitwarden/common/models/export/folder-with-id.export";
import { FolderWithIdExport } from "@bitwarden/common/models/export";
import { FolderView } from "@bitwarden/common/vault/models/view/folder.view";

import { BaseResponse } from "../../models/response/base.response";
Expand Down
1 change: 1 addition & 0 deletions apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"@bitwarden/common/spec/*": ["../../libs/common/spec/*"],
"@bitwarden/common/*": ["../../libs/common/src/*"],
"@bitwarden/importer": ["../../libs/importer/src"],
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"],
"@bitwarden/node/*": ["../../libs/node/src/*"]
}
},
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ import { PremiumComponent } from "../vault/app/accounts/premium.component";
import { FolderAddEditComponent } from "../vault/app/vault/folder-add-edit.component";

import { SettingsComponent } from "./accounts/settings.component";
import { ExportComponent } from "./tools/export/export.component";
import { GeneratorComponent } from "./tools/generator.component";
import { PasswordGeneratorHistoryComponent } from "./tools/password-generator-history.component";
import { ExportComponent } from "./vault/export.component";

const BroadcasterSubscriptionId = "AppComponent";
const IdleTimeout = 60000 * 10; // 10 minutes
Expand Down
2 changes: 1 addition & 1 deletion apps/desktop/src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ import { HeaderComponent } from "./layout/header.component";
import { NavComponent } from "./layout/nav.component";
import { SearchComponent } from "./layout/search/search.component";
import { SharedModule } from "./shared/shared.module";
import { ExportComponent } from "./tools/export/export.component";
import { GeneratorComponent } from "./tools/generator.component";
import { PasswordGeneratorHistoryComponent } from "./tools/password-generator-history.component";
import { AddEditComponent as SendAddEditComponent } from "./tools/send/add-edit.component";
import { EffluxDatesComponent as SendEffluxDatesComponent } from "./tools/send/efflux-dates.component";
import { SendComponent } from "./tools/send/send.component";
import { ExportComponent } from "./vault/export.component";

@NgModule({
imports: [SharedModule, AppRoutingModule, VaultFilterModule, LoginModule],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@ import * as os from "os";
import { Component, OnInit } from "@angular/core";
import { UntypedFormBuilder } from "@angular/forms";

import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/tools/export/components/export.component";
import { BroadcasterService } from "@bitwarden/common/abstractions/broadcaster.service";
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";

const BroadcasterSubscriptionId = "ExportComponent";

Expand All @@ -26,7 +26,7 @@ export class ExportComponent extends BaseExportComponent implements OnInit {
cryptoService: CryptoService,
i18nService: I18nService,
platformUtilsService: PlatformUtilsService,
exportService: ExportService,
exportService: VaultExportServiceAbstraction,
eventCollectionService: EventCollectionService,
policyService: PolicyService,
userVerificationService: UserVerificationService,
Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
Loading