@xmtp/node-sdk 6.2.0-dev.4b7b477 → 6.2.0-dev.9f72722

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../src/utils/auth.ts","../src/utils/createBackend.ts","../src/utils/errors.ts","../src/utils/inboxId.ts","../src/utils/validation.ts","../src/utils/messages.ts","../src/CodecRegistry.ts","../src/utils/date.ts","../src/DecodedMessage.ts","../src/MessageStream.ts","../src/Notifications.ts","../src/Conversation.ts","../src/Dm.ts","../src/Group.ts","../src/AsyncStream.ts","../src/utils/streams.ts","../src/Conversations.ts","../src/DebugInformation.ts","../src/Preferences.ts","../src/ServerConfiguration.ts","../src/utils/createClient.ts","../src/Client.ts","../src/utils/streamFailure.ts"],"sourcesContent":[null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null,null],"names":["generateInboxIdBinding","resolveBackend","verifySignedWithPublicKeyBinding","isAddressAuthorizedBinding","isInstallationAuthorizedBinding","fetchServerConfigurationBinding"],"mappings":";;;;;;;;AAEA;AACO,MAAM,cAAc,GAAG,OAC5B,QAAsB,KACC;AACvB,IAAA,IAAI;AACF,QAAA,MAAM,UAAU,GAAG,MAAM,QAAQ,EAAE;AACnC,QAAA,IACE,OAAO,UAAU,CAAC,KAAK,KAAK,QAAQ;AACpC,aAAC,UAAU,CAAC,IAAI,KAAK,SAAS,IAAI,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,CAAC;YACtE,CAAC,MAAM,CAAC,aAAa,CAAC,UAAU,CAAC,gBAAgB,CAAC,EAClD;YACA,MAAM,IAAI,KAAK,EAAE;QACnB;QACA,OAAO;YACL,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,KAAK,EAAE,UAAU,CAAC,KAAK;YACvB,gBAAgB,EAAE,UAAU,CAAC,gBAAgB;SAC9C;IACH;AAAE,IAAA,MAAM;AAC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,KAAK,CAAC;IAC7B,IAAI,CAAC,uBAAuB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;AACtC,QAAA,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC;IACjD;IACA,MAAM,KAAK,GAAG,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;AAC5C,IAAA,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;QACjD,KAAK,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,CAAC;IACzE;AACA,IAAA,OAAO,KAAK;AACd,CAAC;;;;"}
1
+ {"version":3,"file":"index.js","names":["generateInboxIdBinding","contentTypeText","contentTypeMarkdown","contentTypeReply","contentTypeReaction","contentTypeAttachment","contentTypeRemoteAttachment","contentTypeMultiRemoteAttachment","contentTypeTransactionReference","contentTypeGroupUpdated","contentTypeReadReceipt","contentTypeLeaveRequest","contentTypeWalletSendCalls","contentTypeActions","contentTypeIntent","BindingNotificationOverride","SortDirection","GroupMembershipState","ConversationType","resolveBackend","LogLevel","IdentifierKind","isAddressAuthorizedBinding","isInstallationAuthorizedBinding","BackupElementSelectionOption","fetchServerConfigurationBinding"],"sources":["../src/utils/auth.ts","../src/utils/createBackend.ts","../src/utils/errors.ts","../src/utils/inboxId.ts","../src/utils/validation.ts","../src/utils/messages.ts","../src/CodecRegistry.ts","../src/utils/date.ts","../src/DecodedMessage.ts","../src/MessageStream.ts","../src/Notifications.ts","../src/Conversation.ts","../src/Dm.ts","../src/Group.ts","../src/AsyncStream.ts","../src/utils/streamFailure.ts","../src/utils/streams.ts","../src/Conversations.ts","../src/DebugInformation.ts","../src/Preferences.ts","../src/ServerConfiguration.ts","../src/utils/createClient.ts","../src/Client.ts"],"sourcesContent":["import type { AuthCallback, Credential } from \"@/types\";\n\n/** Keep callback failures and invalid credentials out of error messages. */\nexport const readCredential = async (\n callback: AuthCallback,\n): Promise<Credential> => {\n try {\n const credential = await callback();\n if (\n typeof credential.value !== \"string\" ||\n (credential.name !== undefined && typeof credential.name !== \"string\") ||\n !Number.isSafeInteger(credential.expiresAtSeconds)\n ) {\n throw new Error();\n }\n return {\n name: credential.name,\n value: credential.value,\n expiresAtSeconds: credential.expiresAtSeconds,\n };\n } catch {\n throw new Error(\"auth callback failed\");\n }\n};\n","import {\n AuthCallback,\n BackendBuilder,\n type Backend,\n} from \"@xmtp/node-bindings\";\n\nimport type { NetworkOptions } from \"@/types\";\n\nimport { readCredential } from \"./auth\";\n\nexport const createBackend = async (\n options: NetworkOptions,\n): Promise<Backend> => {\n // oxlint-disable-next-line typescript/no-unnecessary-condition -- Validate options from JavaScript callers.\n if (!options?.backendUrl?.trim()) {\n throw new Error(\"backendUrl is required\");\n }\n const builder = new BackendBuilder(options.backendUrl);\n if (options.env !== undefined) builder.setEnv(options.env);\n if (options.appVersion !== undefined)\n builder.setAppVersion(options.appVersion);\n if (options.authCallback) {\n const callback = options.authCallback;\n builder.authCallback(new AuthCallback(() => readCredential(callback)));\n }\n return builder.build();\n};\n","export class InboxReassignError extends Error {\n constructor() {\n super(\n \"Unable to create add account signature text, `allowInboxReassign` must be true\",\n );\n }\n}\n\nexport class AccountAlreadyAssociatedError extends Error {\n constructor(inboxId: string) {\n super(`Account already associated with inbox ${inboxId}`);\n }\n}\n\nexport class MissingContentTypeError extends Error {\n constructor() {\n super(\"Content type is required when sending encoded content\");\n }\n}\n\nexport class SignerUnavailableError extends Error {\n constructor() {\n super(\n \"Signer unavailable, use Client.create to create a client with a signer\",\n );\n }\n}\n\nexport class ClientNotInitializedError extends Error {\n constructor() {\n super(\n \"Client not initialized, use Client.create or Client.build to create a client\",\n );\n }\n}\n\nexport class StreamFailedError extends Error {\n constructor(retryAttempts: number) {\n const times = `time${retryAttempts !== 1 ? \"s\" : \"\"}`;\n super(`Stream failed, retried ${retryAttempts} ${times}`);\n }\n}\n\nexport class StreamInvalidRetryAttemptsError extends Error {\n constructor() {\n super(\"Stream retry attempts must be greater than 0\");\n }\n}\n","import {\n generateInboxId as generateInboxIdBinding,\n getInboxIdByIdentity,\n type Backend,\n type Identifier,\n} from \"@xmtp/node-bindings\";\n\nexport const generateInboxId = (\n identifier: Identifier,\n nonce?: bigint,\n): string => {\n return generateInboxIdBinding(identifier, nonce);\n};\n\nexport const getInboxIdForIdentifier = async (\n backend: Backend,\n identifier: Identifier,\n) => {\n return getInboxIdByIdentity(backend, identifier);\n};\n","export type HexString = `0x${string}`;\n\nexport function isHexString(value: unknown): value is HexString {\n return typeof value === \"string\" && /^0x(?:[0-9a-fA-F]{2})+$/.test(value);\n}\n\nexport function validHex(value: unknown): HexString {\n if (!isHexString(value)) {\n throw new TypeError(`Value is not a hexadecimal string.`);\n }\n return value;\n}\n","import type {\n Actions,\n Attachment,\n GroupUpdated,\n Intent,\n LeaveRequest,\n MultiRemoteAttachment,\n Reaction,\n ReadReceipt,\n RemoteAttachment,\n TransactionReference,\n WalletSendCalls,\n} from \"@xmtp/node-bindings\";\n\nimport type { DecodedMessage } from \"@/DecodedMessage\";\nimport type { EnrichedReply } from \"@/types\";\n\nexport const isReaction = (m: DecodedMessage): m is DecodedMessage<Reaction> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"reaction\";\n\nexport const isReply = (\n m: DecodedMessage,\n): m is DecodedMessage<EnrichedReply> =>\n m.contentType.authorityId === \"xmtp.org\" && m.contentType.typeId === \"reply\";\n\nexport const isTextReply = (\n m: DecodedMessage,\n): m is DecodedMessage<EnrichedReply<string>> =>\n isReply(m) && typeof m.content?.content === \"string\";\n\nexport const isText = (m: DecodedMessage): m is DecodedMessage<string> =>\n m.contentType.authorityId === \"xmtp.org\" && m.contentType.typeId === \"text\";\n\nexport const isRemoteAttachment = (\n m: DecodedMessage,\n): m is DecodedMessage<RemoteAttachment> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"remoteStaticAttachment\";\n\nexport const isAttachment = (\n m: DecodedMessage,\n): m is DecodedMessage<Attachment> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"attachment\";\n\nexport const isMultiRemoteAttachment = (\n m: DecodedMessage,\n): m is DecodedMessage<MultiRemoteAttachment> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"multiRemoteStaticAttachment\";\n\nexport const isTransactionReference = (\n m: DecodedMessage,\n): m is DecodedMessage<TransactionReference> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"transactionReference\";\n\nexport const isGroupUpdated = (\n m: DecodedMessage,\n): m is DecodedMessage<GroupUpdated> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"group_updated\";\n\nexport const isReadReceipt = (\n m: DecodedMessage,\n): m is DecodedMessage<ReadReceipt> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"readReceipt\";\n\nexport const isLeaveRequest = (\n m: DecodedMessage,\n): m is DecodedMessage<LeaveRequest> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"leave_request\";\n\nexport const isWalletSendCalls = (\n m: DecodedMessage,\n): m is DecodedMessage<WalletSendCalls> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"walletSendCalls\";\n\nexport const isIntent = (m: DecodedMessage): m is DecodedMessage<Intent> =>\n m.contentType.authorityId === \"coinbase.com\" &&\n m.contentType.typeId === \"intent\";\n\nexport const isActions = (m: DecodedMessage): m is DecodedMessage<Actions> =>\n m.contentType.authorityId === \"coinbase.com\" &&\n m.contentType.typeId === \"actions\";\n\nexport const isMarkdown = (m: DecodedMessage): m is DecodedMessage<string> =>\n m.contentType.authorityId === \"xmtp.org\" &&\n m.contentType.typeId === \"markdown\";\n","import {\n contentTypeToString,\n type ContentCodec,\n type ContentTypeId,\n} from \"@xmtp/content-type-primitives\";\n\nexport class CodecRegistry {\n #codecs: Map<string, ContentCodec>;\n\n constructor(codecs: ContentCodec[]) {\n this.#codecs = new Map(\n codecs.map((codec) => [contentTypeToString(codec.contentType), codec]),\n );\n }\n\n /**\n * Gets the codec for a given content type\n *\n * @param contentType - The content type to get the codec for\n * @returns The codec, if found\n */\n getCodec<ContentType = unknown>(contentType: ContentTypeId) {\n return this.#codecs.get(contentTypeToString(contentType)) as\n | ContentCodec<ContentType>\n | undefined;\n }\n}\n","export function nsToDate(ns: bigint): Date {\n return new Date(Number(ns / 1_000_000n));\n}\n","import { contentTypeToString } from \"@xmtp/content-type-primitives\";\nimport {\n contentTypeActions,\n contentTypeAttachment,\n contentTypeGroupUpdated,\n contentTypeIntent,\n contentTypeLeaveRequest,\n contentTypeMarkdown,\n contentTypeMultiRemoteAttachment,\n contentTypeReaction,\n contentTypeReadReceipt,\n contentTypeRemoteAttachment,\n contentTypeReply,\n contentTypeText,\n contentTypeTransactionReference,\n contentTypeWalletSendCalls,\n DecodedMessageContentType,\n type ContentTypeId,\n type DecodedMessageContent,\n type DeliveryStatus,\n type DeliveryCursor,\n type EncodedContent,\n type EnrichedReply,\n type GroupMessageKind,\n type Reaction,\n type DecodedMessage as XmtpDecodedMessage,\n} from \"@xmtp/node-bindings\";\n\nimport type { CodecRegistry } from \"@/CodecRegistry\";\nimport { nsToDate } from \"@/utils/date\";\n\nconst decodeFailures = new WeakMap<DecodedMessage, { error: unknown }>();\n\n/** Reject failed registered codecs at delivery without changing legacy reads. */\nexport const assertMessageDecodedForDelivery = (message: DecodedMessage) => {\n const failure = decodeFailures.get(message);\n if (failure) throw failure.error;\n};\n\nconst getContentFromDecodedMessageContent = <T = unknown>(\n content: DecodedMessageContent,\n): T => {\n switch (content.type) {\n case DecodedMessageContentType.Text: {\n return content.text as T;\n }\n case DecodedMessageContentType.Markdown: {\n return content.markdown as T;\n }\n case DecodedMessageContentType.Reply: {\n return content.reply as T;\n }\n case DecodedMessageContentType.Reaction: {\n return content.reaction as T;\n }\n case DecodedMessageContentType.Attachment: {\n return content.attachment as T;\n }\n case DecodedMessageContentType.RemoteAttachment: {\n return content.remoteAttachment as T;\n }\n case DecodedMessageContentType.MultiRemoteAttachment: {\n return content.multiRemoteAttachment as T;\n }\n case DecodedMessageContentType.TransactionReference: {\n return content.transactionReference as T;\n }\n case DecodedMessageContentType.GroupUpdated: {\n return content.groupUpdated as T;\n }\n case DecodedMessageContentType.ReadReceipt: {\n return content.readReceipt as T;\n }\n case DecodedMessageContentType.LeaveRequest: {\n return content.leaveRequest as T;\n }\n case DecodedMessageContentType.WalletSendCalls: {\n return content.walletSendCalls as T;\n }\n case DecodedMessageContentType.Actions: {\n return content.actions as T;\n }\n case DecodedMessageContentType.Intent: {\n return content.intent as T;\n }\n case DecodedMessageContentType.DeletedMessage: {\n return content.deletedMessage as T;\n }\n case DecodedMessageContentType.Custom: {\n return content.custom as T;\n }\n default:\n content.type satisfies never;\n return null as T;\n }\n};\n\nconst getContentTypeFromDecodedMessageContent = (\n content: DecodedMessageContent,\n): ContentTypeId | undefined => {\n switch (content.type) {\n case DecodedMessageContentType.Text: {\n return contentTypeText();\n }\n case DecodedMessageContentType.Markdown: {\n return contentTypeMarkdown();\n }\n case DecodedMessageContentType.Reply: {\n return contentTypeReply();\n }\n case DecodedMessageContentType.Reaction: {\n return contentTypeReaction();\n }\n case DecodedMessageContentType.Attachment: {\n return contentTypeAttachment();\n }\n case DecodedMessageContentType.RemoteAttachment: {\n return contentTypeRemoteAttachment();\n }\n case DecodedMessageContentType.MultiRemoteAttachment: {\n return contentTypeMultiRemoteAttachment();\n }\n case DecodedMessageContentType.TransactionReference: {\n return contentTypeTransactionReference();\n }\n case DecodedMessageContentType.GroupUpdated: {\n return contentTypeGroupUpdated();\n }\n case DecodedMessageContentType.ReadReceipt: {\n return contentTypeReadReceipt();\n }\n case DecodedMessageContentType.LeaveRequest: {\n return contentTypeLeaveRequest();\n }\n case DecodedMessageContentType.WalletSendCalls: {\n return contentTypeWalletSendCalls();\n }\n case DecodedMessageContentType.Actions: {\n return contentTypeActions();\n }\n case DecodedMessageContentType.Intent: {\n return contentTypeIntent();\n }\n case DecodedMessageContentType.DeletedMessage: {\n return undefined;\n }\n case DecodedMessageContentType.Custom: {\n return content.custom?.type;\n }\n default:\n content.type satisfies never;\n return undefined;\n }\n};\n\n/**\n * Represents a decoded XMTP message\n *\n * @class\n * @property {unknown} content - The decoded content of the message\n * @property {ContentTypeId} contentType - The content type of the message content\n * @property {string} conversationId - Unique identifier for the conversation\n * @property {MessageDeliveryStatus} deliveryStatus - Current delivery status of the message (\"unpublished\" | \"published\" | \"failed\")\n * @property {bigint} expiresAtNs - Timestamp when the message will expire (in nanoseconds)\n * @property {Date} expiresAt - Timestamp when the message will expire\n * @property {string} [fallback] - Optional fallback text for the message\n * @property {string} id - Unique identifier for the message\n * @property {MessageKind} kind - Type of message (\"application\" | \"membership_change\")\n * @property {number} numReplies - Number of replies to the message\n * @property {DecodedMessage<Reaction>[]} reactions - Reactions to the message\n * @property {string} senderInboxId - Identifier for the sender's inbox\n * @property {Date} sentAt - Timestamp when the message was sent\n * @property {bigint} sentAtNs - Timestamp when the message was sent (in nanoseconds)\n */\nexport class DecodedMessage<ContentTypes = unknown> {\n /** Database-local position of this delivery. Absent for ordinary history reads. */\n deliveryCursor?: DeliveryCursor;\n content: ContentTypes | undefined;\n contentType: ContentTypeId;\n conversationId: string;\n deliveryStatus: DeliveryStatus;\n expiresAtNs?: bigint;\n expiresAt?: Date;\n fallback?: string;\n id: string;\n kind: GroupMessageKind;\n numReplies: number;\n reactions: DecodedMessage<Reaction>[];\n senderInboxId: string;\n sentAt: Date;\n sentAtNs: bigint;\n\n constructor(codecRegistry: CodecRegistry, message: XmtpDecodedMessage) {\n this.id = message.id;\n this.expiresAtNs = message.expiresAtNs ?? undefined;\n this.expiresAt = message.expiresAtNs\n ? nsToDate(message.expiresAtNs)\n : undefined;\n this.sentAtNs = message.sentAtNs;\n this.sentAt = nsToDate(message.sentAtNs);\n this.conversationId = message.conversationId;\n this.senderInboxId = message.senderInboxId;\n this.contentType = message.contentType;\n this.fallback = message.fallback ?? undefined;\n this.kind = message.kind;\n this.deliveryStatus = message.deliveryStatus;\n\n const decodeChild = <ChildContentTypes>(child: XmtpDecodedMessage) => {\n const decoded = new DecodedMessage<ChildContentTypes>(\n codecRegistry,\n child,\n );\n const failure = decodeFailures.get(decoded);\n if (failure && !decodeFailures.has(this))\n decodeFailures.set(this, failure);\n return decoded;\n };\n\n this.numReplies = message.numReplies;\n this.reactions = message.reactions.map((reaction) =>\n decodeChild<Reaction>(reaction),\n );\n\n this.content =\n getContentFromDecodedMessageContent<ContentTypes>(message.content) ??\n undefined;\n\n switch (message.content.type) {\n case DecodedMessageContentType.Reply: {\n const reply = message.content.reply as EnrichedReply;\n let replyContent = getContentFromDecodedMessageContent<ContentTypes>(\n reply.content,\n );\n if (reply.content.type === DecodedMessageContentType.Custom) {\n const codec = codecRegistry.getCodec<ContentTypes>(\n reply.content.custom?.type as ContentTypeId,\n );\n if (codec) {\n try {\n replyContent = codec.decode(replyContent as EncodedContent);\n } catch (error) {\n if (!decodeFailures.has(this))\n decodeFailures.set(this, { error });\n if (error instanceof Error) {\n console.warn(`Error decoding custom content: ${error.message}`);\n } else {\n console.warn(`Error decoding custom content`);\n }\n }\n }\n }\n this.content = {\n referenceId: reply.referenceId,\n content: replyContent,\n contentType: getContentTypeFromDecodedMessageContent(reply.content),\n inReplyTo: reply.inReplyTo\n ? decodeChild<ContentTypes>(reply.inReplyTo)\n : null,\n } as ContentTypes;\n break;\n }\n case DecodedMessageContentType.Custom: {\n const customContent = message.content.custom;\n if (customContent !== null) {\n const codec = codecRegistry.getCodec<ContentTypes>(this.contentType);\n if (codec) {\n try {\n this.content = codec.decode(customContent);\n } catch (error) {\n if (!decodeFailures.has(this))\n decodeFailures.set(this, { error });\n if (error instanceof Error) {\n console.warn(`Error decoding custom content: ${error.message}`);\n } else {\n console.warn(`Error decoding custom content`);\n }\n this.content = undefined;\n }\n } else {\n console.warn(\n `No codec found for content type \"${contentTypeToString(this.contentType)}\"`,\n );\n this.content = undefined;\n }\n }\n break;\n }\n }\n }\n}\n","import type {\n ConsentState,\n ConversationType,\n DeliveryCursor,\n DecodedMessage as XmtpDecodedMessage,\n MessageCatchUp,\n} from \"@xmtp/node-bindings\";\n\nimport type { StreamOptions } from \"@/utils/streams\";\n\nexport type MessageAcknowledgement = {\n checkOwner(): boolean | Promise<boolean>;\n acknowledge(): void | Promise<void>;\n enrichedMessage(): XmtpDecodedMessage | null;\n reject(): void | Promise<void>;\n};\n\nexport type MessageDelivery<T> = {\n message: T;\n cursor: DeliveryCursor;\n acknowledgement: MessageAcknowledgement;\n};\n\nexport type MessageReaderSource<T> = {\n nextDelivery(): Promise<MessageDelivery<T> | null | undefined>;\n close(): void | Promise<void>;\n updateScope(groupIds?: string[]): void | Promise<void>;\n updateFilter(\n conversationType?: ConversationType,\n consentStates?: ConsentState[],\n ): void | Promise<void>;\n catchUpSnapshot(): MessageCatchUp | Promise<MessageCatchUp>;\n catchUpChanged(): Promise<MessageCatchUp>;\n};\n\n/** One pending item. Construction selects callback mode or next-request acknowledgement. */\nexport class MessageStream<T, V> implements AsyncIterable<V> {\n #reader: MessageReaderSource<T>;\n #convert: (\n message: T,\n cursor: DeliveryCursor,\n acknowledgement: MessageAcknowledgement,\n ) => V | undefined | Promise<V | undefined>;\n #options: StreamOptions<T, V>;\n readonly #onValue?: (value: V) => void | Promise<void>;\n #pending?: MessageAcknowledgement;\n #reading = false;\n #done = false;\n #closing?: Promise<IteratorReturnResult<undefined>>;\n #cursor?: DeliveryCursor;\n\n constructor(\n reader: MessageReaderSource<T>,\n convert: (\n message: T,\n cursor: DeliveryCursor,\n acknowledgement: MessageAcknowledgement,\n ) => V | undefined | Promise<V | undefined>,\n options: StreamOptions<T, V> = {},\n ) {\n this.#reader = reader;\n this.#convert = convert;\n this.#options = options;\n this.#onValue = options.onValue;\n if (this.#onValue) {\n // Callback mode has no caller waiting on next(). Errors reach onError after cleanup.\n void this.#read().catch(() => undefined);\n }\n }\n\n get isDone() {\n return this.#done;\n }\n get deliveredCursor() {\n return this.#cursor;\n }\n\n #hasEnded() {\n return this.#done;\n }\n\n next = (): Promise<IteratorResult<V, undefined>> => {\n if (this.#onValue) {\n return Promise.reject(\n new Error(\"Cannot call next() on a message stream in callback mode\"),\n );\n }\n return this.#read();\n };\n\n async #acknowledgePending() {\n const pending = this.#pending;\n if (pending) {\n // Keep the token until success so close can reject a failed acknowledgement.\n await pending.acknowledge();\n if (this.#pending === pending) this.#pending = undefined;\n }\n }\n\n // implements: PROC-028, PROC-031, PROC-032\n async #read(): Promise<IteratorResult<V, undefined>> {\n if (this.#hasEnded()) return { done: true, value: undefined };\n if (this.#reading) throw new Error(\"A message read is already pending\");\n this.#reading = true;\n try {\n await this.#acknowledgePending();\n while (!this.#hasEnded()) {\n const item = await this.#reader.nextDelivery();\n if (item === undefined || item === null) {\n await this.return();\n break;\n }\n if (this.#hasEnded()) {\n await item.acknowledgement.reject();\n break;\n }\n this.#pending = item.acknowledgement;\n // A codec that throws must not advance the cursor. The message is\n // retained and a later reader, or the same client with the codec\n // registered, must still see it. Acknowledging here would skip a\n // message nothing has read. This matches the undefined case below:\n // both mean this client could not decode the message, so both hold\n // the item rather than discarding it.\n const value: V | undefined = await this.#convert(\n item.message,\n item.cursor,\n item.acknowledgement,\n );\n if (this.#hasEnded()) break;\n // Native checkOwner is synchronous. A storage failure ends this stream;\n // the caller can repair storage and open a new stream on the same client.\n const checked = item.acknowledgement.checkOwner();\n const valid = typeof checked === \"boolean\" ? checked : await checked;\n if (this.#hasEnded()) break;\n if (!valid) {\n this.#pending = undefined;\n await item.acknowledgement.reject();\n continue;\n }\n if (value === undefined) {\n // The converter could not produce a value. That includes a failed\n // lookup, so it is not safe to acknowledge: skipping here would\n // advance the durable cursor past a message nothing has read.\n // Report it and stop, leaving the item replayable.\n throw new Error(\"The retained message could not be decoded\");\n }\n // Do not await between the final ownership check and the app handoff.\n this.#cursor = item.cursor;\n if (this.#onValue) {\n await this.#onValue(value);\n if (this.#hasEnded()) break;\n await this.#acknowledgePending();\n } else {\n return { done: false, value };\n }\n }\n return { done: true, value: undefined };\n } catch (error) {\n if (!this.#hasEnded()) {\n // Release this reader before onError can open a replacement. Failed\n // cleanup must not replace the error that stopped delivery.\n try {\n await this.return();\n } catch {\n // Native close fences this reader even when storage release fails.\n }\n try {\n // Do not await application error handling. It may open and consume\n // another stream. Its rejection must not escape the callback task.\n void Promise.resolve(this.#options.onError?.(error as Error)).catch(\n () => undefined,\n );\n } catch {\n // Iterator mode reports the original cause below.\n }\n }\n throw error;\n } finally {\n this.#reading = false;\n }\n }\n\n async #close(\n pending?: MessageAcknowledgement,\n ): Promise<IteratorReturnResult<undefined>> {\n const invoke = (action: () => void | Promise<void>): Promise<void> => {\n try {\n return Promise.resolve(action());\n } catch (error) {\n return Promise.reject(\n error instanceof Error\n ? error\n : new Error(\"Message stream close failed\", { cause: error }),\n );\n }\n };\n // Invoke close before any await so it fences pending reads and host handoffs.\n const results = await Promise.allSettled([\n invoke(() => this.#reader.close()),\n invoke(() => pending?.reject()),\n ]);\n try {\n for (const result of results) {\n if (result.status === \"rejected\") throw result.reason;\n }\n return { done: true, value: undefined };\n } finally {\n void Promise.resolve(this.#options.onEnd?.()).catch(() => undefined);\n }\n }\n\n return = (): Promise<IteratorReturnResult<undefined>> => {\n if (this.#done) {\n return this.#closing ?? Promise.resolve({ done: true, value: undefined });\n }\n this.#done = true;\n const pending = this.#pending;\n this.#pending = undefined;\n this.#closing = this.#close(pending);\n return this.#closing;\n };\n\n end = this.return;\n updateScope = (groupIds?: string[]) => this.#reader.updateScope(groupIds);\n updateFilter = (\n conversationType?: ConversationType,\n consentStates?: ConsentState[],\n ) => this.#reader.updateFilter(conversationType, consentStates);\n catchUpSnapshot = () => this.#reader.catchUpSnapshot();\n catchUpChanged = () => this.#reader.catchUpChanged();\n [Symbol.asyncIterator]() {\n return this;\n }\n}\n","import {\n NotificationFailure,\n NotificationOverride as BindingNotificationOverride,\n NotificationStateKind,\n type ConsentState,\n type NotificationConfig as BindingNotificationConfig,\n type NotificationState as BindingNotificationState,\n} from \"@xmtp/node-bindings\";\n\n/** Delivery channel for this installation. */\nexport type NotificationChannel =\n | { type: \"apns\"; token: string }\n | { type: \"fcm\"; token: string }\n | { type: \"http\"; url: string; signingKey: Uint8Array };\n\n/** Notification delivery and conversation rules. */\nexport type NotificationConfig = {\n channel: NotificationChannel;\n /** Defaults to Allowed. An empty list selects no consent states. */\n consentStates?: ConsentState[];\n /** Defaults to true. */\n includeWelcomes?: boolean;\n /** Defaults to false. */\n includeSyncGroups?: boolean;\n /** Defaults to false. */\n includeCommits?: boolean;\n};\n\n/** Reset to the configured consent rules with \"default\". */\nexport type NotificationOverride = \"enabled\" | \"disabled\" | \"default\";\n\n/** A notification failure with a stable error code. */\nexport class NotificationError extends Error {\n constructor(\n public readonly code: string,\n options?: ErrorOptions,\n ) {\n super(code, options);\n this.name = \"NotificationError\";\n }\n}\n\n/** Local notification state. Reading it makes no backend request. */\nexport type NotificationState =\n | { state: \"disabled\" }\n | { state: \"enabled\" }\n | { state: \"failed\"; error: NotificationError };\n\nexport const toBindingNotificationConfig = (\n config: NotificationConfig,\n): BindingNotificationConfig => {\n const { channel, ...rules } = config;\n return {\n ...rules,\n channel: channel.type,\n ...(channel.type === \"http\"\n ? { url: channel.url, signingKey: Array.from(channel.signingKey) }\n : { token: channel.token }),\n };\n};\n\nexport const toNotificationState = (\n value: BindingNotificationState,\n): NotificationState => {\n switch (value.state) {\n case NotificationStateKind.Disabled:\n return { state: \"disabled\" };\n case NotificationStateKind.Enabled:\n return { state: \"enabled\" };\n case NotificationStateKind.Failed: {\n const codes: Record<NotificationFailure, string> = {\n [NotificationFailure.PermissionDenied]: \"PermissionDenied\",\n [NotificationFailure.InvalidArgument]: \"InvalidArgument\",\n [NotificationFailure.OutOfRange]: \"OutOfRange\",\n [NotificationFailure.Unimplemented]: \"Unimplemented\",\n [NotificationFailure.ChannelNotConfigured]: \"ChannelNotConfigured\",\n };\n if (value.failure == null) {\n throw new Error(\"Notification failure is missing its error\");\n }\n return {\n state: \"failed\",\n error: new NotificationError(\n `NotificationError::${codes[value.failure]}`,\n ),\n };\n }\n }\n};\n\nexport const toBindingNotificationOverride = (\n value: NotificationOverride,\n): BindingNotificationOverride => {\n switch (value) {\n case \"enabled\":\n return BindingNotificationOverride.Enabled;\n case \"disabled\":\n return BindingNotificationOverride.Disabled;\n case \"default\":\n return BindingNotificationOverride.Default;\n }\n};\n\nexport const throwNotificationError = (error: unknown): never => {\n if (error instanceof Error) {\n const code = /^\\[(NotificationError::[^\\]]+)\\]/.exec(error.message)?.[1];\n if (code) throw new NotificationError(code, { cause: error });\n }\n throw error;\n};\n","import {\n SortDirection,\n type Actions,\n type Attachment,\n type ConsentState,\n type DeliveryCursor,\n type EncodedContent,\n type Intent,\n type ListMessagesOptions,\n type Message,\n type MultiRemoteAttachment,\n type Reaction,\n type RemoteAttachment,\n type Reply,\n type SendMessageOpts,\n type SendOpts,\n type TransactionReference,\n type WalletSendCalls,\n type Conversation as XmtpConversation,\n} from \"@xmtp/node-bindings\";\n\nimport type { Client } from \"@/Client\";\nimport type { CodecRegistry } from \"@/CodecRegistry\";\nimport {\n assertMessageDecodedForDelivery,\n DecodedMessage,\n} from \"@/DecodedMessage\";\nimport { MessageStream, type MessageAcknowledgement } from \"@/MessageStream\";\nimport {\n toBindingNotificationOverride,\n type NotificationOverride,\n} from \"@/Notifications\";\nimport { nsToDate } from \"@/utils/date\";\nimport { MissingContentTypeError } from \"@/utils/errors\";\nimport type { StreamOptions } from \"@/utils/streams\";\n\n/**\n * Represents a conversation\n *\n * This class is not intended to be initialized directly.\n */\nexport class Conversation<ContentTypes = unknown> {\n #codecRegistry: CodecRegistry;\n #conversation: XmtpConversation;\n\n /**\n * Creates a new conversation instance\n *\n * @param _client - The client instance managing the conversation\n * @param codecRegistry - The codec registry instance\n * @param conversation - The underlying conversation instance\n */\n constructor(\n _client: Client<ContentTypes>,\n codecRegistry: CodecRegistry,\n conversation: XmtpConversation,\n ) {\n this.#codecRegistry = codecRegistry;\n this.#conversation = conversation;\n }\n\n /**\n * Gets the unique identifier for this conversation\n */\n get id() {\n return this.#conversation.id();\n }\n\n /**\n * Gets whether this conversation is currently active\n */\n get isActive() {\n return this.#conversation.isActive();\n }\n\n /** Override notification rules, or reset the override with \"default\". */\n setNotifications(value: NotificationOverride): Promise<void> {\n return Promise.resolve().then(() => {\n this.#conversation.setNotifications(toBindingNotificationOverride(value));\n });\n }\n\n /** Read the effective notification value for this conversation. */\n notificationsEnabled(): Promise<boolean> {\n return Promise.resolve().then(() =>\n this.#conversation.notificationsEnabled(),\n );\n }\n\n /**\n * Gets the inbox ID that added this client's inbox to the conversation\n */\n get addedByInboxId() {\n return this.#conversation.addedByInboxId();\n }\n\n /**\n * Gets the timestamp when the conversation was created in nanoseconds\n */\n get createdAtNs() {\n return this.#conversation.createdAtNs();\n }\n\n /**\n * Gets the date when the conversation was created\n */\n get createdAt() {\n return nsToDate(this.createdAtNs);\n }\n\n get topic() {\n return `00${this.id}`;\n }\n\n pausedForVersion() {\n return this.#conversation.pausedForVersion() ?? undefined;\n }\n\n /**\n * Gets HMAC keys for this conversation\n *\n * @returns The HMAC keys for this conversation\n */\n hmacKeys() {\n return this.#conversation.hmacKeys();\n }\n\n /**\n * Gets the metadata for this conversation\n *\n * @returns Promise that resolves with the conversation metadata\n */\n async metadata() {\n const metadata = await this.#conversation.groupMetadata();\n return {\n creatorInboxId: metadata.creatorInboxId(),\n conversationType: metadata.conversationType(),\n };\n }\n\n /**\n * Gets the members of this conversation\n *\n * @returns Promise that resolves with the conversation members\n */\n async members() {\n return this.#conversation.listMembers();\n }\n\n /**\n * Synchronizes conversation data from the network\n *\n * @returns Promise that resolves when synchronization is complete\n */\n async sync() {\n return this.#conversation.sync();\n }\n\n /**\n * Reads retained messages after the default acknowledgement position.\n * Set `from` to replay after a cursor without changing default progress.\n * Set `onValue` for callback mode, or request items with the iterator.\n * Core owns network recovery. Legacy retry options and `disableSync` do not apply.\n *\n * @param options - Optional delivery callbacks and replay cursor\n * @returns Stream instance for new messages\n */\n async stream(\n options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {\n from?: DeliveryCursor;\n },\n ) {\n const reader = await this.#conversation.messageReader(options?.from);\n const convertMessage = (\n _value: Message,\n cursor: DeliveryCursor,\n acknowledgement: MessageAcknowledgement,\n ) => {\n const retained = acknowledgement.enrichedMessage();\n if (retained === null) return undefined;\n // Keep storage failures distinct from application codec failures.\n const enrichedMessage = new DecodedMessage<ContentTypes>(\n this.#codecRegistry,\n retained,\n );\n assertMessageDecodedForDelivery(enrichedMessage);\n enrichedMessage.deliveryCursor = cursor;\n return enrichedMessage;\n };\n return new MessageStream(reader, convertMessage, options);\n }\n\n messageHistorySnapshot(limit: number) {\n return this.#conversation.messageHistorySnapshot(limit);\n }\n\n beginningDeliveryCursor() {\n return this.#conversation.beginningDeliveryCursor();\n }\n\n /**\n * Decodes, decrypts, and persists a raw envelope from a group message stream.\n *\n * @param envelopeBytes - Raw protobuf-encoded envelope bytes from the stream\n * @returns The processed and stored messages\n */\n async processStreamedMessage(envelopeBytes: Uint8Array) {\n return this.#conversation.processStreamedGroupMessage(envelopeBytes);\n }\n\n /**\n * Publishes pending messages that were sent optimistically\n *\n * @returns Promise that resolves when publishing is complete\n */\n async publishMessages() {\n return this.#conversation.publishMessages();\n }\n\n /**\n * Sends a message with configurable delivery behavior\n *\n * @param encodedContent - The encoded content to send\n * @param sendOptions - Options for sending the message\n * @param sendOptions.shouldPush - Indicates whether this message should be\n * included in push notifications\n * @param sendOptions.optimistic - Indicates whether this message should be\n * sent optimistically and published later via `publishMessages`\n * @param sendOptions.idempotencyKey - Optional idempotency key; re-sending\n * identical content with the same key produces the same deduplicated message id\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async send(encodedContent: EncodedContent, sendOptions?: SendMessageOpts) {\n if (!encodedContent.type) {\n throw new MissingContentTypeError();\n }\n return this.#conversation.send(\n encodedContent,\n sendOptions ?? { shouldPush: false },\n );\n }\n\n /**\n * Sends a text message\n *\n * @param text - The text to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendText(text: string, opts?: SendOpts) {\n return this.#conversation.sendText(text, opts);\n }\n\n /**\n * Sends a markdown message\n *\n * @param markdown - The markdown to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendMarkdown(markdown: string, opts?: SendOpts) {\n return this.#conversation.sendMarkdown(markdown, opts);\n }\n\n /**\n * Sends a reaction message\n *\n * @param reaction - The reaction to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendReaction(reaction: Reaction, opts?: SendOpts) {\n return this.#conversation.sendReaction(reaction, opts);\n }\n\n /**\n * Sends a read receipt message\n *\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendReadReceipt(opts?: SendOpts) {\n return this.#conversation.sendReadReceipt(opts);\n }\n\n /**\n * Sends a reply message\n *\n * @param reply - The reply to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendReply(reply: Reply, opts?: SendOpts) {\n return this.#conversation.sendReply(reply, opts);\n }\n\n /**\n * Sends a transaction reference message\n *\n * @param transactionReference - The transaction reference to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendTransactionReference(\n transactionReference: TransactionReference,\n opts?: SendOpts,\n ) {\n return this.#conversation.sendTransactionReference(\n transactionReference,\n opts,\n );\n }\n\n /**\n * Sends a wallet send calls message\n *\n * @param walletSendCalls - The wallet send calls to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendWalletSendCalls(walletSendCalls: WalletSendCalls, opts?: SendOpts) {\n return this.#conversation.sendWalletSendCalls(walletSendCalls, opts);\n }\n\n /**\n * Sends a actions message\n *\n * @param actions - The actions to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendActions(actions: Actions, opts?: SendOpts) {\n return this.#conversation.sendActions(actions, opts);\n }\n\n /**\n * Sends a intent message\n *\n * @param intent - The intent to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendIntent(intent: Intent, opts?: SendOpts) {\n return this.#conversation.sendIntent(intent, opts);\n }\n\n /**\n * Sends an attachment message\n *\n * @param attachment - The attachment to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendAttachment(attachment: Attachment, opts?: SendOpts) {\n return this.#conversation.sendAttachment(attachment, opts);\n }\n\n /**\n * Sends a multi remote attachment message\n *\n * @param multiRemoteAttachment - The multi remote attachment to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendMultiRemoteAttachment(\n multiRemoteAttachment: MultiRemoteAttachment,\n opts?: SendOpts,\n ) {\n return this.#conversation.sendMultiRemoteAttachment(\n multiRemoteAttachment,\n opts,\n );\n }\n\n /**\n * Sends a remote attachment message\n *\n * @param remoteAttachment - The remote attachment to send\n * @param opts - Send options (optimistic delivery, idempotency key)\n * @returns Promise that resolves with the message ID after it has been sent\n */\n async sendRemoteAttachment(\n remoteAttachment: RemoteAttachment,\n opts?: SendOpts,\n ) {\n return this.#conversation.sendRemoteAttachment(remoteAttachment, opts);\n }\n\n /**\n * Lists messages in this conversation\n *\n * @param options - Optional filtering and pagination options\n * @returns Promise that resolves with an array of decoded messages\n */\n async messages(options?: ListMessagesOptions) {\n const messages = await this.#conversation.listEnrichedMessages(options);\n return messages.map(\n (message) =>\n new DecodedMessage<ContentTypes>(this.#codecRegistry, message),\n );\n }\n\n /**\n * Counts messages in this conversation\n *\n * @param options - Optional filtering options\n * @returns Promise that resolves with the count of messages\n */\n async countMessages(\n options?: Omit<ListMessagesOptions, \"limit\" | \"direction\">,\n ) {\n const count = await this.#conversation.countMessages(options);\n return count;\n }\n\n /**\n * Gets the last message in this conversation\n *\n * @returns Promise that resolves with the last message or undefined if none exists\n */\n async lastMessage() {\n const messages = await this.messages({\n limit: 1,\n direction: SortDirection.Descending,\n });\n if (messages.length > 0) {\n return messages[0];\n }\n return undefined;\n }\n\n /**\n * Gets the consent state for this conversation\n */\n consentState() {\n return this.#conversation.consentState();\n }\n\n /**\n * Updates the consent state for this conversation\n *\n * @param consentState - The new consent state to set\n */\n updateConsentState(consentState: ConsentState) {\n this.#conversation.updateConsentState(consentState);\n }\n\n /**\n * Gets the message disappearing settings for this conversation\n *\n * @returns The current message disappearing settings or undefined if not set\n */\n messageDisappearingSettings() {\n return this.#conversation.messageDisappearingSettings() ?? undefined;\n }\n\n /**\n * Updates message disappearing settings for this conversation\n *\n * @param fromNs - The timestamp from which messages should start disappearing\n * @param inNs - The duration after which messages should disappear\n * @returns Promise that resolves when the update is complete\n */\n async updateMessageDisappearingSettings(fromNs: bigint, inNs: bigint) {\n return this.#conversation.updateMessageDisappearingSettings({\n fromNs,\n inNs,\n });\n }\n\n /**\n * Removes message disappearing settings from this conversation\n *\n * @returns Promise that resolves when the settings are removed\n */\n async removeMessageDisappearingSettings() {\n return this.#conversation.removeMessageDisappearingSettings();\n }\n\n /**\n * Checks if message disappearing is enabled for this conversation\n *\n * @returns Whether message disappearing is enabled\n */\n isMessageDisappearingEnabled() {\n return this.#conversation.isMessageDisappearingEnabled();\n }\n\n /**\n * Retrieves information for this conversation to help with debugging\n *\n * @returns The debug information for this conversation\n */\n async debugInfo() {\n return this.#conversation.debugInfo();\n }\n\n /**\n * Retrieves the last read times for this conversation\n *\n * @returns A map keyed by inbox ID with the last read timestamp\n * (nanoseconds since epoch)\n */\n async lastReadTimes() {\n return this.#conversation.lastReadTimes();\n }\n}\n","import type { Conversation as XmtpConversation } from \"@xmtp/node-bindings\";\n\nimport type { Client } from \"@/Client\";\nimport type { CodecRegistry } from \"@/CodecRegistry\";\nimport { Conversation } from \"@/Conversation\";\n\n/**\n * Represents a direct message conversation between two inboxes\n *\n * This class is not intended to be initialized directly.\n */\nexport class Dm<ContentTypes = unknown> extends Conversation<ContentTypes> {\n #client: Client<ContentTypes>;\n #codecRegistry: CodecRegistry;\n #conversation: XmtpConversation;\n\n /**\n * Creates a new direct message conversation instance\n *\n * @param client - The client instance managing this direct message conversation\n * @param codecRegistry - The codec registry instance\n * @param conversation - The underlying conversation instance\n */\n constructor(\n client: Client<ContentTypes>,\n codecRegistry: CodecRegistry,\n conversation: XmtpConversation,\n ) {\n super(client, codecRegistry, conversation);\n this.#client = client;\n this.#codecRegistry = codecRegistry;\n this.#conversation = conversation;\n }\n\n /**\n * Retrieves the inbox ID of the other participant in the DM\n *\n * @returns Promise that resolves with the peer's inbox ID\n */\n get peerInboxId() {\n return this.#conversation.dmPeerInboxId();\n }\n\n async duplicateDms() {\n const duplicateDms = await this.#conversation.duplicateDms();\n return duplicateDms.map(\n (dm) => new Dm<ContentTypes>(this.#client, this.#codecRegistry, dm),\n );\n }\n}\n","import {\n GroupMembershipState,\n type Identifier,\n type MetadataField,\n type PermissionPolicy,\n type PermissionUpdateType,\n type Conversation as XmtpConversation,\n} from \"@xmtp/node-bindings\";\n\nimport type { Client } from \"@/Client\";\nimport type { CodecRegistry } from \"@/CodecRegistry\";\nimport { Conversation } from \"@/Conversation\";\n\n/**\n * Represents a group conversation between multiple inboxes\n *\n * This class is not intended to be initialized directly.\n */\nexport class Group<ContentTypes = unknown> extends Conversation<ContentTypes> {\n #conversation: XmtpConversation;\n\n /**\n * Creates a new group conversation instance\n *\n * @param client - The client instance managing this group conversation\n * @param codecRegistry - The codec registry instance\n * @param conversation - The underlying conversation object\n */\n constructor(\n client: Client<ContentTypes>,\n codecRegistry: CodecRegistry,\n conversation: XmtpConversation,\n ) {\n super(client, codecRegistry, conversation);\n this.#conversation = conversation;\n }\n\n /**\n * The name of the group\n */\n get name() {\n return this.#conversation.groupName();\n }\n\n /**\n * Updates the group's name\n *\n * @param name The new name for the group\n */\n async updateName(name: string) {\n return this.#conversation.updateGroupName(name);\n }\n\n /**\n * The image URL of the group\n */\n get imageUrl() {\n return this.#conversation.groupImageUrlSquare();\n }\n\n /**\n * Updates the group's image URL\n *\n * @param imageUrl The new image URL for the group\n */\n async updateImageUrl(imageUrl: string) {\n return this.#conversation.updateGroupImageUrlSquare(imageUrl);\n }\n\n /**\n * The description of the group\n */\n get description() {\n return this.#conversation.groupDescription();\n }\n\n /**\n * Updates the group's description\n *\n * @param description The new description for the group\n */\n async updateDescription(description: string) {\n return this.#conversation.updateGroupDescription(description);\n }\n\n /**\n * The app data of the group\n */\n get appData() {\n return this.#conversation.appData();\n }\n\n /**\n * Updates the group's app data (max 8192 bytes)\n *\n * @param appData The new app data for the group\n * @param expectedAppData Optional compare-and-swap guard. When provided, the\n * update is abandoned — rather than overwriting — if the committed value is\n * no longer this, including when another member's commit wins the race after\n * this update was published. Callers reconciling structured state should\n * pass the value they merged against, so a concurrent write surfaces as an\n * error instead of silently discarding someone else's change. Omit for\n * last-writer-wins.\n */\n async updateAppData(appData: string, expectedAppData?: string) {\n return this.#conversation.updateAppData({\n value: appData,\n expectedValue: expectedAppData,\n });\n }\n\n /**\n * The permissions of the group\n */\n permissions() {\n const permissions = this.#conversation.groupPermissions();\n return {\n policyType: permissions.policyType(),\n policySet: permissions.policySet(),\n };\n }\n\n /**\n * Updates a specific permission policy for the group\n *\n * @param permissionType The type of permission to update\n * @param policy The new permission policy\n * @param metadataField Optional metadata field for the permission\n */\n async updatePermission(\n permissionType: PermissionUpdateType,\n policy: PermissionPolicy,\n metadataField?: MetadataField,\n ) {\n return this.#conversation.updatePermissionPolicy(\n permissionType,\n policy,\n metadataField,\n );\n }\n\n /**\n * The list of admins of the group\n */\n listAdmins() {\n return this.#conversation.listAdmins();\n }\n\n /**\n * The list of super admins of the group\n */\n listSuperAdmins() {\n return this.#conversation.listSuperAdmins();\n }\n\n /**\n * Checks if an inbox is an admin of the group\n *\n * @param inboxId The inbox ID to check\n * @returns Boolean indicating if the inbox is an admin\n */\n isAdmin(inboxId: string) {\n return this.#conversation.isAdmin(inboxId);\n }\n\n /**\n * Checks if an inbox is a super admin of the group\n *\n * @param inboxId The inbox ID to check\n * @returns Boolean indicating if the inbox is a super admin\n */\n isSuperAdmin(inboxId: string) {\n return this.#conversation.isSuperAdmin(inboxId);\n }\n\n /**\n * Adds members to the group using identifiers\n *\n * @param identifiers Array of member identifiers to add\n */\n async addMembersByIdentifiers(identifiers: Identifier[]) {\n return this.#conversation.addMembersByIdentity(identifiers);\n }\n\n /**\n * Adds members to the group using inbox IDs\n *\n * @param inboxIds Array of inbox IDs to add\n */\n async addMembers(inboxIds: string[]) {\n return this.#conversation.addMembers(inboxIds);\n }\n\n /**\n * Removes members from the group using identifiers\n *\n * @param identifiers Array of member identifiers to remove\n */\n async removeMembersByIdentifiers(identifiers: Identifier[]) {\n return this.#conversation.removeMembersByIdentity(identifiers);\n }\n\n /**\n * Removes members from the group using inbox IDs\n *\n * @param inboxIds Array of inbox IDs to remove\n */\n async removeMembers(inboxIds: string[]) {\n return this.#conversation.removeMembers(inboxIds);\n }\n\n /**\n * Promotes a group member to admin status\n *\n * @param inboxId The inbox ID of the member to promote\n */\n async addAdmin(inboxId: string) {\n return this.#conversation.addAdmin(inboxId);\n }\n\n /**\n * Removes admin status from a group member\n *\n * @param inboxId The inbox ID of the admin to demote\n */\n async removeAdmin(inboxId: string) {\n return this.#conversation.removeAdmin(inboxId);\n }\n\n /**\n * Promotes a group member to super admin status\n *\n * @param inboxId The inbox ID of the member to promote\n */\n async addSuperAdmin(inboxId: string) {\n return this.#conversation.addSuperAdmin(inboxId);\n }\n\n /**\n * Removes super admin status from a group member\n *\n * @param inboxId The inbox ID of the super admin to demote\n */\n async removeSuperAdmin(inboxId: string) {\n return this.#conversation.removeSuperAdmin(inboxId);\n }\n\n /**\n * Request to leave the group\n */\n async requestRemoval() {\n return this.#conversation.leaveGroup();\n }\n\n /**\n * Checks if the current user has requested to leave the group\n *\n * @returns Boolean\n */\n isPendingRemoval() {\n return (\n this.#conversation.membershipState() ===\n GroupMembershipState.PendingRemove\n );\n }\n}\n","export type ResolveValue<T> = {\n value: T;\n done: boolean;\n};\n\ntype ResolveNext<T> = (resolveValue: ResolveValue<T>) => void;\n\n/**\n * AsyncStream provides an async iterable interface for streaming data.\n *\n * This class implements a producer-consumer pattern where:\n * - Producers can push values using the `push()` method\n * - Consumers can iterate over values asynchronously using `for await` loops or `next()`\n * - Values are queued internally when no consumers are waiting\n * - Consumers are resolved immediately when values are available\n * - The stream can be terminated using `done()`, `return()`, or `end()`\n *\n * @example\n * ```typescript\n * const stream = new AsyncStream<string>();\n *\n * stream.push(\"hello\");\n * stream.push(\"world\");\n *\n * for await (const value of stream) {\n * console.log(value); // \"hello\", \"world\"\n * }\n * ```\n */\nexport class AsyncStream<T> {\n isDone = false;\n #pendingResolves: ResolveNext<T | undefined>[] = [];\n #queue: T[];\n onDone: (() => void) | undefined;\n onReturn: (() => void) | undefined;\n\n constructor() {\n this.#queue = [];\n this.isDone = false;\n }\n\n flush() {\n while (this.#pendingResolves.length > 0) {\n const nextResolve = this.#pendingResolves.shift();\n if (nextResolve) {\n nextResolve({ done: true, value: undefined });\n }\n }\n }\n\n done() {\n this.flush();\n this.#queue = [];\n this.#pendingResolves = [];\n this.isDone = true;\n this.onDone?.();\n }\n\n push = (value: T) => {\n if (this.isDone) {\n return;\n }\n\n const nextResolve = this.#pendingResolves.shift();\n if (nextResolve) {\n nextResolve({\n done: false,\n value,\n });\n } else {\n this.#queue.push(value);\n }\n };\n\n next = (): Promise<ResolveValue<T | undefined>> => {\n if (this.isDone) {\n return Promise.resolve({ done: true, value: undefined });\n }\n\n if (this.#queue.length > 0) {\n return Promise.resolve({\n done: false,\n value: this.#queue.shift(),\n });\n }\n\n return new Promise((resolve) => {\n this.#pendingResolves.push(resolve);\n });\n };\n\n return = (): Promise<ResolveValue<T | undefined>> => {\n this.onReturn?.();\n this.done();\n\n return Promise.resolve({\n done: true,\n value: undefined,\n });\n };\n\n end = () => this.return();\n\n [Symbol.asyncIterator]() {\n return this;\n }\n}\n\nexport interface AsyncStreamProxy<T> extends AsyncIterable<T> {\n next(): Promise<ResolveValue<T>>;\n return(): Promise<ResolveValue<undefined>>;\n end(): Promise<ResolveValue<undefined>>;\n isDone: boolean;\n}\n\nconst usableProperties = [\n \"end\",\n \"isDone\",\n \"next\",\n \"return\",\n Symbol.asyncIterator,\n];\nconst isUsableProperty = <T>(\n prop: string | symbol,\n): prop is keyof AsyncStreamProxy<T> => {\n return usableProperties.includes(prop);\n};\n\n/**\n * Creates a read-only proxy for AsyncStream instances that restricts access to consumer-only methods.\n *\n * This proxy only exposes the following properties and methods:\n * - `next()`: Get the next value from the stream\n * - `end()`: Terminate the stream and stop iteration\n * - `return()`: Same as end(), terminates the stream\n * - `isDone`: Boolean indicating if the stream has been terminated\n * - `Symbol.asyncIterator`: Enables `for await` loop iteration\n *\n * Producer methods like `push()`, `done()`, and `flush()` are hidden to prevent\n * consumers from accidentally modifying the stream state.\n *\n * @param stream - The AsyncStream instance to create a proxy for\n * @returns A read-only proxy that implements AsyncStreamProxy<T>\n *\n * @example\n * ```typescript\n * const stream = new AsyncStream<string>();\n * const proxy = createAsyncStreamProxy(stream);\n *\n * stream.push(\"hello\");\n * stream.push(\"world\");\n *\n * for await (const value of proxy) {\n * console.log(value); // \"hello\", \"world\"\n * }\n * ```\n */\nexport function createAsyncStreamProxy<T>(stream: AsyncStream<T>) {\n return new Proxy(stream, {\n get(target, prop, receiver) {\n if (isUsableProperty(prop)) {\n return Reflect.get(target, prop, receiver);\n }\n },\n\n set() {\n return true;\n },\n\n has(_target, prop) {\n return isUsableProperty(prop);\n },\n\n ownKeys() {\n return usableProperties;\n },\n\n getOwnPropertyDescriptor(target, prop) {\n if (isUsableProperty(prop)) {\n return {\n enumerable: true,\n configurable: true,\n value: Reflect.get(target, prop),\n };\n }\n return undefined;\n },\n }) as AsyncStreamProxy<T>;\n}\n","const streamFailureMarker = \"\\n[XMTP_STREAM_FAILURE_V1]\";\nconst maxCursor = (1n << 64n) - 1n;\n\nexport type StreamFailureCause = {\n kind:\n | \"target_pending\"\n | \"receipt_pending\"\n | \"processing_pending\"\n | \"blocked\"\n | \"storage\"\n | \"receiver\"\n | \"invalid_topic\";\n code: string | null;\n message: string;\n retryable: boolean;\n};\n\nexport type UnfinishedStreamTopic = {\n topic: Uint8Array;\n /** Null means that target capture did not complete. */\n target: bigint | null;\n received: bigint;\n processed: bigint;\n unresolvedWelcomes: bigint[];\n inactive: boolean;\n cause: StreamFailureCause | null;\n};\n\nexport type StreamBarrierFailure = {\n reason: \"blocked\" | \"deadline\" | \"cancelled\";\n unfinished: UnfinishedStreamTopic[];\n};\n\nexport type StreamFailureDetails = {\n kind: \"barrier\" | \"published_but_unconfirmed\" | \"catch_up\";\n code: string;\n message: string;\n retryable: boolean;\n intentId: number | null;\n publishedIntentIds: number[];\n summary: {\n messages: bigint;\n conversations: bigint;\n failed: bigint;\n completed: boolean;\n } | null;\n barriers: StreamBarrierFailure[];\n};\n\n/**\n * Reads structured progress from a stream, sync, or publication error.\n * All sequence values are exact bigints. Invalid or absent details return undefined.\n * A published-but-unconfirmed error does not mean that publication failed.\n */\nexport const getStreamFailureDetails = (\n error: unknown,\n): StreamFailureDetails | undefined => {\n try {\n const message =\n typeof error === \"string\" ? error : readObject(error).message;\n if (typeof message !== \"string\") return undefined;\n const marker = message.lastIndexOf(streamFailureMarker);\n if (marker === -1) return undefined;\n const details = readObject(\n JSON.parse(message.slice(marker + streamFailureMarker.length)),\n );\n return {\n kind: readChoice(details.kind, [\n \"barrier\",\n \"published_but_unconfirmed\",\n \"catch_up\",\n ]),\n code: readString(details.code),\n message: readString(details.message),\n retryable: readBoolean(details.retryable),\n intentId: readNullable(details.intentId, readIntentId),\n publishedIntentIds: readArray(details.publishedIntentIds, readIntentId),\n summary: readNullable(details.summary, (value) => {\n const summary = readObject(value);\n return {\n messages: readCursor(summary.messages),\n conversations: readCursor(summary.conversations),\n failed: readCursor(summary.failed),\n completed: readBoolean(summary.completed),\n };\n }),\n barriers: readArray(details.barriers, readBarrier),\n };\n } catch {\n return undefined;\n }\n};\n\nconst readBarrier = (value: unknown): StreamBarrierFailure => {\n const barrier = readObject(value);\n return {\n reason: readChoice(barrier.reason, [\"blocked\", \"deadline\", \"cancelled\"]),\n unfinished: readArray(barrier.unfinished, (value) => {\n const topic = readObject(value);\n return {\n topic: readTopic(topic.topic),\n target: readNullable(topic.target, readCursor),\n received: readCursor(topic.received),\n processed: readCursor(topic.processed),\n unresolvedWelcomes: readArray(topic.unresolvedWelcomes, readCursor),\n inactive: readBoolean(topic.inactive),\n cause: readNullable(topic.cause, (value) => {\n const cause = readObject(value);\n return {\n kind: readChoice(cause.kind, [\n \"target_pending\",\n \"receipt_pending\",\n \"processing_pending\",\n \"blocked\",\n \"storage\",\n \"receiver\",\n \"invalid_topic\",\n ]),\n code: readNullable(cause.code, readString),\n message: readString(cause.message),\n retryable: readBoolean(cause.retryable),\n };\n }),\n };\n }),\n };\n};\n\nconst readObject = (value: unknown): Record<string, unknown> => {\n if (typeof value !== \"object\" || value === null || Array.isArray(value)) {\n throw new Error(\"Invalid stream failure object\");\n }\n return value as Record<string, unknown>;\n};\n\nconst readString = (value: unknown): string => {\n if (typeof value !== \"string\") throw new Error(\"Invalid stream failure text\");\n return value;\n};\n\nconst readBoolean = (value: unknown): boolean => {\n if (typeof value !== \"boolean\")\n throw new Error(\"Invalid stream failure flag\");\n return value;\n};\n\nconst readChoice = <T extends string>(\n value: unknown,\n choices: readonly T[],\n): T => {\n const choice = choices.find((choice) => choice === value);\n if (choice === undefined) throw new Error(\"Invalid stream failure kind\");\n return choice;\n};\n\nconst readNullable = <T>(\n value: unknown,\n read: (value: unknown) => T,\n): T | null => (value === null ? null : read(value));\n\nconst readArray = <T>(value: unknown, read: (value: unknown) => T): T[] => {\n if (!Array.isArray(value)) throw new Error(\"Invalid stream failure list\");\n return value.map(read);\n};\n\nconst readCursor = (value: unknown): bigint => {\n const cursor = readString(value);\n if (!/^(0|[1-9][0-9]*)$/.test(cursor)) {\n throw new Error(\"Invalid stream failure sequence\");\n }\n const number = BigInt(cursor);\n if (number > maxCursor)\n throw new Error(\"Stream failure sequence is too large\");\n return number;\n};\n\nconst readIntentId = (value: unknown): number => {\n if (\n typeof value !== \"number\" ||\n !Number.isInteger(value) ||\n value < -2147483648 ||\n value > 2147483647\n ) {\n throw new Error(\"Invalid stream failure intent ID\");\n }\n return value;\n};\n\nconst readTopic = (value: unknown): Uint8Array => {\n const hex = readString(value);\n if (!/^(?:[0-9a-fA-F]{2})*$/.test(hex)) {\n throw new Error(\"Invalid stream failure topic\");\n }\n const bytes = new Uint8Array(hex.length / 2);\n for (let index = 0; index < bytes.length; index++) {\n bytes[index] = Number.parseInt(hex.slice(index * 2, index * 2 + 2), 16);\n }\n return bytes;\n};\n","import { isPromise } from \"node:util/types\";\n\nimport type { StreamCloser } from \"@xmtp/node-bindings\";\n\nimport { AsyncStream, createAsyncStreamProxy } from \"@/AsyncStream\";\n\nimport { StreamFailedError, StreamInvalidRetryAttemptsError } from \"./errors\";\nimport { getStreamFailureDetails } from \"./streamFailure\";\n\nexport const DEFAULT_RETRY_DELAY = 60_000; // milliseconds\nexport const DEFAULT_RETRY_ATTEMPTS = 10;\n\n// Core reports exhausted network budgets and storage failures as terminal.\n// Reopening here would bypass that boundary and hide the original failure.\nconst isTerminalNativeFailure = (error: unknown) => {\n if (\n error instanceof Error &&\n /^\\[(?:LocalDeliveryError::(?:NetworkRecoveryExhausted|NetworkFailure)|(?:SubscribeError|GroupError|ClientError)::(?:Db|Storage)|GroupError::SqlKeyStore)\\]/.test(\n error.message,\n )\n )\n return true;\n return (\n getStreamFailureDetails(error)?.barriers.some((barrier) =>\n barrier.unfinished.some(\n ({ cause }) =>\n cause?.kind === \"storage\" ||\n (cause?.kind === \"receiver\" && cause.code === \"incoming_storage\"),\n ),\n ) ?? false\n );\n};\n\n/**\n * Notification streams created by createStream use the retry settings and hooks.\n * Durable message streams use onValue, onError, and onEnd. Core handles their\n * network recovery; notification retry settings and hooks do not apply.\n */\nexport type StreamOptions<T = unknown, V = T> = {\n /**\n * Called when the stream ends\n */\n onEnd?: () => void;\n /**\n * Called when a stream error occurs\n */\n onError?: (error: Error) => void;\n /**\n * Called when a notification stream fails\n */\n onFail?: () => void;\n /**\n * Called when a notification stream is restarted\n */\n onRestart?: () => void;\n /**\n * Called when a notification stream is retried\n */\n onRetry?: (attempts: number, maxAttempts: number) => void;\n /**\n * Called when a value is emitted from the stream.\n * For message streams, this selects callback mode. Do not also iterate that stream.\n * Message delivery is acknowledged after this callback returns successfully.\n */\n onValue?: (value: V) => void | Promise<void>;\n /**\n * The number of times to retry an unexpected notification stream closure.\n * Terminal native storage and network errors are not retried.\n * (default: 10)\n */\n retryAttempts?: number;\n /**\n * The delay between notification stream retries (in milliseconds)\n * (default: 60000)\n */\n retryDelay?: number;\n /**\n * Whether to retry a notification stream if it fails\n * (default: true)\n */\n retryOnFail?: boolean;\n /**\n * Whether to skip pre-sync for notification streams.\n * Durable message readers start receipt without a separate pre-sync.\n * (default: false)\n */\n disableSync?: boolean;\n};\n\nexport type StreamCallback<T = unknown> = (\n error: Error | null,\n value: T | undefined,\n) => void;\n\nexport type StreamFunction<T = unknown> = (\n callback: StreamCallback<T>,\n onFail: () => void,\n) => Promise<StreamCloser>;\n\nexport type StreamValueMutator<T = unknown, V = T> = (\n value: T,\n) => V | Promise<V>;\n\n/**\n * Creates a stream from a stream function\n *\n * Unexpected native closures can be retried. Terminal native storage and\n * network errors end the stream and reject iteration with the original cause.\n *\n * Ending the stream is terminal: no callbacks are invoked and no native\n * stream is created after the stream ends.\n *\n * This function is not intended to be used directly.\n *\n * @param streamFunction - The stream function to create a stream from\n * @param streamValueMutator - An optional function to mutate the value emitted from the stream\n * @param options - The options for the stream\n * @returns An async iterable stream proxy\n * @throws {StreamInvalidRetryAttemptsError} if the retryAttempts option is less than 0 and retryOnFail is true\n * @throws {StreamFailedError} if the stream fails and can't be restarted\n */\nexport const createStream = async <T = unknown, V = T>(\n streamFunction: StreamFunction<T>,\n streamValueMutator?: StreamValueMutator<T, V | undefined>,\n options?: StreamOptions<T, V>,\n) => {\n const {\n onEnd,\n onError,\n onFail,\n onRestart,\n onRetry,\n onValue,\n retryAttempts = DEFAULT_RETRY_ATTEMPTS,\n retryDelay = DEFAULT_RETRY_DELAY,\n retryOnFail = true,\n } = options ?? {};\n // retry attempts must be greater than 0\n if (retryOnFail && retryAttempts < 0) {\n throw new StreamInvalidRetryAttemptsError();\n }\n\n const asyncStream = new AsyncStream<V>();\n\n // lifecycle state, owned by this wrapper\n let stopped = false;\n // reading the flag through a function call defeats TS control-flow\n // narrowing, which cannot see the closure mutation across awaits\n const isStopped = () => stopped;\n let currentCloser: StreamCloser | undefined;\n let retryTimer: ReturnType<typeof setTimeout> | undefined;\n let retryInFlight = false;\n // set when a restart's native stream closes during its own creation, so the\n // completed attempt reschedules instead of installing an already-dead closer\n let closePendingDuringRestart = false;\n // read through a call so no-unnecessary-condition cannot narrow the flag to\n // a constant; handleNativeClose mutates it across an await\n const isClosePending = () => closePendingDuringRestart;\n // Core owns network recovery and its healthy reset. This separate finite\n // budget only restarts a native loop that closes without a terminal cause.\n let remainingRetries = retryAttempts;\n let generation = 0;\n let terminalError: Error | undefined;\n let lastError: Error | undefined;\n const next = asyncStream.next;\n const throwTerminalError = () => {\n if (terminalError) throw terminalError;\n };\n asyncStream.next = async () => {\n throwTerminalError();\n const value = await next();\n throwTerminalError();\n return value;\n };\n\n const reportError = (error: Error) => {\n try {\n void Promise.resolve(onError?.(error)).catch(() => undefined);\n } catch {\n // Error handlers must not throw from the native callback task.\n }\n };\n\n // terminal transition: cancel any pending retry, close the active native\n // stream, and notify onEnd exactly once\n const stop = () => {\n if (isStopped()) {\n return;\n }\n stopped = true;\n generation += 1;\n closePendingDuringRestart = false;\n if (retryTimer !== undefined) {\n clearTimeout(retryTimer);\n retryTimer = undefined;\n }\n const closer = currentCloser;\n currentCloser = undefined;\n try {\n closer?.end();\n } catch {\n // The stopped generation stays fenced if native cleanup fails.\n }\n try {\n void Promise.resolve(onEnd?.()).catch(() => undefined);\n } catch {\n // A synchronous end handler must not interrupt iterator completion.\n }\n };\n // registered before any async work so ending the stream is always terminal,\n // even while a retry is pending or a native stream is being created\n asyncStream.onDone = stop;\n\n const fail = (error: Error) => {\n if (isStopped()) {\n return;\n }\n terminalError = error;\n // Fence callbacks and close before application code opens a replacement.\n // Preserve the original cause if an end handler fails.\n try {\n void asyncStream.end().catch(() => undefined);\n } catch {\n // stop() has already fenced this generation.\n }\n reportError(error);\n };\n\n const handleAsyncError = (error: unknown) => {\n if (!isStopped()) {\n if (isTerminalNativeFailure(error)) fail(error as Error);\n else reportError(error as Error);\n }\n };\n\n const streamCallback = (\n error: Error | null,\n value: T | undefined,\n isCurrent: () => boolean,\n ) => {\n // An ended or replaced native stream cannot invoke callbacks.\n if (!isCurrent()) {\n return;\n }\n // if a stream error occurs, call the onError callback\n if (error) {\n lastError = error;\n if (isTerminalNativeFailure(error)) fail(error);\n else reportError(error);\n return;\n }\n // ensure the value is not undefined\n if (value !== undefined) {\n try {\n // if a streamValueMutator is provided, mutate the value\n if (streamValueMutator) {\n const mutatedValue = streamValueMutator(value);\n if (isPromise(mutatedValue)) {\n void mutatedValue\n .then((mutatedValue) => {\n // the stream may have ended while the value was mutating\n if (isCurrent() && mutatedValue !== undefined) {\n asyncStream.push(mutatedValue);\n return onValue?.(mutatedValue);\n }\n })\n .catch((error: unknown) => {\n if (isCurrent()) handleAsyncError(error);\n });\n } else {\n // a synchronous mutator may have ended the stream; gate delivery\n // on the stopped flag to match the async branch above\n if (isCurrent() && mutatedValue !== undefined) {\n asyncStream.push(mutatedValue);\n void Promise.resolve(onValue?.(mutatedValue)).catch(\n (error: unknown) => {\n if (isCurrent()) handleAsyncError(error);\n },\n );\n }\n }\n } else {\n asyncStream.push(value as unknown as V);\n void Promise.resolve(onValue?.(value as unknown as V)).catch(\n (error: unknown) => {\n if (isCurrent()) handleAsyncError(error);\n },\n );\n }\n } catch (error) {\n handleAsyncError(error);\n }\n }\n };\n\n const scheduleRetry = () => {\n // at most one retry may be in flight per wrapper\n if (isStopped() || retryInFlight) {\n return;\n }\n if (remainingRetries <= 0) {\n const error = new StreamFailedError(retryAttempts);\n error.cause = lastError;\n fail(error);\n return;\n }\n retryInFlight = true;\n retryTimer = setTimeout(() => {\n retryTimer = undefined;\n void attemptRestart();\n }, retryDelay);\n };\n\n const attemptRestart = async () => {\n if (isStopped()) {\n retryInFlight = false;\n return;\n }\n // scope the pending-close flag to this attempt: a close recorded while the\n // retry timer was merely pending belongs to the stream that scheduled it\n closePendingDuringRestart = false;\n remainingRetries -= 1;\n onRetry?.(retryAttempts - remainingRetries, retryAttempts);\n if (isStopped()) {\n // onRetry may have ended the stream; do not open a native stream after\n // termination\n retryInFlight = false;\n return;\n }\n try {\n // attempt to restart the stream\n const streamCloser = await openNative();\n if (isStopped()) {\n // the stream ended while the native stream was being created\n streamCloser.end();\n retryInFlight = false;\n return;\n }\n await streamCloser.waitForReady();\n if (isStopped()) {\n streamCloser.end();\n retryInFlight = false;\n return;\n }\n if (isClosePending()) {\n // the replacement stream closed during its own creation; discard it\n // and schedule a fresh attempt instead of installing a dead closer\n closePendingDuringRestart = false;\n streamCloser.end();\n retryInFlight = false;\n scheduleRetry();\n return;\n }\n currentCloser = streamCloser;\n retryInFlight = false;\n // stream restarted, call the onRestart callback\n onRestart?.();\n } catch (error) {\n retryInFlight = false;\n if (isStopped()) {\n return;\n }\n closePendingDuringRestart = false;\n lastError = error as Error;\n if (isTerminalNativeFailure(lastError)) fail(lastError);\n else {\n reportError(lastError);\n scheduleRetry();\n }\n }\n };\n\n const handleNativeClose = () => {\n // ending the stream closes the native stream, which still triggers this\n // callback; only an unexpected close is a failure\n if (isStopped()) {\n return;\n }\n currentCloser = undefined;\n onFail?.();\n if (retryOnFail) {\n // a native close during an in-flight restart is dropped by the\n // single-flight guard; record it so the completed attempt reschedules\n // instead of installing a stream that already died\n if (retryInFlight) {\n closePendingDuringRestart = true;\n return;\n }\n scheduleRetry();\n } else {\n fail(new StreamFailedError(0));\n }\n };\n\n const openNative = () => {\n const openedGeneration = ++generation;\n const isCurrent = () => !isStopped() && openedGeneration === generation;\n return streamFunction(\n (error, value) => {\n streamCallback(error, value, isCurrent);\n },\n () => {\n if (openedGeneration === generation) handleNativeClose();\n },\n );\n };\n\n try {\n // create the stream\n const streamCloser = await openNative();\n if (isStopped()) {\n streamCloser.end();\n } else {\n await streamCloser.waitForReady();\n if (isStopped()) {\n streamCloser.end();\n } else {\n currentCloser = streamCloser;\n }\n }\n } catch (error) {\n lastError = error as Error;\n if (isTerminalNativeFailure(lastError)) fail(lastError);\n else if (retryOnFail) {\n reportError(lastError);\n scheduleRetry();\n } else {\n fail(lastError);\n }\n }\n\n // return a proxy for the async stream\n return createAsyncStreamProxy(asyncStream);\n};\n","import {\n ConversationType,\n type ConsentState,\n type Conversation,\n type CreateDmOptions,\n type CreateGroupOptions,\n type DeliveryCursor,\n type Identifier,\n type ListConversationsOptions,\n type Message,\n type Conversations as XmtpConversations,\n type DecodedMessage as XmtpDecodedMessage,\n} from \"@xmtp/node-bindings\";\n\nimport type { Client } from \"@/Client\";\nimport type { CodecRegistry } from \"@/CodecRegistry\";\nimport {\n assertMessageDecodedForDelivery,\n DecodedMessage,\n} from \"@/DecodedMessage\";\nimport { Dm } from \"@/Dm\";\nimport { Group } from \"@/Group\";\nimport { MessageStream, type MessageAcknowledgement } from \"@/MessageStream\";\nimport {\n createStream,\n type StreamCallback,\n type StreamOptions,\n} from \"@/utils/streams\";\n\n/**\n * Manages conversations\n *\n * This class is not intended to be initialized directly.\n */\nexport class Conversations<ContentTypes = unknown> {\n #client: Client<ContentTypes>;\n #codecRegistry: CodecRegistry;\n #conversations: XmtpConversations;\n\n /**\n * Creates a new conversations instance\n *\n * @param client - The client instance managing the conversations\n * @param codecRegistry - The codec registry instance\n * @param conversations - The underlying conversations instance\n */\n constructor(\n client: Client<ContentTypes>,\n codecRegistry: CodecRegistry,\n conversations: XmtpConversations,\n ) {\n this.#client = client;\n this.#codecRegistry = codecRegistry;\n this.#conversations = conversations;\n }\n\n get topic() {\n return `01${this.#client.installationId}`;\n }\n\n /**\n * Retrieves a conversation by its ID\n *\n * @param id - The conversation ID to look up\n * @returns The conversation if found, undefined otherwise\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n async getConversationById(id: string) {\n try {\n // getConversationById will throw if group is not found\n const group = this.#conversations.getConversationById(id);\n const metadata = await group.groupMetadata();\n switch (metadata.conversationType()) {\n case ConversationType.Group:\n return new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n group,\n );\n case ConversationType.Dm:\n return new Dm<ContentTypes>(this.#client, this.#codecRegistry, group);\n default:\n return undefined;\n }\n } catch {\n return undefined;\n }\n }\n\n /**\n * Retrieves a DM by inbox ID\n *\n * @param inboxId - The inbox ID to look up\n * @returns The DM if found, undefined otherwise\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n getDmByInboxId(inboxId: string) {\n try {\n // getDmByInboxId will throw if group is not found\n const group = this.#conversations.getDmByInboxId(inboxId);\n return new Dm<ContentTypes>(this.#client, this.#codecRegistry, group);\n } catch {\n return undefined;\n }\n }\n\n /**\n * Retrieves a DM by identifier\n *\n * @param identifier - The identifier to look up\n * @returns Promise that resolves with the DM, if found\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n async fetchDmByIdentifier(identifier: Identifier) {\n const inboxId = await this.#client.fetchInboxIdByIdentifier(identifier);\n if (!inboxId) {\n return undefined;\n }\n return this.getDmByInboxId(inboxId);\n }\n\n /**\n * Retrieves a message by its ID\n *\n * @param id - The message ID to look up\n * @returns The decoded message if found, undefined otherwise\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n getMessageById(id: string) {\n try {\n // getEnrichedMessageById will throw if message is not found\n const message = this.#conversations.getEnrichedMessageById(id);\n return new DecodedMessage<ContentTypes>(this.#codecRegistry, message);\n } catch {\n return undefined;\n }\n }\n\n /**\n * Creates a new group conversation without publishing to the network\n *\n * @param options - Optional group creation options\n * @returns The new group\n * @see https://docs.xmtp.org/sdk/conversations/#optimistically-create-a-group\n */\n createGroupOptimistic(options?: CreateGroupOptions) {\n const group = this.#conversations.createGroupOptimistic(options);\n return new Group<ContentTypes>(this.#client, this.#codecRegistry, group);\n }\n\n /**\n * Creates a new group conversation with the specified identifiers\n *\n * @param identifiers - Array of identifiers for group members\n * @param options - Optional group creation options\n * @returns The new group\n * @see https://docs.xmtp.org/sdk/conversations/#create-a-group\n */\n async createGroupWithIdentifiers(\n identifiers: Identifier[],\n options?: CreateGroupOptions,\n ) {\n const group = await this.#conversations.createGroupByIdentity(\n identifiers,\n options,\n );\n const conversation = new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n group,\n );\n return conversation;\n }\n\n /**\n * Creates a new group conversation with the specified inbox IDs\n *\n * @param inboxIds - Array of inbox IDs for group members\n * @param options - Optional group creation options\n * @returns The new group\n * @see https://docs.xmtp.org/sdk/conversations/#create-a-group\n */\n async createGroup(inboxIds: string[], options?: CreateGroupOptions) {\n const group = await this.#conversations.createGroup(inboxIds, options);\n const conversation = new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n group,\n );\n return conversation;\n }\n\n /**\n * Creates a new DM conversation with the specified identifier\n *\n * @param identifier - Identifier for the DM recipient\n * @param options - Optional DM creation options\n * @returns The new DM\n * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm\n */\n async createDmWithIdentifier(\n identifier: Identifier,\n options?: CreateDmOptions,\n ) {\n const group = await this.#conversations.createDmByIdentity(\n identifier,\n options,\n );\n const conversation = new Dm<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n group,\n );\n return conversation;\n }\n\n /**\n * Creates a new DM conversation with the specified inbox ID\n *\n * @param inboxId - Inbox ID for the DM recipient\n * @param options - Optional DM creation options\n * @returns The new DM\n * @see https://docs.xmtp.org/sdk/conversations/#create-a-dm\n */\n async createDm(inboxId: string, options?: CreateDmOptions) {\n const group = await this.#conversations.createDm(inboxId, options);\n const conversation = new Dm<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n group,\n );\n return conversation;\n }\n\n /**\n * Lists all conversations with optional filtering\n *\n * @param options - Optional filtering and pagination options\n * @returns Array of conversations\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n async list(options?: ListConversationsOptions) {\n const groups = this.#conversations.list(options);\n const conversations = await Promise.all(\n groups.map(async (item) => {\n const metadata = await item.conversation.groupMetadata();\n const conversationType = metadata.conversationType();\n switch (conversationType) {\n case ConversationType.Dm:\n return new Dm<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n item.conversation,\n );\n case ConversationType.Group:\n return new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n item.conversation,\n );\n default:\n return undefined;\n }\n }),\n );\n return conversations.filter((conversation) => conversation !== undefined);\n }\n\n /**\n * Lists all groups with optional filtering\n *\n * @param options - Optional filtering and pagination options\n * @returns Array of groups\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n listGroups(options?: Omit<ListConversationsOptions, \"conversationType\">) {\n const groups = this.#conversations.list({\n ...options,\n conversationType: ConversationType.Group,\n });\n return groups.map((item) => {\n const conversation = new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n item.conversation,\n );\n return conversation;\n });\n }\n\n /**\n * Lists all DMs with optional filtering\n *\n * @param options - Optional filtering and pagination options\n * @returns Array of DMs\n * @see https://docs.xmtp.org/sdk/conversations/\n */\n listDms(options?: Omit<ListConversationsOptions, \"conversationType\">) {\n const groups = this.#conversations.list({\n ...options,\n conversationType: ConversationType.Dm,\n });\n return groups.map((item) => {\n const conversation = new Dm<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n item.conversation,\n );\n return conversation;\n });\n }\n\n /**\n * Synchronizes conversations for the current client from the network\n *\n * @returns Promise that resolves when sync is complete\n * @see https://docs.xmtp.org/sdk/sync/\n */\n async sync() {\n return this.#conversations.sync();\n }\n\n /**\n * Synchronizes all conversations and messages from the network with optional\n * consent state filtering\n *\n * @param consentStates - Optional array of consent states to filter by\n * @returns Promise that resolves when sync is complete\n * @see https://docs.xmtp.org/sdk/sync/\n */\n async syncAll(consentStates?: ConsentState[]) {\n return this.#conversations.syncAll(consentStates);\n }\n\n /**\n * Creates a stream for new conversations\n *\n * @param options - Optional stream options\n * @param options.conversationType - Optional conversation type to filter by\n * @returns Stream instance for new conversations\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async stream(\n options?: StreamOptions<\n Conversation,\n Group<ContentTypes> | Dm<ContentTypes> | undefined\n > & {\n conversationType?: ConversationType;\n },\n ) {\n const stream = async (\n callback: StreamCallback<Conversation>,\n onFail: () => void,\n ) => {\n if (!options?.disableSync) {\n await this.sync();\n }\n return this.#conversations.stream(\n callback,\n onFail,\n options?.conversationType,\n );\n };\n const convertConversation = async (value: Conversation) => {\n const metadata = await value.groupMetadata();\n const conversationType = metadata.conversationType();\n switch (conversationType) {\n case ConversationType.Dm:\n return new Dm<ContentTypes>(this.#client, this.#codecRegistry, value);\n case ConversationType.Group:\n return new Group<ContentTypes>(\n this.#client,\n this.#codecRegistry,\n value,\n );\n default:\n console.warn(`Unknown conversation type: ${conversationType}`);\n return undefined;\n }\n };\n\n return createStream(stream, convertConversation, options);\n }\n\n /**\n * Creates a stream for new group conversations\n *\n * @param options - Optional stream options\n * @returns Stream instance for new group conversations\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async streamGroups(\n options?: StreamOptions<Conversation, Group<ContentTypes>>,\n ) {\n const stream = async (\n callback: StreamCallback<Conversation>,\n onFail: () => void,\n ) => {\n if (!options?.disableSync) {\n await this.sync();\n }\n return this.#conversations.stream(\n callback,\n onFail,\n ConversationType.Group,\n );\n };\n const convertConversation = (value: Conversation) => {\n return new Group<ContentTypes>(this.#client, this.#codecRegistry, value);\n };\n\n return createStream(stream, convertConversation, options);\n }\n\n /**\n * Creates a stream for new DM conversations\n *\n * @param options - Optional stream options\n * @returns Stream instance for new DM conversations\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async streamDms(options?: StreamOptions<Conversation, Dm<ContentTypes>>) {\n const stream = async (\n callback: StreamCallback<Conversation>,\n onFail: () => void,\n ) => {\n if (!options?.disableSync) {\n await this.sync();\n }\n return this.#conversations.stream(callback, onFail, ConversationType.Dm);\n };\n const convertConversation = (value: Conversation) => {\n return new Dm<ContentTypes>(this.#client, this.#codecRegistry, value);\n };\n\n return createStream(stream, convertConversation, options);\n }\n\n /**\n * Reads retained messages after each group's default acknowledgement position.\n * Set `from` to replay after a cursor without changing default progress.\n * Set `onValue` for callback mode, or request items with the iterator.\n * Core owns network recovery. Legacy retry options and `disableSync` do not apply.\n *\n * @param options - Optional stream options\n * @param options.conversationType - Optional conversation type to filter by\n * @param options.consentStates - Optional array of consent states to filter by\n * @returns Stream instance for new messages\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async streamAllMessages(\n options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {\n conversationType?: ConversationType;\n consentStates?: ConsentState[];\n groupIds?: string[];\n from?: DeliveryCursor;\n },\n ) {\n const reader = await this.#conversations.messageReader(\n options?.groupIds,\n options?.conversationType,\n options?.consentStates,\n options?.from,\n );\n const convertMessage = (\n _value: Message,\n cursor: DeliveryCursor,\n acknowledgement: MessageAcknowledgement,\n ) => {\n const retained = acknowledgement.enrichedMessage();\n if (retained === null) return undefined;\n // Keep storage failures distinct from application codec failures.\n const enrichedMessage = new DecodedMessage<ContentTypes>(\n this.#codecRegistry,\n retained,\n );\n assertMessageDecodedForDelivery(enrichedMessage);\n enrichedMessage.deliveryCursor = cursor;\n return enrichedMessage;\n };\n return new MessageStream(reader, convertMessage, options);\n }\n\n messageHistorySnapshot(\n limit: number,\n options?: {\n groupIds?: string[];\n conversationType?: ConversationType;\n consentStates?: ConsentState[];\n },\n ) {\n return this.#conversations.messageHistorySnapshot(\n limit,\n options?.groupIds,\n options?.conversationType,\n options?.consentStates,\n );\n }\n\n beginningDeliveryCursor() {\n return this.#conversations.beginningDeliveryCursor();\n }\n\n /**\n * Reads retained group messages with default progress or an explicit replay cursor.\n *\n * @param options - Optional stream options\n * @param options.consentStates - Optional array of consent states to filter by\n * @returns Stream instance for new group messages\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async streamAllGroupMessages(\n options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {\n consentStates?: ConsentState[];\n groupIds?: string[];\n from?: DeliveryCursor;\n },\n ) {\n return this.streamAllMessages({\n ...options,\n conversationType: ConversationType.Group,\n consentStates: options?.consentStates,\n });\n }\n\n /**\n * Reads retained DM messages with default progress or an explicit replay cursor.\n *\n * @param options - Optional stream options\n * @param options.consentStates - Optional array of consent states to filter by\n * @returns Stream instance for new DM messages\n * @see https://docs.xmtp.org/sdk/stream/#stream-methods\n */\n async streamAllDmMessages(\n options?: StreamOptions<Message, DecodedMessage<ContentTypes>> & {\n consentStates?: ConsentState[];\n groupIds?: string[];\n from?: DeliveryCursor;\n },\n ) {\n return this.streamAllMessages({\n ...options,\n conversationType: ConversationType.Dm,\n consentStates: options?.consentStates,\n });\n }\n\n /**\n * Creates a stream for message deletions that streams the message IDs of\n * deleted messages\n *\n * This is a local stream, does not require network sync, and will not fail\n * like other streams.\n *\n * @param options - Optional stream options\n * @returns Stream instance for message deletions\n * @deprecated Use streamDeletedMessages instead\n */\n async streamMessageDeletions(\n options?: Omit<\n StreamOptions<XmtpDecodedMessage, string>,\n | \"disableSync\"\n | \"onFail\"\n | \"onRetry\"\n | \"onRestart\"\n | \"retryAttempts\"\n | \"retryDelay\"\n | \"retryOnFail\"\n >,\n ) {\n const stream = async (callback: StreamCallback<XmtpDecodedMessage>) => {\n return this.#conversations.streamMessageDeletions(callback);\n };\n const convertMessage = (value: XmtpDecodedMessage) => value.id;\n return createStream(stream, convertMessage, options);\n }\n\n /**\n * Creates a stream for message deletions that streams the deleted messages\n *\n * This is a local stream, does not require network sync, and will not fail\n * like other streams.\n *\n * @param options - Optional stream options\n * @returns Stream instance for message deletions\n */\n async streamDeletedMessages(\n options?: Omit<\n StreamOptions<XmtpDecodedMessage, DecodedMessage<ContentTypes>>,\n | \"disableSync\"\n | \"onFail\"\n | \"onRetry\"\n | \"onRestart\"\n | \"retryAttempts\"\n | \"retryDelay\"\n | \"retryOnFail\"\n >,\n ) {\n const stream = async (callback: StreamCallback<XmtpDecodedMessage>) => {\n return this.#conversations.streamMessageDeletions(callback);\n };\n const convertMessage = (value: XmtpDecodedMessage) => {\n return new DecodedMessage<ContentTypes>(this.#codecRegistry, value);\n };\n return createStream(stream, convertMessage, options);\n }\n\n /**\n * Gets the HMAC keys for all conversations\n *\n * @returns The HMAC keys for all conversations\n * @see https://docs.xmtp.org/sdk/push-notifications/\n */\n hmacKeys() {\n return this.#conversations.hmacKeys();\n }\n}\n","import type { Client } from \"@xmtp/node-bindings\";\n\n/**\n * Debug information helpers for the client\n *\n * This class is not intended to be initialized directly.\n */\nexport class DebugInformation {\n #client: Client;\n\n constructor(client: Client) {\n this.#client = client;\n }\n\n apiStatistics() {\n return this.#client.apiStatistics();\n }\n\n apiIdentityStatistics() {\n return this.#client.apiIdentityStatistics();\n }\n\n apiAggregateStatistics() {\n return this.#client.apiAggregateStatistics();\n }\n\n clearAllStatistics() {\n this.#client.clearAllStatistics();\n }\n}\n","import type {\n Client,\n Consent,\n ConsentEntityType,\n Conversations,\n UserPreferenceUpdate,\n} from \"@xmtp/node-bindings\";\n\nimport {\n createStream,\n type StreamCallback,\n type StreamOptions,\n} from \"@/utils/streams\";\n\n/**\n * Manages user preferences and consent states\n *\n * This class is not intended to be initialized directly.\n */\nexport class Preferences {\n #client: Client;\n #conversations: Conversations;\n\n /**\n * Creates a new preferences instance\n *\n * @param client - The client instance managing preferences\n * @param conversations - The underlying conversations instance\n */\n constructor(client: Client, conversations: Conversations) {\n this.#client = client;\n this.#conversations = conversations;\n }\n\n sync() {\n return this.#conversations.syncPreferences();\n }\n\n /**\n * Retrieves the current inbox state of this client from the local database\n *\n * @returns Promise that resolves with the inbox state\n */\n async inboxState() {\n return this.#client.inboxState(false);\n }\n\n /**\n * Retrieves the latest inbox state of this clientfrom the network\n *\n * @returns Promise that resolves with the inbox state\n */\n async fetchInboxState() {\n return this.#client.inboxState(true);\n }\n\n /**\n * Retrieves the current inbox states for specified inbox IDs from the local\n * database\n *\n * @param inboxIds - Array of inbox IDs to get state for\n * @returns Promise that resolves with the inbox states for the inbox IDs\n */\n async getInboxStates(inboxIds: string[]) {\n return this.#client.fetchInboxStatesByInboxIds(inboxIds, false);\n }\n\n /**\n * Retrieves the latest inbox states for specified inbox IDs from the network\n *\n * @param inboxIds - Array of inbox IDs to get state for\n * @returns Promise that resolves with the inbox states for the inbox IDs\n */\n async fetchInboxStates(inboxIds: string[]) {\n return this.#client.fetchInboxStatesByInboxIds(inboxIds, true);\n }\n\n /**\n * Updates consent states for multiple records\n *\n * @param consentStates - Array of consent records to update\n * @returns Promise that resolves when consent states are updated\n */\n async setConsentStates(consentStates: Consent[]) {\n return this.#client.setConsentStates(consentStates);\n }\n\n /**\n * Retrieves consent state for a specific entity\n *\n * @param entityType - Type of entity to get consent for\n * @param entity - Entity identifier\n * @returns Promise that resolves with the consent state\n */\n async getConsentState(entityType: ConsentEntityType, entity: string) {\n return this.#client.getConsentState(entityType, entity);\n }\n\n /**\n * Creates a stream of consent state updates\n *\n * @param options - Optional stream options\n * @returns Stream instance for consent updates\n */\n streamConsent(options?: StreamOptions<Consent[]>) {\n const streamConsent = async (\n callback: StreamCallback<Consent[]>,\n onFail: () => void,\n ) => {\n if (!options?.disableSync) {\n await this.sync();\n }\n return this.#conversations.streamConsent(callback, onFail);\n };\n return createStream(streamConsent, undefined, options);\n }\n\n /**\n * Creates a stream of user preference updates\n *\n * @param options - Optional stream options\n * @returns Stream instance for preference updates\n */\n streamPreferences(options?: StreamOptions<UserPreferenceUpdate[]>) {\n const streamPreferences = async (\n callback: StreamCallback<UserPreferenceUpdate[]>,\n onFail: () => void,\n ) => {\n if (!options?.disableSync) {\n await this.sync();\n }\n return this.#conversations.streamPreferences(callback, onFail);\n };\n return createStream(streamPreferences, undefined, options);\n }\n}\n","/**\n * Typed failures for the deployment configuration a backend publishes\n * (spec 006 §7).\n *\n * The bindings report every one of these as an `Error` whose message begins\n * with `[ClientError::<Variant>]`. Matching on that string is what this module\n * removes: each of the six documented codes becomes its own class, so an app\n * writes `error instanceof BackendMismatchError` instead of a regular\n * expression over a message that may be reworded.\n *\n * Every class keeps the binding's message and the original error as `cause`,\n * so the identifiers, versions, scopes, or chain the core reported are still\n * readable for diagnostics.\n */\n\n/**\n * Base class of the six configuration failures. Catch this to handle any of\n * them; catch a subclass to handle one.\n */\nexport class ServerConfigurationError extends Error {\n constructor(\n /** The stable code the bindings reported, e.g. `ClientError::AuthRequired`. */\n readonly code: string,\n message: string,\n options?: ErrorOptions,\n ) {\n super(message, options);\n this.name = \"ServerConfigurationError\";\n }\n}\n\n/**\n * The configuration could not be read: the deployment did not answer, answered\n * `UNIMPLEMENTED` because it predates spec 006, or the copy could not be\n * stored.\n */\nexport class ConfigurationUnavailableError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::ConfigurationUnavailable\", message, options);\n this.name = \"ConfigurationUnavailableError\";\n }\n}\n\n/**\n * The deployment answered with a configuration no client can use: an empty or\n * malformed identifier, an unparseable minimum version, or a chain that is not\n * a CAIP-2 identifier. Nothing is stored.\n */\nexport class ConfigurationInvalidError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::ConfigurationInvalid\", message, options);\n this.name = \"ConfigurationInvalidError\";\n }\n}\n\n/**\n * This database is bound to a different deployment. The identifier the backend\n * published is not the one the database was created against. Recovery is a\n * database created for the deployment the app now uses.\n */\nexport class BackendMismatchError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::BackendMismatch\", message, options);\n this.name = \"BackendMismatchError\";\n }\n}\n\n/** The deployment requires a newer libxmtp than this SDK is built on. */\nexport class ClientVersionTooOldError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::ClientVersionTooOld\", message, options);\n this.name = \"ClientVersionTooOldError\";\n }\n}\n\n/**\n * The deployment requires authentication and no credential source was\n * configured. The message carries the scopes it requires.\n */\nexport class AuthRequiredError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::AuthRequired\", message, options);\n this.name = \"AuthRequiredError\";\n }\n}\n\n/**\n * A smart contract wallet signature names a chain the deployment does not\n * verify on. Raised before any network call, and only for signatures the app\n * supplied.\n */\nexport class ChainNotAcceptedError extends ServerConfigurationError {\n constructor(message: string, options?: ErrorOptions) {\n super(\"ClientError::ChainNotAccepted\", message, options);\n this.name = \"ChainNotAcceptedError\";\n }\n}\n\nconst configurationCode = /^\\[(ClientError::[A-Za-z]+)\\]\\s*([\\s\\S]*)$/;\n\n// implements: CONF-064\nconst build = (\n code: string,\n message: string,\n options: ErrorOptions,\n): ServerConfigurationError | undefined => {\n switch (code) {\n case \"ClientError::ConfigurationUnavailable\":\n return new ConfigurationUnavailableError(message, options);\n case \"ClientError::ConfigurationInvalid\":\n return new ConfigurationInvalidError(message, options);\n case \"ClientError::BackendMismatch\":\n return new BackendMismatchError(message, options);\n case \"ClientError::ClientVersionTooOld\":\n return new ClientVersionTooOldError(message, options);\n case \"ClientError::AuthRequired\":\n return new AuthRequiredError(message, options);\n case \"ClientError::ChainNotAccepted\":\n return new ChainNotAcceptedError(message, options);\n default:\n return undefined;\n }\n};\n\n/**\n * Classifies an error from any SDK call as one of the six configuration\n * failures, or `undefined` when it is something else.\n *\n * Use this where the SDK hands back the raw error, for instance a\n * `ChainNotAcceptedError` raised deep inside a call that supplies a smart\n * contract wallet signature.\n */\nexport const toServerConfigurationError = (\n error: unknown,\n): ServerConfigurationError | undefined => {\n if (!(error instanceof Error)) return undefined;\n const match = configurationCode.exec(error.message);\n if (!match) return undefined;\n return build(match[1], match[2], { cause: error });\n};\n\n/**\n * Rethrows an error as its typed configuration failure, or unchanged when it\n * is not one.\n */\nexport const throwServerConfigurationError = (error: unknown): never => {\n throw toServerConfigurationError(error) ?? error;\n};\n","import { join } from \"node:path\";\nimport process from \"node:process\";\n\nimport {\n createClientWithBackend,\n LogLevel,\n SyncWorkerMode,\n UnstableChangeCallbacks,\n type Backend,\n type Identifier,\n type LogOptions,\n} from \"@xmtp/node-bindings\";\n\nimport type { ClientOptions } from \"@/types\";\nimport { createBackend } from \"@/utils/createBackend\";\nimport { generateInboxId, getInboxIdForIdentifier } from \"@/utils/inboxId\";\n\nimport { isHexString } from \"./validation\";\n\nconst networkOptionKeys = [\n \"env\",\n \"backendUrl\",\n \"appVersion\",\n \"authCallback\",\n] as const;\n\nconst hasBackend = (\n options: ClientOptions,\n): options is { backend: Backend } & ClientOptions => {\n return \"backend\" in options;\n};\n\nconst resolveBackend = async (options?: ClientOptions): Promise<Backend> => {\n if (!options) {\n throw new Error(\"backendUrl is required\");\n }\n\n if (hasBackend(options)) {\n // Validate that no NetworkOptions fields are also set\n const conflicting = networkOptionKeys.filter(\n (key) =>\n key in options && (options as Record<string, unknown>)[key] != null,\n );\n if (conflicting.length > 0) {\n throw new Error(\n `Cannot specify both 'backend' and network options (${conflicting.join(\", \")}). ` +\n `Use either a pre-built Backend or network options, not both.`,\n );\n }\n return options.backend;\n }\n\n // No backend provided — build one from NetworkOptions\n return createBackend(options);\n};\n\nexport const createClient = async (\n identifier: Identifier,\n options?: ClientOptions,\n) => {\n const backend = await resolveBackend(options);\n\n const inboxId =\n (await getInboxIdForIdentifier(backend, identifier)) ||\n generateInboxId(identifier, options?.nonce);\n\n const env = backend.env ?? \"default\";\n // `env` only labels the database file, so it must stay one path component.\n // Without this a value such as \"../other\" would move the database outside\n // the working directory.\n if (env === \"\" || /[/\\\\]/.test(env) || env === \".\" || env === \"..\") {\n throw new Error(\"env must be a single path component\");\n }\n\n let dbPath: string | null;\n if (options?.dbPath === undefined) {\n // Default: auto-generated path\n dbPath = join(process.cwd(), `xmtp-${env}-${inboxId}.db3`);\n } else if (typeof options.dbPath === \"function\") {\n // Callback function: call with inbox ID\n dbPath = options.dbPath(inboxId);\n } else {\n // String or null: use as-is\n dbPath = options.dbPath;\n }\n\n const logOptions: LogOptions = {\n structured: options?.structuredLogging ?? false,\n level: options?.loggingLevel ?? LogLevel.Off,\n stdoutLevel: options?.stdoutLoggingLevel,\n otelEndpoint: options?.otelEndpoint,\n otelServiceName: options?.otelServiceName,\n otelSampleRatio: options?.otelSampleRatio,\n resourceAttributes: options?.resourceAttributes,\n };\n const deviceSyncWorkerMode = options?.disableDeviceSync\n ? SyncWorkerMode.Disabled\n : SyncWorkerMode.Enabled;\n\n const dbEncryptionKey = isHexString(options?.dbEncryptionKey)\n ? Buffer.from(options.dbEncryptionKey.replace(/^0x/, \"\"), \"hex\")\n : options?.dbEncryptionKey;\n\n // Only build the registry when something is actually registered — an empty\n // one would make the core snapshot app_data on every processed message.\n const changeCallbacks = options?.unstableChangeCallbacks?.appData\n ? new UnstableChangeCallbacks(options.unstableChangeCallbacks.appData)\n : undefined;\n\n const client = await createClientWithBackend(\n backend,\n {\n dbPath: dbPath ?? undefined,\n encryptionKey: dbEncryptionKey,\n maxDbPoolSize: options?.maxDbPoolSize,\n minDbPoolSize: options?.minDbPoolSize,\n useSingleConnection: options?.useSingleConnection,\n },\n inboxId,\n identifier,\n deviceSyncWorkerMode,\n options?.workerConfig,\n logOptions,\n undefined, // allowOffline\n options?.nonce,\n changeCallbacks,\n );\n\n return { client, env };\n};\n","import { randomBytes } from \"node:crypto\";\n\nimport { type ContentCodec } from \"@xmtp/content-type-primitives\";\nimport {\n applySignatureRequest,\n Backend,\n BackupElementSelectionOption,\n fetchInboxStatesByInboxIds,\n fetchServerConfiguration as fetchServerConfigurationBinding,\n IdentifierKind,\n isAddressAuthorized as isAddressAuthorizedBinding,\n isInstallationAuthorized as isInstallationAuthorizedBinding,\n revokeInstallationsSignatureRequest,\n verifySignedWithPublicKey as verifySignedWithPublicKeyBinding,\n type ArchiveMetadata,\n type ArchiveOptions,\n type GroupSyncSummary,\n type Identifier,\n type Client as NodeClient,\n type ServerConfiguration,\n type SignatureRequestHandle,\n} from \"@xmtp/node-bindings\";\n\nimport { CodecRegistry } from \"@/CodecRegistry\";\nimport { Conversations } from \"@/Conversations\";\nimport { DebugInformation } from \"@/DebugInformation\";\nimport {\n throwNotificationError,\n toBindingNotificationConfig,\n toNotificationState,\n type NotificationConfig,\n type NotificationState,\n} from \"@/Notifications\";\nimport { Preferences } from \"@/Preferences\";\nimport { throwServerConfigurationError } from \"@/ServerConfiguration\";\nimport type {\n ClientOptions,\n DistributiveOmit,\n ExtractCodecContentTypes,\n NetworkOptions,\n} from \"@/types\";\nimport { createBackend } from \"@/utils/createBackend\";\nimport { createClient } from \"@/utils/createClient\";\nimport {\n AccountAlreadyAssociatedError,\n ClientNotInitializedError,\n InboxReassignError,\n SignerUnavailableError,\n} from \"@/utils/errors\";\nimport { getInboxIdForIdentifier } from \"@/utils/inboxId\";\nimport { type Signer } from \"@/utils/signer\";\n\n/** Resolve a backend from explicit network options or an existing backend. */\nconst resolveBackend = async (\n optionsOrBackend: NetworkOptions | Backend,\n): Promise<Backend> => {\n if (optionsOrBackend instanceof Backend) {\n return optionsOrBackend;\n }\n return createBackend(optionsOrBackend);\n};\n\n/**\n * Read a backend URL and app version from a bare URL, network options, or an\n * existing backend. `fetchServerConfiguration` builds no backend of its own,\n * so it needs the two values rather than a `Backend`.\n */\nconst resolveEndpoint = (\n target: string | NetworkOptions | Backend,\n): { backendUrl: string; appVersion?: string } =>\n typeof target === \"string\"\n ? { backendUrl: target }\n : { backendUrl: target.backendUrl, appVersion: target.appVersion };\n\nconst createEphemeralIdentifier = (): Identifier => ({\n identifier: `0x${randomBytes(20).toString(\"hex\")}`,\n identifierKind: IdentifierKind.Ethereum,\n});\n\nconst toInboxUpdatesCountMap = (\n value: Map<string, number> | Record<string, number>,\n) => {\n if (value instanceof Map) {\n return value;\n }\n\n return new Map(Object.entries(value));\n};\n\n/**\n * Client for interacting with the XMTP network\n */\nexport class Client<ContentTypes = ExtractCodecContentTypes> {\n #client?: NodeClient;\n #codecRegistry: CodecRegistry;\n #conversations?: Conversations<ContentTypes>;\n #debugInformation?: DebugInformation;\n #env?: string;\n #preferences?: Preferences;\n #signer?: Signer;\n #identifier?: Identifier;\n #options?: ClientOptions;\n\n /**\n * Creates a new XMTP client instance\n *\n * This class is not intended to be initialized directly.\n * Use `Client.create` or `Client.build` instead.\n *\n * @param options - Optional configuration for the client\n */\n constructor(options?: ClientOptions) {\n this.#options = options;\n this.#codecRegistry = new CodecRegistry([...(options?.codecs ?? [])]);\n }\n\n /**\n * Initializes the client with the provided identifier\n *\n * This is not meant to be called directly.\n * Use `Client.create` or `Client.build` instead.\n *\n * @param identifier - The identifier to initialize the client with\n */\n async init(identifier: Identifier) {\n if (this.#client) {\n return;\n }\n\n this.#identifier = identifier;\n // A build resolves the deployment configuration before any identity work,\n // so its six configuration failures surface here as distinct types.\n const { client, env } = await createClient(identifier, this.#options).catch(\n throwServerConfigurationError,\n );\n this.#client = client;\n this.#env = env;\n const conversations = this.#client.conversations();\n this.#conversations = new Conversations(\n this,\n this.#codecRegistry,\n conversations,\n );\n this.#debugInformation = new DebugInformation(this.#client);\n this.#preferences = new Preferences(this.#client, conversations);\n }\n\n /**\n * Creates a new client instance with a signer\n *\n * @param signer - The signer to use for authentication\n * @param options - Optional configuration for the client\n * @returns A new client instance\n */\n static async create<ContentCodecs extends ContentCodec[] = []>(\n signer: Signer,\n options: DistributiveOmit<ClientOptions, \"codecs\"> & {\n codecs?: ContentCodecs;\n },\n ) {\n const identifier = await signer.getIdentifier();\n const client = new Client<ExtractCodecContentTypes<ContentCodecs>>(options);\n client.#signer = signer;\n await client.init(identifier);\n\n if (!options.disableAutoRegister) {\n await client.register();\n }\n\n return client;\n }\n\n /**\n * Creates a new client instance with an identifier\n *\n * Clients created with this method must already be registered.\n * Any methods called that require a signer will throw an error.\n *\n * @param identifier - The identifier to use\n * @param options - Optional configuration for the client\n * @returns A new client instance\n */\n static async build<ContentCodecs extends ContentCodec[] = []>(\n identifier: Identifier,\n options: DistributiveOmit<ClientOptions, \"codecs\"> & {\n codecs?: ContentCodecs;\n },\n ) {\n const client = new Client<ExtractCodecContentTypes<ContentCodecs>>({\n ...options,\n disableAutoRegister: true,\n });\n await client.init(identifier);\n return client;\n }\n\n /**\n * Gets the version of libxmtp used in the bindings\n */\n get libxmtpVersion() {\n return this.#client?.libxmtpVersion();\n }\n\n /**\n * Gets the app version used by the client\n */\n get appVersion() {\n return this.#client?.appVersion();\n }\n\n /**\n * Gets the label used for the default database file name\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n get env(): string {\n if (this.#env === undefined) {\n throw new ClientNotInitializedError();\n }\n return this.#env;\n }\n\n /**\n * Gets the client options\n */\n get options() {\n return this.#options;\n }\n\n /**\n * Gets the signer associated with this client\n */\n get signer() {\n return this.#signer;\n }\n\n /**\n * Gets the account identifier for this client\n */\n get accountIdentifier() {\n return this.#identifier;\n }\n\n /**\n * Gets the inbox ID associated with this client\n */\n get inboxId() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n return this.#client.inboxId();\n }\n\n /**\n * Gets the installation ID for this client\n */\n get installationId() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n return this.#client.installationId();\n }\n\n /**\n * Gets the installation ID bytes for this client\n */\n get installationIdBytes() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n return this.#client.installationIdBytes();\n }\n\n /**\n * Gets whether the client is registered with the XMTP network\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n get isRegistered() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n return this.#client.isRegistered();\n }\n\n /**\n * Gets the conversations manager for this client\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n get conversations() {\n if (!this.#conversations) {\n throw new ClientNotInitializedError();\n }\n return this.#conversations;\n }\n\n /**\n * Gets the debug information helpersfor this client\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n get debugInformation() {\n if (!this.#debugInformation) {\n throw new ClientNotInitializedError();\n }\n return this.#debugInformation;\n }\n\n /**\n * Gets the preferences manager for this client\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n get preferences() {\n if (!this.#preferences) {\n throw new ClientNotInitializedError();\n }\n return this.#preferences;\n }\n\n /**\n * Cleanly shuts down the client: cancels in-flight workers and detached\n * streams, then releases the database connection.\n *\n * This is idempotent — calling it more than once resolves without error.\n * Await this before deleting the database file or dropping the client\n * reference to avoid log noise from background tasks running against a\n * closed database.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @returns Promise that resolves when the client has shut down\n */\n async close() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n return this.#client.close();\n }\n\n /**\n * Adds a signature to a signature request using the client's signer (or the\n * provided signer)\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `register`, `unsafe_addAccount`,\n * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`\n * methods instead.\n *\n * @param signatureRequest - The signature request to add the signature to\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async unsafe_addSignature(\n signatureRequest: SignatureRequestHandle,\n signer?: Signer,\n ) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n if (!this.#signer) {\n throw new SignerUnavailableError();\n }\n\n const finalSigner = signer ?? this.#signer;\n const signature = await finalSigner.signMessage(\n await signatureRequest.signatureText(),\n );\n const identifier = await finalSigner.getIdentifier();\n\n switch (finalSigner.type) {\n case \"SCW\":\n // The deployment publishes the chains it verifies on, so a signature\n // for any other chain is rejected here, before any network call.\n await signatureRequest\n .addScwSignature(\n identifier,\n signature,\n finalSigner.getChainId(),\n finalSigner.getBlockNumber?.(),\n )\n .catch(throwServerConfigurationError);\n break;\n case \"EOA\":\n await signatureRequest.addEcdsaSignature(signature);\n break;\n }\n }\n\n /**\n * Returns a signature request handler for creating a new inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `register` method instead.\n *\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_createInboxSignatureRequest() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.createInboxSignatureRequest();\n }\n\n /**\n * Returns a signature request handler for adding a new account to the\n * client's inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `unsafe_addAccount` method instead.\n *\n * The `allowInboxReassign` parameter must be true or this function will\n * throw an error.\n *\n * @param newAccountIdentifier - The identifier of the new account\n * @param allowInboxReassign - Whether to allow inbox reassignment\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_addAccountSignatureRequest(\n newAccountIdentifier: Identifier,\n allowInboxReassign: boolean = false,\n ) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n if (!allowInboxReassign) {\n throw new InboxReassignError();\n }\n\n return this.#client.addIdentifierSignatureRequest(newAccountIdentifier);\n }\n\n /**\n * Returns a signature request handler for removing an account from the\n * client's inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `removeAccount` method instead.\n *\n * @param identifier - The identifier of the account to remove\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_removeAccountSignatureRequest(identifier: Identifier) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.revokeIdentifierSignatureRequest(identifier);\n }\n\n /**\n * Returns a signature request handler for revoking all other installations\n * of the client's inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `revokeAllOtherInstallations` method instead.\n *\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_revokeAllOtherInstallationsSignatureRequest() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.revokeAllOtherInstallationsSignatureRequest();\n }\n\n /**\n * Returns a signature request handler for revoking specific installations\n * of the client's inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `revokeInstallations` method instead.\n *\n * @param installationIds - The installation IDs to revoke\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_revokeInstallationsSignatureRequest(\n installationIds: Uint8Array[],\n ) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.revokeInstallationsSignatureRequest(installationIds);\n }\n\n /**\n * Returns a signature request handler for changing the recovery identifier\n * for this client's inbox\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `changeRecoveryIdentifier` method instead.\n *\n * @param identifier - The new recovery identifier\n * @returns The signature text\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_changeRecoveryIdentifierSignatureRequest(\n identifier: Identifier,\n ) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.changeRecoveryIdentifierSignatureRequest(identifier);\n }\n\n /**\n * Applies a signature request to the client\n *\n * WARNING: This function should be used with caution. It is only provided\n * for use in special cases where the provided workflows do not meet the\n * requirements of an application.\n *\n * It is highly recommended to use the `register`, `unsafe_addAccount`,\n * `removeAccount`, `revokeAllOtherInstallations`, or `revokeInstallations`\n * methods instead.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async unsafe_applySignatureRequest(signatureRequest: SignatureRequestHandle) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.applySignatureRequest(signatureRequest);\n }\n\n /**\n * Registers the client with the XMTP network\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async register() {\n const signatureRequest = await this.unsafe_createInboxSignatureRequest();\n if (!signatureRequest) {\n return;\n }\n\n await this.unsafe_addSignature(signatureRequest);\n await this.#client?.registerIdentity(\n signatureRequest,\n this.#options?.waitForRegistrationVisible,\n );\n }\n\n /**\n * Adds a new account to the client inbox\n *\n * WARNING: This function should be used with caution. Adding a wallet already\n * associated with an inbox ID will cause the wallet to lose access to\n * that inbox.\n *\n * The `allowInboxReassign` parameter must be true to reassign an inbox\n * already associated with a different account.\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @param newAccountSigner - The signer for the new account\n * @param allowInboxReassign - Whether to allow inbox reassignment\n * @throws {AccountAlreadyAssociatedError} if the account is already associated with an inbox ID\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async unsafe_addAccount(\n newAccountSigner: Signer,\n allowInboxReassign: boolean = false,\n ) {\n // check for existing inbox id\n const identifier = await newAccountSigner.getIdentifier();\n const existingInboxId = await this.fetchInboxIdByIdentifier(identifier);\n\n if (existingInboxId && !allowInboxReassign) {\n throw new AccountAlreadyAssociatedError(existingInboxId);\n }\n\n const signatureRequest = await this.unsafe_addAccountSignatureRequest(\n identifier,\n allowInboxReassign,\n );\n\n await this.unsafe_addSignature(signatureRequest, newAccountSigner);\n await this.unsafe_applySignatureRequest(signatureRequest);\n }\n\n /**\n * Removes an account from the client's inbox\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @param identifier - The identifier of the account to remove\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async removeAccount(identifier: Identifier) {\n const signatureRequest =\n await this.unsafe_removeAccountSignatureRequest(identifier);\n\n await this.unsafe_addSignature(signatureRequest);\n await this.unsafe_applySignatureRequest(signatureRequest);\n }\n\n /**\n * Revokes all other installations of the client's inbox\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async revokeAllOtherInstallations() {\n const signatureRequest =\n await this.unsafe_revokeAllOtherInstallationsSignatureRequest();\n\n // no other installations to revoke\n if (!signatureRequest) {\n return;\n }\n\n await this.unsafe_addSignature(signatureRequest);\n await this.unsafe_applySignatureRequest(signatureRequest);\n }\n\n /**\n * Revokes specific installations of the client's inbox\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @param installationIds - The installation IDs to revoke\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async revokeInstallations(installationIds: Uint8Array[]) {\n const signatureRequest =\n await this.unsafe_revokeInstallationsSignatureRequest(installationIds);\n\n await this.unsafe_addSignature(signatureRequest);\n await this.unsafe_applySignatureRequest(signatureRequest);\n }\n\n /** Revoke installations with an explicit backend or network options. */\n static async revokeInstallations(\n signer: Signer,\n inboxId: string,\n installationIds: Uint8Array[],\n optionsOrBackend: NetworkOptions | Backend,\n ) {\n const backend = await resolveBackend(optionsOrBackend);\n const identifier = await signer.getIdentifier();\n const signatureRequest = await revokeInstallationsSignatureRequest(\n backend,\n identifier,\n inboxId,\n installationIds,\n );\n const signatureText = await signatureRequest.signatureText();\n const signature = await signer.signMessage(signatureText);\n\n switch (signer.type) {\n case \"SCW\":\n // Same chain restriction as the instance path: the deployment's\n // accepted chains reject any other one here, before the network call.\n await signatureRequest\n .addScwSignature(\n identifier,\n signature,\n signer.getChainId(),\n signer.getBlockNumber?.(),\n )\n .catch(throwServerConfigurationError);\n break;\n case \"EOA\":\n await signatureRequest.addEcdsaSignature(signature);\n break;\n }\n\n await applySignatureRequest(backend, signatureRequest);\n }\n\n /**\n * Changes the recovery identifier for the client's inbox\n *\n * Requires a signer, use `Client.create` to create a client with a signer.\n *\n * @param identifier - The new recovery identifier\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {SignerUnavailableError} if no signer is available\n */\n async changeRecoveryIdentifier(identifier: Identifier) {\n const signatureRequest =\n await this.unsafe_changeRecoveryIdentifierSignatureRequest(identifier);\n\n await this.unsafe_addSignature(signatureRequest);\n await this.unsafe_applySignatureRequest(signatureRequest);\n }\n\n /**\n * Checks if the client can message the specified identifiers\n *\n * @param identifiers - The identifiers to check\n * @returns Whether the client can message the identifiers\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async canMessage(identifiers: Identifier[]) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n const canMessage = await this.#client.canMessage(identifiers);\n return new Map(Object.entries(canMessage));\n }\n\n /**\n * Fetches the latest inbox updates count for the specified inbox IDs\n *\n * @param inboxIds - The inbox IDs to check\n * @returns Map of inbox IDs to their updates count\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async fetchLatestInboxUpdatesCount(inboxIds: string[]) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n const result = await this.#client.fetchInboxUpdatesCount(inboxIds, true);\n\n return toInboxUpdatesCountMap(result);\n }\n\n /**\n * Fetches the latest inbox updates count for the client's inbox\n *\n * @returns The latest inbox updates count\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async fetchOwnInboxUpdatesCount() {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.fetchOwnInboxUpdatesCount(true);\n }\n\n /**\n * Fetches the key package statuses from the network for the specified\n * installation IDs\n *\n * @param installationIds - The installation IDs to check\n * @returns The key package statuses\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async fetchKeyPackageStatuses(installationIds: string[]) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.fetchKeyPackageStatusesByInstallationIds(\n installationIds,\n );\n }\n\n /**\n * Fetches the inbox ID for a given identifier from the local database\n * If not found, fetches from the network\n *\n * @param identifier - The identifier to look up\n * @returns The inbox ID, if found\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n async fetchInboxIdByIdentifier(identifier: Identifier) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.getInboxIdByIdentity(identifier);\n }\n\n /**\n * Signs a message with the installation key\n *\n * @param signatureText - The text to sign\n * @returns The signature\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n signWithInstallationKey(signatureText: string) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.signWithInstallationKey(signatureText);\n }\n\n /**\n * Verifies a signature was made with the installation key\n *\n * @param signatureText - The text that was signed\n * @param signatureBytes - The signature bytes to verify\n * @returns Whether the signature is valid\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n verifySignedWithInstallationKey(\n signatureText: string,\n signatureBytes: Uint8Array,\n ) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n try {\n this.#client.verifySignedWithInstallationKey(\n signatureText,\n signatureBytes,\n );\n return true;\n } catch {\n return false;\n }\n }\n\n /** Fetch inbox states with an explicit backend or network options. */\n static async fetchInboxStates(\n inboxIds: string[],\n optionsOrBackend: NetworkOptions | Backend,\n ) {\n const backend = await resolveBackend(optionsOrBackend);\n return fetchInboxStatesByInboxIds(backend, inboxIds);\n }\n\n /** Fetch inbox update counts with an explicit backend or network options. */\n static async fetchLatestInboxUpdatesCount(\n inboxIds: string[],\n optionsOrBackend: NetworkOptions | Backend,\n ) {\n const backend = await resolveBackend(optionsOrBackend);\n // The node-bindings Client is a napi-rs class with no explicit close/free\n // method. Release is non-deterministic: once this reference goes out of\n // scope, JS GC will eventually invoke the Rust Drop impl and reclaim the\n // underlying resources. If this becomes a bottleneck, switch to an\n // explicit disposal API if/when the bindings expose one.\n const { client } = await createClient(createEphemeralIdentifier(), {\n backend,\n dbPath: null,\n disableDeviceSync: true,\n });\n const result = await client.fetchInboxUpdatesCount(inboxIds, true);\n\n return toInboxUpdatesCountMap(result);\n }\n\n /** Check identifiers with an explicit backend or network options. */\n static async canMessage(\n identifiers: Identifier[],\n optionsOrBackend: NetworkOptions | Backend,\n ) {\n const backend = await resolveBackend(optionsOrBackend);\n const canMessageMap = new Map<string, boolean>();\n for (const identifier of identifiers) {\n const inboxId = await getInboxIdForIdentifier(backend, identifier);\n canMessageMap.set(identifier.identifier.toLowerCase(), inboxId !== null);\n }\n return canMessageMap;\n }\n\n /**\n * Verifies a signature was made with a public key\n *\n * @param signatureText - The text that was signed\n * @param signatureBytes - The signature bytes to verify\n * @param publicKey - The public key to verify against\n * @returns Whether the signature is valid\n */\n static verifySignedWithPublicKey(\n signatureText: string,\n signatureBytes: Uint8Array,\n publicKey: Uint8Array,\n ) {\n try {\n verifySignedWithPublicKeyBinding(\n signatureText,\n signatureBytes,\n publicKey,\n );\n return true;\n } catch {\n return false;\n }\n }\n\n /** Check address authorization with an explicit backend or network options. */\n static async isAddressAuthorized(\n inboxId: string,\n address: string,\n optionsOrBackend: NetworkOptions | Backend,\n ): Promise<boolean> {\n const backend = await resolveBackend(optionsOrBackend);\n return await isAddressAuthorizedBinding(backend, inboxId, address);\n }\n\n /** Check installation authorization with an explicit backend or network options. */\n static async isInstallationAuthorized(\n inboxId: string,\n installation: Uint8Array,\n optionsOrBackend: NetworkOptions | Backend,\n ): Promise<boolean> {\n const backend = await resolveBackend(optionsOrBackend);\n return await isInstallationAuthorizedBinding(\n backend,\n inboxId,\n installation,\n );\n }\n\n /**\n * Get the default archive options (consent and messages)\n */\n #getDefaultArchiveOptions(): ArchiveOptions {\n return {\n elements: [\n BackupElementSelectionOption.Consent,\n BackupElementSelectionOption.Messages,\n ],\n excludeDisappearingMessages: false,\n };\n }\n\n /**\n * Archive application elements to file for later restoration\n *\n * @param path - The file path to save the archive\n * @param key - Encryption key for the archive\n * @param opts - Archive options specifying what to include (defaults to consent and messages)\n * @returns Promise that resolves when the archive is created\n */\n async createArchive(path: string, key: Uint8Array, opts?: ArchiveOptions) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n const resolvedOpts = opts ?? this.#getDefaultArchiveOptions();\n\n return this.#client.deviceSync().createArchive(path, resolvedOpts, key);\n }\n\n /**\n * Import a previous archive from a file\n *\n * @param path - The file path to the archive\n * @param key - Encryption key for the archive\n * @returns Promise that resolves when the archive is imported\n */\n async importArchive(path: string, key: Uint8Array) {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.deviceSync().importArchive(path, key);\n }\n\n /**\n * Load the metadata for an archive to see what it contains\n *\n * Reads only the metadata without loading the entire file, so this function is quick.\n *\n * @param path - The file path to the archive\n * @param key - Encryption key for the archive\n * @returns Promise that resolves with the archive metadata\n */\n async archiveMetadata(\n path: string,\n key: Uint8Array,\n ): Promise<ArchiveMetadata> {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.deviceSync().archiveMetadata(path, key);\n }\n\n /**\n * Manually sync all device sync groups\n *\n * @returns Promise that resolves with a summary of the sync operation\n */\n async syncAllDeviceSyncGroups(): Promise<GroupSyncSummary> {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.deviceSync().syncAllDeviceSyncGroups();\n }\n\n /** Enable notifications and register the delivery channel. */\n async enableNotifications(\n config: NotificationConfig,\n ): Promise<NotificationState> {\n if (!this.#client) throw new ClientNotInitializedError();\n try {\n return toNotificationState(\n await this.#client.enableNotifications(\n toBindingNotificationConfig(config),\n ),\n );\n } catch (error) {\n return throwNotificationError(error);\n }\n }\n\n /** Disable notifications. Per-conversation overrides remain stored. */\n async disableNotifications(): Promise<void> {\n if (!this.#client) throw new ClientNotInitializedError();\n try {\n await this.#client.disableNotifications();\n } catch (error) {\n throwNotificationError(error);\n }\n }\n\n /** Read the local state without a backend request. */\n notificationState(): Promise<NotificationState> {\n return Promise.resolve().then(() => {\n if (!this.#client) throw new ClientNotInitializedError();\n return toNotificationState(this.#client.notificationState());\n });\n }\n\n /**\n * What the deployment published about itself, as this client resolved it\n * when it was built.\n *\n * Reads memory and makes no backend request. The value never changes for the\n * life of the client: a background refresh rewrites the stored copy, and a\n * new value takes effect at the next build.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n */\n serverConfiguration(): ServerConfiguration {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client.serverConfiguration();\n }\n\n /**\n * Fetch the deployment configuration now, rewrite the stored copy, and\n * return what was fetched.\n *\n * The snapshot this client holds is unchanged; use it to observe a change an\n * operator has made without restarting.\n *\n * @throws {ClientNotInitializedError} if the client is not initialized\n * @throws {ConfigurationUnavailableError} if the deployment did not answer\n * @throws {ConfigurationInvalidError} if it published an unusable configuration\n * @throws {BackendMismatchError} if it published a different identifier\n * @throws {ClientVersionTooOldError} if it now requires a newer libxmtp\n */\n async refreshServerConfiguration(): Promise<ServerConfiguration> {\n if (!this.#client) {\n throw new ClientNotInitializedError();\n }\n\n return this.#client\n .refreshServerConfiguration()\n .catch(throwServerConfigurationError);\n }\n\n /**\n * Read what a deployment publishes about itself with no database, no client,\n * and no credential.\n *\n * Lets an app learn `auth.enabled`, `auth.requiredScopes`, and the accepted\n * smart contract wallet chains before it decides how to build a client.\n * Nothing is stored and no identifier binding is applied.\n *\n * @param target - A backend URL, network options, or an existing backend\n * @throws {ConfigurationUnavailableError} if the deployment did not answer\n * @throws {ConfigurationInvalidError} if it published an unusable configuration\n */\n static async fetchServerConfiguration(\n target: string | NetworkOptions | Backend,\n ): Promise<ServerConfiguration> {\n const { backendUrl, appVersion } = resolveEndpoint(target);\n // oxlint-disable-next-line typescript/no-unnecessary-condition -- Validate options from JavaScript callers.\n if (!backendUrl?.trim()) {\n throw new Error(\"backendUrl is required\");\n }\n\n return fetchServerConfigurationBinding(backendUrl, appVersion).catch(\n throwServerConfigurationError,\n );\n }\n}\n"],"mappings":";;;;;;;;AAGA,MAAa,iBAAiB,OAC5B,aACwB;CACxB,IAAI;EACF,MAAM,aAAa,MAAM,SAAS;EAClC,IACE,OAAO,WAAW,UAAU,YAC3B,WAAW,SAAS,KAAA,KAAa,OAAO,WAAW,SAAS,YAC7D,CAAC,OAAO,cAAc,WAAW,gBAAgB,GAEjD,MAAM,IAAI,MAAM;EAElB,OAAO;GACL,MAAM,WAAW;GACjB,OAAO,WAAW;GAClB,kBAAkB,WAAW;EAC/B;CACF,QAAQ;EACN,MAAM,IAAI,MAAM,sBAAsB;CACxC;AACF;;;ACbA,MAAa,gBAAgB,OAC3B,YACqB;CAErB,IAAI,CAAC,SAAS,YAAY,KAAK,GAC7B,MAAM,IAAI,MAAM,wBAAwB;CAE1C,MAAM,UAAU,IAAI,eAAe,QAAQ,UAAU;CACrD,IAAI,QAAQ,QAAQ,KAAA,GAAW,QAAQ,OAAO,QAAQ,GAAG;CACzD,IAAI,QAAQ,eAAe,KAAA,GACzB,QAAQ,cAAc,QAAQ,UAAU;CAC1C,IAAI,QAAQ,cAAc;EACxB,MAAM,WAAW,QAAQ;EACzB,QAAQ,aAAa,IAAI,mBAAmB,eAAe,QAAQ,CAAC,CAAC;CACvE;CACA,OAAO,QAAQ,MAAM;AACvB;;;AC1BA,IAAa,qBAAb,cAAwC,MAAM;CAC5C,cAAc;EACZ,MACE,gFACF;CACF;AACF;AAEA,IAAa,gCAAb,cAAmD,MAAM;CACvD,YAAY,SAAiB;EAC3B,MAAM,yCAAyC,SAAS;CAC1D;AACF;AAEA,IAAa,0BAAb,cAA6C,MAAM;CACjD,cAAc;EACZ,MAAM,uDAAuD;CAC/D;AACF;AAEA,IAAa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