Skip to content
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

Align UnionMessageReply with the various replies that processMessage #648

Merged
merged 6 commits into from
Dec 30, 2023

Conversation

LiranCohen
Copy link
Member

@LiranCohen LiranCohen commented Dec 20, 2023

UnionMessageReply was not fully in sync with the actual replies.

  • data is actually within record for a RecordsReadReply.
  • modified events to entries for EventsGetReply and EventsQueryReply
  • modified messages to entries for MessagesGetReply

This way all of the individual replies can be represented by:

/**
 * Catch-all message reply type. It is recommended to use GenericMessageReply or a message-specific reply type wherever possible.
 */
export type UnionMessageReply = GenericMessageReply & {
  /**
   * Resulting message entries or events returned from the invocation of the corresponding message.
   * e.g. the resulting messages from a RecordsQuery, or array of messageCid strings for EventsGet or EventsQuery
   * Mutually exclusive with `record`.
   */
  entries?: QueryResultEntry[] | ProtocolsConfigureMessage[] | MessagesGetReplyEntry[] | string[];

  /**
   * Record corresponding to the message received if applicable (e.g. RecordsRead).
   * Mutually exclusive with `entries` and `cursor`.
   */
  record?: RecordsWriteReply;

  /**
   * A cursor for pagination if applicable (e.g. RecordsQuery).
   * Mutually exclusive with `record`.
   */
  cursor?: string;

  /**
   * A subscription object if a subscription was requested.
   */
  subscription?: GenericMessageSubscription;
};

Copy link

codesandbox bot commented Dec 20, 2023

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@codecov-commenter
Copy link

codecov-commenter commented Dec 20, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (a6f95fb) 98.83% compared to head (788e1b7) 98.83%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #648   +/-   ##
=======================================
  Coverage   98.83%   98.83%           
=======================================
  Files          71       71           
  Lines        9240     9243    +3     
  Branches     1391     1391           
=======================================
+ Hits         9132     9135    +3     
  Misses        100      100           
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@LiranCohen LiranCohen merged commit 8d5cac4 into main Dec 30, 2023
4 checks passed
@LiranCohen LiranCohen deleted the lirancohen/records-read-reply branch December 30, 2023 00:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants