mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 07:43:35 +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:
committed by
GitHub
parent
830af7b06d
commit
192bb5a7b3
@@ -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,
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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"),
|
||||
|
||||
@@ -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,
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -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";
|
||||
@@ -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,
|
||||
@@ -105,7 +108,7 @@ export class Main {
|
||||
auditService: AuditService;
|
||||
importService: ImportServiceAbstraction;
|
||||
importApiService: ImportApiServiceAbstraction;
|
||||
exportService: ExportService;
|
||||
exportService: VaultExportServiceAbstraction;
|
||||
searchService: SearchService;
|
||||
cryptoFunctionService: NodeCryptoFunctionService;
|
||||
encryptService: EncryptServiceImplementation;
|
||||
@@ -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,
|
||||
|
||||
@@ -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 (
|
||||
@@ -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";
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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/*"]
|
||||
}
|
||||
},
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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],
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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,
|
||||
@@ -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
|
||||
},
|
||||
|
||||
@@ -4,7 +4,6 @@ import { concatMap, Subject, takeUntil } from "rxjs";
|
||||
|
||||
import { UserNamePipe } from "@bitwarden/angular/pipes/user-name.pipe";
|
||||
import { ApiService } from "@bitwarden/common/abstractions/api.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";
|
||||
@@ -18,6 +17,7 @@ import { EventResponse } from "@bitwarden/common/models/response/event.response"
|
||||
|
||||
import { BaseEventsComponent } from "../../../common/base.events.component";
|
||||
import { EventService } from "../../../core";
|
||||
import { EventExportService } from "../../../tools/event-export";
|
||||
|
||||
const EVENT_SYSTEM_USER_TO_TRANSLATION: Record<EventSystemUser, string> = {
|
||||
[EventSystemUser.SCIM]: null, // SCIM acronym not able to be translated so just display SCIM
|
||||
@@ -41,7 +41,7 @@ export class EventsComponent extends BaseEventsComponent implements OnInit, OnDe
|
||||
private route: ActivatedRoute,
|
||||
eventService: EventService,
|
||||
i18nService: I18nService,
|
||||
exportService: ExportService,
|
||||
exportService: EventExportService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
private router: Router,
|
||||
logService: LogService,
|
||||
|
||||
@@ -5,7 +5,6 @@ import { ActivatedRoute } from "@angular/router";
|
||||
import { ModalService } from "@bitwarden/angular/services/modal.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";
|
||||
@@ -13,6 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
|
||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { EventType } from "@bitwarden/common/enums";
|
||||
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
|
||||
|
||||
import { ExportComponent } from "../../../../tools/import-export/export.component";
|
||||
|
||||
@@ -26,7 +26,7 @@ export class OrganizationExportComponent extends ExportComponent {
|
||||
cryptoService: CryptoService,
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
exportService: ExportService,
|
||||
exportService: VaultExportServiceAbstraction,
|
||||
eventCollectionService: EventCollectionService,
|
||||
private route: ActivatedRoute,
|
||||
policyService: PolicyService,
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Directive } from "@angular/core";
|
||||
|
||||
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";
|
||||
@@ -10,6 +9,7 @@ import { ListResponse } from "@bitwarden/common/models/response/list.response";
|
||||
import { EventView } from "@bitwarden/common/models/view/event.view";
|
||||
|
||||
import { EventService } from "../core";
|
||||
import { EventExportService } from "../tools/event-export";
|
||||
|
||||
@Directive()
|
||||
export abstract class BaseEventsComponent {
|
||||
@@ -29,7 +29,7 @@ export abstract class BaseEventsComponent {
|
||||
constructor(
|
||||
protected eventService: EventService,
|
||||
protected i18nService: I18nService,
|
||||
protected exportService: ExportService,
|
||||
protected exportService: EventExportService,
|
||||
protected platformUtilsService: PlatformUtilsService,
|
||||
protected logService: LogService,
|
||||
protected fileDownloadService: FileDownloadService
|
||||
|
||||
20
apps/web/src/app/tools/event-export/event-export.service.ts
Normal file
20
apps/web/src/app/tools/event-export/event-export.service.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { Injectable } from "@angular/core";
|
||||
import * as papa from "papaparse";
|
||||
|
||||
import { EventView } from "@bitwarden/common/models/view/event.view";
|
||||
import { ExportHelper } from "@bitwarden/exporter/export-helper";
|
||||
|
||||
import { EventExport } from "./event.export";
|
||||
|
||||
@Injectable({
|
||||
providedIn: "root",
|
||||
})
|
||||
export class EventExportService {
|
||||
async getEventExport(events: EventView[]): Promise<string> {
|
||||
return papa.unparse(events.map((e) => new EventExport(e)));
|
||||
}
|
||||
|
||||
getFileName(prefix: string = null, extension = "csv"): string {
|
||||
return ExportHelper.getFileName(prefix, extension);
|
||||
}
|
||||
}
|
||||
28
apps/web/src/app/tools/event-export/event.export.ts
Normal file
28
apps/web/src/app/tools/event-export/event.export.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { EventType } from "@bitwarden/common/enums";
|
||||
import { EventView } from "@bitwarden/common/models/view/event.view";
|
||||
|
||||
export class EventExport {
|
||||
message: string;
|
||||
appIcon: string;
|
||||
appName: string;
|
||||
userId: string;
|
||||
userName: string;
|
||||
userEmail: string;
|
||||
date: string;
|
||||
ip: string;
|
||||
type: string;
|
||||
installationId: string;
|
||||
|
||||
constructor(event: EventView) {
|
||||
this.message = event.humanReadableMessage;
|
||||
this.appIcon = event.appIcon;
|
||||
this.appName = event.appName;
|
||||
this.userId = event.userId;
|
||||
this.userName = event.userName;
|
||||
this.userEmail = event.userEmail;
|
||||
this.date = event.date;
|
||||
this.ip = event.ip;
|
||||
this.type = EventType[event.type];
|
||||
this.installationId = event.installationId;
|
||||
}
|
||||
}
|
||||
1
apps/web/src/app/tools/event-export/index.ts
Normal file
1
apps/web/src/app/tools/event-export/index.ts
Normal file
@@ -0,0 +1 @@
|
||||
export * from "./event-export.service";
|
||||
@@ -1,11 +1,10 @@
|
||||
import { Component } from "@angular/core";
|
||||
import { UntypedFormBuilder } from "@angular/forms";
|
||||
|
||||
import { ExportComponent as BaseExportComponent } from "@bitwarden/angular/components/export.component";
|
||||
import { ModalService } from "@bitwarden/angular/services/modal.service";
|
||||
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";
|
||||
@@ -13,6 +12,7 @@ import { PlatformUtilsService } from "@bitwarden/common/abstractions/platformUti
|
||||
import { UserVerificationService } from "@bitwarden/common/abstractions/userVerification/userVerification.service.abstraction";
|
||||
import { PolicyService } from "@bitwarden/common/admin-console/abstractions/policy/policy.service.abstraction";
|
||||
import { EncryptedExportType } from "@bitwarden/common/enums";
|
||||
import { VaultExportServiceAbstraction } from "@bitwarden/exporter/vault-export";
|
||||
|
||||
import { UserVerificationPromptComponent } from "../../components/user-verification-prompt.component";
|
||||
|
||||
@@ -29,7 +29,7 @@ export class ExportComponent extends BaseExportComponent {
|
||||
cryptoService: CryptoService,
|
||||
i18nService: I18nService,
|
||||
platformUtilsService: PlatformUtilsService,
|
||||
exportService: ExportService,
|
||||
exportService: VaultExportServiceAbstraction,
|
||||
eventCollectionService: EventCollectionService,
|
||||
policyService: PolicyService,
|
||||
logService: LogService,
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"@bitwarden/common/*": ["../../libs/common/src/*"],
|
||||
"@bitwarden/angular/*": ["../../libs/angular/src/*"],
|
||||
"@bitwarden/components": ["../../libs/components/src"],
|
||||
"@bitwarden/importer": ["../../libs/importer/src"]
|
||||
"@bitwarden/importer": ["../../libs/importer/src"],
|
||||
"@bitwarden/exporter/*": ["../../libs/exporter/src/*"]
|
||||
}
|
||||
},
|
||||
"angularCompilerOptions": {
|
||||
|
||||
Reference in New Issue
Block a user