Skip to content

Commit

Permalink
Corrected UnionMessageReply type for downstream consumption
Browse files Browse the repository at this point in the history
  • Loading branch information
thehenrytsai committed Oct 7, 2024
1 parent 475270d commit 10d863e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 18 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tbd54566975/dwn-sdk-js",
"version": "0.5.0",
"version": "0.5.1",
"description": "A reference implementation of https://identity.foundation/decentralized-web-node/spec/",
"repository": {
"type": "git",
Expand Down
17 changes: 2 additions & 15 deletions src/core/message-reply.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { MessagesReadReplyEntry } from '../types/messages-types.js';
import type { PaginationCursor } from '../types/query-types.js';
import type { ProtocolsConfigureMessage } from '../types/protocols-types.js';
import type { Readable } from 'readable-stream';
import type { RecordsWriteMessage } from '../types/records-types.js';
import type { RecordsReadReply } from '../types/records-types.js';
import type { GenericMessageReply, MessageSubscription, QueryResultEntry } from '../types/message-types.js';

export function messageReplyFromError(e: unknown, code: number): GenericMessageReply {
Expand All @@ -15,7 +14,7 @@ export function messageReplyFromError(e: unknown, code: number): GenericMessageR
/**
* Catch-all message reply type. It is recommended to use GenericMessageReply or a message-specific reply type wherever possible.
*/
export type UnionMessageReply = GenericMessageReply & {
export type UnionMessageReply = GenericMessageReply & RecordsReadReply &{
/**
* 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 MessagesQuery
Expand All @@ -29,18 +28,6 @@ export type UnionMessageReply = GenericMessageReply & {
*/
entry?: MessagesReadReplyEntry;

/**
* Record corresponding to the message received if applicable (e.g. RecordsRead).
* Mutually exclusive with `entries` and `cursor`.
*/
record?: RecordsWriteMessage & {
/**
* The initial write of the record if the returned RecordsWrite message itself is not the initial write.
*/
initialWrite?: RecordsWriteMessage;
data: Readable;
};

/**
* A cursor for pagination if applicable (e.g. RecordsQuery).
* Mutually exclusive with `record`.
Expand Down

0 comments on commit 10d863e

Please sign in to comment.