diff --git a/src/collection.ts b/src/collection.ts index 7b24f85..1cf4176 100644 --- a/src/collection.ts +++ b/src/collection.ts @@ -1,6 +1,6 @@ import { UpdateOptions } from "mingo/core"; import { UpdateExpression } from "mingo/updater"; -import { Observable, Subscription } from "rxjs"; +import { Observable, Subject, Subscription } from "rxjs"; import { observe, observeOne } from "./observe/mod.ts"; import { @@ -26,7 +26,10 @@ export class Collection { readonly storage: Storage, ) {} - get observable() { + get observable(): { + change: Subject>; + flush: Subject; + } { return this.storage.observable; } diff --git a/src/logger.ts b/src/logger.ts index 74998ed..24b6d9f 100644 --- a/src/logger.ts +++ b/src/logger.ts @@ -1,5 +1,5 @@ class Performance { - startedAt = performance.now(); + startedAt: number = performance.now(); endedAt?: number; duration?: number; @@ -10,7 +10,7 @@ class Performance { } abstract class LogEvent { - readonly performance = new Performance(); + readonly performance: Performance = new Performance(); data?: Record; diff --git a/src/storage/storage.ts b/src/storage/storage.ts index 15a9ad1..dec0f39 100644 --- a/src/storage/storage.ts +++ b/src/storage/storage.ts @@ -10,7 +10,10 @@ import { RemoveResult } from "./operators/remove.ts"; import { UpdateResult } from "./operators/update.ts"; export abstract class Storage { - readonly observable = { + readonly observable: { + change: Subject>; + flush: Subject; + } = { change: new Subject>(), flush: new Subject(), }; @@ -21,7 +24,7 @@ export abstract class Storage { constructor( readonly name: string, - readonly id = crypto.randomUUID(), + readonly id: string = crypto.randomUUID(), ) { this.#channel = new BroadcastChannel(`valkyr:db:${name}`); this.#channel.onmessage = ({ data }: MessageEvent>) => {