Skip to content

Commit

Permalink
remove optionality complexity
Browse files Browse the repository at this point in the history
  • Loading branch information
LiranCohen committed Oct 22, 2024
1 parent 242990c commit 0f899a5
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions packages/agent/src/store-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = Jwk> implem

// set the recordId in the messageParams to update the existing record
// set the dateCreated to the existing dateCreated as this is an immutable property
messageParams.recordId = matchingRecordEntry.recordsWrite?.recordId;
messageParams.dateCreated = matchingRecordEntry.recordsWrite?.descriptor.dateCreated;
messageParams.recordId = matchingRecordEntry.recordsWrite!.recordId;
messageParams.dateCreated = matchingRecordEntry.recordsWrite!.descriptor.dateCreated;
} else if (preventDuplicates) {
// Look up the DWN record ID of the object in the store with the given `id`.
const matchingRecordId = await this.lookupRecordId({ id, tenantDid, agent });
Expand Down Expand Up @@ -326,10 +326,6 @@ export class DwnDataStore<TStoreObject extends Record<string, any> = Jwk> implem
messageParams : { filter: { recordId } }
});

if (readReply.status.code !== 200 || !readReply.entry) {
throw new Error(`${this.name}: Failed to read data from DWN for: ${recordId}`);
}

return readReply.entry;
}
}
Expand Down

0 comments on commit 0f899a5

Please sign in to comment.