fix: slow types
This commit is contained in:
@@ -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<TSchema extends Document = Document> {
|
||||
readonly storage: Storage<TSchema>,
|
||||
) {}
|
||||
|
||||
get observable() {
|
||||
get observable(): {
|
||||
change: Subject<ChangeEvent<TSchema>>;
|
||||
flush: Subject<void>;
|
||||
} {
|
||||
return this.storage.observable;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<string, any>;
|
||||
|
||||
|
||||
@@ -10,7 +10,10 @@ import { RemoveResult } from "./operators/remove.ts";
|
||||
import { UpdateResult } from "./operators/update.ts";
|
||||
|
||||
export abstract class Storage<TSchema extends Document = Document> {
|
||||
readonly observable = {
|
||||
readonly observable: {
|
||||
change: Subject<ChangeEvent<TSchema>>;
|
||||
flush: Subject<void>;
|
||||
} = {
|
||||
change: new Subject<ChangeEvent<TSchema>>(),
|
||||
flush: new Subject<void>(),
|
||||
};
|
||||
@@ -21,7 +24,7 @@ export abstract class Storage<TSchema extends Document = Document> {
|
||||
|
||||
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<StorageBroadcast<TSchema>>) => {
|
||||
|
||||
Reference in New Issue
Block a user