generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sync fixes #103
Merged
Merged
Sync fixes #103
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fix can be tested by doing the following:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script type="module">
import { Web5 } from '/node_modules/@tbd54566975/web5/dist/browser.mjs';
const { web5, did: aliceDid } = await Web5.connect({
techPreview: {
dwnUrls: ['http://localhost:3000']
}
});
console.log(aliceDid);
const { record, status } = await web5.dwn.records.create({
data: "Hello Web5",
message: {
dataFormat: 'text/plain',
},
});
console.log('WRITE RESULT', status);
const readResult = await record.data.text();
console.log('READ RESULT', readResult);
const updateResult = await record.update({ data: "Hello, I'm updated!" });
console.log('UPDATE RESULT', updateResult);
const deleteResult = await record.delete();
console.log('DELETE RESULT', updateResult);
</script>
</body>
</html>
|
Nice 👍 |
Codecov Report
@@ Coverage Diff @@
## main #103 +/- ##
==========================================
+ Coverage 65.50% 65.64% +0.14%
==========================================
Files 31 31
Lines 3383 3397 +14
Branches 195 195
==========================================
+ Hits 2216 2230 +14
Misses 1165 1165
Partials 2 2
|
Signed-off-by: Frank Hinek <[email protected]>
Signed-off-by: Frank Hinek <[email protected]>
frankhinek
approved these changes
Jun 1, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR fixes two issues related to sync (specifically
push
):RecordsWrite
with the same recordId. only the first and most recentRecordsWrite
messages are kept for a givenrecordId
. any in between are outright nuked from everywhere. Prior to this PR, sync would attempt topush
these non-existent records which would end up resulting inSync failed due to error: Error: TODO: message not found
push
occurs.RecordsDelete
messages keep the initialRecordsWrite
and simply delete the data associated to that message. Prior to this PR, sync would attempt to fetch data for a deleted record which would end up resulting inSync failed due to error: Error: (404) Failed to read data associated with record <record_id>
This PR will also be used to bump the relevant package versions to get the fix published the NPMjs.com