Skip to content

Commit

Permalink
fix(packages/engine): apply some new name of methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mohammadhonarvar committed Sep 2, 2024
1 parent 3c27903 commit e3d5712
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions packages/engine/src/alwatr-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export class AlwatrStore {
*/
exists(id: StoreFileId): boolean {
const id_ = getStoreId(id);
const exists = this.rootDb__.exists(id_);
const exists = this.rootDb__.itemExists(id_);
logger.logMethodFull?.('exists', id_, exists);
return exists;
}
Expand Down Expand Up @@ -214,12 +214,12 @@ export class AlwatrStore {
throw new Error('store_file_type_not_supported', {cause: stat});
}

if (this.rootDb__.exists(fileStoreRef.id)) {
if (this.rootDb__.itemExists(fileStoreRef.id)) {
logger.accident('newStoreFile_', 'store_file_already_defined', stat);
throw new Error('store_file_already_defined', {cause: stat});
}

this.rootDb__.add(fileStoreRef.id, stat);
this.rootDb__.addItem(fileStoreRef.id, stat);
this.cacheReferences__[fileStoreRef.id] = fileStoreRef;

// fileStoreRef.save();
Expand Down Expand Up @@ -256,12 +256,12 @@ export class AlwatrStore {
return this.cacheReferences__[id_] as unknown as DocumentReference<TDoc>;
}

if (!this.rootDb__.exists(id_)) {
if (!this.rootDb__.itemExists(id_)) {
logger.accident('openDocument', 'document_not_found', id_);
throw new Error('document_not_found', {cause: id_});
}

const storeStat = this.rootDb__.getItem(id_);
const storeStat = this.rootDb__.getItemData(id_);

if (storeStat.type != StoreFileType.Document) {
logger.accident('openDocument', 'document_wrong_type', id_);
Expand Down Expand Up @@ -306,12 +306,12 @@ export class AlwatrStore {
}

// load and create new collection reference
if (!this.rootDb__.exists(id_)) {
if (!this.rootDb__.itemExists(id_)) {
logger.accident('openCollection', 'collection_not_found', id_);
throw new Error('collection_not_found', {cause: id_});
}

const storeStat = this.rootDb__.getItem(id_);
const storeStat = this.rootDb__.getItemData(id_);

if (storeStat.type != StoreFileType.Collection) {
logger.accident('openCollection', 'collection_wrong_type', id_);
Expand Down Expand Up @@ -363,7 +363,7 @@ export class AlwatrStore {
async remove(id: StoreFileId): Promise<void> {
const id_ = getStoreId(id);
logger.logMethodArgs?.('remove', id_);
if (!this.rootDb__.exists(id_)) {
if (!this.rootDb__.itemExists(id_)) {
logger.accident('doc', 'document_not_found', id_);
throw new Error('document_not_found', {cause: id_});
}
Expand All @@ -375,8 +375,8 @@ export class AlwatrStore {
ref.hasUnprocessedChanges_ = false;
delete this.cacheReferences__[id_]; // unload
}
const path = getStorePath(this.rootDb__.getItem(id_));
this.rootDb__.remove(id_);
const path = getStorePath(this.rootDb__.getItemData(id_));
this.rootDb__.removeItem(id_);
await waitForTimeout(0);
try {
await unlink(resolve(this.config__.rootPath, path));
Expand Down

0 comments on commit e3d5712

Please sign in to comment.