-
Notifications
You must be signed in to change notification settings - Fork 105
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
Consider separating processMessage()
into individual handling methods per DWN Interface Method
#289
Comments
@thehenrytsai / @EbonyLouis — can I pick this up? If yes, a few questions before I get started —
Looking forward to hearing back and contributing. Thanks! |
@shobitb yay, I assigned it to you! |
Hi @shobitb, thanks for considering to contribute!! Answering your questions:
No, the response type should be as specific to the type of message as possible, which is really the intent and benefit of having dedicated handler methods. There is a couple of precedence (
Totally. Agree with you that small commits are better for many reasons! Also, when making sure you have test coverage on these new dedicated handlers, you have one of the two approaches: either add new tests in |
This commit introduces a handleRecordsWrite function meant to be used in place of the existing processMessage which is eventually meant to be replaced as described in issue TBD54566975#289. This commit also updates the relevant tests in records-(write|delete|read|query).ts files, which were using processMessage and replaces its usage with the new handleRecordsWrite. It also introduces a few new tests in dwn.spec.ts, enough to bring uncovered lines of this function to 0 (more specifically, the new test is meant to cover the exception path).
Thanks for assigning and helping, @EbonyLouis and @thehenrytsai. I've created a PR. Would love your feedback. If this looks good, I'll use the same format to introduce handleRecordsDelete in a subsequent PR. |
This commit introduces a handleRecordsDelete function meant to be used in place of the existing processMessage (which is eventually meant to be replaced, as described in issue TBD54566975#289). This commit also updates the relevant tests in records-(write|delete|read).ts files, which were using processMessage and replaces its usage with the new handleRecordsDelete. It also introduces a test in dwn.spec.ts, enough to bring uncovered lines of this new function to 0 (more specifically, the new test is meant to cover the exception path).
#554 addresses this by overloading the function signature of |
Background:
With the introduction and implementation of
RecordsRead
(and other Interface Methods to follow likeRecordsCommit
), it is becoming apparent that the return type cannot be represented by a universal type that covers all need, unless we hack our way by adding a bunch of optional properties or even just useany
.Task Details:
processMessage()
which has served well, and replace/augment it with individual handlers:handleRecordsRead(...): RecordsReadResponse { ... }
✅handleRecordsWrite(...): RecordsWriteResponse { ... }
...
Objective:
handleRecordsWrite(...): RecordsWriteResponse { ... }
Picking Up This Issue:
Questions:
#hack-together
channel and collaborate with a buddy.#getting-started
channel.Resources:
Remember, communication is key! If you have any questions or face any challenges, we're here to help so please don't hesitate to reach out.
Good Luck! 🍁
The text was updated successfully, but these errors were encountered: