diff --git a/libs/storage-core/src/fake-storage.service.ts b/libs/storage-core/src/fake-storage.service.ts index 37abad400a3..f1677165005 100644 --- a/libs/storage-core/src/fake-storage.service.ts +++ b/libs/storage-core/src/fake-storage.service.ts @@ -2,11 +2,11 @@ import { MockProxy, mock } from "jest-mock-extended"; import { Subject } from "rxjs"; import { StorageOptions } from "./storage-options"; -import { AbstractStorageService, ObservableStorageService, StorageUpdate } from "./storage.service"; +import { StorageService, ObservableStorageService, StorageUpdate } from "./storage.service"; const INTERNAL_KEY = "__internal__"; -export class FakeStorageService implements AbstractStorageService, ObservableStorageService { +export class FakeStorageService implements StorageService, ObservableStorageService { private store: Record; private updatesSubject = new Subject(); private _valuesRequireDeserialization = false; @@ -16,11 +16,11 @@ export class FakeStorageService implements AbstractStorageService, ObservableSto * amount of calls. It is not recommended to use this to mock implementations as * they are not respected. */ - mock: MockProxy; + mock: MockProxy; constructor(initial?: Record) { this.store = initial ?? {}; - this.mock = mock(); + this.mock = mock(); } /** diff --git a/libs/storage-core/src/index.ts b/libs/storage-core/src/index.ts index 570d8bcdec9..f2662fb5907 100644 --- a/libs/storage-core/src/index.ts +++ b/libs/storage-core/src/index.ts @@ -7,4 +7,6 @@ export * from "./storage-location"; export * from "./storage-location.enum"; export * from "./storage-options"; export * from "./storage-service.provider"; +// Renamed to just "StorageService", to be removed when references are updated +export { StorageService as AbstractStorageService } from "./storage.service"; export * from "./storage.service"; diff --git a/libs/storage-core/src/memory-storage.service.ts b/libs/storage-core/src/memory-storage.service.ts index c8583d9e576..425547f9aa7 100644 --- a/libs/storage-core/src/memory-storage.service.ts +++ b/libs/storage-core/src/memory-storage.service.ts @@ -2,9 +2,9 @@ // @ts-strict-ignore import { Subject } from "rxjs"; -import { AbstractStorageService, StorageUpdate } from "./storage.service"; +import { StorageService, StorageUpdate } from "./storage.service"; -export class MemoryStorageService extends AbstractStorageService { +export class MemoryStorageService extends StorageService { protected store = new Map(); private updatesSubject = new Subject(); diff --git a/libs/storage-core/src/serialized-memory-storage.service.ts b/libs/storage-core/src/serialized-memory-storage.service.ts index 35066f5c8c6..ce52efc44ff 100644 --- a/libs/storage-core/src/serialized-memory-storage.service.ts +++ b/libs/storage-core/src/serialized-memory-storage.service.ts @@ -2,10 +2,10 @@ // @ts-strict-ignore import { Subject } from "rxjs"; -import { AbstractStorageService, ObservableStorageService, StorageUpdate } from "./storage.service"; +import { StorageService, ObservableStorageService, StorageUpdate } from "./storage.service"; export class SerializedMemoryStorageService - extends AbstractStorageService + extends StorageService implements ObservableStorageService { protected store: Record = {}; diff --git a/libs/storage-core/src/storage-service.provider.spec.ts b/libs/storage-core/src/storage-service.provider.spec.ts index 243a4ba4094..9e40e5cd433 100644 --- a/libs/storage-core/src/storage-service.provider.spec.ts +++ b/libs/storage-core/src/storage-service.provider.spec.ts @@ -1,11 +1,11 @@ import { mock } from "jest-mock-extended"; import { StorageServiceProvider } from "./storage-service.provider"; -import { AbstractStorageService, ObservableStorageService } from "./storage.service"; +import { StorageService, ObservableStorageService } from "./storage.service"; describe("StorageServiceProvider", () => { - const mockDiskStorage = mock(); - const mockMemoryStorage = mock(); + const mockDiskStorage = mock(); + const mockMemoryStorage = mock(); const sut = new StorageServiceProvider(mockDiskStorage, mockMemoryStorage); diff --git a/libs/storage-core/src/storage-service.provider.ts b/libs/storage-core/src/storage-service.provider.ts index a819acc487d..dcf54c821c4 100644 --- a/libs/storage-core/src/storage-service.provider.ts +++ b/libs/storage-core/src/storage-service.provider.ts @@ -1,6 +1,6 @@ import { ClientLocations } from "./client-locations"; import { StorageLocation } from "./storage-location"; -import { AbstractStorageService, ObservableStorageService } from "./storage.service"; +import { StorageService, ObservableStorageService } from "./storage.service"; export type PossibleLocation = StorageLocation | ClientLocations[keyof ClientLocations]; @@ -9,8 +9,8 @@ export type PossibleLocation = StorageLocation | ClientLocations[keyof ClientLoc */ export class StorageServiceProvider { constructor( - protected readonly diskStorageService: AbstractStorageService & ObservableStorageService, - protected readonly memoryStorageService: AbstractStorageService & ObservableStorageService, + protected readonly diskStorageService: StorageService & ObservableStorageService, + protected readonly memoryStorageService: StorageService & ObservableStorageService, ) {} /** @@ -26,7 +26,7 @@ export class StorageServiceProvider { get( defaultLocation: PossibleLocation, overrides: Partial, - ): [location: PossibleLocation, service: AbstractStorageService & ObservableStorageService] { + ): [location: PossibleLocation, service: StorageService & ObservableStorageService] { switch (defaultLocation) { case "disk": return [defaultLocation, this.diskStorageService]; diff --git a/libs/storage-core/src/storage.service.ts b/libs/storage-core/src/storage.service.ts index 316c6c94dc4..49dc0c45778 100644 --- a/libs/storage-core/src/storage.service.ts +++ b/libs/storage-core/src/storage.service.ts @@ -17,7 +17,7 @@ export interface ObservableStorageService { get updates$(): Observable; } -export abstract class AbstractStorageService { +export abstract class StorageService { abstract get valuesRequireDeserialization(): boolean; abstract get(key: string, options?: StorageOptions): Promise; abstract has(key: string, options?: StorageOptions): Promise;