Skip to content

Commit

Permalink
Implement a delete method and state on the @web5/api Record cla…
Browse files Browse the repository at this point in the history
…ss (#635)

This PR Allows a `Record` class to include a `deleted` state based on a `RecordsDeleteMessage` being applied to it.

We update the `RecordModel` to reflect the immutable properties that a record may contain, as well as the optional mutable properties that are only relevant to a record that is in a non-deleted state.

When a record is in a deleted state, it derives the immutable properties from the `initialWrite` of that record.

Currently when dealing with a remote DWN, the user cannot be notified of a deleted state through a Query, however when Subscriptions are brought up to the API a user could receive a message from the remote which signals that the record has been deleted, more useful scenario testing will be implemented when `record.subscribe()` feature is added.

- Implements a `delete()` method on the `Record` class that behaves similarly to `update()`.
- Implements a `deleted` property on the `Record` class to indicate if the record is in a deleted state.
  • Loading branch information
LiranCohen authored Jul 3, 2024
1 parent 89f239d commit 09f80b7
Show file tree
Hide file tree
Showing 3 changed files with 978 additions and 107 deletions.
5 changes: 5 additions & 0 deletions .changeset/eighty-spoons-cross.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@web5/api": minor
---

Implement a `delete` method and state on the `@web5/api` `Record` class
Loading

0 comments on commit 09f80b7

Please sign in to comment.