chore: fix uuid generation for importers

This commit is contained in:
Mo
2023-08-07 05:06:11 -05:00
parent cedd8e1006
commit ee473fe34d
17 changed files with 94 additions and 47 deletions

View File

@@ -11,6 +11,7 @@ import {
LegacyApiServiceInterface,
StatusServiceInterface,
MfaServiceInterface,
GenerateUuid,
} from '@standardnotes/services'
import { VaultLockServiceInterface } from './../VaultLock/VaultLockServiceInterface'
import { HistoryServiceInterface } from './../History/HistoryServiceInterface'
@@ -85,6 +86,7 @@ export interface ApplicationInterface {
get files(): FilesClientInterface
get history(): HistoryServiceInterface
get homeServer(): HomeServerServiceInterface | undefined
get generateUuid(): GenerateUuid
get items(): ItemManagerInterface
get legacyApi(): LegacyApiServiceInterface
get mfa(): MfaServiceInterface

View File

@@ -0,0 +1,12 @@
import { Result, SyncUseCaseInterface } from '@standardnotes/domain-core'
import { PureCryptoInterface } from '@standardnotes/sncrypto-common'
export class GenerateUuid implements SyncUseCaseInterface<string> {
constructor(private crypto: PureCryptoInterface) {}
execute(): Result<string> {
const uuid = this.crypto.generateUUID()
return Result.ok(uuid)
}
}

View File

@@ -178,6 +178,7 @@ export * from './Sync/SyncServiceInterface'
export * from './Sync/SyncSource'
export * from './UseCase/ChangeAndSaveItem'
export * from './UseCase/DiscardItemsLocally'
export * from './UseCase/GenerateUuid'
export * from './UseCase/GetHost'
export * from './UseCase/SetHost'
export * from './User/AccountEvent'