Skip to content

Releases: xmtp/xmtp-js

@xmtp/agent-sdk@2.2.0

13 Feb 09:30
8ebe198

Choose a tag to compare

Minor Changes

  • da8658f: Added transaction utility functions

@xmtp/cli@0.1.0

10 Feb 17:27
ac9d0f2

Choose a tag to compare

Rebuilt CLI using oclif.

@xmtp/agent-sdk@2.1.0

10 Feb 21:26
8842156

Choose a tag to compare

Minor Changes

  • 126833a: Added PerformanceMonitor middleware

@xmtp/node-sdk@5.3.0

03 Feb 16:16
dd1def5

Choose a tag to compare

Added contentType field to enriched replies.

type EnrichedReply<T = unknown, U = unknown> = {
  referenceId: string;
  content: T;
  contentType: ContentTypeId | undefined;
  inReplyTo: DecodedMessage<U> | null;
};

Use this new field to get the content type of a reply's content.

import { encodeText, contentTypeText } from "@xmtp/node-sdk";

const textMessageId = await group.sendText("hi");
const replyMessageId = await group.sendReply({
  content: encodeText("hello"),
  reference: textMessageId,
});
const reply: DecodedMessage<EnrichedReply> =
  client.conversations.getMessageById(replyMessageId);

// access reply's content type
expect(reply.content.contentType).toEqual(contentTypeText());

@xmtp/cli@0.0.6

03 Feb 23:12
7c1ec9e

Choose a tag to compare

Patch Changes

  • Updated dependencies [a87b56b]
    • @xmtp/agent-sdk@2.0.2

@xmtp/browser-sdk@6.3.0

03 Feb 16:16
dd1def5

Choose a tag to compare

Added contentType method to enriched replies.

type EnrichedReply<T = unknown, U = unknown> = {
  referenceId: string;
  content: T;
  contentType: () => Promise<ContentTypeId | undefined>;
  inReplyTo: DecodedMessage<U> | null;
};

Use this new method to get the content type of a reply's content.

import { encodeText, contentTypeText } from "@xmtp/browser-sdk";

const textMessageId = await group.sendText("hi");
const replyMessageId = await group.sendReply({
  content: await encodeText("hello"),
  reference: textMessageId,
});
const reply: DecodedMessage<EnrichedReply> =
  await client.conversations.getMessageById(replyMessageId);

// access reply's content type
expect(await reply.content.contentType()).toEqual(await contentTypeText());

@xmtp/agent-sdk@2.0.2

03 Feb 23:12
7c1ec9e

Choose a tag to compare

Patch Changes

  • a87b56b: Added help command configuration to CommandRouter middleware

@xmtp/cli@0.0.5

01 Feb 11:13
1c6307b

Choose a tag to compare

Patch Changes

  • Updated dependencies [e100655]
    • @xmtp/agent-sdk@2.0.1

@xmtp/agent-sdk@2.0.1

01 Feb 11:13
1c6307b

Choose a tag to compare

Patch Changes

  • e100655: Added native events from Node SDK

@xmtp/node-sdk@5.2.0

29 Jan 18:30
8388aa8

Choose a tag to compare

This release introduces new features and critical bug fixes. If you've been building on a previous release, this one should be a drop-in replacement. Update as soon as possible to take advantage of these enhancements and fixes.

Message type guards

New utility functions have been added to help identify message content types. These type guards provide a convenient way to check message types and narrow TypeScript types when working with decoded messages.

import {
  isText,
  isMarkdown,
  isReaction,
  isReply,
  isTextReply,
  isAttachment,
  isRemoteAttachment,
  isMultiRemoteAttachment,
  isTransactionReference,
  isReadReceipt,
  isGroupUpdated,
  isWalletSendCalls,
  isActions,
  isIntent,
} from "@xmtp/node-sdk";

const messages = await group.messages();

for (const message of messages) {
  if (isText(message)) {
    // message.content is narrowed to string
    console.log(message.content);
  }

  if (isReaction(message)) {
    // message.content is narrowed to Reaction
    console.log(message.content.content);
  }

  if (isTextReply(message)) {
    // message.content is narrowed to EnrichedReply<string>
    console.log(message.content.content);
  }
}

Stream deleted messages

The streamMessageDeletions method has been deprecated and will be removed in a future release. Use the new streamDeletedMessages method. This new method streams the entire decoded message of deleted messages rather than just the message ID.

const deletedMessagesStream =
  await client.conversations.streamDeletedMessages();

for await (const message of deletedMessagesStream) {
  // message is a DecodedMessage
}

Improved streaming method types

The return types of streamAllMessages, streamAllGroupMessages, streamAllDmMessages, and stream (for conversations) have been simplified. These methods now return only converted values (DecodedMessage or Group/Dm) instead of a union type that could include raw or undefined values.

Previously, when a streamed value couldn't be converted, the raw value or undefined was returned. Now, unconvertible values are filtered out with a warning logged to the console. This makes the stream output more predictable and type-safe.

Actions and intent content type serialization

The actions and intent content types were not being serialized properly. This release ensures that these content types are backwards-compatible with all clients using these content types.