From b6a4aba2e5fc51585d69b047a9bd22c49ed2098a Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Mon, 2 Sep 2024 13:54:20 +0330 Subject: [PATCH] refactor: Update type imports in alwatr-store.ts Refactor the type imports in alwatr-store.ts to use the `JsonObject` type instead of `JsonifiableObject`. This aligns with the recent refactoring of the type definitions in the repository. --- .../reference/src/collection-reference.ts | 24 ++++++------- packages/reference/src/document-reference.ts | 36 +++++++++---------- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/packages/reference/src/collection-reference.ts b/packages/reference/src/collection-reference.ts index daaaa409..979d7ad9 100644 --- a/packages/reference/src/collection-reference.ts +++ b/packages/reference/src/collection-reference.ts @@ -13,7 +13,7 @@ import {waitForImmediate, waitForTimeout} from '@alwatr/wait'; import {logger} from './logger.js'; import {getStoreId, getStorePath} from './util.js'; -import type {Dictionary, JsonifiableObject} from '@alwatr/type-helper'; +import type {Dictionary, JsonObject} from '@alwatr/type-helper'; logger.logModule?.('collection-reference'); @@ -23,7 +23,7 @@ logger.logModule?.('collection-reference'); * * @template TItem - The data type of the collection items. */ -export class CollectionReference { +export class CollectionReference { /** * Alwatr store engine version string. */ @@ -43,7 +43,7 @@ export class CollectionReference( + static newRefFromData( stat: StoreFileId, initialData: CollectionContext['data'] | null, updatedCallback: (from: CollectionReference) => void, @@ -79,7 +79,7 @@ export class CollectionReference( + static newRefFromContext( context: CollectionContext, updatedCallback: (from: CollectionReference) => void, debugDomain?: string, @@ -147,7 +147,7 @@ export class CollectionReference { - this.logger__.logMethodArgs?.('updated__', {id, immediate, delayed: this.updateDelayed_}); + private async updated__(itemId: string | number | null = null, immediate = false): Promise { + this.logger__.logMethodArgs?.('updated__', {id: itemId, immediate, delayed: this.updateDelayed_}); this.hasUnprocessedChanges_ = true; - if (id !== null) this.refreshMeta_(id); // meta must updated per item + if (itemId !== null) this.refreshMeta_(itemId); // meta must updated per item if (immediate === false && this.updateDelayed_ === true) return; // else @@ -597,7 +597,7 @@ export class CollectionReference { +export class DocumentReference { /** * Alwatr store engine version string. */ @@ -33,7 +33,7 @@ export class DocumentReference( + static newRefFromData( statId: StoreFileId, initialData: TDoc, updatedCallback: (from: DocumentReference) => unknown, @@ -68,7 +68,7 @@ export class DocumentReference( + static newRefFromContext( context: DocumentContext, updatedCallback: (from: DocumentReference) => unknown, debugDomain?: string, @@ -136,7 +136,7 @@ export class DocumentReference