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

@@ -81,6 +81,7 @@ import {
GetHost,
SetHost,
MfaServiceInterface,
GenerateUuid,
} from '@standardnotes/services'
import {
SNNote,
@@ -112,7 +113,6 @@ import {
removeFromArray,
isNullOrUndefined,
sleep,
UuidGenerator,
useBoolean,
LoggerInterface,
canBlockDeinit,
@@ -932,10 +932,6 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
return this.migrations.hasPendingMigrations()
}
public generateUuid(): string {
return UuidGenerator.GenerateUuid()
}
public presentKeyRecoveryWizard(): void {
const service = this.dependencies.get<KeyRecoveryService>(TYPES.KeyRecoveryService)
return service.presentKeyRecoveryWizard()
@@ -1243,6 +1239,10 @@ export class SNApplication implements ApplicationInterface, AppGroupManagedAppli
return this.dependencies.get<MfaService>(TYPES.MfaService)
}
public get generateUuid(): GenerateUuid {
return this.dependencies.get<GenerateUuid>(TYPES.GenerateUuid)
}
private get migrations(): MigrationService {
return this.dependencies.get<MigrationService>(TYPES.MigrationService)
}

View File

@@ -130,6 +130,7 @@ import {
FullyResolvedApplicationOptions,
GetHost,
SetHost,
GenerateUuid,
} from '@standardnotes/services'
import { ItemManager } from '../../Services/Items/ItemManager'
import { PayloadManager } from '../../Services/Payloads/PayloadManager'
@@ -214,6 +215,10 @@ export class Dependencies {
}
private registerUseCaseMakers() {
this.factory.set(TYPES.GenerateUuid, () => {
return new GenerateUuid(this.get<PureCryptoInterface>(TYPES.Crypto))
})
this.factory.set(TYPES.DecryptErroredPayloads, () => {
return new DecryptErroredPayloads(
this.get<ItemsEncryptionService>(TYPES.ItemsEncryptionService),

View File

@@ -159,6 +159,7 @@ export const TYPES = {
ChangeAndSaveItem: Symbol.for('ChangeAndSaveItem'),
GetHost: Symbol.for('GetHost'),
SetHost: Symbol.for('SetHost'),
GenerateUuid: Symbol.for('GenerateUuid'),
// Mappers
SessionStorageMapper: Symbol.for('SessionStorageMapper'),