import { DropboxBackupFailedEvent , DuplicateItemSyncedEvent , EmailArchiveExtensionSyncedEvent , EmailBackupAttachmentCreatedEvent , GoogleDriveBackupFailedEvent , ItemsSyncedEvent , MailBackupAttachmentTooBigEvent , OneDriveBackupFailedEvent , UserRegisteredEvent } from '@standardnotes/domain-events' ; import * as dayjs from 'dayjs' ; import { injectable } from 'inversify' ; import { DomainEventFactoryInterface } from './DomainEventFactoryInterface' ; @ injectable ( ) export class DomainEventFactory implements DomainEventFactoryInterface { createDuplicateItemSyncedEvent ( itemUuid , userUuid ) { return { type : 'DUPLICATE_ITEM_SYNCED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : userUuid , userIdentifierType : 'uuid' , } , } , payload : { itemUuid , userUuid , } , } ; } createDropboxBackupFailedEvent ( muteCloudEmailsSettingUuid , email ) { return { type : 'DROPBOX_BACKUP_FAILED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : email , userIdentifierType : 'email' , } , } , payload : { muteCloudEmailsSettingUuid , email , } , } ; } createGoogleDriveBackupFailedEvent ( muteCloudEmailsSettingUuid , email ) { return { type : 'GOOGLE_DRIVE_BACKUP_FAILED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : email , userIdentifierType : 'email' , } , } , payload : { muteCloudEmailsSettingUuid , email , } , } ; } createOneDriveBackupFailedEvent ( muteCloudEmailsSettingUuid , email ) { return { type : 'ONE_DRIVE_BACKUP_FAILED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : email , userIdentifierType : 'email' , } , } , payload : { muteCloudEmailsSettingUuid , email , } , } ; } createMailBackupAttachmentTooBigEvent ( dto ) { return { type : 'MAIL_BACKUP_ATTACHMENT_TOO_BIG' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : dto . email , userIdentifierType : 'email' , } , } , payload : dto , } ; } createItemsSyncedEvent ( dto ) { return { type : 'ITEMS_SYNCED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : dto . userUuid , userIdentifierType : 'uuid' , } , } , payload : dto , } ; } createUserRegisteredEvent ( userUuid , email ) { return { type : 'USER_REGISTERED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : userUuid , userIdentifierType : 'uuid' , } , } , payload : { userUuid , email , } , } ; } createEmailArchiveExtensionSyncedEvent ( userUuid , extensionId ) { return { type : 'EMAIL_ARCHIVE_EXTENSION_SYNCED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : userUuid , userIdentifierType : 'uuid' , } , } , payload : { userUuid , extensionId , } , } ; } createEmailBackupAttachmentCreatedEvent ( backupFileName , email ) { return { type : 'EMAIL_BACKUP_ATTACHMENT_CREATED' , createdAt : dayjs . utc ( ) . toDate ( ) , meta : { correlation : { userIdentifier : email , userIdentifierType : 'email' , } , } , payload : { backupFileName , email , } , } ; } }