Skip to content

Commit

Permalink
Replace MessageReply with UnionMessageReply for DWN SDK 0.0.37
Browse files Browse the repository at this point in the history
Signed-off-by: Frank Hinek <[email protected]>
  • Loading branch information
frankhinek committed Jul 7, 2023
1 parent 50b64e8 commit 128c22a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 30 deletions.
14 changes: 7 additions & 7 deletions packages/web5-agent/src/web5-agent.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { Readable } from 'readable-stream';

import {
MessageReply,
RecordsQueryMessage,
ProtocolsQueryMessage,
ProtocolsConfigureMessage,
EventsGetMessage,
UnionMessageReply,
MessagesGetMessage,
RecordsQueryMessage,
RecordsWriteMessage,
RecordsDeleteMessage
RecordsDeleteMessage,
ProtocolsQueryMessage,
ProtocolsConfigureMessage,
} from '@tbd54566975/dwn-sdk-js';

export interface Web5Agent {
Expand Down Expand Up @@ -51,7 +51,7 @@ export type SendDwnRequest = DwnRequest & (ProcessDwnRequest | { messageCid: str
export type DwnResponse = {
message?: unknown;
messageCid?: string;
reply: MessageReply;
reply: UnionMessageReply;
};


Expand Down Expand Up @@ -97,4 +97,4 @@ export type DwnRpcRequest = {
/**
* TODO: add jsdoc
*/
export type DwnRpcResponse = MessageReply;
export type DwnRpcResponse = UnionMessageReply;
18 changes: 9 additions & 9 deletions packages/web5-user-agent/src/web5-user-agent.ts
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
import type { DwnServiceEndpoint } from '@tbd54566975/dids';
import {
DataStream,
SignatureInput,
RecordsWriteOptions,
RecordsWriteMessage,
PrivateJwk as DwnPrivateKeyJwk,
MessagesGetReply,
DataStream,
RecordsReadReply,
MessageReply,
UnionMessageReply,
RecordsWriteMessage,
RecordsWriteOptions,
PrivateJwk as DwnPrivateKeyJwk,
} from '@tbd54566975/dwn-sdk-js';

import { Readable } from 'readable-stream';
import {
DwnRpc,
Web5Agent,
DwnRpcRequest,
ProcessDwnRequest,
DwnResponse,
DwnRpcRequest,
SendDwnRequest,
ProcessDwnRequest,
} from '@tbd54566975/web5-agent';

import {
Cid,
Encoder,
Message
Message,
} from '@tbd54566975/dwn-sdk-js';

import type { SyncManager } from './sync-manager.js';
Expand Down Expand Up @@ -111,7 +111,7 @@ export class Web5UserAgent implements Web5Agent {
async processDwnRequest(request: ProcessDwnRequest): Promise<DwnResponse> {
const { message, dataStream }= await this.#constructDwnMessage(request);

let reply: MessageReply;
let reply: UnionMessageReply;
if (request.store !== false) {
reply = await this.dwn.processMessage(request.target, message, dataStream as any);
} else {
Expand Down
28 changes: 14 additions & 14 deletions packages/web5/src/dwn-api.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Web5Agent } from '@tbd54566975/web5-agent';
import type {
MessageReply,
ProtocolsConfigureDescriptor,
ProtocolsConfigureOptions,
ProtocolsQueryOptions,
RecordsDeleteOptions,
RecordsQueryOptions,
RecordsQueryReplyEntry,
UnionMessageReply,
RecordsReadOptions,
RecordsQueryOptions,
RecordsWriteMessage,
RecordsWriteOptions,
ProtocolsConfigureMessage
RecordsDeleteOptions,
ProtocolsQueryOptions,
RecordsQueryReplyEntry,
ProtocolsConfigureMessage,
ProtocolsConfigureOptions,
ProtocolsConfigureDescriptor,
} from '@tbd54566975/dwn-sdk-js';

import { DwnInterfaceName, DwnMethodName } from '@tbd54566975/dwn-sdk-js';
Expand All @@ -24,7 +24,7 @@ export type ProtocolsConfigureRequest = {
}

export type ProtocolsConfigureResponse = {
status: MessageReply['status'];
status: UnionMessageReply['status'];
protocol?: Protocol;
}

Expand All @@ -39,7 +39,7 @@ export type ProtocolsQueryRequest = {

export type ProtocolsQueryResponse = {
protocols: Protocol[];
status: MessageReply['status'];
status: UnionMessageReply['status'];
}

export type RecordsCreateRequest = RecordsWriteRequest;
Expand All @@ -59,7 +59,7 @@ export type RecordsDeleteRequest = {
}

export type RecordsDeleteResponse = {
status: MessageReply['status'];
status: UnionMessageReply['status'];
};

export type RecordsQueryRequest = {
Expand All @@ -69,7 +69,7 @@ export type RecordsQueryRequest = {
}

export type RecordsQueryResponse = {
status: MessageReply['status'];
status: UnionMessageReply['status'];
records?: Record[]
};

Expand All @@ -80,7 +80,7 @@ export type RecordsReadRequest = {
}

export type RecordsReadResponse = {
status: MessageReply['status'];
status: UnionMessageReply['status'];
record: Record;
};

Expand All @@ -91,7 +91,7 @@ export type RecordsWriteRequest = {
}

export type RecordsWriteResponse = {
status: MessageReply['status'];
status: UnionMessageReply['status'];
record?: Record
};

Expand Down

0 comments on commit 128c22a

Please sign in to comment.